From ce7923e1645d70baf1e1b4d2dbeb866dc838ac03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 6 May 2017 13:54:43 +0200 Subject: [PATCH] Remove log and enabled status from lock tooltip - Log status is a feature that only works with xep-0136 which nobody uses anymore - Even then we can only trust in the server/user to not log the session - We should not imply that a client could control if messages are logged on the server or the other end, especially as this is about encryption and security we should be as accurate as possible - The lock image is only shown if a encryption was sucessfully activated, so the enabled flag is unnecessary --- src/chat_control.py | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index b1beb22f7..2a39d5628 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -848,46 +848,31 @@ class ChatControl(ChatControlBase): encryption_state = {'visible': visible, 'enc_type': self.encryption, - 'enc_enabled': False, - 'chat_logged': loggable, 'authenticated': False} gajim.plugin_manager.gui_extension_point( 'encryption_state' + self.encryption, self, encryption_state) self._show_lock_image(**encryption_state) - - def _show_lock_image(self, visible, enc_type='', enc_enabled=False, - chat_logged=False, authenticated=False): + + def _show_lock_image(self, visible, enc_type='', + authenticated=False): """ Set lock icon visibility and create tooltip """ - #encryption %s active - status_string = enc_enabled and _('is') or _('is NOT') - #chat session %s be logged - logged_string = chat_logged and _('will') or _('will NOT') - if authenticated: - #About encrypted chat session authenticated_string = _('and authenticated') img_path = gtkgui_helpers.get_icon_path('security-high') else: - #About encrypted chat session authenticated_string = _('and NOT authenticated') img_path = gtkgui_helpers.get_icon_path('security-low') self.lock_image.set_from_file(img_path) - #status will become 'is' or 'is not', authentificaed will become - #'and authentificated' or 'and not authentificated', logged will become - #'will' or 'will not' - tooltip = _('%(type)s encryption %(status)s active %(authenticated)s.\n' - 'Your chat session %(logged)s be logged.') % {'type': enc_type, - 'status': status_string, 'authenticated': authenticated_string, - 'logged': logged_string} + tooltip = _('%(type)s encryption is active %(authenticated)s.') % {'type': enc_type, 'authenticated': authenticated_string} self.authentication_button.set_tooltip_text(tooltip) self.widget_set_visible(self.authentication_button, not visible) - self.lock_image.set_sensitive(enc_enabled) + self.lock_image.set_sensitive(visible) def _on_authentication_button_clicked(self, widget): gajim.plugin_manager.gui_extension_point( @@ -991,8 +976,8 @@ class ChatControl(ChatControlBase): msg = _('E2E encryption disabled') ChatControlBase.print_conversation_line(self, msg, 'status', '', None) - self._show_lock_image(e2e_is_active, 'E2E', e2e_is_active, self.session and \ - self.session.is_loggable(), self.session and self.session.verified_identity) + self._show_lock_image(e2e_is_active, 'E2E', + self.session and self.session.verified_identity) def print_session_details(self, old_session=None): if isinstance(self.session, EncryptedStanzaSession) or \