plugin XEP-0050: Ad-Hoc commands first draft (answering part)

This commit is contained in:
Goffi 2013-12-10 17:25:31 +01:00
commit f7efb167c8
2 changed files with 381 additions and 5 deletions

View file

@ -37,6 +37,10 @@ class NotConnectedProfileError(Exception):
pass
class ProfileKeyUnknownError(Exception):
pass
class UnknownEntityError(Exception):
pass

View file

@ -341,6 +341,19 @@ class SAT(service.Service):
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)