diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-04-13 15:37:56 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-04-13 15:37:56 +0200 |
commit | 020325dbb071f1735bceb80de9f982aefcd2de47 (patch) | |
tree | 6d87663ec9f4a31016e7b1fac662000d30c223ce /src/irc/irc_client.cpp | |
parent | 65601a96d20d4ce010723df3a059ee5a9713fae7 (diff) | |
download | biboumi-020325dbb071f1735bceb80de9f982aefcd2de47.tar.gz biboumi-020325dbb071f1735bceb80de9f982aefcd2de47.tar.bz2 biboumi-020325dbb071f1735bceb80de9f982aefcd2de47.tar.xz biboumi-020325dbb071f1735bceb80de9f982aefcd2de47.zip |
[WIP] DummyIrcChannel
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r-- | src/irc/irc_client.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 884f214..e565658 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -280,7 +280,11 @@ void IrcClient::set_and_forward_user_list(const IrcMessage& message) void IrcClient::on_channel_join(const IrcMessage& message) { const std::string chan_name = utils::tolower(message.arguments[0]); - IrcChannel* channel = this->get_channel(chan_name); + IrcChannel* channel; + if (chan_name.empty()) + channel = &this->dummy_channel; + else + channel = this->get_channel(chan_name); const std::string nick = message.prefix; if (channel->joined == false) channel->set_self(nick); @@ -394,6 +398,18 @@ void IrcClient::on_welcome_message(const IrcMessage& message) for (const std::string& chan_name: this->channels_to_join) this->send_join_command(chan_name); this->channels_to_join.clear(); + // Indicate that the dummy channel is joined as well, if needed + if (this->dummy_channel.joining) + { + // Simulate a message coming from the IRC server saying that we joined + // the channel + const IrcMessage join_message(this->get_nick(), "JOIN", {""}); + this->on_channel_join(join_message); + const IrcMessage end_join_message(std::string(this->hostname), "366", + {this->get_nick(), + "", "End of NAMES list"}); + this->on_channel_completely_joined(end_join_message); + } } void IrcClient::on_part(const IrcMessage& message) @@ -624,3 +640,8 @@ size_t IrcClient::number_of_joined_channels() const { return this->channels.size(); } + +DummyIrcChannel& IrcClient::get_dummy_channel() +{ + return this->dummy_channel; +} |