From 99aba5667d0d7ba6657f9c175a9342126bc4b0f2 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 22 Feb 2014 21:42:24 +0100 Subject: Connection to servers does not block the process anymore --- src/irc/irc_client.cpp | 11 +++++++---- src/irc/irc_client.hpp | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/irc') diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 0d5c4e3..d35437c 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -29,10 +29,13 @@ void IrcClient::start() { this->bridge->send_xmpp_message(this->hostname, "", std::string("Connecting to ") + this->hostname + ":" + "6667"); - std::pair res = this->connect(this->hostname, "6667"); - if (!res.first) - this->bridge->send_xmpp_message(this->hostname, "", - std::string("Connection failed: ") + res.second); + this->connect(this->hostname, "6667"); +} + +void IrcClient::on_connection_failed(const std::string& reason) +{ + this->bridge->send_xmpp_message(this->hostname, "", + std::string("Connection failed: ") + reason); } void IrcClient::on_connected() diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index 5cd1403..28a1424 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -29,6 +29,10 @@ public: * Connect to the IRC server */ void start(); + /** + * Called when the connection to the server cannot be established + */ + void on_connection_failed(const std::string& reason) override final; /** * Called when successfully connected to the server */ -- cgit v1.2.3