]> code.delx.au - pymsnt/commitdiff
Support for Twisted 2.0.1 and 2.1.0
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Fri, 11 Aug 2006 15:06:30 +0000 (15:06 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Fri, 11 Aug 2006 15:06:30 +0000 (15:06 +0000)
Fixed some exceptions
Fixed a failing test case

git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@225 55fbd22a-6204-0410-b2f0-b6c764c7e90a

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

src/legacy/msn/msn.py
src/legacy/msn/test_msn.py
src/register.py

index 2bc306c4f33a290f20572ce3508282b603f32bd5..835106cebd0caaa409c07e126c6fbcc5559ba581 100644 (file)
@@ -520,13 +520,18 @@ class MSNObject:
         e = parseText(s, True)
         if not e:
             return # Parse failed
-        self.creator = e.getAttribute("Creator")
-        self.size = int(e.getAttribute("Size"))
-        self.type = int(e.getAttribute("Type"))
-        self.location = e.getAttribute("Location")
-        self.friendly = e.getAttribute("Friendly")
-        self.sha1d = e.getAttribute("SHA1D")
-        self.text = s
+        try:
+            self.creator = e.getAttribute("Creator")
+            self.size = int(e.getAttribute("Size"))
+            self.type = int(e.getAttribute("Type"))
+            self.location = e.getAttribute("Location")
+            self.friendly = e.getAttribute("Friendly")
+            self.sha1d = e.getAttribute("SHA1D")
+            self.text = s
+        except TypeError:
+            self.setNull()
+        except ValueError:
+            self.setNull()
 
 
 class MSNContact:
index 85b90675dd2dc21aec1063a8699ada4d3f691440..ace4464ebdefee30fbd6c5e938b03db990c0f2e5 100644 (file)
@@ -42,11 +42,11 @@ class LoopbackCon:
     def __init__(self, con1, con2):
         self.con1 = con1
         self.con2 = con2
-        self.con1ToCon2 = loopback.LoopbackRelay(con1)
-        self.con2ToCon1 = loopback.LoopbackRelay(con2)
         self.reconnect()
 
     def reconnect(self):
+        self.con1ToCon2 = loopback.LoopbackRelay(self.con1)
+        self.con2ToCon1 = loopback.LoopbackRelay(self.con2)
         self.con2.makeConnection(self.con1ToCon2)
         self.con1.makeConnection(self.con2ToCon1)
         self.connected = True
index aaca74d2678a5b8565fdae10c5f48ab51784ea1a..b15c1018dd82f576c853509be4ebc37c973d74a1 100644 (file)
@@ -134,8 +134,8 @@ class RegisterManager:
                                LogEvent(INFO, "", "Updated XDB")
                                self.successReply(incoming)
                                LogEvent(INFO, "", "Sent a result Iq")
-                               (user, host, res) = internJID(incoming.getAttribute("from"))
-                               jabw.sendPresence(self.pytrans, to=user + "@" + host, fro=config.jid, ptype="subscribe")
+                               to = internJID(incoming.getAttribute("from")).userhost()
+                               jabw.sendPresence(self.pytrans, to=to, fro=config.jid, ptype="subscribe")
                                if(config.registerMessage):
                                        jabw.sendMessage(self.pytrans, to=incoming.getAttribute("from"), fro=config.jid, body=config.registerMessage)
                        except: