summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-17 11:35:43 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-21 00:35:15 +0100
commit1e122d3342ef4336f17bd5606be7101748627415 (patch)
tree06ef6b0698865d2a13404190d726f680adb536ea /src/irc/irc_client.cpp
parenta85e1abaaa5fe4f6cd9da7276088d14bf5f2c41f (diff)
downloadbiboumi-1e122d3342ef4336f17bd5606be7101748627415.tar.gz
biboumi-1e122d3342ef4336f17bd5606be7101748627415.tar.bz2
biboumi-1e122d3342ef4336f17bd5606be7101748627415.tar.xz
biboumi-1e122d3342ef4336f17bd5606be7101748627415.zip
Send the motd as one single big message
We append each line to a string, and when the MOTD is complete, we send that string at once.
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r--src/irc/irc_client.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 82abbd9..f339580 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -222,6 +222,27 @@ void IrcClient::on_channel_message(const IrcMessage& message)
this->bridge->send_message(iid, nick, body, muc);
}
+void IrcClient::empty_motd(const IrcMessage& message)
+{
+ (void)message;
+ this->motd.erase();
+}
+
+void IrcClient::on_motd_line(const IrcMessage& message)
+{
+ const std::string body = message.arguments[1];
+ // We could send the MOTD without a line break between each IRC-message,
+ // but sometimes it contains some ASCII art, we use line breaks to keep
+ // them intact.
+ this->motd += body+"\n";
+}
+
+void IrcClient::send_motd(const IrcMessage& message)
+{
+ (void)message;
+ this->bridge->send_xmpp_message(this->hostname, "", this->motd);
+}
+
void IrcClient::on_topic_received(const IrcMessage& message)
{
const std::string chan_name = message.arguments[1];