diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 77f99f1..85f4d19 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,8 @@ For users can still use the in-room JID (#chan%irc@biboumi/NickName) to send a private message but the response you will receive will come from nickname%irc@biboumi. +- Message Correction (XEP-0308) no longer works, and will instead return an + error when the user attempts to. For admins ---------- diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp index 725e714..7be2bee 100644 --- a/src/xmpp/biboumi_component.cpp +++ b/src/xmpp/biboumi_component.cpp @@ -295,6 +295,15 @@ void BiboumiComponent::handle_message(const Stanza& stanza) error_type, error_name, error_text); }); const XmlNode* body = stanza.get_child("body", COMPONENT_NS); + const XmlNode* replace = stanza.get_child("replace", MESSAGE_CORRECT_NS); + + if (replace) + { + error_type = "cancel"; + error_name = "feature-not-implemented"; + error_text = "This room is mapped from IRC, which does not support message correction."; + return; + } try { // catch IRCNotConnected exceptions if (type == "groupchat" && iid.type == Iid::Type::Channel) diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp index ee6b776..a415183 100644 --- a/src/xmpp/xmpp_component.hpp +++ b/src/xmpp/xmpp_component.hpp @@ -39,6 +39,7 @@ #define STABLE_ID_NS "urn:xmpp:sid:0" #define STABLE_MUC_ID_NS "http://jabber.org/protocol/muc#stable_id" #define SELF_PING_FLAG MUC_NS"#self-ping-optimization" +#define MESSAGE_CORRECT_NS "urn:xmpp:message-correct:0" /** * An XMPP component, communicating with an XMPP server using the protocole diff --git a/tests/end_to_end/scenarios/message_correction.py b/tests/end_to_end/scenarios/message_correction.py new file mode 100644 index 0000000..67f7750 --- /dev/null +++ b/tests/end_to_end/scenarios/message_correction.py @@ -0,0 +1,10 @@ +from scenarios import * + +scenario = ( + scenarios.simple_channel_join.scenario, + send_stanza("hello"), + expect_stanza("/message[@from='#foo%{irc_server_one}/{nick_one}'][@id='the-message-id'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='hello']"), + send_stanza("hello"), + expect_stanza("/message[@from='#foo%{irc_server_one}'][@id='the-message-id-2'][@to='{jid_one}/{resource_one}'][@type='error']/error[@type='cancel']/stanza:feature-not-implemented", + "/message[@from='#foo%{irc_server_one}'][@id='the-message-id-2'][@to='{jid_one}/{resource_one}'][@type='error']/error[@type='cancel']/stanza:text[text()='This room is mapped from IRC, which does not support message correction.']"), +)