summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
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.cpp
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.cpp')
-rw-r--r--src/irc/irc_client.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 10a5b12..912ee45 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -16,7 +16,8 @@ IrcClient::IrcClient(const std::string& hostname, const std::string& username, B
username(username),
current_nick(username),
bridge(bridge),
- welcomed(false)
+ welcomed(false),
+ chanmodes({"", "", "", ""})
{
}
@@ -196,6 +197,32 @@ void IrcClient::forward_server_message(const IrcMessage& message)
this->bridge->send_xmpp_message(this->hostname, from, body);
}
+void IrcClient::on_isupport_message(const IrcMessage& message)
+{
+ const size_t len = message.arguments.size();
+ for (size_t i = 1; i < len; ++i)
+ {
+ const std::string token = message.arguments[i];
+ if (token.substr(0, 10) == "CHANMODES=")
+ {
+ this->chanmodes = utils::split(token.substr(11), ',');
+ // make sure we have 4 strings
+ this->chanmodes.resize(4);
+ }
+ else if (token.substr(0, 7) == "PREFIX=")
+ {
+ size_t i = 8; // jump PREFIX=(
+ size_t j = 9;
+ // Find the ) char
+ while (j < token.size() && token[j] != ')')
+ j++;
+ j++;
+ while (j < token.size() && token[i] != ')')
+ this->prefix_to_mode[token[j++]] = token[i++];
+ }
+ }
+}
+
void IrcClient::send_gateway_message(const std::string& message, const std::string& from)
{
this->bridge->send_xmpp_message(this->hostname, from, message);