]> code.delx.au - pymsnt/commitdiff
Messages sent to offline contacts should be bounced properly now.
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 23 May 2006 12:47:21 +0000 (12:47 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 23 May 2006 12:47:21 +0000 (12:47 +0000)
git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@161 55fbd22a-6204-0410-b2f0-b6c764c7e90a

committer: jamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>

src/tlib/msn/msn.py
src/tlib/msn/msnw.py

index e03aa87e3814797600eb7013a503ef13bac02aa9..199308621419af977b479860fbbc7990e1976328 100644 (file)
@@ -813,9 +813,9 @@ class MSNEventBase(LineReceiver):
         if len(cmd) != 3: raise MSNProtocolError, "Invalid Command, %s" % repr(cmd)
         if cmd.isdigit():
             id = params.split(' ')[0]
         if len(cmd) != 3: raise MSNProtocolError, "Invalid Command, %s" % repr(cmd)
         if cmd.isdigit():
             id = params.split(' ')[0]
-            if id.isdigit() and self.ids.has_key(id):
+            if id.isdigit() and self.ids.has_key(int(id)):
                 id = int(id)
                 id = int(id)
-                self.ids[id].errback(int(cmd))
+                self.ids[id][0].errback(int(cmd))
                 del self.ids[id]
                 return
             else:       # we received an error which doesn't map to a sent command
                 del self.ids[id]
                 return
             else:       # we received an error which doesn't map to a sent command
index ad693cd953485213d4dace1628bc81acefb69f69..2855c0c03edd5ae0d6e9daf407fc6a9020345139 100644 (file)
@@ -469,13 +469,8 @@ class SwitchboardSessionBase(msn.SwitchboardClient):
                self.funcBuffer = []
                self.ready = False
 
                self.funcBuffer = []
                self.ready = False
 
-       def __del__(self):
-               self.ready = False
-               LogEvent(INFO, self.ident)
-               del self.msncon
-               self.transport.disconnect()
-       
        def connectionLost(self, reason):
        def connectionLost(self, reason):
+               LogEvent(INFO, self.ident)
                self.ready = False
                self.msncon = None
                self.msnobj = None
                self.ready = False
                self.msncon = None
                self.msnobj = None
@@ -591,7 +586,7 @@ class MultiSwitchboardSession(SwitchboardSessionBase):
        def __init__(self, msncon):
                """ Automatically creates a new switchboard connection to the server """
                SwitchboardSessionBase.__init__(self, msncon)
        def __init__(self, msncon):
                """ Automatically creates a new switchboard connection to the server """
                SwitchboardSessionBase.__init__(self, msncon)
-               self.ident = (self.msncon.ident, self)
+               self.ident = (self.msncon.ident, repr(self))
                self.contactCount = 0
                self.groupchat = None
                self.connect()
                self.contactCount = 0
                self.groupchat = None
                self.connect()
@@ -642,13 +637,14 @@ class OneSwitchboardSession(SwitchboardSessionBase):
                self.chattingUsers = []
                self.timeout = None
        
                self.chattingUsers = []
                self.timeout = None
        
-       def __del__(self):
+       def connectionLost(self, reason):
                if self.timeout:
                        self.timeout.cancel()
                self.timeout = None
                for message, noerror in self.messageBuffer:
                        if not noerror:
                                self.failedMessage(message)
                if self.timeout:
                        self.timeout.cancel()
                self.timeout = None
                for message, noerror in self.messageBuffer:
                        if not noerror:
                                self.failedMessage(message)
+               SwitchboardSessionBase.connectionLost(self, reason)
 
        def _ready(self):
                LogEvent(INFO, self.ident)
 
        def _ready(self):
                LogEvent(INFO, self.ident)
@@ -682,6 +678,7 @@ class OneSwitchboardSession(SwitchboardSessionBase):
                                LogEvent(INFO, self.ident, "User has not joined after 30 seconds.")
                                del self.msncon.switchboardSessions[self.remoteUser]
                                self.timeout = None
                                LogEvent(INFO, self.ident, "User has not joined after 30 seconds.")
                                del self.msncon.switchboardSessions[self.remoteUser]
                                self.timeout = None
+                               self.transport.loseConnection()
                        d = self.inviteUser(self.remoteUser)
                        d.addErrback(failCB)
                        self.timeout = reactor.callLater(30.0, failCB)
                        d = self.inviteUser(self.remoteUser)
                        d.addErrback(failCB)
                        self.timeout = reactor.callLater(30.0, failCB)