From bfce6709586b662cd2ebf87478434b5717ab0ec5 Mon Sep 17 00:00:00 2001 From: hawk Date: Thu, 5 Nov 2009 12:25:31 +0000 Subject: [PATCH] - bugfixes from gentoo Changed files: PyMSNt-delete-reactor.patch -> 1.1 PyMSNt-remove-pid.patch -> 1.1 PyMSNt-unexpected-xfr.patch -> 1.1 --- PyMSNt-delete-reactor.patch | 10 +++++++++ PyMSNt-remove-pid.patch | 41 ++++++++++++++++++++++++++++++++++ PyMSNt-unexpected-xfr.patch | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 PyMSNt-delete-reactor.patch create mode 100644 PyMSNt-remove-pid.patch create mode 100644 PyMSNt-unexpected-xfr.patch diff --git a/PyMSNt-delete-reactor.patch b/PyMSNt-delete-reactor.patch new file mode 100644 index 0000000..19ad24f --- /dev/null +++ b/PyMSNt-delete-reactor.patch @@ -0,0 +1,10 @@ +--- pymsn-t/src/main.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/main.py 2008-09-19 10:55:55.000000000 +0200 +@@ -72,7 +72,6 @@ + + if config.reactor: + # They picked their own reactor. Lets install it. +- del sys.modules["twisted.internet.reactor"] + if config.reactor == "epoll": + from twisted.internet import epollreactor + epollreactor.install() diff --git a/PyMSNt-remove-pid.patch b/PyMSNt-remove-pid.patch new file mode 100644 index 0000000..fb85d04 --- /dev/null +++ b/PyMSNt-remove-pid.patch @@ -0,0 +1,41 @@ +--- pymsn-t/src/main.py 2008-04-04 17:45:43.000000000 +0400 ++++ pymsn-t/src/main.py 2008-08-05 17:44:17.000000000 +0400 +@@ -91,6 +91,7 @@ + from twisted.words.xish.domish import Element + from twisted.words.protocols.jabber import component + from twisted.words.protocols.jabber.jid import internJID ++from twisted.python import log + + from debug import LogEvent, INFO, WARN, ERROR + +@@ -352,13 +353,29 @@ + pf = open(config.pid, "w") + pf.write("%s\n" % pid) + pf.close() ++ ++ def removePID(self, pidfile): ++ # Remove a PID file ++ if not pidfile: ++ return ++ try: ++ os.unlink(pidfile) ++ except OSError, e: ++ if e.errno == errno.EACCES or e.errno == errno.EPERM: ++ log.msg("Warning: No permission to delete pid file") ++ else: ++ log.msg("Failed to unlink PID file:") ++ log.deferr() ++ except: ++ log.msg("Failed to unlink PID file:") ++ log.deferr() + + def shuttingDown(self): + self.transportSvc.removeMe() + # Keep the transport running for another 3 seconds + def cb(ignored=None): + if config.pid: +- twistd.removePID(config.pid) ++ self.removePID(config.pid) + d = Deferred() + d.addCallback(cb) + reactor.callLater(3.0, d.callback, None) diff --git a/PyMSNt-unexpected-xfr.patch b/PyMSNt-unexpected-xfr.patch new file mode 100644 index 0000000..7d93d97 --- /dev/null +++ b/PyMSNt-unexpected-xfr.patch @@ -0,0 +1,44 @@ +--- pymsn-t/src/legacy/glue.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/glue.py 2008-09-19 10:52:38.000000000 +0200 +@@ -379,7 +379,13 @@ + self.session.removeMe() + + def connectionLost(self, reason): +- LogEvent(INFO, self.jabberID) ++ LogEvent(INFO, self.jabberID) ++ # If we got a second referral, don't really log out but let the next NS ++ # try to log us in ++ if reason.type == error.ConnectionDone and self.gotadditionalXFR != 0: ++ LogEvent(INFO, self.ident) ++ self.gotadditionalXFR = 0 ++ return + if reason.type != error.ConnectionDone: + text = lang.get(self.session.lang).msnDisconnected % reason + self.session.sendMessage(to=self.jabberID, fro=config.jid, body=text) +--- pymsn-t/src/legacy/msn/msn.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/msn/msn.py 2008-09-19 10:52:38.000000000 +0200 +@@ -1347,7 +1347,9 @@ + port = MSN_PORT + + if not self._fireCallback(id, host, int(port), params[4]): +- raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug ++ #raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug ++ self.factory.msncon.gotadditionalXFR = 1 ++ self.factory.msncon.connectors.append(reactor.connectTCP(host, int(port), self.factory, bindAddress=(self.factory.msncon.BINDADDRESS, 0))) + + def handle_RNG(self, params): + checkParamLen(len(params), 6, 'RNG') +--- pymsn-t/src/legacy/msn/msnw.py 2008-09-19 10:53:30.000000000 +0200 ++++ pymsn-t/src/legacy/msn/msnw.py 2008-09-19 10:52:38.000000000 +0200 +@@ -67,8 +67,9 @@ + LogEvent(INFO, self.ident) + + def _gotNotificationReferral(self, (host, port)): +- self.timeout.cancel() +- self.timeout = None ++ if self.timeout != None: ++ self.timeout.cancel() ++ self.timeout = None + # Create the NotificationClient + self.notificationFactory = msn.NotificationFactory() + self.notificationFactory.userHandle = self.username -- 2.44.0