Philipp Hörist pushed to branch master at gajim / gajim
Commits:
fd6dec12 by Philipp Hörist at 2018-12-03T14:40:43Z
Handle presence without from attr correctly
Fixes #9472
- - - - -
3 changed files:
- gajim/common/modules/caps.py
- gajim/common/modules/chatstates.py
- gajim/common/modules/vcard_avatars.py
Changes:
=====================================
gajim/common/modules/caps.py
=====================================
@@ -42,6 +42,15 @@ class Caps:
self._create_suitable_client_caps =
caps_cache.create_suitable_client_caps
def _presence_received(self, _con, stanza):
+ if stanza.getType() in ('unavailable', 'error'):
+ return
+
+ from_ = stanza.getFrom()
+ if from_ is None:
+ # Presence from ourself
+ return
+ full_jid = str(from_)
+
hash_method = node = caps_hash = None
caps = stanza.getTag('c', namespace=nbxmpp.NS_CAPS)
@@ -50,8 +59,6 @@ class Caps:
node = caps['node']
caps_hash = caps['ver']
- from_ = stanza.getFrom()
- full_jid = str(from_)
show = parse_show(stanza)
type_ = parse_type(stanza)
=====================================
gajim/common/modules/chatstates.py
=====================================
@@ -74,8 +74,8 @@ class Chatstate:
return
full_jid = stanza.getFrom()
-
- if self._con.get_own_jid().bareMatch(full_jid):
+ if full_jid is None or self._con.get_own_jid().bareMatch(full_jid):
+ # Presence from ourself
return
contact = app.contacts.get_gc_contact(
=====================================
gajim/common/modules/vcard_avatars.py
=====================================
@@ -51,12 +51,15 @@ class VCardAvatars:
app.config.set_per('accounts', self._account, 'avatar_sha', '')
def _presence_received(self, _con, stanza):
- update = stanza.getTag('x', namespace=nbxmpp.NS_VCARD_UPDATE)
- if update is None:
+ if stanza.getType() in ('unavailable', 'error'):
return
jid = stanza.getFrom()
+ update = stanza.getTag('x', namespace=nbxmpp.NS_VCARD_UPDATE)
+ if update is None:
+ return
+
avatar_sha = update.getTagData('photo')
if avatar_sha is None:
log.info('%s is not ready to promote an avatar', jid)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/fd6dec1208dd6c5dd7bd2e2cf7785e893b3c3adf
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/fd6dec1208dd6c5dd7bd2e2cf7785e893b3c3adf
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