# HG changeset patch # User souliane # Date 1410442737 -7200 # Node ID 3e234902177ad1e58048d98cfbb162eeb34c6d1f # Parent 2ee0cd57144e91255ef36a252ad239e0d7a65526 plugin XEP-0033: fixes sending the message after the changes made in rev 1052 (e88bff4c8b77) diff -r 2ee0cd57144e -r 3e234902177a src/plugins/plugin_xep_0033.py --- a/src/plugins/plugin_xep_0033.py Mon Sep 15 14:18:34 2014 +0200 +++ b/src/plugins/plugin_xep_0033.py Thu Sep 11 15:38:57 2014 +0200 @@ -119,6 +119,16 @@ - 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 @@ 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)