Fix message stanza with body changing MUC subject (#1569)

- fixes https://github.com/dino/dino/issues/1542
            - more consistent with
              https://xmpp.org/extensions/xep-0045.html#enter-subject:
                    "Note: In accordance with the core definition of XML stanzas,
                    any message can contain a <subject/> element; only a message that
                    contains a <subject/> but no <body/> element shall be considered a
                    subject change for MUC purposes."
This commit is contained in:
eerielili 2024-04-01 11:33:11 +00:00 committed by Maxim Logaev
parent d6a6bdc546
commit e5302d1d9d

View file

@ -285,7 +285,7 @@ public class Module : XmppStreamModule {
private void on_received_message(XmppStream stream, MessageStanza message) { private void on_received_message(XmppStream stream, MessageStanza message) {
if (message.type_ == MessageStanza.TYPE_GROUPCHAT) { if (message.type_ == MessageStanza.TYPE_GROUPCHAT) {
StanzaNode? subject_node = message.stanza.get_subnode("subject"); StanzaNode? subject_node = message.stanza.get_subnode("subject");
if (subject_node != null) { if (subject_node != null && message.body == null){
string subject = subject_node.get_string_content(); string subject = subject_node.get_string_content();
stream.get_flag(Flag.IDENTITY).set_muc_subject(message.from, subject); stream.get_flag(Flag.IDENTITY).set_muc_subject(message.from, subject);
subject_set(stream, subject, message.from); subject_set(stream, subject, message.from);