Mercurial > libervia-backend
comparison src/core/sat_main.py @ 501:e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
- QuickContactManagement is not used anymore and will be removed, ContactList + Core are used instead
- disconnected contacts are now displayed in Primitivus (M-d to show/hide them)
- avatars are temporary unavailable in wix
- new bridge method: getContactsFromGroup
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Sep 2012 00:58:34 +0200 |
parents | f36c705a5310 |
children | 65ecbb473cbb |
comparison
equal
deleted
inserted
replaced
500:00d3679976ab | 501:e9634d2e7b38 |
---|---|
124 self.bridge.register("registerNewAccount", self.registerNewAccount) | 124 self.bridge.register("registerNewAccount", self.registerNewAccount) |
125 self.bridge.register("connect", self.connect) | 125 self.bridge.register("connect", self.connect) |
126 self.bridge.register("asyncConnect", self.asyncConnect) | 126 self.bridge.register("asyncConnect", self.asyncConnect) |
127 self.bridge.register("disconnect", self.disconnect) | 127 self.bridge.register("disconnect", self.disconnect) |
128 self.bridge.register("getContacts", self.getContacts) | 128 self.bridge.register("getContacts", self.getContacts) |
129 self.bridge.register("getContactsFromGroup", self.getContactsFromGroup) | |
129 self.bridge.register("getLastResource", self.memory.getLastResource) | 130 self.bridge.register("getLastResource", self.memory.getLastResource) |
130 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) | 131 self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus) |
131 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) | 132 self.bridge.register("getWaitingSub", self.memory.getWaitingSub) |
132 self.bridge.register("sendMessage", self.sendMessage) | 133 self.bridge.register("sendMessage", self.sendMessage) |
133 self.bridge.register("getConfig", self.memory.getConfig) | 134 self.bridge.register("getConfig", self.memory.getConfig) |
274 disconnected_cb(profile) | 275 disconnected_cb(profile) |
275 | 276 |
276 def getContacts(self, profile_key): | 277 def getContacts(self, profile_key): |
277 client = self.getClient(profile_key) | 278 client = self.getClient(profile_key) |
278 if not client: | 279 if not client: |
279 error(_('Asking contacts for a non-existant profile')) | 280 raise ProfileUnknownError(_('Asking contacts for a non-existant profile')) |
280 return [] | |
281 ret = [] | 281 ret = [] |
282 for item in client.roster.getItems(): #we get all item for client's roster | 282 for item in client.roster.getItems(): #we get all item for client's roster |
283 #and convert them to expected format | 283 #and convert them to expected format |
284 attr = client.roster.getAttributes(item) | 284 attr = client.roster.getAttributes(item) |
285 ret.append([item.jid.userhost(), attr, item.groups]) | 285 ret.append([item.jid.userhost(), attr, item.groups]) |
286 return ret | 286 return ret |
287 | |
288 def getContactsFromGroup(self, group, profile_key): | |
289 client = self.getClient(profile_key) | |
290 if not client: | |
291 raise ProfileUnknownError(_("Asking group's contacts for a non-existant profile")) | |
292 return client.roster.getJidsFromGroup(group) | |
287 | 293 |
288 def purgeClient(self, profile): | 294 def purgeClient(self, profile): |
289 """Remove reference to a profile client and purge cache | 295 """Remove reference to a profile client and purge cache |
290 the garbage collector can then free the memory""" | 296 the garbage collector can then free the memory""" |
291 try: | 297 try: |