plugin XEP-0033: fixes sending the message after the changes made in rev 1052 (e88bff4c8b77)
This commit is contained in:
parent
c9087d3a12
commit
b30501f004
1 changed files with 13 additions and 3 deletions
|
|
@ -119,6 +119,16 @@ class XEP_0033(object):
|
|||
- redesign the database to save only one entry to the database
|
||||
- change the newMessage signal to eventually pass more than one recipient
|
||||
"""
|
||||
def send(mess_data, skip_send=False):
|
||||
client = self.host.profiles[profile]
|
||||
d = defer.Deferred()
|
||||
if not skip_send:
|
||||
d.addCallback(self.host._sendMessageToStream, client)
|
||||
d.addCallback(self.host._storeMessage, client)
|
||||
d.addCallback(self.host.sendMessageToBridge, client)
|
||||
d.addErrback(lambda failure: failure.trap(exceptions.CancelError))
|
||||
return d.callback(mess_data)
|
||||
|
||||
def discoCallback(entities, to_jid_s):
|
||||
history_data = copy.deepcopy(mess_data)
|
||||
history_data['to'] = JID(to_jid_s)
|
||||
|
|
@ -128,13 +138,13 @@ class XEP_0033(object):
|
|||
sent_data = copy.deepcopy(mess_data)
|
||||
sent_data['to'] = JID(JID(to_jid_s).host)
|
||||
sent_data['xml']['to'] = JID(to_jid_s).host
|
||||
self.host.sendAndStoreMessage(sent_data, False, profile)
|
||||
send(sent_data)
|
||||
self.internal_data[timestamp].append(entities)
|
||||
# we still need to fill the history and signal the echo...
|
||||
self.host.sendAndStoreMessage(history_data, True, profile)
|
||||
send(history_data, skip_send=True)
|
||||
else:
|
||||
# target server misses the addressing feature
|
||||
self.host.sendAndStoreMessage(history_data, False, profile)
|
||||
send(history_data)
|
||||
|
||||
def errback(failure, to_jid):
|
||||
discoCallback(None, to_jid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue