plugin OTR: do not save in history the encrypted messages for skipped profiles
This commit is contained in:
parent
17b1f461db
commit
8654193b40
1 changed files with 11 additions and 2 deletions
|
|
@ -429,10 +429,19 @@ class OTR(object):
|
||||||
else:
|
else:
|
||||||
raise failure.Failure(exceptions.CancelError()) # no message at all (no history, no signal)
|
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):
|
def MessageReceivedTrigger(self, message, post_treat, profile):
|
||||||
if profile in self.skipped_profiles:
|
if profile in self.skipped_profiles:
|
||||||
return True
|
post_treat.addCallback(self._receivedTreatmentForSkippedProfiles, profile)
|
||||||
post_treat.addCallback(self._receivedTreatment, profile)
|
else:
|
||||||
|
post_treat.addCallback(self._receivedTreatment, profile)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile):
|
def sendMessageTrigger(self, mess_data, pre_xml_treatments, post_xml_treatments, profile):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue