]> code.delx.au - pymsnt/blobdiff - src/session.py
Fixed jid.internJID that somehow slipped through
[pymsnt] / src / session.py
index 19dfd305e72ce2af3adaea79ea2a7c7aaa0db212..be2955025cbd5e31956ee1ce492a5aedc025342e 100644 (file)
@@ -1,7 +1,7 @@
-# Copyright 2004-2005 James Bunton <james@delx.cjb.net>
+# Copyright 2004-2006 James Bunton <james@delx.cjb.net>
 # Licensed for distribution under the GPL version 2, check COPYING for details
 
-from tlib.xmlw import jid
+from twisted.words.protocols.jabber.jid import internJID
 
 import utils
 import legacy
@@ -150,7 +150,7 @@ class Session(jabw.JabberConnection):
        def updateNickname(self, nickname):
                self.nickname = nickname
                if not self.nickname:
-                       j = jid.intern(self.jabberID)
+                       j = internJID(self.jabberID)
                        self.nickname = j.user
                self.setStatus(self.show, self.status)
        
@@ -329,11 +329,14 @@ class Session(jabw.JabberConnection):
                del self.resourceList[resource]
                self.legacycon.resourceOffline(resource)
        
-       def subscriptionReceived(self, to, subtype):
+       def subscriptionReceived(self, fro, to, subtype):
                """ Sends the subscription request to the legacy services handler """
                if to.find('@') > 0:
-                       LogEvent(INFO, self.jabberID, "Passing subscription to legacy service.")
-                       self.contactList.jabberSubscriptionReceived(to, subtype)
+                       if self.ready:
+                               LogEvent(INFO, self.jabberID, "Passing subscription to legacy service.")
+                               self.contactList.jabberSubscriptionReceived(to, subtype)
+                       else:
+                               self.sendPresence(fro, to, ptype="error")
                else:
                        if subtype == "subscribe":
                                self.sendPresence(to=self.jabberID, fro=config.jid, ptype="subscribed")