Skip to content

fix: Do not treat thread subject as MUC subject

nicoco requested to merge nicoco/python-nbxmpp:fix-thread-subject into master

From https://xmpp.org/extensions/xep-0045.html#subject-mod

Note: A message with a <subject/> and a <body/> or a <subject/> and a <thread/> is a legitimate message, but it SHALL NOT be interpreted as a subject change.

Context: Cheogram (and soonish slidge) take advantage of this to give threads a name. Without this fix (first commit), gajim logs a lot of:

Handler exception:
Traceback (most recent call last):
  File "/home/ncedilni/src/perso/gajim/.venv/lib64/python3.13/site-packages/nbxmpp/dispatcher.py", line 751, in _execute_handler_chain
    handler["func"](self._client, stanza, properties)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ncedilni/src/perso/gajim/gajim/common/modules/muc.py", line 931, in _on_subject_change
    assert muc_subject is not None
           ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

The second commit opens the door for using such thread subjects in gajim, maybe some day? @lovetox maybe you don't want that in nbxmpp, let me know. But the first commit is strictly about spec compliance. ;)

Edited by nicoco

Merge request reports

Loading