Mercurial > libervia-backend
diff plugins/plugin_xep_0100.py @ 42:874de3020e1c
Initial VCard (XEP-0054) support + misc fixes
- new xep-0054 plugin, avatar are cached, new getProfile bridge method
- gateways plugin (XEP-0100): new __private__ key in resulting data, used to keep target jid
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 21 Dec 2009 13:22:11 +1100 |
parents | 2e3411a6baad |
children | 4392f1fdb064 |
line wrap: on
line diff
--- a/plugins/plugin_xep_0100.py Sat Dec 19 20:32:58 2009 +1100 +++ b/plugins/plugin_xep_0100.py Mon Dec 21 13:22:11 2009 +1100 @@ -75,15 +75,17 @@ self.__inc_handled_items(request_id) - def discoItems(self, disco, request_id): + def discoItems(self, disco, request_id, target): """Look for items with disco protocol, and ask infos for each one""" + #FIXME: target is used as we can't find the original iq node (parent is None) + # an other way would avoid this useless parameter (is there a way with wokkel ?) if len(disco._items) == 0: debug ("No gateway found") self.host.actionResultExt(request_id,"DICT_DICT",{}) return - self.__gateways[request_id] = {'__total_items':len(disco._items), '__handled_items':0} + self.__gateways[request_id] = {'__total_items':len(disco._items), '__handled_items':0, '__private__':{'target':target.full()}} for item in disco._items: debug ("item found: %s", item.name) self.host.disco.requestInfo(item.entity).addCallback(self.discoInfo, entity=item.entity, request_id=request_id) @@ -105,7 +107,8 @@ """Find gateways in the target JID, using discovery protocol Return an id used for retrieving the list of gateways """ - debug ("find gateways (target = %s)" % target) + to_jid = jid.JID(target) + debug ("find gateways (target = %s)" % to_jid.full()) request_id = self.host.get_next_id() - self.host.disco.requestItems(jid.JID(target)).addCallback(self.discoItems, request_id=request_id) + self.host.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target = to_jid) return request_id