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
This commit is contained in:
Florent Le Coz
2015-05-19 06:43:38 +02:00
parent a2b0f21a96
commit e454c12bd7
+4
View File
@@ -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.