diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-09-18 22:02:01 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-09-18 22:09:26 +0200 |
commit | 532228a3cefd92fe43ad0f52149b7f0f5ab5cb79 (patch) | |
tree | caa2d30622e20a9a6bb31948328580dd43ee0cd2 /src | |
parent | 1691cf8f64d6175c61ddf9a4f4a95b44c32d698e (diff) | |
download | biboumi-532228a3cefd92fe43ad0f52149b7f0f5ab5cb79.tar.gz biboumi-532228a3cefd92fe43ad0f52149b7f0f5ab5cb79.tar.bz2 biboumi-532228a3cefd92fe43ad0f52149b7f0f5ab5cb79.tar.xz biboumi-532228a3cefd92fe43ad0f52149b7f0f5ab5cb79.zip |
Send a PASS IRC command if the “pass” config is sot by a user, on an IRC server
fix #3068
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/irc_client.cpp | 12 | ||||
-rw-r--r-- | src/irc/irc_client.hpp | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 29f0b54..bac3e34 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -1,4 +1,5 @@ #include <utils/timed_events.hpp> +#include <database/database.hpp> #include <irc/irc_message.hpp> #include <irc/irc_client.hpp> #include <bridge/bridge.hpp> @@ -94,6 +95,12 @@ void IrcClient::on_connection_failed(const std::string& reason) void IrcClient::on_connected() { +#ifdef USE_DATABASE + auto options = Database::get_irc_server_options(this->bridge->get_bare_jid(), + this->get_hostname()); + if (!options.pass.value().empty()) + this->send_pass_command(options.pass.value()); +#endif this->send_nick_command(this->username); this->send_user_command(this->username, this->username); this->send_gateway_message("Connected to IRC server"s + (this->use_tls ? " (encrypted)": "") + "."); @@ -218,6 +225,11 @@ void IrcClient::send_nick_command(const std::string& nick) this->send_message(IrcMessage("NICK", {nick})); } +void IrcClient::send_pass_command(const std::string& password) +{ + this->send_message(IrcMessage("PASS", {password})); +} + void IrcClient::send_kick_command(const std::string& chan_name, const std::string& target, const std::string& reason) { this->send_message(IrcMessage("KICK", {chan_name, target, reason})); diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index a3f69a0..4e61d14 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -85,6 +85,7 @@ public: * Send the NICK irc command */ void send_nick_command(const std::string& username); + void send_pass_command(const std::string& password); /** * Send the JOIN irc command. */ |