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


Commits:
8de0c5d2 by lovetox at 2022-08-14T14:12:27+02:00
new: Contacts: Add convenience method to access disco fields

- - - - -
2e4be3bb by lovetox at 2022-08-14T14:25:30+02:00
imprv: Don’t try to query avatars in MUCs which don’t allow it

Fixes #10937

- - - - -


2 changed files:

- gajim/common/modules/contacts.py
- gajim/common/modules/vcard_avatars.py


Changes:

=====================================
gajim/common/modules/contacts.py
=====================================
@@ -651,6 +651,11 @@ def is_irc(self) -> bool:
             return False
         return disco_info.is_irc
 
+    def get_config_value(self, field_name: str) -> Any:
+        disco_info = self.get_disco()
+        assert disco_info is not None
+        return disco_info.get_field_value(Namespace.MUC_INFO, field_name)
+
     def add_resource(self, resource: str) -> GroupchatParticipant:
         assert resource is not None
         # Check if resource is not None because not the whole


=====================================
gajim/common/modules/vcard_avatars.py
=====================================
@@ -195,6 +195,15 @@ def _process_update(self,
     def _muc_update_received(self, properties: PresenceProperties) -> None:
         contact = self._con.get_module('Contacts').get_contact(properties.jid,
                                                                groupchat=True)
+        assert isinstance(contact, GroupchatParticipant)
+
+        # Custom ejabberd room config option
+        allow_query = contact.room.get_config_value('allow_query_users')
+        if allow_query is False:
+            self._log.debug('Room does not allow IQ queries: %s',
+                            contact.room.jid)
+            return
+
         nick = properties.jid.resource
 
         if properties.avatar_state == AvatarState.EMPTY:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/587c3bb75727a1cc8701a116a8e4e6a4c409b4ce...2e4be3bb1eb14f70335ace8019887d187d08ab65

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/587c3bb75727a1cc8701a116a8e4e6a4c409b4ce...2e4be3bb1eb14f70335ace8019887d187d08ab65
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

Reply via email to