summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_component.cpp11
-rw-r--r--src/xmpp/xmpp_component.hpp4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 6829cef..8335c8a 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -380,7 +380,7 @@ void XmppComponent::send_topic(const std::string& from, Xmpp::body&& topic, cons
this->send_stanza(message);
}
-void XmppComponent::send_muc_message(const std::string& muc_name, const std::string& nick, Xmpp::body&& xmpp_body, const std::string& jid_to)
+void XmppComponent::send_muc_message(const std::string& muc_name, const std::string& nick, Xmpp::body&& xmpp_body, const std::string& jid_to, std::string uuid)
{
Stanza message("message");
message["to"] = jid_to;
@@ -402,6 +402,15 @@ void XmppComponent::send_muc_message(const std::string& muc_name, const std::str
// Pass the ownership of the pointer to this xmlnode
html.add_child(std::move(std::get<1>(xmpp_body)));
}
+
+ if (!uuid.empty())
+ {
+ XmlSubNode stanza_id(message, "stanza-id");
+ stanza_id["xmlns"] = STABLE_ID_NS;
+ stanza_id["by"] = muc_name + "@" + this->served_hostname;
+ stanza_id["id"] = std::move(uuid);
+ }
+
this->send_stanza(message);
}
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index 250f0a8..8eabaf6 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -33,6 +33,7 @@
#define DATAFORM_NS "jabber:x:data"
#define RSM_NS "http://jabber.org/protocol/rsm"
#define MUC_TRAFFIC_NS "http://jabber.org/protocol/muc#traffic"
+#define STABLE_ID_NS "urn:xmpp:sid:0"
/**
* An XMPP component, communicating with an XMPP server using the protocole
@@ -134,7 +135,8 @@ public:
/**
* Send a (non-private) message to the MUC
*/
- void send_muc_message(const std::string& muc_name, const std::string& nick, Xmpp::body&& body, const std::string& jid_to);
+ void send_muc_message(const std::string& muc_name, const std::string& nick, Xmpp::body&& body, const std::string& jid_to,
+ std::string uuid);
/**
* Send a message, with a <delay/> element, part of a MUC history
*/