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


Commits:
a8e22ed9 by wurstsalat at 2025-02-23T21:30:04+01:00
cfix: ServerInfo: Fix checking for SM; improve type annotations

- - - - -


1 changed file:

- gajim/gtk/server_info.py


Changes:

=====================================
gajim/gtk/server_info.py
=====================================
@@ -15,7 +15,7 @@
 from gi.repository import Pango
 from nbxmpp.errors import MalformedStanzaError
 from nbxmpp.errors import StanzaError
-from nbxmpp.modules.dataforms import SimpleDataForm
+from nbxmpp.modules.dataforms import DataForm
 from nbxmpp.namespaces import Namespace
 from nbxmpp.structs import LastActivityData
 from nbxmpp.structs import SoftwareVersionResult
@@ -110,6 +110,7 @@ def _add_connection_info(self) -> None:
         nbxmpp_client = self._client.connection
         address = nbxmpp_client.current_address
 
+        assert address is not None
         self._ui.connection_type.set_text(address.type.value)
         if address.type.is_plain:
             self._ui.connection_type.add_css_class("error-color")
@@ -137,12 +138,13 @@ def _add_connection_info(self) -> None:
         self._ui.websocket.set_visible(visible)
         self._ui.websocket.set_text(address.uri or "")
 
+        assert nbxmpp_client is not None
         tls_version = TLS_VERSION_STRINGS.get(nbxmpp_client.tls_version)
         self._ui.tls_version.set_text(tls_version or _("Not available"))
 
         self._ui.cipher_suite.set_text(nbxmpp_client.ciphersuite or _("Not 
available"))
 
-    def _add_contact_addresses(self, dataforms: list[SimpleDataForm]) -> None:
+    def _add_contact_addresses(self, dataforms: list[DataForm]) -> None:
         fields = {
             "admin-addresses": _("Admin"),
             "status-addresses": _("Status"),
@@ -170,7 +172,7 @@ def _add_contact_addresses(self, dataforms: 
list[SimpleDataForm]) -> None:
 
     @staticmethod
     def _get_addresses(
-        fields: dict[str, str], dataforms: list[SimpleDataForm]
+        fields: dict[str, str], dataforms: list[DataForm]
     ) -> dict[str, list[str]] | None:
         addresses: dict[str, list[str]] = {}
         for form in dataforms:
@@ -260,7 +262,7 @@ def _get_features(self) -> list[Feature]:
         if http_upload_module.available:
             max_size = http_upload_module.max_file_size
             if max_size is not None:
-                max_size = GLib.format_size_full(max_size, self._units)
+                max_size = GLib.format_size_full(int(max_size), self._units)
                 http_upload_info = f"{http_upload_info} (max. {max_size})"
 
         return [
@@ -289,7 +291,7 @@ def _get_features(self) -> list[Feature]:
             ),
             Feature(
                 "XEP-0198: Stream Management",
-                self._client.features.has_sm,
+                self._client.features.has_sm(),
                 Namespace.STREAM_MGMT,
             ),
             Feature(



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

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


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to