diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-02-20 02:19:50 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-02-20 02:19:50 +0100 |
commit | 190c4ff1762e5e762e913f98033369ed75ed5291 (patch) | |
tree | 622383f469eac0904465e3ac53dd5b5ae5b1bcd5 /src/irc/irc_client.cpp | |
parent | e390b79a12a150b13570f7f0b19f50e1b0ead3a0 (diff) | |
download | biboumi-190c4ff1762e5e762e913f98033369ed75ed5291.tar.gz biboumi-190c4ff1762e5e762e913f98033369ed75ed5291.tar.bz2 biboumi-190c4ff1762e5e762e913f98033369ed75ed5291.tar.xz biboumi-190c4ff1762e5e762e913f98033369ed75ed5291.zip |
QUIT the irc server when the last channel is left
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r-- | src/irc/irc_client.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index e134bea..0d5c4e3 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -134,9 +134,9 @@ void IrcClient::send_topic_command(const std::string& chan_name, const std::stri this->send_message(IrcMessage("TOPIC", {chan_name, topic})); } -void IrcClient::send_quit_command() +void IrcClient::send_quit_command(const std::string& reason) { - this->send_message(IrcMessage("QUIT", {"gateway shutdown"})); + this->send_message(IrcMessage("QUIT", {reason})); } void IrcClient::send_join_command(const std::string& chan_name) @@ -403,7 +403,6 @@ void IrcClient::on_part(const IrcMessage& message) iid.chan = chan_name; iid.server = this->hostname; bool self = channel->get_self()->nick == nick; - this->bridge->send_muc_leave(std::move(iid), std::move(nick), std::move(txt), self); if (self) { channel->joined = false; @@ -411,6 +410,7 @@ void IrcClient::on_part(const IrcMessage& message) // channel pointer is now invalid channel = nullptr; } + this->bridge->send_muc_leave(std::move(iid), std::move(nick), std::move(txt), self); } } @@ -608,3 +608,8 @@ void IrcClient::on_user_mode(const IrcMessage& message) std::string("User mode for ") + message.arguments[0] + " is [" + message.arguments[1] + "]"); } + +size_t IrcClient::number_of_joined_channels() const +{ + return this->channels.size(); +} |