class NotificationClient(msn.NotificationClient):
+ def doDisconnect(self, *args):
+ if hasattr(self, "transport") and self.transport:
+ self.transport.loseConnection()
+
def loginFailure(self, message):
self.factory.msncon.loginFailed(message)
def logOut(self):
msn.NotificationClient.logOut(self)
+ # If we explicitly log out, then all of these events
+ # are now redundant
+ self.loginFailure = self.doDisconnect
+ self.loggedIn = self.doDisconnect
+ self.connectionLost = self.doDisconnect
def connectionLost(self, reason):
- print "NotificationClient.connectionLost!!!"
- if not self.factory.msncon: return # If we called logOut
+ if not self.ready: return
def wait():
LogEvent(INFO, self.factory.msncon.ident)
msn.NotificationClient.connectionLost(self, reason)
self.funcBuffer = []
self.ready = False
- def __del__(self):
+ def connectionLost(self, reason):
LogEvent(INFO, self.ident)
- del self.msncon
- self.transport.disconnect()
+ self.ready = False
+ self.msncon = None
+ self.msnobj = None
+ self.ident = (self.ident[0], self.ident[1], "Disconnected!")
def loggedIn(self):
LogEvent(INFO, self.ident)
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.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)
+ SwitchboardSessionBase.connectionLost(self, reason)
def _ready(self):
LogEvent(INFO, self.ident)
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)