Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
2d028d07 by nicoco at 2025-09-20T13:42:14+02:00
imprv: Log details about invalid roster items
- - - - -
bed88d4f by nicoco at 2025-09-21T00:06:02+02:00
imprv: Log details about invalid MUC affiliation items
- - - - -
2 changed files:
- nbxmpp/modules/muc/muc.py
- nbxmpp/modules/roster.py
Changes:
=====================================
nbxmpp/modules/muc/muc.py
=====================================
@@ -440,10 +440,15 @@ class MUC(BaseModule):
items = query.getTags("item")
users_dict = {}
for item in items:
+ user_jid = item.getAttr("jid")
+ if user_jid is None:
+ self._log.warning("Received an affiliation item without JID:
%s", item)
+ self._log.warning(response)
+ continue
try:
- jid = JID.from_string(item.getAttr("jid"))
- except Exception as error:
- self._log.warning("Invalid JID: %s, %s", item.getAttr("jid"),
error)
+ jid = JID.from_string(user_jid)
+ except Exception as e:
+ self._log.warning("'%s' is an invalid JID: %s", user_jid, e)
continue
users_dict[jid] = {}
=====================================
nbxmpp/modules/roster.py
=====================================
@@ -81,7 +81,9 @@ class Roster(BaseModule):
ver_support = self._client.features.has_roster_version()
pushed_items, version = self._parse_push(stanza, ver_support)
if len(pushed_items) != 1:
- self._log.warning("Roster push contains more than one item")
+ self._log.warning(
+ "Roster push does not have exactly one item: %s", pushed_items
+ )
self._log.warning(stanza)
raise NodeProcessed
@@ -134,8 +136,8 @@ class Roster(BaseModule):
for item in query.getTags("item"):
try:
roster_item = RosterItem.from_node(item)
- except Exception:
- self._log.warning("Invalid roster item")
+ except Exception as e:
+ self._log.warning("Invalid roster item: %s", e)
self._log.warning(stanza)
continue
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/bc73c22de4de4f00e7335800bbe65698ef34489f...bed88d4f49daee03d93ba1b77eb332adb97cc565
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/bc73c22de4de4f00e7335800bbe65698ef34489f...bed88d4f49daee03d93ba1b77eb332adb97cc565
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]