Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
46aad329 by wurstsalat at 2021-09-20T09:06:13+02:00
Add setting for XEP-0258 Security Labels

- - - - -


4 changed files:

- gajim/common/setting_values.py
- gajim/gtk/accounts.py
- gajim/gtk/controls/base.py
- gajim/gtk/conversation/rows/message.py


Changes:

=====================================
gajim/common/setting_values.py
=====================================
@@ -219,6 +219,7 @@ class _ACCOUNT_DEFAULT:
         'gc_send_marker_public_default': False,
         'chat_history_max_age': -1,
         'enable_gssapi': False,
+        'enable_security_labels': False,
     },
 
     'contact': {


=====================================
gajim/gtk/accounts.py
=====================================
@@ -841,7 +841,7 @@ def __init__(self, account):
                     'confirm_unencrypted_connection',
                     desc=_('Show a confirmation dialog before connecting '
                            'unencrypted')),
-            ]
+        ]
         GenericSettingPage.__init__(self, account, settings)
 
     @staticmethod
@@ -877,8 +877,12 @@ def __init__(self, account):
                     props={'entries': {'httpupload': _('Upload Files'),
                                        'jingle': _('Send Files Directly')}},
                     desc=_('Preferred file transfer mechanism for '
-                           'file drag&drop on a chat window'))
-            ]
+                           'file drag&drop on a chat window')),
+            Setting(SettingKind.SWITCH, _('Security Labels'),
+                    SettingType.ACCOUNT_CONFIG, 'enable_security_labels',
+                    desc=_('Show labels describing confidentiality of '
+                           'messages, if the server supports XEP-0258'))
+        ]
         GenericSettingPage.__init__(self, account, settings)
 
 
@@ -905,7 +909,7 @@ def __init__(self, account):
             Setting(SettingKind.SWITCH, _('Global Status'),
                     SettingType.ACCOUNT_CONFIG, 'sync_with_global_status',
                     desc=_('Synchronize the status of all accounts')),
-            ]
+        ]
 
         GenericSettingPage.__init__(self, account, settings)
 
@@ -925,7 +929,7 @@ def __init__(self, account, parent):
 
             Setting(SettingKind.ENTRY, _('Email'),
                     SettingType.ACCOUNT_CONFIG, 'zeroconf_email'),
-            ]
+        ]
 
         SettingsDialog.__init__(self, parent, _('Profile'),
                                 Gtk.DialogFlags.MODAL, settings, account)
@@ -951,7 +955,7 @@ def __init__(self, account, parent):
                     bind='account::adjust_priority_with_status',
                     inverted=True,
                     props={'range_': range_}),
-            ]
+        ]
 
         SettingsDialog.__init__(self, parent, _('Priority'),
                                 Gtk.DialogFlags.MODAL, settings, account)
@@ -990,7 +994,7 @@ def __init__(self, account, parent):
                     SettingType.ACCOUNT_CONFIG, 'custom_type',
                     bind='account::use_custom_host',
                     props={'combo_items': type_values}),
-            ]
+        ]
 
         SettingsDialog.__init__(self, parent, _('Connection Settings'),
                                 Gtk.DialogFlags.MODAL, settings, account)
@@ -1006,7 +1010,7 @@ def __init__(self, account, parent):
 
             Setting(SettingKind.SWITCH, _('Encrypted Certificate'),
                     SettingType.ACCOUNT_CONFIG, 'client_cert_encrypted'),
-            ]
+        ]
 
         SettingsDialog.__init__(self, parent, _('Certificate Settings'),
                                 Gtk.DialogFlags.MODAL, settings, account)
@@ -1029,7 +1033,7 @@ def __init__(self, account, parent):
 
             Setting(SettingKind.SWITCH, _('Use GSSAPI'),
                     SettingType.ACCOUNT_CONFIG, 'enable_gssapi'),
-            ]
+        ]
 
         SettingsDialog.__init__(self, parent, _('Login Settings'),
                                 Gtk.DialogFlags.MODAL, settings, account)


=====================================
gajim/gtk/controls/base.py
=====================================
@@ -457,6 +457,11 @@ def _sec_labels_received(self, event):
 
         if event.jid != jid:
             return
+
+        if not app.settings.get_account_setting(
+                event.account, 'enable_security_labels'):
+            return
+
         model = self.xml.label_selector.get_model()
         model.clear()
 


=====================================
gajim/gtk/conversation/rows/message.py
=====================================
@@ -114,7 +114,8 @@ def __init__(self,
             if encryption_img:
                 self._meta_box.pack_end(encryption_img, False, True, 0)
 
-        if display_marking:
+        if display_marking and app.settings.get_account_setting(
+                account, 'enable_security_labels'):
             label_text = GLib.markup_escape_text(display_marking.name)
             if label_text:
                 bgcolor = display_marking.bgcolor



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/46aad329c4acd4f6869698d763e687a18a2fb67a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/46aad329c4acd4f6869698d763e687a18a2fb67a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to