diff options
-rw-r--r-- | src/irc/irc_client.cpp | 16 | ||||
-rw-r--r-- | src/irc/irc_client.hpp | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 0efae04..1150155 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -34,6 +34,7 @@ static const std::unordered_map<std::string, {"NOTICE", {&IrcClient::on_notice, {2, 0}}}, {"002", {&IrcClient::forward_server_message, {2, 0}}}, {"003", {&IrcClient::forward_server_message, {2, 0}}}, + {"004", {&IrcClient::on_server_myinfo, {4, 0}}}, {"005", {&IrcClient::on_isupport_message, {0, 0}}}, {"RPL_LISTSTART", {&IrcClient::on_rpl_liststart, {0, 0}}}, {"321", {&IrcClient::on_rpl_liststart, {0, 0}}}, @@ -41,6 +42,8 @@ static const std::unordered_map<std::string, {"322", {&IrcClient::on_rpl_list, {0, 0}}}, {"RPL_LISTEND", {&IrcClient::on_rpl_listend, {0, 0}}}, {"323", {&IrcClient::on_rpl_listend, {0, 0}}}, + {"RPL_NOTOPIC", {&IrcClient::on_empty_topic, {0, 0}}}, + {"331", {&IrcClient::on_empty_topic, {0, 0}}}, {"RPL_MOTDSTART", {&IrcClient::empty_motd, {0, 0}}}, {"375", {&IrcClient::empty_motd, {0, 0}}}, {"RPL_MOTD", {&IrcClient::on_motd_line, {2, 0}}}, @@ -594,6 +597,10 @@ void IrcClient::on_isupport_message(const IrcMessage& message) } } +void IrcClient::on_server_myinfo(const IrcMessage&) +{ +} + void IrcClient::send_gateway_message(const std::string& message, const std::string& from) { this->bridge.send_xmpp_message(this->hostname, from, message); @@ -690,6 +697,15 @@ void IrcClient::empty_motd(const IrcMessage&) this->motd.erase(); } +void IrcClient::on_empty_topic(const IrcMessage& message) +{ + const std::string chan_name = utils::tolower(message.arguments[message.arguments.size() - 1]); + log_debug("empty topic for " << chan_name); + IrcChannel* channel = this->get_channel(chan_name); + if (channel) + channel->topic.clear(); +} + void IrcClient::on_motd_line(const IrcMessage& message) { const std::string body = message.arguments[1]; diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 628f547..5efecc6 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -144,6 +144,10 @@ public: */ void on_isupport_message(const IrcMessage& message); /** + * Does nothing yet. Isn’t that duplicating features from 005? + */ + void on_server_myinfo(const IrcMessage& message); + /** * Just empty the motd we kept as a string */ void empty_motd(const IrcMessage& message); @@ -195,6 +199,10 @@ public: */ void on_topic_received(const IrcMessage& message); /** + * Empty the topic + */ + void on_empty_topic(const IrcMessage& message); + /** * The channel has been completely joined (self presence, topic, all names * received etc), send the self presence and topic to the XMPP user. */ |