From 0ee533256d13c3a19c45db376fa872ebe619bf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Thu, 18 May 2017 21:54:12 +0200 Subject: Handle messages 367 and 368 to display the banlist in the MUC fix #3234 --- src/irc/irc_client.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/irc/irc_client.hpp | 2 ++ 2 files changed, 41 insertions(+) (limited to 'src/irc') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 0e3926a..1d74098 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -62,6 +62,8 @@ static const std::unordered_mapbridge.send_topic(this->hostname, chan_name, channel->topic, channel->topic_author); } +void IrcClient::on_banlist(const IrcMessage& message) +{ + const std::string chan_name = utils::tolower(message.arguments[1]); + IrcChannel* channel = this->get_channel(chan_name); + if (channel->joined) + { + Iid iid; + iid.set_local(chan_name); + iid.set_server(this->hostname); + iid.type = Iid::Type::Channel; + std::string body{message.arguments[2] + " banned"}; + if (message.arguments.size() >= 4) + { + IrcUser by(message.arguments[3], this->prefix_to_mode); + body += " by " + by.nick; + } + if (message.arguments.size() >= 5) + body += " on " + message.arguments[4]; + + this->bridge.send_message(iid, "", body, true); + } +} + +void IrcClient::on_banlist_end(const IrcMessage& message) +{ + const std::string chan_name = utils::tolower(message.arguments[1]); + IrcChannel* channel = this->get_channel(chan_name); + if (channel->joined) + { + Iid iid; + iid.set_local(chan_name); + iid.set_server(this->hostname); + iid.type = Iid::Type::Channel; + this->bridge.send_message(iid, "", message.arguments[2], true); + } +} + void IrcClient::on_own_host_received(const IrcMessage& message) { this->own_host = message.arguments[1]; diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 7593029..aec6cd9 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -222,6 +222,8 @@ public: * received etc), send the self presence and topic to the XMPP user. */ void on_channel_completely_joined(const IrcMessage& message); + void on_banlist(const IrcMessage& message); + void on_banlist_end(const IrcMessage& message); /** * Save our own host, as reported by the server */ -- cgit v1.2.3