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
This commit is contained in:
Goffi 2009-12-21 13:22:11 +11:00
commit 31df7d8557

View file

@ -75,15 +75,17 @@ class XEP_0100():
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 @@ class XEP_0100():
"""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