* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
class SeeWhois : public ModeHandler
{
public:
- SeeWhois(InspIRCd* Instance, Module* Creator, bool IsOpersOnly) : ModeHandler(Instance, Creator, 'W', 0, 0, false, MODETYPE_USER, IsOpersOnly) { }
+ SeeWhois(Module* Creator, bool IsOpersOnly) : ModeHandler(Creator, "showwhois", 'W', PARAM_NONE, MODETYPE_USER)
+ {
+ oper = IsOpersOnly;
+ }
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
if (adding)
{
class WhoisNoticeCmd : public Command
{
public:
- WhoisNoticeCmd(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"WHOISNOTICE", 0, 1)
+ WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 1)
{
+ flags_needed = FLAG_SERVERONLY;
}
void HandleFast(User* dest, User* src)
CmdResult Handle(const std::vector<std::string> ¶meters, User *user)
{
User* dest = ServerInstance->FindNick(parameters[0]);
+ User* source = ServerInstance->FindNick(parameters[1]);
- if (IS_LOCAL(dest))
- HandleFast(dest, user);
+ if (IS_LOCAL(dest) && source)
+ HandleFast(dest, source);
return CMD_SUCCESS;
}
public:
- ModuleShowwhois(InspIRCd* Me) : Module(Me), cmd(Me, this)
+ ModuleShowwhois() : cmd(this)
{
- ConfigReader conf(ServerInstance);
+ ConfigReader conf;
bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0);
ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0);
- sw = new SeeWhois(ServerInstance, this, OpersOnly);
+ sw = new SeeWhois(this, OpersOnly);
if (!ServerInstance->Modes->AddMode(sw))
throw ModuleException("Could not add new modes!");
ServerInstance->AddCommand(&cmd);
~ModuleShowwhois()
{
- ServerInstance->Modes->DelMode(sw);
delete sw;
}
- virtual Version GetVersion()
+ Version GetVersion()
{
- return Version("$Id$",VF_COMMON|VF_VENDOR,API_VERSION);
+ return Version("Allows opers to set +W to see when a user uses WHOIS on them",VF_OPTCOMMON|VF_VENDOR);
}
- virtual void OnWhois(User* source, User* dest)
+ void OnWhois(User* source, User* dest)
{
if (!dest->IsModeSet('W') || source == dest)
return;
- if (!ShowWhoisFromOpers && (IS_OPER(source) != IS_OPER(dest)))
+ if (!ShowWhoisFromOpers && (!IS_OPER(source) != !IS_OPER(dest)))
return;
if (IS_LOCAL(dest))
params.push_back(dest->server);
params.push_back("WHOISNOTICE");
params.push_back(dest->uuid);
+ params.push_back(source->uuid);
ServerInstance->PI->SendEncapsulatedData(params);
}
}