diff --git a/src/plugins/plugin_sec_otr.py b/src/plugins/plugin_sec_otr.py index baadacf0..c6cabfb9 100644 --- a/src/plugins/plugin_sec_otr.py +++ b/src/plugins/plugin_sec_otr.py @@ -429,10 +429,19 @@ class OTR(object): else: raise failure.Failure(exceptions.CancelError()) # no message at all (no history, no signal) + def _receivedTreatmentForSkippedProfiles(self, data, profile): + """This profile must be skipped because the frontend manages OTR itself, + but we still need to check if the message must be stored in history or not""" + body = data['body'].encode('utf-8') + if body.startswith(potr.proto.OTRTAG): + raise failure.Failure(exceptions.SkipHistory()) + return data + def MessageReceivedTrigger(self, message, post_treat, profile): if profile in self.skipped_profiles: - return True - post_treat.addCallback(self._receivedTreatment, profile) + post_treat.addCallback(self._receivedTreatmentForSkippedProfiles, profile) + else: + post_treat.addCallback(self._receivedTreatment, profile) return True def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile):