Bounce message corrections
On IRC it is confusing when an XMPP user "corrects" a message, but on the other side a new message is sent. To prevent spam and confusion, do not allow message corrections at all, and instead return an error if attempted. Fixes: #3436 Fixes: #3480
This commit is contained in:
committed by
mathieui
parent
5cb2802fd2
commit
9c92f7ce4a
@@ -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
|
||||
----------
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from scenarios import *
|
||||
|
||||
scenario = (
|
||||
scenarios.simple_channel_join.scenario,
|
||||
send_stanza("<message id='the-message-id' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>hello</body></message>"),
|
||||
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("<message id='the-message-id-2' from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>hello</body><replace id='the-message-id' xmlns='urn:xmpp:message-correct:0'/></message>"),
|
||||
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.']"),
|
||||
)
|
||||
Reference in New Issue
Block a user