summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.hpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-27 17:42:48 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commita075517824da7e82e1be7b67d615834851482861 (patch)
tree1cb740a20e5c6aefd2be8c10b730730156aecaf7 /src/irc/irc_client.hpp
parent43cc60e4a9e2859fdf67c89e58ee18cf7571f186 (diff)
downloadbiboumi-a075517824da7e82e1be7b67d615834851482861.tar.gz
biboumi-a075517824da7e82e1be7b67d615834851482861.tar.bz2
biboumi-a075517824da7e82e1be7b67d615834851482861.tar.xz
biboumi-a075517824da7e82e1be7b67d615834851482861.zip
Basic isupport support
CHANMODES and PREFIX only
Diffstat (limited to 'src/irc/irc_client.hpp')
-rw-r--r--src/irc/irc_client.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/irc/irc_client.hpp b/src/irc/irc_client.hpp
index eced4b6..a0258ee 100644
--- a/src/irc/irc_client.hpp
+++ b/src/irc/irc_client.hpp
@@ -8,7 +8,9 @@
#include <network/socket_handler.hpp>
#include <unordered_map>
+#include <vector>
#include <string>
+#include <map>
class Bridge;
@@ -110,6 +112,11 @@ public:
*/
void forward_server_message(const IrcMessage& message);
/**
+ * When receiving the isupport informations. See
+ * http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt
+ */
+ void on_isupport_message(const IrcMessage& message);
+ /**
* Just empty the motd we kept as a string
*/
void empty_motd(const IrcMessage& message);
@@ -209,10 +216,23 @@ private:
std::vector<std::string> channels_to_join;
bool welcomed;
/**
+ * See http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt section 3.3
+ * We store the possible chanmodes in this object.
+ * chanmodes[0] contains modes of type A, [1] of type B etc
+ */
+ std::vector<std::string> chanmodes;
+ /**
* Each motd line received is appended to this string, which we send when
* the motd is completely received
*/
std::string motd;
+ /**
+ * See http://www.irc.org/tech_docs/draft-brocklesby-irc-isupport-03.txt section 3.14
+ * The example given would be transformed into
+ * modes_to_prefix = {{'a', '&'}, {'b', '*'}}
+ */
+ std::map<char, char> prefix_to_mode;
+
IrcClient(const IrcClient&) = delete;
IrcClient(IrcClient&&) = delete;
IrcClient& operator=(const IrcClient&) = delete;
@@ -229,6 +249,7 @@ 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},
+ {"005", &IrcClient::on_isupport_message},
{"RPL_MOTDSTART", &IrcClient::empty_motd},
{"375", &IrcClient::empty_motd},
{"RPL_MOTD", &IrcClient::on_motd_line},