X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcommands%2Fcmd_userhost.cpp;h=7e1efd6375de04c8c041c588f32580e03c91f6ee;hb=e6601069038c35c546fd3f3dce95024b0d13f1b4;hp=726c063b334f80d2f38d6ef10ac427090ab11968;hpb=baa9ba88b78cf9de5e37dc78433c4e2f91ee9c79;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp index 726c063b3..7e1efd637 100644 --- a/src/commands/cmd_userhost.cpp +++ b/src/commands/cmd_userhost.cpp @@ -30,7 +30,9 @@ class CommandUserhost : public Command public: /** Constructor for userhost. */ - CommandUserhost ( Module* parent) : Command(parent,"USERHOST",0,1) { syntax = "{,}"; } + CommandUserhost ( Module* parent) : Command(parent,"USERHOST", 1) { + syntax = " [ ...]"; + } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -42,9 +44,14 @@ class CommandUserhost : public Command CmdResult CommandUserhost::Handle (const std::vector& parameters, User *user) { - std::string retbuf = std::string("302 ") + user->nick + " :"; + std::string retbuf = "302 " + user->nick + " :"; + + unsigned int max = parameters.size(); + if (max > 5) + max = 5; - for (unsigned int i = 0; i < parameters.size(); i++) + bool has_privs = user->HasPrivPermission("users/auspex"); + for (unsigned int i = 0; i < max; i++) { User *u = ServerInstance->FindNickOnly(parameters[i]); @@ -54,13 +61,14 @@ CmdResult CommandUserhost::Handle (const std::vector& parameters, U if (IS_OPER(u)) { - retbuf = retbuf + "*="; - } - else - { - retbuf = retbuf + "="; + // XXX: +H hidden opers must not be shown as opers + ModeHandler* mh = ServerInstance->Modes->FindMode('H', MODETYPE_USER); + if ((u == user) || (has_privs) || (!mh) || (!u->IsModeSet('H')) || (mh->name != "hideoper")) + retbuf += '*'; } + retbuf = retbuf + "="; + if (IS_AWAY(u)) retbuf += "-"; else @@ -68,7 +76,7 @@ CmdResult CommandUserhost::Handle (const std::vector& parameters, U retbuf = retbuf + u->ident + "@"; - if (user->HasPrivPermission("users/auspex")) + if (has_privs) { retbuf = retbuf + u->host; }