Commit fd6dec12 authored by Philipp Hörist's avatar Philipp Hörist

Handle presence without from attr correctly

Fixes #9472
parent 1d11e066
Pipeline #2742 passed with stages
in 3 minutes and 52 seconds
......@@ -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)
......
......@@ -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(
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment