aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormesonium <93607429+mesonium@users.noreply.github.com>2023-07-29 14:02:38 +0200
committerGitHub <noreply@github.com>2023-07-29 14:02:38 +0200
commitbc5a1d35cbf5c1aca406fa0fe81ca60d6b280bd5 (patch)
treec2ce06ec1355dd1729e9b56dad35e823458f17bc
parentd0fca291ac319173268683bf316e1d708db930ee (diff)
downloaddino-bc5a1d35cbf5c1aca406fa0fe81ca60d6b280bd5.tar.gz
dino-bc5a1d35cbf5c1aca406fa0fe81ca60d6b280bd5.zip
fix: Add x node to MUC PM stanza (#1462)
Add <x/> tag in MUC-PMs to support better Carbon delivery in compliance with XEP-0045 v1.28 and above. Fixes #1306
-rw-r--r--libdino/src/service/muc_manager.vala7
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala5
2 files changed, 12 insertions, 0 deletions
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index e2e13435..119079f0 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -54,6 +54,7 @@ public class MucManager : StreamInteractionModule, Object {
}
return true;
});
+ stream_interactor.get_module(MessageProcessor.IDENTITY).build_message_stanza.connect(on_build_message_stanza);
}
// already_autojoin: Without this flag we'd be retrieving bookmarks (to check for autojoin) from the sender on every join
@@ -651,6 +652,12 @@ public class MucManager : StreamInteractionModule, Object {
conference_removed(account, jid);
}
+ private void on_build_message_stanza(Entities.Message message, Xmpp.MessageStanza message_stanza, Conversation conversation) {
+ if (conversation.type_ == Conversation.Type.GROUPCHAT_PM) {
+ Xmpp.Xep.Muc.add_muc_pm_message_stanza_x_node(message_stanza);
+ }
+ }
+
private void self_ping(Account account) {
XmppStream? stream = stream_interactor.get_stream(account);
if (stream == null) return;
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index 46abe303..2d7ddd14 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -54,6 +54,11 @@ public enum Feature {
UNSECURED
}
+public static void add_muc_pm_message_stanza_x_node(MessageStanza message_stanza) {
+ StanzaNode x_node = new StanzaNode.build("x", "http://jabber.org/protocol/muc#user").add_self_xmlns();
+ message_stanza.stanza.put_node(x_node);
+}
+
public class JoinResult {
public MucEnterError? muc_error;
public string? stanza_error;