changeset 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 95bdad7041d4
files src/browser/sat_browser/plugin_sec_otr.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/plugin_sec_otr.py	Mon Sep 08 15:32:33 2014 +0200
+++ b/src/browser/sat_browser/plugin_sec_otr.py	Mon Sep 08 15:44:11 2014 +0200
@@ -87,6 +87,8 @@
 QUERY_KEY = D_("You already have a private key, but to start the conversation will still require a couple of seconds.{eol}{eol}")
 QUERY_CONFIRM = D_("Press OK to start now the encryption.")
 
+ACTION_NA_TITLE = D_("Impossible action")
+ACTION_NA = D_("Your correspondent must be connected to start an OTR conversation with him.")
 
 DEFAULT_POLICY_FLAGS = {
     'ALLOW_V2': True,
@@ -501,6 +503,9 @@
 
         try:
             other_jid = menu_data['jid']
+            if other_jid.bare not in self.host.contact_panel.connected:
+                dialog.InfoDialog(ACTION_NA_TITLE, ACTION_NA, AddStyleName="maxWidthLimit").show()
+                return
             self.fixResource(other_jid, cb)
         except KeyError:
             log.error(_("jid key is not present !"))