summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-03-18 19:33:07 +0100
committerlouiz’ <louiz@louiz.org>2018-03-18 19:33:07 +0100
commit9500bfd4ccb21b261fd8204180d78553704f7acc (patch)
treed675c05fc54fdbce7cc72e2cac6131945c407c2c /src/xmpp
parent68e14800750042fdd371626c179692ba57076b73 (diff)
downloadbiboumi-9500bfd4ccb21b261fd8204180d78553704f7acc.tar.gz
biboumi-9500bfd4ccb21b261fd8204180d78553704f7acc.tar.bz2
biboumi-9500bfd4ccb21b261fd8204180d78553704f7acc.tar.xz
biboumi-9500bfd4ccb21b261fd8204180d78553704f7acc.zip
Reflect message IDs in channel MUCs
fix #3283
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/biboumi_component.cpp2
-rw-r--r--src/xmpp/xmpp_component.cpp12
-rw-r--r--src/xmpp/xmpp_component.hpp2
3 files changed, 6 insertions, 10 deletions
diff --git a/src/xmpp/biboumi_component.cpp b/src/xmpp/biboumi_component.cpp
index 891b715..f35c7f4 100644
--- a/src/xmpp/biboumi_component.cpp
+++ b/src/xmpp/biboumi_component.cpp
@@ -279,7 +279,7 @@ void BiboumiComponent::handle_message(const Stanza& stanza)
{
if (body && !body->get_inner().empty())
{
- bridge->send_channel_message(iid, body->get_inner());
+ bridge->send_channel_message(iid, body->get_inner(), id);
}
const XmlNode* subject = stanza.get_child("subject", COMPONENT_NS);
if (subject)
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index a71d810..b3d925e 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -2,6 +2,7 @@
#include <utils/scopeguard.hpp>
#include <utils/tolower.hpp>
#include <logger/logger.hpp>
+#include <utils/uuid.hpp>
#include <xmpp/xmpp_component.hpp>
#include <config/config.hpp>
@@ -14,8 +15,6 @@
#include <iostream>
#include <set>
-#include <uuid/uuid.h>
-
#include <cstdlib>
#include <set>
@@ -364,10 +363,11 @@ 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, std::string uuid)
+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, std::string id)
{
Stanza message("message");
message["to"] = jid_to;
+ message["id"] = std::move(id);
if (!nick.empty())
message["from"] = muc_name + "@" + this->served_hostname + "/" + nick;
else // Message from the room itself
@@ -673,9 +673,5 @@ void XmppComponent::send_iq_result(const std::string& id, const std::string& to_
std::string XmppComponent::next_id()
{
- char uuid_str[37];
- uuid_t uuid;
- uuid_generate(uuid);
- uuid_unparse(uuid, uuid_str);
- return uuid_str;
+ return utils::gen_uuid();
}
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index 06cc6ff..b11e56c 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -134,7 +134,7 @@ 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,
- std::string uuid);
+ std::string uuid, std::string id);
#ifdef USE_DATABASE
/**
* Send a message, with a <delay/> element, part of a MUC history