X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_userhost.cpp;h=3100995a82b86c76ebc3e769bf34dda168a13eb6;hb=dcd3438011d59aa4de4df64abf06bca1cbf36859;hp=1b34addb509b93dc36878b6d14d57e03fe476150;hpb=0f3db84269dc029aa00d706a9821ab00b7ed0c85;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_userhost.cpp b/src/coremods/core_userhost.cpp index 1b34addb5..3100995a8 100644 --- a/src/coremods/core_userhost.cpp +++ b/src/coremods/core_userhost.cpp @@ -24,11 +24,16 @@ */ class CommandUserhost : public Command { + UserModeReference hideopermode; + public: /** Constructor for userhost. */ - CommandUserhost ( Module* parent) : Command(parent,"USERHOST", 1, 5) { - syntax = " {}"; + CommandUserhost(Module* parent) + : Command(parent,"USERHOST", 1) + , hideopermode(parent, "hideoper") + { + syntax = " [ ...]"; } /** Handle command. * @param parameters The parameters to the command @@ -42,9 +47,13 @@ CmdResult CommandUserhost::Handle (const std::vector& parameters, U { const bool has_privs = user->HasPrivPermission("users/auspex"); - std::string retbuf = "302 " + user->nick + " :"; + std::string retbuf; + + unsigned int max = parameters.size(); + if (max > 5) + max = 5; - for (unsigned int i = 0; i < parameters.size(); i++) + for (unsigned int i = 0; i < max; i++) { User *u = ServerInstance->FindNickOnly(parameters[i]); @@ -53,7 +62,11 @@ CmdResult CommandUserhost::Handle (const std::vector& parameters, U retbuf += u->nick; if (u->IsOper()) - retbuf += '*'; + { + // XXX: +H hidden opers must not be shown as opers + if ((u == user) || (has_privs) || (!u->IsModeSet(hideopermode))) + retbuf += '*'; + } retbuf += '='; retbuf += (u->IsAway() ? '-' : '+'); @@ -64,7 +77,7 @@ CmdResult CommandUserhost::Handle (const std::vector& parameters, U } } - user->WriteServ(retbuf); + user->WriteNumeric(RPL_USERHOST, retbuf); return CMD_SUCCESS; }