X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_whois.cpp;h=8ac86337e27bee694a4f21744841a2c16368e5bf;hb=ab49ff82c562a0a97bcca759f6a6c80fef31516f;hp=ca3b6f73392f65ea0e9a97d054829c53656d4907;hpb=c7de80233a0cc52b30ad91ff2de9ecc2abdfba38;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp index ca3b6f733..8ac86337e 100644 --- a/src/coremods/core_whois.cpp +++ b/src/coremods/core_whois.cpp @@ -1,9 +1,17 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2019 Matt Schatz + * Copyright (C) 2018 linuxdaemon + * Copyright (C) 2018 Dylan Frank + * Copyright (C) 2017-2018 Sadie Powell + * Copyright (C) 2012-2016 Attila Molnar + * Copyright (C) 2012, 2019 Robby + * Copyright (C) 2009 Uli Schlachter * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2008 Thomas Stagner * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2007 Dennis Friis + * Copyright (C) 2006-2008, 2010 Craig Edwards * * 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 @@ -20,6 +28,7 @@ #include "inspircd.h" +#include "modules/whois.h" enum { @@ -87,8 +96,14 @@ class CommandWhois : public SplitCommand void SendChanList(WhoisContextImpl& whois); public: + /** If true then all opers are shown with a generic 'is a server operator' line rather than the oper type. */ + bool genericoper; + + /** How to handle private/secret channels in the WHOIS response. */ SplitWhoisState splitwhois; + + /** Constructor for whois. */ CommandWhois(Module* parent) @@ -100,7 +115,7 @@ class CommandWhois : public SplitCommand , lineevprov(parent, "event/whoisline") { Penalty = 2; - syntax = "{,}"; + syntax = "[] [,]+"; } /** Handle command. @@ -108,8 +123,8 @@ class CommandWhois : public SplitCommand * @param user The user issuing the command * @return A value from CmdResult to indicate command success or failure. */ - CmdResult HandleLocal(const std::vector& parameters, LocalUser* user) CXX11_OVERRIDE; - CmdResult HandleRemote(const std::vector& parameters, RemoteUser* target) CXX11_OVERRIDE; + CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE; + CmdResult HandleRemote(RemoteUser* target, const Params& parameters) CXX11_OVERRIDE; }; class WhoisNumericSink @@ -210,7 +225,7 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned { WhoisContextImpl whois(user, dest, lineevprov); - whois.SendLine(RPL_WHOISUSER, dest->ident, dest->GetDisplayedHost(), '*', dest->fullname); + whois.SendLine(RPL_WHOISUSER, dest->ident, dest->GetDisplayedHost(), '*', dest->GetRealName()); if (whois.IsSelfWhois() || user->HasPrivPermission("users/auspex")) { whois.SendLine(RPL_WHOISHOST, InspIRCd::Format("is connecting from %s@%s %s", dest->ident.c_str(), dest->GetRealHost().c_str(), dest->GetIPString().c_str())); @@ -234,8 +249,8 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned if (dest->IsOper()) { - if (ServerInstance->Config->GenericOper) - whois.SendLine(RPL_WHOISOPERATOR, "is an IRC operator"); + if (genericoper) + whois.SendLine(RPL_WHOISOPERATOR, "is a server operator"); else whois.SendLine(RPL_WHOISOPERATOR, InspIRCd::Format("is %s %s on %s", (strchr("AEIOUaeiou",dest->oper->name[0]) ? "an" : "a"), dest->oper->name.c_str(), ServerInstance->Config->Network.c_str())); } @@ -266,7 +281,7 @@ void CommandWhois::DoWhois(LocalUser* user, User* dest, time_t signon, unsigned whois.SendLine(RPL_ENDOFWHOIS, "End of /WHOIS list."); } -CmdResult CommandWhois::HandleRemote(const std::vector& parameters, RemoteUser* target) +CmdResult CommandWhois::HandleRemote(RemoteUser* target, const Params& parameters) { if (parameters.size() < 2) return CMD_FAILURE; @@ -286,7 +301,7 @@ CmdResult CommandWhois::HandleRemote(const std::vector& parameters, return CMD_SUCCESS; } -CmdResult CommandWhois::HandleLocal(const std::vector& parameters, LocalUser* user) +CmdResult CommandWhois::HandleLocal(LocalUser* user, const Params& parameters) { User *dest; unsigned int userindex = 0; @@ -349,15 +364,20 @@ class CoreModWhois : public Module void ReadConfig(ConfigStatus&) CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("options"); - const std::string splitwhois = tag->getString("splitwhois", "no"); + const std::string splitwhois = tag->getString("splitwhois", "no", 1); + SplitWhoisState newsplitstate; if (stdalgo::string::equalsci(splitwhois, "no")) - cmd.splitwhois = SPLITWHOIS_NONE; + newsplitstate = SPLITWHOIS_NONE; else if (stdalgo::string::equalsci(splitwhois, "split")) - cmd.splitwhois = SPLITWHOIS_SPLIT; + newsplitstate = SPLITWHOIS_SPLIT; else if (stdalgo::string::equalsci(splitwhois, "splitmsg")) - cmd.splitwhois = SPLITWHOIS_SPLITMSG; + newsplitstate = SPLITWHOIS_SPLITMSG; else - throw ModuleException(splitwhois + " is an invalid value, at " + tag->getTagLocation()); + throw ModuleException(splitwhois + " is an invalid value, at " + tag->getTagLocation()); + + ConfigTag* security = ServerInstance->Config->ConfValue("security"); + cmd.genericoper = security->getBool("genericoper"); + cmd.splitwhois = newsplitstate; } Version GetVersion() CXX11_OVERRIDE