Connection to servers does not block the process anymore

This commit is contained in:
Florent Le Coz
2014-02-22 21:42:24 +01:00
parent 61ca40fa0e
commit 99aba5667d
10 changed files with 111 additions and 32 deletions
+7 -4
View File
@@ -29,10 +29,13 @@ void IrcClient::start()
{
this->bridge->send_xmpp_message(this->hostname, "", std::string("Connecting to ") +
this->hostname + ":" + "6667");
std::pair<bool, std::string> 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()
+4
View File
@@ -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
*/