# HG changeset patch # User Goffi # Date 1371723406 -7200 # Node ID 890776a6fdb79ac9fcb532f9122a7503eef84c74 # Parent 5fdea93b25418ef17b8d843e8de1d68299a28411 browser + server: vcard is requested when no avatar data is found in cache diff -r 5fdea93b2541 -r 890776a6fdb7 libervia.py --- a/libervia.py Thu Jun 20 12:16:46 2013 +0200 +++ b/libervia.py Thu Jun 20 12:16:46 2013 +0200 @@ -100,8 +100,8 @@ def __init__(self): LiberviaJsonProxy.__init__(self, "/json_api", ["getContacts", "addContact", "sendMessage", "sendMblog", "sendMblogComment", "getLastMblogs", "getMassiveLastMblogs", "getMblogComments", "getProfileJid", "getHistory", "getPresenceStatus", - "joinMUC", "mucLeave", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed", - "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getEntityData", "getParamsUI", + "joinMUC", "mucLeave", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed", "tarotGamePlayCards", + "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getCard", "getEntityData", "getParamsUI", #"setParam", "launchAction", "disconnect", ]) @@ -220,9 +220,14 @@ def dataReceived(result): if 'avatar' in result: self._entityDataUpdatedCb(jid_str, 'avatar', result['avatar']) + else: + self.bridge.call("getCard", None, jid_str) + def avatarError(error_data): + # The jid is maybe not in our roster, we ask for the VCard + self.bridge.call("getCard", None, jid_str) if jid_str not in self.avatars_cache: - self.bridge.call('getEntityData', dataReceived, jid_str, ['avatar']) + self.bridge.call('getEntityData', (dataReceived, avatarError), jid_str, ['avatar']) self.avatars_cache[jid_str] = "/media/misc/empty_avatar" return self.avatars_cache[jid_str] diff -r 5fdea93b2541 -r 890776a6fdb7 libervia.tac --- a/libervia.tac Thu Jun 20 12:16:46 2013 +0200 +++ b/libervia.tac Thu Jun 20 12:16:46 2013 +0200 @@ -345,6 +345,13 @@ profile = ISATSession(self.session).profile return self.sat_host.bridge.getEntityData(jid, keys, profile) + def jsonrpc_getCard(self, jid): + """Get VCard for entiry + @param jid: jid of contact from who we want data + @return: id to retrieve the profile""" + profile = ISATSession(self.session).profile + return self.sat_host.bridge.getCard(jid, profile) + #def jsonrpc_getParamsUI(self): # """Return the parameters XMLUI for profile""" # profile = ISATSession(self.session).profile