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/bridge | |
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/bridge')
-rw-r--r-- | src/bridge/bridge.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 9b7908a..f4d4814 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -1,6 +1,7 @@ #include <bridge/bridge.hpp> #include <bridge/colors.hpp> #include <xmpp/xmpp_component.hpp> +#include <irc/irc_message.hpp> #include <network/poller.hpp> #include <utils/encoding.hpp> #include <logger/logger.hpp> @@ -100,6 +101,25 @@ IrcClient* Bridge::get_irc_client(const std::string& hostname) bool Bridge::join_irc_channel(const Iid& iid, const std::string& username) { IrcClient* irc = this->get_irc_client(iid.server, username); + if (iid.chan.empty()) + { // Join the dummy channel + if (irc->is_welcomed()) + { + if (irc->get_dummy_channel().joined) + return false; + // Immediately simulate a message coming from the IRC server saying that we + // joined the channel + const IrcMessage join_message(irc->get_nick(), "JOIN", {""}); + irc->on_channel_join(join_message); + const IrcMessage end_join_message(std::string(iid.server), "366", + {irc->get_nick(), + "", "End of NAMES list"}); + irc->on_channel_completely_joined(end_join_message); + } + else + irc->get_dummy_channel().joining = true; + return true; + } if (irc->is_channel_joined(iid.chan) == false) { irc->send_join_command(iid.chan); |