summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-10 05:08:50 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-10 05:08:50 +0100
commit0bb7ee0127a625ca8b6c25d9f593bfaa3d5af84b (patch)
tree25a8f55fe2998618e0d293d1a4a72ac679e7b911 /src/irc/irc_client.cpp
parentaf4fc92c215e48cf13be36a1f8e8e1a821dabb5a (diff)
downloadbiboumi-0bb7ee0127a625ca8b6c25d9f593bfaa3d5af84b.tar.gz
biboumi-0bb7ee0127a625ca8b6c25d9f593bfaa3d5af84b.tar.bz2
biboumi-0bb7ee0127a625ca8b6c25d9f593bfaa3d5af84b.tar.xz
biboumi-0bb7ee0127a625ca8b6c25d9f593bfaa3d5af84b.zip
Handle IRC QUIT command
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r--src/irc/irc_client.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index e3d7653..8de7c8f 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -89,6 +89,8 @@ void IrcClient::parse_in_buffer()
this->on_welcome_message(message);
else if (message.command == "PART")
this->on_part(message);
+ else if (message.command == "QUIT")
+ this->on_quit(message);
}
}
@@ -257,3 +259,25 @@ void IrcClient::on_part(const IrcMessage& message)
channel->joined = false;
}
}
+
+void IrcClient::on_quit(const IrcMessage& message)
+{
+ std::string txt;
+ if (message.arguments.size() >= 1)
+ txt = message.arguments[0];
+ for (auto it = this->channels.begin(); it != this->channels.end(); ++it)
+ {
+ const std::string chan_name = it->first;
+ IrcChannel* channel = it->second.get();
+ const IrcUser* user = channel->find_user(message.prefix);
+ if (user)
+ {
+ std::string nick = user->nick;
+ channel->remove_user(user);
+ Iid iid;
+ iid.chan = chan_name;
+ iid.server = this->hostname;
+ this->bridge->send_muc_leave(std::move(iid), std::move(nick), std::move(txt), false);
+ }
+ }
+}