summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.hpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-21 00:37:01 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-21 00:37:01 +0100
commit70a58a8f7152e775a1c6cdc15b3c9f23a7719f85 (patch)
treed37b7a377c3f76a2e51fe2dcebb2b19874773872 /src/irc/irc_client.hpp
parente7a441e798e0a32fc4bb4021e058f3dc080adc80 (diff)
parentb72908548dc841de65dc9288a96c1abe648acc46 (diff)
downloadbiboumi-70a58a8f7152e775a1c6cdc15b3c9f23a7719f85.tar.gz
biboumi-70a58a8f7152e775a1c6cdc15b3c9f23a7719f85.tar.bz2
biboumi-70a58a8f7152e775a1c6cdc15b3c9f23a7719f85.tar.xz
biboumi-70a58a8f7152e775a1c6cdc15b3c9f23a7719f85.zip
Merge branch 'epolletc'
Diffstat (limited to 'src/irc/irc_client.hpp')
-rw-r--r--src/irc/irc_client.hpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index 3b22fa0..aa420f4 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -100,6 +100,18 @@ public:
*/
void forward_server_message(const IrcMessage& message);
/**
+ * Just empty the motd we kept as a string
+ */
+ void empty_motd(const IrcMessage& message);
+ /**
+ * Send the MOTD string as one single "big" message
+ */
+ void send_motd(const IrcMessage& message);
+ /**
+ * Append this line to the MOTD
+ */
+ void on_motd_line(const IrcMessage& message);
+ /**
* Forward the join of an other user into an IRC channel, and save the
* IrcUsers in the IrcChannel
*/
@@ -172,6 +184,11 @@ private:
*/
std::vector<std::string> channels_to_join;
bool welcomed;
+ /**
+ * Each motd line received is appended to this string, which we send when
+ * the motd is completely received
+ */
+ std::string motd;
IrcClient(const IrcClient&) = delete;
IrcClient(IrcClient&&) = delete;
IrcClient& operator=(const IrcClient&) = delete;
@@ -186,8 +203,12 @@ typedef void (IrcClient::*irc_callback_t)(const IrcMessage&);
static const std::unordered_map<std::string, irc_callback_t> irc_callbacks = {
{"NOTICE", &IrcClient::forward_server_message},
- {"375", &IrcClient::forward_server_message},
- {"372", &IrcClient::forward_server_message},
+ {"RPL_MOTDSTART", &IrcClient::empty_motd},
+ {"375", &IrcClient::empty_motd},
+ {"RPL_MOTD", &IrcClient::on_motd_line},
+ {"372", &IrcClient::on_motd_line},
+ {"RPL_MOTDEND", &IrcClient::send_motd},
+ {"376", &IrcClient::send_motd},
{"JOIN", &IrcClient::on_channel_join},
{"PRIVMSG", &IrcClient::on_channel_message},
{"353", &IrcClient::set_and_forward_user_list},