summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.hpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-27 11:49:28 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:35 +0100
commit483e17020dc4f19223001ab36da0dc48a15a0d3e (patch)
treeae4ce10c17db0139e91cfedf9e5e8aca24806e5f /src/irc/irc_client.hpp
parent9df757fc6737b59f56d5b808ef48baba760b142e (diff)
downloadbiboumi-483e17020dc4f19223001ab36da0dc48a15a0d3e.tar.gz
biboumi-483e17020dc4f19223001ab36da0dc48a15a0d3e.tar.bz2
biboumi-483e17020dc4f19223001ab36da0dc48a15a0d3e.tar.xz
biboumi-483e17020dc4f19223001ab36da0dc48a15a0d3e.zip
Be verbose about the connection status, and some errors
Diffstat (limited to 'src/irc/irc_client.hpp')
-rw-r--r--src/irc/irc_client.hpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index 99ee6c0..e695e53 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -100,6 +100,12 @@ public:
*/
void send_quit_command();
/**
+ * Send a message to the gateway user, not generated by the IRC server,
+ * but that might be useful because we want to be verbose (for example we
+ * might want to notify the user about the connexion state)
+ */
+ void send_gateway_message(const std::string& message, const std::string& from="");
+ /**
* Forward the server message received from IRC to the XMPP component
*/
void forward_server_message(const IrcMessage& message);
@@ -139,6 +145,14 @@ public:
*/
void on_channel_completely_joined(const IrcMessage& message);
/**
+ * We tried to set an invalid nickname
+ */
+ void on_erroneous_nickname(const IrcMessage& message);
+ /**
+ * Handles most errors from the server by just forwarding the message to the user.
+ */
+ void on_generic_error(const IrcMessage& message);
+ /**
* When a message 001 is received, join the rooms we wanted to join, and set our actual nickname
*/
void on_welcome_message(const IrcMessage& message);
@@ -208,6 +222,8 @@ typedef void (IrcClient::*irc_callback_t)(const IrcMessage&);
static const std::unordered_map<std::string, irc_callback_t> irc_callbacks = {
{"NOTICE", &IrcClient::forward_server_message},
+ {"002", &IrcClient::forward_server_message},
+ {"003", &IrcClient::forward_server_message},
{"RPL_MOTDSTART", &IrcClient::empty_motd},
{"375", &IrcClient::empty_motd},
{"RPL_MOTD", &IrcClient::on_motd_line},
@@ -220,6 +236,8 @@ static const std::unordered_map<std::string, irc_callback_t> irc_callbacks = {
{"332", &IrcClient::on_topic_received},
{"TOPIC", &IrcClient::on_topic_received},
{"366", &IrcClient::on_channel_completely_joined},
+ {"432", &IrcClient::on_erroneous_nickname},
+ {"461", &IrcClient::on_generic_error},
{"001", &IrcClient::on_welcome_message},
{"PART", &IrcClient::on_part},
{"ERROR", &IrcClient::on_error},