summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp20
-rw-r--r--src/bridge/bridge.hpp5
2 files changed, 25 insertions, 0 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index f69da77..11393d4 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -744,6 +744,26 @@ void Bridge::send_topic(const std::string& hostname, const std::string& chan_nam
}
+void Bridge::send_room_history(const std::string& hostname, const std::string& chan_name)
+{
+ for (const auto& resource: this->resources_in_chan[ChannelKey{chan_name, hostname}])
+ this->send_room_history(hostname, chan_name, resource);
+}
+
+void Bridge::send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource)
+{
+#ifdef USE_DATABASE
+ const auto coptions = Database::get_irc_channel_options_with_server_and_global_default(this->user_jid, hostname, chan_name);
+ const auto lines = Database::get_muc_logs(this->user_jid, chan_name, hostname, coptions.maxHistoryLength.value());
+ for (const auto& line: lines)
+ {
+ const auto seconds = line.date.value().timeStamp();
+ this->xmpp.send_history_message(chan_name + "%" + hostname, line.nick.value(), line.body.value(),
+ this->user_jid + "/" + resource, seconds);
+ }
+#endif
+}
+
std::string Bridge::get_own_nick(const Iid& iid)
{
IrcClient* irc = this->find_irc_client(iid.get_server());
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index 6fdbcc9..c26995f 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -138,6 +138,11 @@ public:
void send_topic(const std::string& hostname, const std::string& chan_name, const std::string& topic, const std::string& who);
void send_topic(const std::string& hostname, const std::string& chan_name, const std::string& topic, const std::string& who, const std::string& resource);
/**
+ * Send the MUC history to the user
+ */
+ void send_room_history(const std::string& hostname, const std::string& chan_name);
+ void send_room_history(const std::string& hostname, const std::string& chan_name, const std::string& resource);
+ /**
* Send a MUC message from some participant
*/
void send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc);