comparison src/plugins/plugin_sec_otr.py @ 1480:8d61160ee4b8

core, plugin watched: new plugin, show an alert when a watched entity goes online
author Goffi <goffi@goffi.org>
date Thu, 20 Aug 2015 18:43:56 +0200
parents 364dcdae2bff
children 62cd8fc1aef7
comparison
equal deleted inserted replaced
1479:057f0714f27e 1480:8d61160ee4b8
206 host.bridge.addMethod("skipOTR", ".plugin", in_sign='s', out_sign='', method=self._skipOTR) 206 host.bridge.addMethod("skipOTR", ".plugin", in_sign='s', out_sign='', method=self._skipOTR)
207 host.importMenu((MAIN_MENU, D_("Start/Refresh")), self._startRefresh, security_limit=0, help_string=D_("Start or refresh an OTR session"), type_=C.MENU_SINGLE) 207 host.importMenu((MAIN_MENU, D_("Start/Refresh")), self._startRefresh, security_limit=0, help_string=D_("Start or refresh an OTR session"), type_=C.MENU_SINGLE)
208 host.importMenu((MAIN_MENU, D_("End session")), self._endSession, security_limit=0, help_string=D_("Finish an OTR session"), type_=C.MENU_SINGLE) 208 host.importMenu((MAIN_MENU, D_("End session")), self._endSession, security_limit=0, help_string=D_("Finish an OTR session"), type_=C.MENU_SINGLE)
209 host.importMenu((MAIN_MENU, D_("Authenticate")), self._authenticate, security_limit=0, help_string=D_("Authenticate user/see your fingerprint"), type_=C.MENU_SINGLE) 209 host.importMenu((MAIN_MENU, D_("Authenticate")), self._authenticate, security_limit=0, help_string=D_("Authenticate user/see your fingerprint"), type_=C.MENU_SINGLE)
210 host.importMenu((MAIN_MENU, D_("Drop private key")), self._dropPrivKey, security_limit=0, type_=C.MENU_SINGLE) 210 host.importMenu((MAIN_MENU, D_("Drop private key")), self._dropPrivKey, security_limit=0, type_=C.MENU_SINGLE)
211 host.trigger.add("presenceReceived", self.presenceReceivedTrigger) 211 host.trigger.add("presenceReceived", self._presenceReceivedTrigger)
212 212
213 def _fixPotr(self): 213 def _fixPotr(self):
214 # FIXME: potr fix for bad unicode handling 214 # FIXME: potr fix for bad unicode handling
215 # this method monkeypatch it, must be removed when potr 215 # this method monkeypatch it, must be removed when potr
216 # is fixed 216 # is fixed
470 return False 470 return False
471 else: 471 else:
472 log.debug(u"sending message unencrypted") 472 log.debug(u"sending message unencrypted")
473 return True 473 return True
474 474
475 def presenceReceivedTrigger(self, entity, show, priority, statuses, profile): 475 def _presenceReceivedTrigger(self, entity, show, priority, statuses, profile):
476 if show != "unavailable": 476 if show != C.PRESENCE_UNAVAILABLE:
477 return True 477 return True
478 if not entity.resource: 478 if not entity.resource:
479 entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored 479 entity.resource = self.host.memory.getMainResource(entity, profile) # FIXME: temporary and unsecure, must be changed when frontends are refactored
480 otrctx = self.context_managers[profile].getContextForUser(entity) 480 otrctx = self.context_managers[profile].getContextForUser(entity)
481 otrctx.disconnect() 481 otrctx.disconnect()