XEP-0153: Fix a bug that would add muc elements to inbound presence

This commit is contained in:
mathieui 2021-02-04 21:30:55 +01:00
parent 712ac671e1
commit ace5aeb80e

View file

@ -152,13 +152,14 @@ class XEP_0153(BasePlugin):
self.xmpp['xep_0054'].get_vcard(jid=jid.bare, ifrom=ifrom, self.xmpp['xep_0054'].get_vcard(jid=jid.bare, ifrom=ifrom,
callback=callback) callback=callback)
def _recv_presence(self, pres): def _recv_presence(self, pres: Presence):
try: try:
if pres['muc']['affiliation']: if pres.get_plugin('muc', check=True):
# Don't process vCard avatars for MUC occupants # Don't process vCard avatars for MUC occupants
# since they all share the same bare JID. # since they all share the same bare JID.
return return
except: pass except:
pass
if not pres.match('presence/vcard_temp_update'): if not pres.match('presence/vcard_temp_update'):
self.api['set_hash'](pres['from'], args=None) self.api['set_hash'](pres['from'], args=None)