diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-07-15 15:39:25 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-07-15 15:39:25 +0200 |
commit | 11a31db2d5bcc158bb8902e74f192dbc82827f53 (patch) | |
tree | 045aa047a7a63c80c501d9f8be30e3cb2ac95ce8 /src/irc | |
parent | 4582f1079767f53bb6bd9b96c358ea3c641aaa96 (diff) | |
download | biboumi-11a31db2d5bcc158bb8902e74f192dbc82827f53.tar.gz biboumi-11a31db2d5bcc158bb8902e74f192dbc82827f53.tar.bz2 biboumi-11a31db2d5bcc158bb8902e74f192dbc82827f53.tar.xz biboumi-11a31db2d5bcc158bb8902e74f192dbc82827f53.zip |
Send the reason of the connection close to the user
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/irc_client.cpp | 6 | ||||
-rw-r--r-- | src/irc/irc_client.hpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 6468094..e518ffc 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -93,9 +93,11 @@ void IrcClient::on_connected() this->send_pending_data(); } -void IrcClient::on_connection_close() +void IrcClient::on_connection_close(const std::string& error_msg) { - static const std::string message = "Connection closed by remote server."; + std::string message = "Connection closed by remote server."; + if (!error_msg.empty()) + message += ": " + error_msg; const IrcMessage error{"ERROR", {message}}; this->on_error(error); log_warning(message); diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp index afa6437..88d2d72 100644 --- a/src/irc/irc_client.hpp +++ b/src/irc/irc_client.hpp @@ -41,7 +41,7 @@ public: /** * Close the connection, remove us from the poller */ - void on_connection_close() override final; + void on_connection_close(const std::string& error) override final; /** * Parse the data we have received so far and try to get one or more * complete messages from it. |