summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2016-02-02 17:41:38 +0100
committerFlorent Le Coz <louiz@louiz.org>2016-02-10 19:19:21 +0100
commit0a352e557d2a0760601847a97c562759fb04d529 (patch)
tree11047f440ba955ea06d8e210cdd21300f0158af4 /src
parent8c249f1447b475619033b978d166acf91e6bb4d7 (diff)
downloadbiboumi-0a352e557d2a0760601847a97c562759fb04d529.tar.gz
biboumi-0a352e557d2a0760601847a97c562759fb04d529.tar.bz2
biboumi-0a352e557d2a0760601847a97c562759fb04d529.tar.xz
biboumi-0a352e557d2a0760601847a97c562759fb04d529.zip
Move the irc callbacks into the cpp file
Diffstat (limited to 'src')
-rw-r--r--src/irc/irc_client.cpp92
-rw-r--r--src/irc/irc_client.hpp93
2 files changed, 92 insertions, 93 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 1a83446..0efae04 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -23,6 +23,98 @@
using namespace std::string_literals;
using namespace std::chrono_literals;
+/**
+ * Define a map of functions to be called for each IRC command we can
+ * handle.
+ */
+typedef void (IrcClient::*irc_callback_t)(const IrcMessage&);
+
+static const std::unordered_map<std::string,
+ std::pair<irc_callback_t, std::pair<std::size_t, std::size_t>>> irc_callbacks = {
+ {"NOTICE", {&IrcClient::on_notice, {2, 0}}},
+ {"002", {&IrcClient::forward_server_message, {2, 0}}},
+ {"003", {&IrcClient::forward_server_message, {2, 0}}},
+ {"005", {&IrcClient::on_isupport_message, {0, 0}}},
+ {"RPL_LISTSTART", {&IrcClient::on_rpl_liststart, {0, 0}}},
+ {"321", {&IrcClient::on_rpl_liststart, {0, 0}}},
+ {"RPL_LIST", {&IrcClient::on_rpl_list, {0, 0}}},
+ {"322", {&IrcClient::on_rpl_list, {0, 0}}},
+ {"RPL_LISTEND", {&IrcClient::on_rpl_listend, {0, 0}}},
+ {"323", {&IrcClient::on_rpl_listend, {0, 0}}},
+ {"RPL_MOTDSTART", {&IrcClient::empty_motd, {0, 0}}},
+ {"375", {&IrcClient::empty_motd, {0, 0}}},
+ {"RPL_MOTD", {&IrcClient::on_motd_line, {2, 0}}},
+ {"372", {&IrcClient::on_motd_line, {2, 0}}},
+ {"RPL_MOTDEND", {&IrcClient::send_motd, {0, 0}}},
+ {"376", {&IrcClient::send_motd, {0, 0}}},
+ {"JOIN", {&IrcClient::on_channel_join, {1, 0}}},
+ {"PRIVMSG", {&IrcClient::on_channel_message, {2, 0}}},
+ {"353", {&IrcClient::set_and_forward_user_list, {4, 0}}},
+ {"332", {&IrcClient::on_topic_received, {2, 0}}},
+ {"TOPIC", {&IrcClient::on_topic_received, {2, 0}}},
+ {"366", {&IrcClient::on_channel_completely_joined, {2, 0}}},
+ {"432", {&IrcClient::on_erroneous_nickname, {2, 0}}},
+ {"433", {&IrcClient::on_nickname_conflict, {2, 0}}},
+ {"438", {&IrcClient::on_nickname_change_too_fast, {2, 0}}},
+ {"001", {&IrcClient::on_welcome_message, {1, 0}}},
+ {"PART", {&IrcClient::on_part, {1, 0}}},
+ {"ERROR", {&IrcClient::on_error, {1, 0}}},
+ {"QUIT", {&IrcClient::on_quit, {0, 0}}},
+ {"NICK", {&IrcClient::on_nick, {1, 0}}},
+ {"MODE", {&IrcClient::on_mode, {1, 0}}},
+ {"PING", {&IrcClient::send_pong_command, {1, 0}}},
+ {"PONG", {&IrcClient::on_pong, {0, 0}}},
+ {"KICK", {&IrcClient::on_kick, {3, 0}}},
+
+ {"401", {&IrcClient::on_generic_error, {2, 0}}},
+ {"402", {&IrcClient::on_generic_error, {2, 0}}},
+ {"403", {&IrcClient::on_generic_error, {2, 0}}},
+ {"404", {&IrcClient::on_generic_error, {2, 0}}},
+ {"405", {&IrcClient::on_generic_error, {2, 0}}},
+ {"406", {&IrcClient::on_generic_error, {2, 0}}},
+ {"407", {&IrcClient::on_generic_error, {2, 0}}},
+ {"408", {&IrcClient::on_generic_error, {2, 0}}},
+ {"409", {&IrcClient::on_generic_error, {2, 0}}},
+ {"410", {&IrcClient::on_generic_error, {2, 0}}},
+ {"411", {&IrcClient::on_generic_error, {2, 0}}},
+ {"412", {&IrcClient::on_generic_error, {2, 0}}},
+ {"414", {&IrcClient::on_generic_error, {2, 0}}},
+ {"421", {&IrcClient::on_generic_error, {2, 0}}},
+ {"422", {&IrcClient::on_generic_error, {2, 0}}},
+ {"423", {&IrcClient::on_generic_error, {2, 0}}},
+ {"424", {&IrcClient::on_generic_error, {2, 0}}},
+ {"431", {&IrcClient::on_generic_error, {2, 0}}},
+ {"436", {&IrcClient::on_generic_error, {2, 0}}},
+ {"441", {&IrcClient::on_generic_error, {2, 0}}},
+ {"442", {&IrcClient::on_generic_error, {2, 0}}},
+ {"443", {&IrcClient::on_generic_error, {2, 0}}},
+ {"444", {&IrcClient::on_generic_error, {2, 0}}},
+ {"446", {&IrcClient::on_generic_error, {2, 0}}},
+ {"451", {&IrcClient::on_generic_error, {2, 0}}},
+ {"461", {&IrcClient::on_generic_error, {2, 0}}},
+ {"462", {&IrcClient::on_generic_error, {2, 0}}},
+ {"463", {&IrcClient::on_generic_error, {2, 0}}},
+ {"464", {&IrcClient::on_generic_error, {2, 0}}},
+ {"465", {&IrcClient::on_generic_error, {2, 0}}},
+ {"467", {&IrcClient::on_generic_error, {2, 0}}},
+ {"470", {&IrcClient::on_generic_error, {2, 0}}},
+ {"471", {&IrcClient::on_generic_error, {2, 0}}},
+ {"472", {&IrcClient::on_generic_error, {2, 0}}},
+ {"473", {&IrcClient::on_generic_error, {2, 0}}},
+ {"474", {&IrcClient::on_generic_error, {2, 0}}},
+ {"475", {&IrcClient::on_generic_error, {2, 0}}},
+ {"476", {&IrcClient::on_generic_error, {2, 0}}},
+ {"477", {&IrcClient::on_generic_error, {2, 0}}},
+ {"481", {&IrcClient::on_generic_error, {2, 0}}},
+ {"482", {&IrcClient::on_generic_error, {2, 0}}},
+ {"483", {&IrcClient::on_generic_error, {2, 0}}},
+ {"484", {&IrcClient::on_generic_error, {2, 0}}},
+ {"485", {&IrcClient::on_generic_error, {2, 0}}},
+ {"487", {&IrcClient::on_generic_error, {2, 0}}},
+ {"491", {&IrcClient::on_generic_error, {2, 0}}},
+ {"501", {&IrcClient::on_generic_error, {2, 0}}},
+ {"502", {&IrcClient::on_generic_error, {2, 0}}},
+};
IrcClient::IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname,
const std::string& nickname, const std::string& username,
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index 7c2a43f..628f547 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -355,97 +355,4 @@ private:
IrcClient& operator=(IrcClient&&) = delete;
};
-/**
- * Define a map of functions to be called for each IRC command we can
- * handle.
- */
-typedef void (IrcClient::*irc_callback_t)(const IrcMessage&);
-
-static const std::unordered_map<std::string,
- std::pair<irc_callback_t, std::pair<std::size_t, std::size_t>>> irc_callbacks = {
- {"NOTICE", {&IrcClient::on_notice, {2, 0}}},
- {"002", {&IrcClient::forward_server_message, {2, 0}}},
- {"003", {&IrcClient::forward_server_message, {2, 0}}},
- {"005", {&IrcClient::on_isupport_message, {0, 0}}},
- {"RPL_LISTSTART", {&IrcClient::on_rpl_liststart, {0, 0}}},
- {"321", {&IrcClient::on_rpl_liststart, {0, 0}}},
- {"RPL_LIST", {&IrcClient::on_rpl_list, {0, 0}}},
- {"322", {&IrcClient::on_rpl_list, {0, 0}}},
- {"RPL_LISTEND", {&IrcClient::on_rpl_listend, {0, 0}}},
- {"323", {&IrcClient::on_rpl_listend, {0, 0}}},
- {"RPL_MOTDSTART", {&IrcClient::empty_motd, {0, 0}}},
- {"375", {&IrcClient::empty_motd, {0, 0}}},
- {"RPL_MOTD", {&IrcClient::on_motd_line, {2, 0}}},
- {"372", {&IrcClient::on_motd_line, {2, 0}}},
- {"RPL_MOTDEND", {&IrcClient::send_motd, {0, 0}}},
- {"376", {&IrcClient::send_motd, {0, 0}}},
- {"JOIN", {&IrcClient::on_channel_join, {1, 0}}},
- {"PRIVMSG", {&IrcClient::on_channel_message, {2, 0}}},
- {"353", {&IrcClient::set_and_forward_user_list, {4, 0}}},
- {"332", {&IrcClient::on_topic_received, {2, 0}}},
- {"TOPIC", {&IrcClient::on_topic_received, {2, 0}}},
- {"366", {&IrcClient::on_channel_completely_joined, {2, 0}}},
- {"432", {&IrcClient::on_erroneous_nickname, {2, 0}}},
- {"433", {&IrcClient::on_nickname_conflict, {2, 0}}},
- {"438", {&IrcClient::on_nickname_change_too_fast, {2, 0}}},
- {"001", {&IrcClient::on_welcome_message, {1, 0}}},
- {"PART", {&IrcClient::on_part, {1, 0}}},
- {"ERROR", {&IrcClient::on_error, {1, 0}}},
- {"QUIT", {&IrcClient::on_quit, {0, 0}}},
- {"NICK", {&IrcClient::on_nick, {1, 0}}},
- {"MODE", {&IrcClient::on_mode, {1, 0}}},
- {"PING", {&IrcClient::send_pong_command, {1, 0}}},
- {"PONG", {&IrcClient::on_pong, {0, 0}}},
- {"KICK", {&IrcClient::on_kick, {3, 0}}},
-
- {"401", {&IrcClient::on_generic_error, {2, 0}}},
- {"402", {&IrcClient::on_generic_error, {2, 0}}},
- {"403", {&IrcClient::on_generic_error, {2, 0}}},
- {"404", {&IrcClient::on_generic_error, {2, 0}}},
- {"405", {&IrcClient::on_generic_error, {2, 0}}},
- {"406", {&IrcClient::on_generic_error, {2, 0}}},
- {"407", {&IrcClient::on_generic_error, {2, 0}}},
- {"408", {&IrcClient::on_generic_error, {2, 0}}},
- {"409", {&IrcClient::on_generic_error, {2, 0}}},
- {"410", {&IrcClient::on_generic_error, {2, 0}}},
- {"411", {&IrcClient::on_generic_error, {2, 0}}},
- {"412", {&IrcClient::on_generic_error, {2, 0}}},
- {"414", {&IrcClient::on_generic_error, {2, 0}}},
- {"421", {&IrcClient::on_generic_error, {2, 0}}},
- {"422", {&IrcClient::on_generic_error, {2, 0}}},
- {"423", {&IrcClient::on_generic_error, {2, 0}}},
- {"424", {&IrcClient::on_generic_error, {2, 0}}},
- {"431", {&IrcClient::on_generic_error, {2, 0}}},
- {"436", {&IrcClient::on_generic_error, {2, 0}}},
- {"441", {&IrcClient::on_generic_error, {2, 0}}},
- {"442", {&IrcClient::on_generic_error, {2, 0}}},
- {"443", {&IrcClient::on_generic_error, {2, 0}}},
- {"444", {&IrcClient::on_generic_error, {2, 0}}},
- {"446", {&IrcClient::on_generic_error, {2, 0}}},
- {"451", {&IrcClient::on_generic_error, {2, 0}}},
- {"461", {&IrcClient::on_generic_error, {2, 0}}},
- {"462", {&IrcClient::on_generic_error, {2, 0}}},
- {"463", {&IrcClient::on_generic_error, {2, 0}}},
- {"464", {&IrcClient::on_generic_error, {2, 0}}},
- {"465", {&IrcClient::on_generic_error, {2, 0}}},
- {"467", {&IrcClient::on_generic_error, {2, 0}}},
- {"470", {&IrcClient::on_generic_error, {2, 0}}},
- {"471", {&IrcClient::on_generic_error, {2, 0}}},
- {"472", {&IrcClient::on_generic_error, {2, 0}}},
- {"473", {&IrcClient::on_generic_error, {2, 0}}},
- {"474", {&IrcClient::on_generic_error, {2, 0}}},
- {"475", {&IrcClient::on_generic_error, {2, 0}}},
- {"476", {&IrcClient::on_generic_error, {2, 0}}},
- {"477", {&IrcClient::on_generic_error, {2, 0}}},
- {"481", {&IrcClient::on_generic_error, {2, 0}}},
- {"482", {&IrcClient::on_generic_error, {2, 0}}},
- {"483", {&IrcClient::on_generic_error, {2, 0}}},
- {"484", {&IrcClient::on_generic_error, {2, 0}}},
- {"485", {&IrcClient::on_generic_error, {2, 0}}},
- {"487", {&IrcClient::on_generic_error, {2, 0}}},
- {"491", {&IrcClient::on_generic_error, {2, 0}}},
- {"501", {&IrcClient::on_generic_error, {2, 0}}},
- {"502", {&IrcClient::on_generic_error, {2, 0}}},
-};
-
#endif // IRC_CLIENT_INCLUDED