# HG changeset patch # User souliane # Date 1409578996 -7200 # Node ID 8cdb97e89d9b38871dc114d6b29631866fe8c25c # Parent 736f1dd6e14271aa2a65e95a597bb8c681d7e34c core: sendMessage handles the extra data key 'send_only' to skip triggers, storage and echo diff -r 736f1dd6e142 -r 8cdb97e89d9b src/core/sat_main.py --- a/src/core/sat_main.py Mon Sep 01 16:11:45 2014 +0200 +++ b/src/core/sat_main.py Mon Sep 01 15:43:16 2014 +0200 @@ -481,7 +481,9 @@ mess_data["type"] == 'chat' mess_data["type"] == "chat" if mess_data["subject"] else "normal" - if not no_trigger: + send_only = mess_data['extra'].get('send_only', None) + + if not no_trigger and not send_only: if not self.trigger.point("sendMessage", mess_data, pre_xml_treatments, post_xml_treatments, profile): return defer.succeed(None) @@ -494,9 +496,12 @@ pre_xml_treatments.addCallback(lambda dummy: self.generateMessageXML(mess_data)) pre_xml_treatments.chainDeferred(post_xml_treatments) post_xml_treatments.addCallback(self._sendMessageToStream, client) - post_xml_treatments.addCallback(self._storeMessage, client) - post_xml_treatments.addCallback(self.sendMessageToBridge, client) - post_xml_treatments.addErrback(cancelErrorTrap) + if send_only: + log.debug(_("Triggers, storage and echo have been inhibited by the 'send_only' parameter")) + else: + post_xml_treatments.addCallback(self._storeMessage, client) + post_xml_treatments.addCallback(self.sendMessageToBridge, client) + post_xml_treatments.addErrback(cancelErrorTrap) pre_xml_treatments.callback(mess_data) return pre_xml_treatments