Mercurial > libervia-backend
comparison src/core/sat_main.py @ 466:448ce3c9e2ac
core: Roster cache refactoring: cache is now managed by client's SatRosterProtocol instance.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 26 Mar 2012 00:22:49 +0200 |
parents | fb1abc0f8c6a |
children | 6cd04adddaea |
comparison
equal
deleted
inserted
replaced
465:78e67a59d51d | 466:448ce3c9e2ac |
---|---|
121 self.bridge.register("deleteProfile", self.memory.deleteProfile) | 121 self.bridge.register("deleteProfile", self.memory.deleteProfile) |
122 self.bridge.register("registerNewAccount", self.registerNewAccount) | 122 self.bridge.register("registerNewAccount", self.registerNewAccount) |
123 self.bridge.register("connect", self.connect) | 123 self.bridge.register("connect", self.connect) |
124 self.bridge.register("asyncConnect", self.asyncConnect) | 124 self.bridge.register("asyncConnect", self.asyncConnect) |
125 self.bridge.register("disconnect", self.disconnect) | 125 self.bridge.register("disconnect", self.disconnect) |
126 self.bridge.register("getContacts", self.memory.getContacts) | 126 self.bridge.register("getContacts", self.getContacts) |
127 self.bridge.register("getLastResource", self.memory.getLastResource) | 127 self.bridge.register("getLastResource", self.memory.getLastResource) |
128 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) | 128 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) |
129 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) | 129 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) |
130 self.bridge.register("sendMessage", self.sendMessage) | 130 self.bridge.register("sendMessage", self.sendMessage) |
131 self.bridge.register("getConfig", self.memory.getConfig) | 131 self.bridge.register("getConfig", self.memory.getConfig) |
268 for plugin in self.plugins.iteritems(): | 268 for plugin in self.plugins.iteritems(): |
269 disconnected_cb = getattr(plugin[1], "profileDisconnected", None) | 269 disconnected_cb = getattr(plugin[1], "profileDisconnected", None) |
270 if disconnected_cb: | 270 if disconnected_cb: |
271 disconnected_cb(profile) | 271 disconnected_cb(profile) |
272 | 272 |
273 def getContacts(self, profile_key): | |
274 client = self.getClient(profile_key) | |
275 if not client: | |
276 error(_('Asking contacts for a non-existant profile')) | |
277 return [] | |
278 ret = [] | |
279 for item in client.roster.getItems(): #we get all item for client's roster | |
280 #and convert them to expected format | |
281 attr = client.roster.getAttributes(item) | |
282 ret.append([item.jid.userhost(), attr, item.groups]) | |
283 return ret | |
284 | |
273 def purgeClient(self, profile): | 285 def purgeClient(self, profile): |
274 """Remove reference to a profile client and purge cache | 286 """Remove reference to a profile client and purge cache |
275 the garbage collector can then free the memory""" | 287 the garbage collector can then free the memory""" |
276 try: | 288 try: |
277 del self.profiles[profile] | 289 del self.profiles[profile] |