comparison src/browser/sat_browser/plugin_sec_otr.py @ 544:ad18eb65b6db

browser_side (plugin OTR): forbid to start an OTR session if the contact is not connected
author souliane <souliane@mailoo.org>
date Mon, 08 Sep 2014 15:44:11 +0200
parents d02335553b5d
children 3aef7c5c7d3a
comparison
equal deleted inserted replaced
543:d02335553b5d 544:ad18eb65b6db
85 QUERY_SLOWDOWN = D_("This end-to-end encryption is computed by your web browser and you may experience slowdowns.{eol}{eol}") 85 QUERY_SLOWDOWN = D_("This end-to-end encryption is computed by your web browser and you may experience slowdowns.{eol}{eol}")
86 QUERY_NO_KEY = D_("This will take up to 10 seconds to generate your single use private key and start the conversation. In a future version of Libervia, your private key will be safely and persistently stored, so you will have to generate it only once.{eol}{eol}") 86 QUERY_NO_KEY = D_("This will take up to 10 seconds to generate your single use private key and start the conversation. In a future version of Libervia, your private key will be safely and persistently stored, so you will have to generate it only once.{eol}{eol}")
87 QUERY_KEY = D_("You already have a private key, but to start the conversation will still require a couple of seconds.{eol}{eol}") 87 QUERY_KEY = D_("You already have a private key, but to start the conversation will still require a couple of seconds.{eol}{eol}")
88 QUERY_CONFIRM = D_("Press OK to start now the encryption.") 88 QUERY_CONFIRM = D_("Press OK to start now the encryption.")
89 89
90 ACTION_NA_TITLE = D_("Impossible action")
91 ACTION_NA = D_("Your correspondent must be connected to start an OTR conversation with him.")
90 92
91 DEFAULT_POLICY_FLAGS = { 93 DEFAULT_POLICY_FLAGS = {
92 'ALLOW_V2': True, 94 'ALLOW_V2': True,
93 'ALLOW_V3': True, 95 'ALLOW_V3': True,
94 'REQUIRE_ENCRYPTION': False, 96 'REQUIRE_ENCRYPTION': False,
499 else: # on query reception we ask always, if we initiate we just ask the first time 501 else: # on query reception we ask always, if we initiate we just ask the first time
500 query(jid) 502 query(jid)
501 503
502 try: 504 try:
503 other_jid = menu_data['jid'] 505 other_jid = menu_data['jid']
506 if other_jid.bare not in self.host.contact_panel.connected:
507 dialog.InfoDialog(ACTION_NA_TITLE, ACTION_NA, AddStyleName="maxWidthLimit").show()
508 return
504 self.fixResource(other_jid, cb) 509 self.fixResource(other_jid, cb)
505 except KeyError: 510 except KeyError:
506 log.error(_("jid key is not present !")) 511 log.error(_("jid key is not present !"))
507 512
508 def _endSession(self, menu_data): 513 def _endSession(self, menu_data):