diff --git a/sat/plugins/plugin_xep_0280.py b/sat/plugins/plugin_xep_0280.py index d43196f5..1360cbf9 100755 --- a/sat/plugins/plugin_xep_0280.py +++ b/sat/plugins/plugin_xep_0280.py @@ -75,7 +75,7 @@ class XEP_0280(object): log.info(_("Plugin XEP_0280 initialization")) self.host = host host.memory.updateParams(self.params) - host.trigger.add("MessageReceived", self.messageReceivedTrigger, priority=1000) + host.trigger.add("MessageReceived", self.messageReceivedTrigger, priority=200000) def getHandler(self, client): return XEP_0280_handler() @@ -138,30 +138,26 @@ class XEP_0280(object): return forwarded_elt = next(carbons_elt.elements(C.NS_FORWARD, "forwarded")) cc_message_elt = next(forwarded_elt.elements(C.NS_CLIENT, "message")) + + # we replace the wrapping message with the CCed one + # and continue the normal behaviour if carbons_elt.name == "received": - # on receive we replace the wrapping message with the CCed one - # and continue the normal behaviour message_elt["from"] = cc_message_elt["from"] - del message_elt.children[:] - for c in cc_message_elt.children: - message_elt.addChild(c) - return True elif carbons_elt.name == "sent": - # on sent we parse the message and just add it to history - # and send it to frontends (without normal sending treatments) - mess_data = client.messageProt.parseMessage(cc_message_elt) - if not mess_data["message"] and not mess_data["subject"]: - return False - client.messageAddToHistory(mess_data) - client.messageSendToBridge(mess_data) + message_elt["to"] = cc_message_elt["to"] else: log.warning( u"invalid message carbons received:\n{xml}".format( xml=message_elt.toXml() ) ) - return False + return False + del message_elt.children[:] + for c in cc_message_elt.children: + message_elt.addChild(c) + + return True class XEP_0280_handler(XMPPHandler): implements(iwokkel.IDisco)