X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_whois.cpp;h=0df6b65f0e8cde5dd8db2393c93f5c6c5b0ae80d;hb=dafa2f3031c4abc7f5506385770c4fc743669b17;hp=fea14f375bb1c12efe85a803ac9cf6117e3e14dc;hpb=c5a46583800374344d8676eccd7061a15a5ac1ce;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index fea14f375..0df6b65f0 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -28,6 +28,10 @@ */ class CommandWhois : public SplitCommand { + ChanModeReference secretmode; + ChanModeReference privatemode; + UserModeReference snomaskmode; + void SplitChanList(User* source, User* dest, const std::string& cl); void DoWhois(User* user, User* dest, unsigned long signon, unsigned long idle); std::string ChannelList(User* source, User* dest, bool spy); @@ -35,7 +39,16 @@ class CommandWhois : public SplitCommand public: /** Constructor for whois. */ - CommandWhois ( Module* parent) : SplitCommand(parent,"WHOIS", 1) { Penalty = 2; syntax = "{,}"; } + CommandWhois(Module* parent) + : SplitCommand(parent, "WHOIS", 1) + , secretmode(parent, "secret") + , privatemode(parent, "private") + , snomaskmode(parent, "snomask") + { + Penalty = 2; + syntax = "{,}"; + } + /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -56,7 +69,7 @@ std::string CommandWhois::ChannelList(User* source, User* dest, bool spy) /* If the target is the sender, neither +p nor +s is set, or * the channel contains the user, it is not a spy channel */ - if (spy != (source == dest || !(c->IsModeSet('p') || c->IsModeSet('s')) || c->HasUser(source))) + if (spy != (source == dest || !(c->IsModeSet(privatemode) || c->IsModeSet(secretmode)) || c->HasUser(source))) list.append(c->GetPrefixChar(dest)).append(c->name).append(" "); } @@ -150,9 +163,9 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne if (user == dest || user->HasPrivPermission("users/auspex")) { - if (dest->IsModeSet('s') != 0) + if (dest->IsModeSet(snomaskmode)) { - ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes(), dest->FormatNoticeMasks()); + ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s %s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes(), snomaskmode->GetUserParameter(dest).c_str()); } else { @@ -160,7 +173,7 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne } } - FOREACH_MOD(I_OnWhois,OnWhois(user,dest)); + FOREACH_MOD(OnWhois, (user,dest)); /* * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or @@ -183,7 +196,7 @@ CmdResult CommandWhois::HandleRemote(const std::vector& parameters, if (!user) return CMD_FAILURE; - unsigned long idle = ConvToInt(parameters[1]); + unsigned long idle = ConvToInt(parameters.back()); DoWhois(user, target, target->signon, idle); return CMD_SUCCESS; @@ -195,7 +208,7 @@ CmdResult CommandWhois::HandleLocal(const std::vector& parameters, int userindex = 0; unsigned long idle = 0, signon = 0; - if (ServerInstance->Parser->LoopCall(user, this, parameters, 0)) + if (CommandParser::LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; /*