X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fwhocmds.c;h=0b166ba0bb0ebd7e8a0dbc94d4382a77efc952fc;hb=refs%2Fheads%2Fupstream;hp=6516d74eb356e467ed08a4e9c959b060f6135ea9;hpb=fb33f1b5ba4fc6e673dc96690d94d11756f445f7;p=ircu2.10.12-pk.git diff --git a/ircd/whocmds.c b/ircd/whocmds.c index 6516d74..0b166ba 100644 --- a/ircd/whocmds.c +++ b/ircd/whocmds.c @@ -72,7 +72,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, int fields, char* qrt) { char *p1; - struct Membership *chan; + struct Membership *chan = 0; static char buf1[512]; /* NOTE: with current fields list and sizes this _cannot_ overrun, @@ -86,7 +86,9 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, that there are no common channels, thus use PubChannel and not SeeChannel */ if (repchan) + { chan = find_channel_member(acptr, repchan); + } else if ((!fields || (fields & (WHO_FIELD_CHA | WHO_FIELD_FLA))) && !IsChannelService(acptr)) { @@ -242,6 +244,23 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, *(p1++) = '0'; } + if (fields & WHO_FIELD_OPL) + { + if (!chan || !IsChanOp(chan)) + { + strcpy(p1, " n/a"); + p1 += 4; + } + else + { + int vis_level = MAXOPLEVEL; + if ((IsGlobalChannel(chan->channel->chname) ? IsOper(sptr) : IsAnOper(sptr)) + || is_chan_op(sptr, chan->channel)) + vis_level = OpLevel(chan); + p1 += ircd_snprintf(0, p1, 5, " %d", vis_level); + } + } + if (!fields || (fields & WHO_FIELD_REN)) { char *p2 = cli_info(acptr); @@ -257,31 +276,3 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, p1 = buf1; send_reply(sptr, fields ? RPL_WHOSPCRPL : RPL_WHOREPLY, ++p1); } - -/** Count number of users who match \a mask. - * @param[in] mask user\@host or user\@ip mask to check. - * @return Count of matching users. - */ -int -count_users(char *mask) -{ - struct Client *acptr; - int count = 0; - char namebuf[USERLEN + HOSTLEN + 2]; - char ipbuf[USERLEN + 16 + 2]; - - for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr)) { - if (!IsUser(acptr)) - continue; - - ircd_snprintf(0, namebuf, sizeof(namebuf), "%s@%s", - cli_user(acptr)->username, cli_user(acptr)->host); - ircd_snprintf(0, ipbuf, sizeof(ipbuf), "%s@%s", cli_user(acptr)->username, - ircd_ntoa(&cli_ip(acptr))); - - if (!match(mask, namebuf) || !match(mask, ipbuf)) - count++; - } - - return count; -}