From 532228a3cefd92fe43ad0f52149b7f0f5ab5cb79 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Fri, 18 Sep 2015 22:02:01 +0200 Subject: =?UTF-8?q?Send=20a=20PASS=20IRC=20command=20if=20the=20=E2=80=9Cp?= =?UTF-8?q?ass=E2=80=9D=20config=20is=20sot=20by=20a=20user,=20on=20an=20I?= =?UTF-8?q?RC=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #3068 --- src/irc/irc_client.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/irc/irc_client.cpp') 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 +#include #include #include #include @@ -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})); -- cgit v1.2.3