Philipp Hörist pushed to branch master at gajim / gajim


Commits:
f67865c7 by Philipp Hörist at 2023-10-29T20:05:19+01:00
cfix: GroupchatInfo: Store contact object for getting the JID

- - - - -


1 changed file:

- gajim/gtk/groupchat_info.py


Changes:

=====================================
gajim/gtk/groupchat_info.py
=====================================
@@ -127,6 +127,7 @@ def __init__(self,
                             Gtk.PolicyType.AUTOMATIC)
 
         self._account = account
+        self._contact: GroupchatContact | None = None
         self._info: DiscoInfo | None = None
 
         self._ui = get_builder('groupchat_info_scrolled.ui')
@@ -141,11 +142,9 @@ def set_account(self, account: str) -> None:
         self._account = account
 
     def get_jid(self) -> JID | None:
-        jid = self._ui.address_label.get_text()
-        if not jid:
-            return None
-
-        return JID.from_string(self._ui.address_label.get_text())
+        if self._contact is not None:
+            return self._contact.jid
+        return self._info.jid
 
     def set_subject(self, muc_subject: MucSubject | None) -> None:
         if muc_subject is None:
@@ -168,6 +167,7 @@ def set_subject(self, muc_subject: MucSubject | None) -> 
None:
         self._ui.subject_label.set_visible(has_subject)
 
     def set_info_from_contact(self, contact: GroupchatContact) -> None:
+        self._contact = contact
         disco_info = contact.get_disco()
         if disco_info is not None:
             self.set_from_disco_info(disco_info)
@@ -274,7 +274,10 @@ def _add_features(self, features: list[str]) -> None:
         grid.show_all()
 
     def _on_copy_address(self, _button: Gtk.Button) -> None:
-        jid = JID.from_string(self._ui.address_label.get_text())
+        if self._contact is not None:
+            jid = self._contact.jid
+        else:
+            jid = self._info.jid
         clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
         clipboard.set_text(jid.to_iri(XmppUriQuery.JOIN.value), -1)
 



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f67865c7c60b8208dd59d2dd6f3d55d680cf796f
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