Philipp Hörist pushed to branch master at gajim / gajim
Commits:
388490b8 by lovetox at 2022-05-16T22:35:08+02:00
fix: Bookmarks: Ignore bookmarks for roster contacts
Some clients allow to add MUCs as roster contacts, this creates
confusion when we receive them via bookmarks and assume they are a MUC.
Fixes #10781
- - - - -
1 changed file:
- gajim/common/modules/bookmarks.py
Changes:
=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -34,6 +34,7 @@
from gajim.common.events import BookmarksReceived
from gajim.common.types import BookmarksDict
from gajim.common.modules.base import BaseModule
+from gajim.common.modules.contacts import GroupchatContact
from gajim.common.modules.util import event_node
@@ -218,11 +219,24 @@ def _bookmarks_received(self, task: Task) -> None:
bookmarks = []
self._request_in_progress = False
+
+ self._cleanup_bookmarks(bookmarks)
self._bookmarks = self._convert_to_dict(bookmarks)
self.auto_join_bookmarks(self.bookmarks)
app.ged.raise_event(
BookmarksReceived(account=self._account))
+ def _cleanup_bookmarks(self, bookmarks: list[BookmarkData]) -> None:
+ for bookmark in list(bookmarks):
+ contact = self._client.get_module('Contacts').get_contact(
+ bookmark.jid, groupchat=True)
+ if not isinstance(contact, GroupchatContact):
+ # The contact exists probably in the roster and is therefore
+ # assumed to not be a MUC
+ self._log.warning('Received bookmark but jid is not '
+ 'a groupchat: %s', bookmark.jid)
+ bookmarks.remove(bookmark)
+
def store_bookmarks(self, bookmarks: List[BookmarkData]) -> None:
if not app.account_is_available(self._account):
return
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/388490b8f35d22169812bf35a5746c9487d718d4
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/388490b8f35d22169812bf35a5746c9487d718d4
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