diff 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
line wrap: on
line diff
--- a/src/core/sat_main.py	Wed Sep 05 00:19:32 2012 +0200
+++ b/src/core/sat_main.py	Tue Sep 25 00:58:34 2012 +0200
@@ -126,6 +126,7 @@
         self.bridge.register("asyncConnect", self.asyncConnect)
         self.bridge.register("disconnect", self.disconnect)
         self.bridge.register("getContacts", self.getContacts)
+        self.bridge.register("getContactsFromGroup", self.getContactsFromGroup)
         self.bridge.register("getLastResource", self.memory.getLastResource)
         self.bridge.register("getPresenceStatus", self.memory.getPresenceStatus)
         self.bridge.register("getWaitingSub", self.memory.getWaitingSub)
@@ -276,8 +277,7 @@
     def getContacts(self, profile_key):
         client = self.getClient(profile_key)
         if not client:
-            error(_('Asking contacts for a non-existant profile'))
-            return []
+            raise ProfileUnknownError(_('Asking contacts for a non-existant profile'))
         ret = []
         for item in client.roster.getItems(): #we get all item for client's roster
             #and convert them to expected format
@@ -285,6 +285,12 @@
             ret.append([item.jid.userhost(), attr, item.groups])
         return ret
 
+    def getContactsFromGroup(self, group, profile_key):
+        client = self.getClient(profile_key)
+        if not client:
+            raise ProfileUnknownError(_("Asking group's contacts for a non-existant profile"))
+        return client.roster.getJidsFromGroup(group)
+
     def purgeClient(self, profile):
         """Remove reference to a profile client and purge cache
         the garbage collector can then free the memory"""