summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-11-28 02:14:42 +0100
committerFlorent Le Coz <louiz@louiz.org>2013-11-28 02:14:42 +0100
commit1151c26c363e736a98c5fcb723c753658fe35b9b (patch)
tree14b1cd8ef09e0ea5ec57ad5a4a230b282ec7f943 /src/irc/irc_client.cpp
parent2921f53657a78a73ca0dc8af95219ca27653fe55 (diff)
downloadbiboumi-1151c26c363e736a98c5fcb723c753658fe35b9b.tar.gz
biboumi-1151c26c363e736a98c5fcb723c753658fe35b9b.tar.bz2
biboumi-1151c26c363e736a98c5fcb723c753658fe35b9b.tar.xz
biboumi-1151c26c363e736a98c5fcb723c753658fe35b9b.zip
Channel names are case insensitive
But some servers (epiknet for example) send channel names with an uppercase
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r--src/irc/irc_client.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 72eec02..dc0986f 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -4,6 +4,7 @@
#include <irc/irc_user.hpp>
#include <utils/make_unique.hpp>
+#include <utils/tolower.hpp>
#include <utils/split.hpp>
#include <iostream>
@@ -174,7 +175,7 @@ void IrcClient::forward_server_message(const IrcMessage& message)
void IrcClient::set_and_forward_user_list(const IrcMessage& message)
{
- const std::string chan_name = message.arguments[2];
+ const std::string chan_name = utils::tolower(message.arguments[2]);
IrcChannel* channel = this->get_channel(chan_name);
std::vector<std::string> nicks = utils::split(message.arguments[3], ' ');
for (const std::string& nick: nicks)
@@ -190,7 +191,7 @@ void IrcClient::set_and_forward_user_list(const IrcMessage& message)
void IrcClient::on_channel_join(const IrcMessage& message)
{
- const std::string chan_name = message.arguments[0];
+ const std::string chan_name = utils::tolower(message.arguments[0]);
IrcChannel* channel = this->get_channel(chan_name);
const std::string nick = message.prefix;
if (channel->joined == false)
@@ -252,14 +253,14 @@ void IrcClient::send_motd(const IrcMessage& message)
void IrcClient::on_topic_received(const IrcMessage& message)
{
- const std::string chan_name = message.arguments[1];
+ const std::string chan_name = utils::tolower(message.arguments[1]);
IrcChannel* channel = this->get_channel(chan_name);
channel->topic = message.arguments[2];
}
void IrcClient::on_channel_completely_joined(const IrcMessage& message)
{
- const std::string chan_name = message.arguments[1];
+ const std::string chan_name = utils::tolower(message.arguments[1]);
IrcChannel* channel = this->get_channel(chan_name);
this->bridge->send_self_join(this->hostname, chan_name, channel->get_self()->nick);
this->bridge->send_topic(this->hostname, chan_name, channel->topic);
@@ -276,7 +277,7 @@ void IrcClient::on_welcome_message(const IrcMessage& message)
void IrcClient::on_part(const IrcMessage& message)
{
- const std::string chan_name = message.arguments[0];
+ const std::string chan_name = utils::tolower(message.arguments[0]);
IrcChannel* channel = this->get_channel(chan_name);
std::string txt;
if (message.arguments.size() >= 2)
@@ -348,7 +349,7 @@ void IrcClient::on_kick(const IrcMessage& message)
{
const std::string target = message.arguments[1];
const std::string reason = message.arguments[2];
- const std::string chan_name = message.arguments[0];
+ const std::string chan_name = utils::tolower(message.arguments[0]);
IrcChannel* channel = this->get_channel(chan_name);
if (channel->get_self()->nick == target)
channel->joined = false;