summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-03-12 01:00:17 +0100
committerlouiz’ <louiz@louiz.org>2018-03-12 01:00:17 +0100
commitbb476f4a0d60bbc41393a86a370aa94ab405b081 (patch)
tree82d15a2f36ae284ac693927c367bb57b89ddda51 /src/irc
parent9e4a3e2b054ee4604b6a42c73895216c68fa96e7 (diff)
downloadbiboumi-bb476f4a0d60bbc41393a86a370aa94ab405b081.tar.gz
biboumi-bb476f4a0d60bbc41393a86a370aa94ab405b081.tar.bz2
biboumi-bb476f4a0d60bbc41393a86a370aa94ab405b081.tar.xz
biboumi-bb476f4a0d60bbc41393a86a370aa94ab405b081.zip
Allow to override the addresses used to connect to an IRC network
fix #3273
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc_client.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index c5ef36c..764f37b 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -186,20 +186,22 @@ void IrcClient::start()
bool tls;
std::tie(port, tls) = this->ports_to_try.top();
this->ports_to_try.pop();
- this->bridge.send_xmpp_message(this->hostname, "", "Connecting to " +
- this->hostname + ":" + port + " (" +
- (tls ? "encrypted" : "not encrypted") + ")");
-
this->bind_addr = Config::get("outgoing_bind", "");
+ std::string address = this->hostname;
-#ifdef BOTAN_FOUND
-# ifdef USE_DATABASE
+#ifdef USE_DATABASE
auto options = Database::get_irc_server_options(this->bridge.get_bare_jid(),
this->get_hostname());
+# ifdef BOTAN_FOUND
this->credential_manager.set_trusted_fingerprint(options.col<Database::TrustedFingerprint>());
# endif
+ if (!options.col<Database::Address>().empty())
+ address = options.col<Database::Address>();
#endif
- this->connect(this->hostname, port, tls);
+ this->bridge.send_xmpp_message(this->hostname, "", "Connecting to " +
+ address + ":" + port + " (" +
+ (tls ? "encrypted" : "not encrypted") + ")");
+ this->connect(address, port, tls);
}
void IrcClient::on_connection_failed(const std::string& reason)