Mercurial > libervia-backend
comparison sat/plugins/plugin_sec_otr.py @ 2659:c26492bd2144
plugin OTR: use new "directed" attribute when registering + use new markAsEncrypted
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 Aug 2018 18:24:55 +0200 |
parents | 9190874a8ac5 |
children | a86f494457c2 |
comparison
equal
deleted
inserted
replaced
2658:4e130cc9bfc0 | 2659:c26492bd2144 |
---|---|
258 log.warning(u"getContextForUser called with a bare jid: %s" % other.full()) | 258 log.warning(u"getContextForUser called with a bare jid: %s" % other.full()) |
259 return self.startContext(other) | 259 return self.startContext(other) |
260 | 260 |
261 | 261 |
262 class OTR(object): | 262 class OTR(object): |
263 | |
263 def __init__(self, host): | 264 def __init__(self, host): |
264 log.info(_(u"OTR plugin initialization")) | 265 log.info(_(u"OTR plugin initialization")) |
265 self.host = host | 266 self.host = host |
266 self.context_managers = {} | 267 self.context_managers = {} |
267 self.skipped_profiles = ( | 268 self.skipped_profiles = ( |
304 self._dropPrivKey, | 305 self._dropPrivKey, |
305 security_limit=0, | 306 security_limit=0, |
306 type_=C.MENU_SINGLE, | 307 type_=C.MENU_SINGLE, |
307 ) | 308 ) |
308 host.trigger.add("presenceReceived", self._presenceReceivedTrigger) | 309 host.trigger.add("presenceReceived", self._presenceReceivedTrigger) |
309 self.host.registerEncryptionPlugin(self, u"OTR", NS_OTR) | 310 self.host.registerEncryptionPlugin(self, u"OTR", NS_OTR, directed=True) |
310 | 311 |
311 def _skipOTR(self, profile): | 312 def _skipOTR(self, profile): |
312 """Tell the backend to not handle OTR for this profile. | 313 """Tell the backend to not handle OTR for this profile. |
313 | 314 |
314 @param profile (str): %(doc_profile)s | 315 @param profile (str): %(doc_profile)s |
619 # history | 620 # history |
620 else: | 621 else: |
621 raise failure.Failure( | 622 raise failure.Failure( |
622 exceptions.CancelError("Cancelled by OTR") | 623 exceptions.CancelError("Cancelled by OTR") |
623 ) # no message at all (no history, no signal) | 624 ) # no message at all (no history, no signal) |
625 client.encryption.markAsEncrypted(data) | |
624 return data | 626 return data |
625 | 627 |
626 def _receivedTreatmentForSkippedProfiles(self, data): | 628 def _receivedTreatmentForSkippedProfiles(self, data): |
627 """This profile must be skipped because the frontend manages OTR itself, | 629 """This profile must be skipped because the frontend manages OTR itself, |
628 | 630 |