core: sendMessage's options parameter has been renamed to extra to be consistent with newMessage
This commit is contained in:
parent
60f03a623e
commit
9d42c269db
1 changed files with 24 additions and 22 deletions
|
|
@ -471,24 +471,25 @@ class SAT(service.Service):
|
|||
ret.append((conf_id, conf_type, data))
|
||||
return ret
|
||||
|
||||
def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', options={}, profile_key='@NONE@'):
|
||||
def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key='@NONE@'):
|
||||
to_jid = jid.JID(to_s)
|
||||
self.sendMessage(to_jid, msg, subject, mess_type, options=options, profile_key=profile_key)
|
||||
#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
|
||||
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', options={}, no_trigger=False, profile_key='@NONE@'):
|
||||
def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key='@NONE@'):
|
||||
#FIXME: check validity of recipient
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
assert(profile)
|
||||
client = self.profiles[profile]
|
||||
current_jid = client.jid
|
||||
if options is None:
|
||||
options = {}
|
||||
if extra is None:
|
||||
extra = {}
|
||||
mess_data = { # we put data in a dict, so trigger methods can change them
|
||||
"to": to_jid,
|
||||
"message": msg,
|
||||
"subject": subject,
|
||||
"type": mess_type,
|
||||
"options": options,
|
||||
"extra": extra,
|
||||
}
|
||||
treatments = defer.Deferred() # XXX: plugin can add their treatments to this deferred
|
||||
|
||||
|
|
@ -535,13 +536,14 @@ class SAT(service.Service):
|
|||
self.memory.addToHistory(current_jid, mess_data['to'],
|
||||
unicode(mess_data["message"]),
|
||||
unicode(mess_data["type"]),
|
||||
mess_data['extra'],
|
||||
profile=profile)
|
||||
# We send back the message, so all clients are aware of it
|
||||
if mess_data["message"]:
|
||||
self.bridge.newMessage(mess_data['xml']['from'],
|
||||
unicode(mess_data["message"]),
|
||||
mess_type=mess_data["type"],
|
||||
to_jid=mess_data['xml']['to'], extra={},
|
||||
to_jid=mess_data['xml']['to'], extra=mess_data['extra'],
|
||||
profile=profile)
|
||||
|
||||
treatments.addCallback(sendAndStore)
|
||||
|
|
|
|||
Loading…
Reference in a new issue