X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_who.cpp;h=508956c44f166c051c10ac8749f10699569df717;hb=b57568ecc46296ba3a0e06d770eceff40cc9aee4;hp=81145a91c13659d9305393eff20df1f5c7f6e100;hpb=2ff0804fdba8355269d66b087fba61060f0f7164;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 81145a91c..508956c44 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -82,6 +82,19 @@ extern "C" command_t* init_command(InspIRCd* Instance) return new cmd_who(Instance); } +bool cmd_who::CanView(chanrec* chan, userrec* user) +{ + /* Execute items in fastest-to-execute first order */ + if (*user->oper) + return true; + else if (!chan->IsModeSet('s') && !chan->IsModeSet('p')) + return true; + else if (chan->HasUser(user)) + return true; + + return false; +} + CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) { /* @@ -145,7 +158,7 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) /* who on a channel? */ ch = ServerInstance->FindChan(matchtext); - if (ch) + if ((ch) && (CanView(ch,user))) { /* who on a channel. */ CUList *cu = ch->GetUsers();