Philipp Hörist pushed to branch master at gajim / gajim
Commits:
80f06668 by wurstsalat at 2024-12-11T17:23:14+00:00
fix: Contacts: Check for existing chat contacts when adding group chat contact
- - - - -
1 changed file:
- gajim/common/modules/contacts.py
Changes:
=====================================
gajim/common/modules/contacts.py
=====================================
@@ -146,11 +146,17 @@ def add_group_chat_contact(self, jid: str | JID) ->
GroupchatContact:
contact = self._contacts.get(jid)
if contact is not None:
- if not isinstance(contact, GroupchatContact):
- raise ValueError(f'Trying to add GroupchatContact {jid}, '
- f'but contact already exists as {contact} '
- f'(in roster: {contact.is_in_roster})')
- return contact
+ if isinstance(contact, GroupchatContact):
+ return contact
+
+ self._log.error(f'Trying to add GroupchatContact {jid}, '
+ f'but contact already exists as {contact} '
+ f'(in roster: {contact.is_in_roster})')
+ # Most likely a groupchat which has been added to the roster.
+ # Remove jid from roster (if we are online) and delete contact.
+ if self._client.state.is_available:
+ self._client.get_module('Roster').delete_item(jid)
+ self._contacts.pop(jid)
contact = GroupchatContact(self._log, jid, self._account)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/80f06668abbb302a798ad0744347ae1994cc7768
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/80f06668abbb302a798ad0744347ae1994cc7768
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]