2012-04-19 20:58:29 +02:00
|
|
|
/*
|
|
|
|
* InspIRCd -- Internet Relay Chat Daemon
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* Copyright (C) 2004, 2008 Craig Edwards <craigedwards@brainbox.cc>
|
|
|
|
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
|
|
|
|
* Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* This file is part of InspIRCd. InspIRCd is free software: you can
|
|
|
|
* redistribute it and/or modify it under the terms of the GNU General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.
|
2007-07-16 17:30:04 +00:00
|
|
|
*
|
2012-04-19 20:58:29 +02:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2007-07-16 17:30:04 +00:00
|
|
|
*/
|
|
|
|
|
2012-04-19 20:58:29 +02:00
|
|
|
|
2007-07-16 17:30:04 +00:00
|
|
|
#include "inspircd.h"
|
2018-04-07 15:48:30 +01:00
|
|
|
#include "modules/whois.h"
|
2007-07-16 17:30:04 +00:00
|
|
|
|
2017-12-09 13:43:44 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
// From UnrealIRCd.
|
2017-12-09 16:12:00 +00:00
|
|
|
RPL_WHOISBOT = 335
|
2017-12-09 13:43:44 +00:00
|
|
|
};
|
|
|
|
|
2015-04-28 15:16:22 +02:00
|
|
|
class ModuleBotMode : public Module, public Whois::EventListener
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2017-11-12 20:53:24 +00:00
|
|
|
SimpleUserModeHandler bm;
|
2007-07-16 17:30:04 +00:00
|
|
|
public:
|
2009-09-26 14:13:13 +00:00
|
|
|
ModuleBotMode()
|
2015-04-28 15:16:22 +02:00
|
|
|
: Whois::EventListener(this)
|
2017-11-12 20:53:24 +00:00
|
|
|
, bm(this, "bot", 'B')
|
2012-10-13 03:12:29 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-25 02:52:11 +00:00
|
|
|
Version GetVersion() override
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2012-07-06 14:23:04 -04:00
|
|
|
return Version("Provides user mode +B to mark the user as a bot",VF_VENDOR);
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
|
|
|
|
2019-01-25 02:52:11 +00:00
|
|
|
void OnWhois(Whois::Context& whois) override
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2015-04-28 15:16:22 +02:00
|
|
|
if (whois.GetTarget()->IsModeSet(bm))
|
2007-07-16 17:30:04 +00:00
|
|
|
{
|
2017-12-09 13:43:44 +00:00
|
|
|
whois.SendLine(RPL_WHOISBOT, "is a bot on " + ServerInstance->Config->Network);
|
2007-07-16 17:30:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_INIT(ModuleBotMode)
|