#include "inspircd.h"
-/** Handles user mode +B
- */
-class BotMode : public SimpleUserModeHandler
-{
- public:
- BotMode(Module* Creator) : SimpleUserModeHandler(Creator, "bot", 'B') { }
-};
-
-class ModuleBotMode : public Module
+class ModuleBotMode : public Module, public Whois::EventListener
{
- BotMode bm;
+ SimpleUserModeHandler bm;
public:
ModuleBotMode()
- : bm(this)
- {
- }
-
- void init() CXX11_OVERRIDE
+ : Whois::EventListener(this)
+ , bm(this, "bot", 'B')
{
- ServerInstance->Modules->AddService(bm);
}
Version GetVersion() CXX11_OVERRIDE
return Version("Provides user mode +B to mark the user as a bot",VF_VENDOR);
}
- void OnWhois(User* src, User* dst) CXX11_OVERRIDE
+ void OnWhois(Whois::Context& whois) CXX11_OVERRIDE
{
- if (dst->IsModeSet(bm))
+ if (whois.GetTarget()->IsModeSet(bm))
{
- ServerInstance->SendWhoisLine(src, dst, 335, src->nick+" "+dst->nick+" :is a bot on "+ServerInstance->Config->Network);
+ whois.SendLine(335, "is a bot on " + ServerInstance->Config->Network);
}
}
};