comparison src/plugins/plugin_xep_0054.py @ 1262:f8a8434dbac7 frontends_multi_profiles

core: improved roster management + misc: - updated methods to no use anymore methods deprecated in Wokkel - use of full jid when it make sense instead of bare jid - getContacts, updateContact and delContact are now asynchronous
author Goffi <goffi@goffi.org>
date Wed, 10 Dec 2014 18:32:33 +0100
parents 38fb8823cee8
children faa1129559b8
comparison
equal deleted inserted replaced
1261:93bce9e4c9c8 1262:f8a8434dbac7
100 def _fillCachedValues(self, result, client): 100 def _fillCachedValues(self, result, client):
101 #FIXME: this is really suboptimal, need to be reworked 101 #FIXME: this is really suboptimal, need to be reworked
102 # the current naive approach keeps a map between all jids of all profiles 102 # the current naive approach keeps a map between all jids of all profiles
103 # in persistent cache, and check if cached jid are in roster, then put avatar 103 # in persistent cache, and check if cached jid are in roster, then put avatar
104 # hashs in memory. 104 # hashs in memory.
105 for _jid in client.roster.getBareJids() + [client.jid.userhost()]: 105 for _jid in client.roster.getJids() + [client.jid]:
106 if _jid in self.avatars_cache: 106 if _jid.userhost() in self.avatars_cache:
107 self.host.memory.updateEntityData(jid.JID(_jid), "avatar", self.avatars_cache[_jid], client.profile) 107 self.host.memory.updateEntityData(_jid, "avatar", self.avatars_cache[_jid.userhost()], client.profile)
108 108
109 def profileConnected(self, profile): 109 def profileConnected(self, profile):
110 client = self.host.getClient(profile) 110 client = self.host.getClient(profile)
111 client.roster.got_roster.addCallback(self._fillCachedValues, client) 111 client.roster.got_roster.addCallback(self._fillCachedValues, client)
112 112