Be verbose about the connection status, and some errors

This commit is contained in:
Florent Le Coz
2014-01-04 01:59:35 +01:00
parent 9df757fc67
commit 483e17020d
2 changed files with 42 additions and 1 deletions
+18
View File
@@ -99,6 +99,12 @@ public:
* Send the QUIT irc command
*/
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
*/
@@ -138,6 +144,14 @@ public:
* received etc), send the self presence and topic to the XMPP user.
*/
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
*/
@@ -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},