diff options
author | fiaxh <git@lightrise.org> | 2022-07-08 16:33:40 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2022-10-10 21:55:15 +0200 |
commit | 6c6e7e3aa7935ec513b7e5ea9b53a92b741ecf92 (patch) | |
tree | f92df8980bb6e65d9ce81f1395773201b664a779 /xmpp-vala/src/module/xep/0045_muc | |
parent | 9c736af765d8c62838440afbfd2ad7ee78b44951 (diff) | |
download | dino-6c6e7e3aa7935ec513b7e5ea9b53a92b741ecf92.tar.gz dino-6c6e7e3aa7935ec513b7e5ea9b53a92b741ecf92.zip |
Rewrite MAM logic and add MUC MAM
Diffstat (limited to 'xmpp-vala/src/module/xep/0045_muc')
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/module.vala | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index 56d50210..f8ddb6d0 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -81,7 +81,7 @@ public class Module : XmppStreamModule { received_pipeline_listener = new ReceivedPipelineListener(this); } - public async JoinResult? enter(XmppStream stream, Jid bare_jid, string nick, string? password, DateTime? history_since, StanzaNode? additional_node) { + public async JoinResult? enter(XmppStream stream, Jid bare_jid, string nick, string? password, DateTime? history_since, bool receive_history, StanzaNode? additional_node) { try { Presence.Stanza presence = new Presence.Stanza(); presence.to = bare_jid.with_resource(nick); @@ -90,10 +90,15 @@ public class Module : XmppStreamModule { if (password != null) { x_node.put_node(new StanzaNode.build("password", NS_URI).put_node(new StanzaNode.text(password))); } - if (history_since != null) { + if (history_since != null || !receive_history) { StanzaNode history_node = new StanzaNode.build("history", NS_URI); - history_node.set_attribute("since", DateTimeProfiles.to_datetime(history_since)); x_node.put_node(history_node); + + if (history_since != null) { + history_node.set_attribute("since", DateTimeProfiles.to_datetime(history_since)); + } else if (!receive_history) { + history_node.set_attribute("maxchars", "0"); + } } presence.stanza.put_node(x_node); @@ -561,7 +566,7 @@ public class ReceivedPipelineListener : StanzaListener<MessageStanza> { StanzaNode? reason_node = invite_node.get_subnode("reason", NS_URI_USER); string? reason = null; if (reason_node != null) reason = reason_node.get_string_content(); - bool is_mam_message = Xep.MessageArchiveManagement.MessageFlag.get_flag(message) != null; // TODO + bool is_mam_message = Xmpp.MessageArchiveManagement.MessageFlag.get_flag(message) != null; // TODO if (!is_mam_message) outer.invite_received(stream, message.from, from_jid, password, reason); return true; } |