Mercurial > libervia-web
diff libervia.py @ 204:890776a6fdb7
browser + server: vcard is requested when no avatar data is found in cache
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 20 Jun 2013 12:16:46 +0200 |
parents | 5fdea93b2541 |
children | ee744ffed7fc |
line wrap: on
line diff
--- 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]