core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
This commit is contained in:
parent
2a40da1664
commit
005ec59a8a
1 changed files with 123 additions and 101 deletions
|
|
@ -219,11 +219,11 @@ class SAT(service.Service):
|
|||
self.plugins[import_name].is_handler = False
|
||||
#TODO: test xmppclient presence and register handler parent
|
||||
|
||||
def connect(self, profile_key='@NONE@'):
|
||||
def connect(self, profile_key=C.PROF_KEY_NONE):
|
||||
"""Connect to jabber server"""
|
||||
self.asyncConnect(profile_key)
|
||||
|
||||
def asyncConnect(self, profile_key='@NONE@'):
|
||||
def asyncConnect(self, profile_key=C.PROF_KEY_NONE):
|
||||
"""Connect to jabber server with asynchronous reply
|
||||
@param profile_key: %(doc_profile)s
|
||||
"""
|
||||
|
|
@ -392,7 +392,7 @@ class SAT(service.Service):
|
|||
return None
|
||||
return self.profiles[profile].getHostJid()
|
||||
|
||||
def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key='@NONE@'):
|
||||
def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key=C.PROF_KEY_NONE):
|
||||
"""Connect to a server and create a new account using in-band registration"""
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
assert(profile)
|
||||
|
|
@ -469,12 +469,12 @@ class SAT(service.Service):
|
|||
ret.append((conf_id, conf_type, data))
|
||||
return ret
|
||||
|
||||
def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key='@NONE@'):
|
||||
def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key=C.PROF_KEY_NONE):
|
||||
to_jid = jid.JID(to_s)
|
||||
#XXX: we need to use the dictionary comprehension because D-Bus return its own types, and pickle can't manage them. TODO: Need to find a better way
|
||||
return self.sendMessage(to_jid, msg, subject, mess_type, {unicode(key): unicode(value) for key, value in extra.items()}, profile_key=profile_key)
|
||||
|
||||
def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key='@NONE@'):
|
||||
def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key=C.PROF_KEY_NONE):
|
||||
#FIXME: check validity of recipient
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
assert(profile)
|
||||
|
|
@ -574,10 +574,10 @@ class SAT(service.Service):
|
|||
extra=mess_data['extra'],
|
||||
profile=profile)
|
||||
|
||||
def _setPresence(self, to="", show="", priority=0, statuses=None, profile_key='@NONE@'):
|
||||
def _setPresence(self, to="", show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE):
|
||||
return self.setPresence(jid.JID(to) if to else None, show, priority, statuses, profile_key)
|
||||
|
||||
def setPresence(self, to_jid=None, show="", priority=0, statuses=None, profile_key='@NONE@'):
|
||||
def setPresence(self, to_jid=None, show="", priority=0, statuses=None, profile_key=C.PROF_KEY_NONE):
|
||||
"""Send our presence information"""
|
||||
if statuses is None:
|
||||
statuses = {}
|
||||
|
|
@ -866,7 +866,7 @@ class SAT(service.Service):
|
|||
debug("Removing callback [%s]" % callback_id)
|
||||
del self._cb_map[callback_id]
|
||||
|
||||
def launchCallback(self, callback_id, data=None, profile_key="@NONE@"):
|
||||
def launchCallback(self, callback_id, data=None, profile_key=C.PROF_KEY_NONE):
|
||||
"""Launch a specific callback
|
||||
@param callback_id: id of the action (callback) to launch
|
||||
@param data: optional data
|
||||
|
|
|
|||
Loading…
Reference in a new issue