Commit 464261d4 authored by louiz’'s avatar louiz’

Support RPL_NOTPIC and 005

parent 606700f4
...@@ -34,6 +34,7 @@ static const std::unordered_map<std::string, ...@@ -34,6 +34,7 @@ static const std::unordered_map<std::string,
{"NOTICE", {&IrcClient::on_notice, {2, 0}}}, {"NOTICE", {&IrcClient::on_notice, {2, 0}}},
{"002", {&IrcClient::forward_server_message, {2, 0}}}, {"002", {&IrcClient::forward_server_message, {2, 0}}},
{"003", {&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}}}, {"005", {&IrcClient::on_isupport_message, {0, 0}}},
{"RPL_LISTSTART", {&IrcClient::on_rpl_liststart, {0, 0}}}, {"RPL_LISTSTART", {&IrcClient::on_rpl_liststart, {0, 0}}},
{"321", {&IrcClient::on_rpl_liststart, {0, 0}}}, {"321", {&IrcClient::on_rpl_liststart, {0, 0}}},
...@@ -41,6 +42,8 @@ static const std::unordered_map<std::string, ...@@ -41,6 +42,8 @@ static const std::unordered_map<std::string,
{"322", {&IrcClient::on_rpl_list, {0, 0}}}, {"322", {&IrcClient::on_rpl_list, {0, 0}}},
{"RPL_LISTEND", {&IrcClient::on_rpl_listend, {0, 0}}}, {"RPL_LISTEND", {&IrcClient::on_rpl_listend, {0, 0}}},
{"323", {&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}}}, {"RPL_MOTDSTART", {&IrcClient::empty_motd, {0, 0}}},
{"375", {&IrcClient::empty_motd, {0, 0}}}, {"375", {&IrcClient::empty_motd, {0, 0}}},
{"RPL_MOTD", {&IrcClient::on_motd_line, {2, 0}}}, {"RPL_MOTD", {&IrcClient::on_motd_line, {2, 0}}},
...@@ -594,6 +597,10 @@ void IrcClient::on_isupport_message(const IrcMessage& message) ...@@ -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) void IrcClient::send_gateway_message(const std::string& message, const std::string& from)
{ {
this->bridge.send_xmpp_message(this->hostname, from, message); this->bridge.send_xmpp_message(this->hostname, from, message);
...@@ -690,6 +697,15 @@ void IrcClient::empty_motd(const IrcMessage&) ...@@ -690,6 +697,15 @@ void IrcClient::empty_motd(const IrcMessage&)
this->motd.erase(); 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) void IrcClient::on_motd_line(const IrcMessage& message)
{ {
const std::string body = message.arguments[1]; const std::string body = message.arguments[1];
......
...@@ -143,6 +143,10 @@ public: ...@@ -143,6 +143,10 @@ public:
* http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt * http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
*/ */
void on_isupport_message(const IrcMessage& message); 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 * Just empty the motd we kept as a string
*/ */
...@@ -194,6 +198,10 @@ public: ...@@ -194,6 +198,10 @@ public:
* Save the topic in the IrcChannel * Save the topic in the IrcChannel
*/ */
void on_topic_received(const IrcMessage& message); 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 * The channel has been completely joined (self presence, topic, all names
* received etc), send the self presence and topic to the XMPP user. * received etc), send the self presence and topic to the XMPP user.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment