summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-05-19 06:43:38 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-05-19 06:43:38 +0200
commite454c12bd7f695d6450dc804c07aa5637a8b1c00 (patch)
treeb95b182ae43eb0541dce934df4c11f7041110976
parenta2b0f21a96a3c9ba217937d4762799e038fd5e9a (diff)
downloadbiboumi-e454c12bd7f695d6450dc804c07aa5637a8b1c00.tar.gz
biboumi-e454c12bd7f695d6450dc804c07aa5637a8b1c00.tar.bz2
biboumi-e454c12bd7f695d6450dc804c07aa5637a8b1c00.tar.xz
biboumi-e454c12bd7f695d6450dc804c07aa5637a8b1c00.zip
Do not forward CTCP commands (PING, VERSION…) to the user as private messages
Some XMPP client ping themselves inside MUCs, to know if they are still in there, this created a flood of PING message in private. If the user is interested in knowing when they receive a ping or version request, they can still read their XML logs
-rw-r--r--src/irc/irc_client.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index d048e47..905a336 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -314,6 +314,10 @@ void IrcClient::on_notice(const IrcMessage& message)
const std::string to = message.arguments[0];
const std::string body = message.arguments[1];
+ if (!body.empty() && body[0] == '\01' && body[body.size() - 1] == '\01')
+ // Do not forward the notice to the user if it's a CTCP command
+ return ;
+
if (!to.empty() && this->chantypes.find(to[0]) == this->chantypes.end())
{
// The notice is for us precisely.