diff options
author | louiz’ <louiz@louiz.org> | 2018-03-18 19:33:07 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2018-03-18 19:33:07 +0100 |
commit | 9500bfd4ccb21b261fd8204180d78553704f7acc (patch) | |
tree | d675c05fc54fdbce7cc72e2cac6131945c407c2c /src/bridge/bridge.cpp | |
parent | 68e14800750042fdd371626c179692ba57076b73 (diff) | |
download | biboumi-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/bridge/bridge.cpp')
-rw-r--r-- | src/bridge/bridge.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 9269bb7..9a0358c 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -5,6 +5,7 @@ #include <utils/empty_if_fixed_server.hpp> #include <utils/encoding.hpp> #include <utils/tolower.hpp> +#include <utils/uuid.hpp> #include <logger/logger.hpp> #include <utils/revstr.hpp> #include <utils/split.hpp> @@ -185,7 +186,7 @@ bool Bridge::join_irc_channel(const Iid& iid, const std::string& nickname, const return false; } -void Bridge::send_channel_message(const Iid& iid, const std::string& body) +void Bridge::send_channel_message(const Iid& iid, const std::string& body, std::string id) { if (iid.get_server().empty()) { @@ -210,6 +211,7 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body) std::vector<std::string> lines = utils::split(body, '\n', true); if (lines.empty()) return ; + bool first = true; for (const std::string& line: lines) { if (line.substr(0, 5) == "/mode") @@ -231,9 +233,12 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body) uuid = Database::store_muc_message(this->get_bare_jid(), iid.get_local(), iid.get_server(), std::chrono::system_clock::now(), std::get<0>(xmpp_body), irc->get_own_nick()); #endif + if (!first) + id = utils::gen_uuid(); for (const auto& resource: this->resources_in_chan[iid.to_tuple()]) this->xmpp.send_muc_message(std::to_string(iid), irc->get_own_nick(), this->make_xmpp_body(line), - this->user_jid + "/" + resource, uuid); + this->user_jid + "/" + resource, uuid, id); + first = false; } } @@ -816,7 +821,7 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st for (const auto& resource: this->resources_in_chan[iid.to_tuple()]) { this->xmpp.send_muc_message(std::to_string(iid), nick, this->make_xmpp_body(body, encoding), - this->user_jid + "/" + resource, {}); + this->user_jid + "/" + resource, {}, utils::gen_uuid()); } } |