]> code.delx.au - pymsnt/blobdiff - src/disco.py
Fix sendRosterImport with ejabberd (trim the resources when sending)
[pymsnt] / src / disco.py
index 3e93a9b017750cc2d298e91edc78ee57970bf081..4fd2221f840a0fd799042967aaf54fbf6360b182 100644 (file)
@@ -1,11 +1,12 @@
-# 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 debug import LogEvent, INFO, WARN, ERROR
 
 from twisted.internet.defer import Deferred
 from twisted.internet import reactor
-from tlib.xmlw import Element, jid
+from twisted.words.xish.domish import Element
+from twisted.words.protocols.jabber.jid import internJID
 
 import sys
 
@@ -70,7 +71,7 @@ class ServerDiscovery:
                Returns a deferred which will fire with the matching IQ response as it's sole argument. """
                def checkDeferred():
                        if(not d.called):
-                               d.errback()
+                               d.errback(Exception("Timeout"))
                                del self.deferredIqs[(jid, ID)]
 
                jid = el.getAttribute("to")
@@ -113,8 +114,8 @@ class ServerDiscovery:
                iqType = el.getAttribute("type")
                ulang = utils.getLang(el)
                try: # Stringprep
-                       froj = jid.intern(fro)
-                       to = jid.intern(to).full()
+                       froj = internJID(fro)
+                       to = internJID(to).full()
                except Exception:
                        LogEvent(WARN, "", "Dropping IQ because of stringprep error")
 
@@ -130,7 +131,7 @@ class ServerDiscovery:
                LogEvent(INFO, "", "Looking for handler")
 
                for query in el.elements():
-                       xmlns = query.defaultUri
+                       xmlns = query.uri
                        node = query.getAttribute("node")
                        
                        if xmlns.startswith(DISCO) and node:
@@ -232,6 +233,7 @@ class ServerDiscovery:
                error.attributes["type"] = etype
                error.attributes["code"] = str(utils.errorCodeMap[condition])
                cond = error.addElement(condition)
+               cond.attributes["xmlns"] = XMPP_STANZAS
                self.pytrans.send(el)