From: jamesbunton Date: Sun, 13 Aug 2006 01:14:03 +0000 (+0000) Subject: Fix sendRosterImport with ejabberd (trim the resources when sending) X-Git-Url: https://code.delx.au/pymsnt/commitdiff_plain/0b0f7c21f7061faab58e4666e79b148366e1db74 Fix sendRosterImport with ejabberd (trim the resources when sending) git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@226 55fbd22a-6204-0410-b2f0-b6c764c7e90a committer: jamesbunton --- diff --git a/src/jabw.py b/src/jabw.py index aa9ddff..031aaf9 100644 --- a/src/jabw.py +++ b/src/jabw.py @@ -162,21 +162,17 @@ class JabberConnection: def sendRosterImport(self, jid, ptype, sub, name="", groups=[]): """ Sends a special presence packet. This will work with all clients, but clients that support roster-import will give a better user experience IMPORTANT - Only ever use this for contacts that have already been authorised on the legacy service """ - el = Element((None, "presence")) - el.attributes["to"] = self.jabberID - el.attributes["from"] = jid - el.attributes["type"] = ptype - r = el.addElement("x") - r.attributes["xmlns"] = disco.SUBSYNC - item = r.addElement("item") + x = Element((None, "x")) + x.attributes["xmlns"] = disco.SUBSYNC + item = x.addElement("item") item.attributes["subscription"] = sub - if(name): + if name: item.attributes["name"] = unicode(name) for group in groups: g = item.addElement("group") g.addContent(group) - self.pytrans.send(el) + self.sendPresence(to=self.jabberID, fro=jid, ptype=ptype, payload=[x]) def onMessage(self, el): """ Handles incoming message packets """