X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_whois.c;h=f38d6adfefde91a4796d8c6ca3b72923e385d038;hb=1570a04e15bec6b2945e4351b1e05211aecdcacc;hp=319ea1dc0f7f79d3980c0521a1a0b57bdb455e36;hpb=1e2b7e3d8432d52b6e7fd2bf486edc35b2e58e7b;p=ircu2.10.12-pk.git diff --git a/ircd/m_whois.c b/ircd/m_whois.c index 319ea1d..f38d6ad 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -86,6 +86,7 @@ #include "hash.h" #include "ircd.h" #include "ircd_features.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "match.h" @@ -96,13 +97,13 @@ #include "send.h" #include "whocmds.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include /* * 2000-07-01: Isomer * * Rewritten to make this understandable - * * You can nolonger /whois unregistered clients. + * * You can no longer /whois unregistered clients. * * * General rules: @@ -136,7 +137,8 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) const struct User* user = cli_user(acptr); const char* name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr); - a2cptr = user->server; + a2cptr = feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsAnOper(sptr) + && sptr != acptr ? &his : user->server; assert(user); send_reply(sptr, RPL_WHOISUSER, name, user->username, user->host, cli_info(acptr)); @@ -152,13 +154,21 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) { chptr = chan->channel; - if (!ShowChannel(sptr, chptr)) + if (!ShowChannel(sptr, chptr) + && !(IsOper(sptr) && IsLocalChannel(chptr->chname))) continue; - + if (acptr != sptr && IsZombie(chan)) continue; - - if (len+strlen(chptr->chname) + mlen > BUFSIZE - 5) + + /* Don't show local channels when HIS is defined, unless it's a + * remote WHOIS --ULtimaTe_ + */ + if (IsLocalChannel(chptr->chname) && (acptr != sptr) && (parc == 2) + && feature_bool(FEAT_HIS_WHOIS_LOCALCHAN) && !IsAnOper(sptr)) + continue; + + if (len+strlen(chptr->chname) + mlen > BUFSIZE - 5) { send_reply(sptr, SND_EXPLICIT | RPL_WHOISCHANNELS, "%s :%s", name, buf); *buf = '\0'; @@ -166,9 +176,13 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) } if (IsDeaf(acptr)) *(buf + len++) = '-'; - if (is_chan_op(acptr, chptr)) + if (!ShowChannel(sptr, chptr)) + *(buf + len++) = '*'; + if (IsDelayedJoin(chan) && (sptr != acptr)) + *(buf + len++) = '<'; + else if (IsChanOp(chan)) *(buf + len++) = '@'; - else if (has_voice(acptr, chptr)) + else if (HasVoice(chan)) *(buf + len++) = '+'; else if (IsZombie(chan)) *(buf + len++) = '!'; @@ -183,13 +197,8 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) send_reply(sptr, RPL_WHOISCHANNELS, name, buf); } - if (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsAnOper(sptr) && - sptr != acptr) - send_reply(sptr, RPL_WHOISSERVER, name, feature_str(FEAT_HIS_SERVERNAME), - feature_str(FEAT_HIS_SERVERINFO)); - else - send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr), - cli_info(a2cptr)); + send_reply(sptr, RPL_WHOISSERVER, name, cli_name(a2cptr), + cli_info(a2cptr)); if (user) { @@ -204,15 +213,15 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) if (HasHiddenHost(acptr) && (IsAnOper(sptr) || acptr == sptr)) send_reply(sptr, RPL_WHOISACTUALLY, name, user->username, - user->realhost, ircd_ntoa((const char*) &(cli_ip(acptr)))); - + user->realhost, ircd_ntoa(&cli_ip(acptr))); + /* Hint: if your looking to add more flags to a user, eg +h, here's * probably a good place to add them :) */ - + if (MyConnect(acptr) && (!feature_bool(FEAT_HIS_WHOIS_IDLETIME) || (sptr == acptr || IsAnOper(sptr) || parc >= 3))) - send_reply(sptr, RPL_WHOISIDLE, name, CurrentTime - user->last, + send_reply(sptr, RPL_WHOISIDLE, name, CurrentTime - user->last, cli_firsttime(acptr)); } } @@ -224,7 +233,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) */ static int do_wilds(struct Client* sptr, char *nick, int count, int parc) { - struct Client *acptr; /* Current client we're concidering */ + struct Client *acptr; /* Current client we're considering */ struct User *user; /* the user portion of the client */ const char *name; /* the name of this client */ struct Membership* chan; @@ -233,7 +242,7 @@ static int do_wilds(struct Client* sptr, char *nick, int count, int parc) int showperson; /* Should we show this person? */ int found = 0 ; /* How many were found? */ - /* Ech! This is hidious! */ + /* Ech! This is hideous! */ for (acptr = GlobalClientList; (acptr = next_client(acptr, nick)); acptr = cli_next(acptr)) { @@ -245,7 +254,7 @@ static int do_wilds(struct Client* sptr, char *nick, int count, int parc) /* * I'm always last :-) and acptr->next == 0!! * - * Isomer: Does this strike anyone else as being a horrible hidious + * Isomer: Does this strike anyone else as being a horrible hideous * hack? */ if (IsMe(acptr)) { @@ -256,8 +265,8 @@ static int do_wilds(struct Client* sptr, char *nick, int count, int parc) /* * 'Rules' established for sending a WHOIS reply: * - * - if wildcards are being used dont send a reply if - * the querier isnt any common channels and the + * - if wildcards are being used don't send a reply if + * the querier isn't any common channels and the * client in question is invisible. * * - only send replies about common or public channels @@ -343,6 +352,7 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) char* p = 0; int found = 0; int total = 0; + int wildscount = 0; if (parc < 2) { @@ -399,7 +409,13 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } } else /* wilds */ - found=do_wilds(sptr, nick, total, parc); + { + if (++wildscount > 3) { + send_reply(sptr, ERR_QUERYTOOLONG, parv[1]); + break; + } + found=do_wilds(sptr, nick, total, parc); + } if (!found) send_reply(sptr, ERR_NOSUCHNICK, nick);