diff src/core/sat_main.py @ 728:e07afabc4a25

plugin XEP-0050: Ad-Hoc commands first draft (answering part)
author Goffi <goffi@goffi.org>
date Tue, 10 Dec 2013 17:25:31 +0100
parents c1cd6c0c2c38
children 03744d9ebc13
line wrap: on
line diff
--- a/src/core/sat_main.py	Tue Dec 10 17:25:31 2013 +0100
+++ b/src/core/sat_main.py	Tue Dec 10 17:25:31 2013 +0100
@@ -341,6 +341,19 @@
             return None
         return self.profiles[profile]
 
+    def getClients(self, profile_key):
+        """Convenient method to get list of clients from profile key (manage list through profile_key like @ALL@)
+        @param profile_key: %(doc_profile_key)s
+        @return: list of clients"""
+        profile = self.memory.getProfileName(profile_key, True)
+        if not profile:
+            return []
+        if profile == "@ALL@":
+            return self.profiles.values()
+        if profile.count('@') > 1:
+            raise exceptions.ProfileKeyUnknownError
+        return [self.profiles[profile]]
+
     def registerNewAccount(self, login, password, email, server, port=5222, id=None, profile_key='@DEFAULT@'):
         """Connect to a server and create a new account using in-band registration"""
         profile = self.memory.getProfileName(profile_key)