Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2022-09-22 19:14:28 +0300
committerPhilipp Hörist <philipp@hoerist.com>2022-09-25 23:01:00 +0300
commit05457d58384591e34c46140523a4f39b2d9d5e86 (patch)
treee4fec9eae353d38f170eecfdb063b897f056cbb4
parent7d01e61890cfc04ffadf1a03f05c8b2c00c7a442 (diff)
feat: ServerInfo: Add TLS version and cipher suite
-rw-r--r--gajim/common/const.py9
-rw-r--r--gajim/data/gui/server_info.ui64
-rw-r--r--gajim/gtk/server_info.py8
3 files changed, 75 insertions, 6 deletions
diff --git a/gajim/common/const.py b/gajim/common/const.py
index 6778bde09..ae4e8a6fe 100644
--- a/gajim/common/const.py
+++ b/gajim/common/const.py
@@ -1184,3 +1184,12 @@ class PresenceShowExt(Enum):
if not isinstance(other, PresenceShow): # pyright: ignore
return NotImplemented
return True
+
+
+# Replace keys with Gio.TlsProtocolVersion enum once
+# we require GLib >= 2.69
+TLS_VERSION_STRINGS = {
+ 3: '1.1',
+ 4: '1.2',
+ 5: '1.3',
+}
diff --git a/gajim/data/gui/server_info.ui b/gajim/data/gui/server_info.ui
index b4ad0050a..786738765 100644
--- a/gajim/data/gui/server_info.ui
+++ b/gajim/data/gui/server_info.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkNotebook" id="server_info_notebook">
@@ -151,7 +151,7 @@
</packing>
</child>
<child>
- <!-- n-columns=2 n-rows=7 -->
+ <!-- n-columns=2 n-rows=9 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -183,7 +183,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">5</property>
+ <property name="top-attach">7</property>
</packing>
</child>
<child>
@@ -196,7 +196,7 @@
</object>
<packing>
<property name="left-attach">1</property>
- <property name="top-attach">5</property>
+ <property name="top-attach">7</property>
</packing>
</child>
<child>
@@ -211,7 +211,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">6</property>
+ <property name="top-attach">8</property>
</packing>
</child>
<child>
@@ -224,7 +224,7 @@
</object>
<packing>
<property name="left-attach">1</property>
- <property name="top-attach">6</property>
+ <property name="top-attach">8</property>
</packing>
</child>
<child>
@@ -351,6 +351,58 @@
<property name="top-attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">TLS Version</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">Cipher Suite</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="tls_version">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="cipher_suite">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">6</property>
+ </packing>
+ </child>
<style>
<class name="margin-18"/>
</style>
diff --git a/gajim/gtk/server_info.py b/gajim/gtk/server_info.py
index d8fb0d951..9d2825a46 100644
--- a/gajim/gtk/server_info.py
+++ b/gajim/gtk/server_info.py
@@ -35,6 +35,7 @@ from nbxmpp.task import Task
from gajim.common import app
from gajim.common import ged
+from gajim.common.const import TLS_VERSION_STRINGS
from gajim.common.events import ServerDiscoReceived
from gajim.common.helpers import open_uri
from gajim.common.i18n import _
@@ -148,6 +149,13 @@ class ServerInfo(Gtk.ApplicationWindow, EventHelper):
self._ui.websocket.set_visible(visible)
self._ui.websocket.set_text(address.uri or '')
+ tls_version = TLS_VERSION_STRINGS.get(nbxmpp_client.tls_version)
+ self._ui.tls_version.set_text(tls_version or _('Not available'))
+
+ visible = nbxmpp_client.ciphersuite is not None
+ self._ui.cipher_suite.set_text(nbxmpp_client.ciphersuite or
+ _('Not available'))
+
def _add_contact_addresses(self, dataforms: list[SimpleDataForm]) -> None:
fields = {
'admin-addresses': _('Admin'),