#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"
#include "send.h"
#include "whocmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
* 2000-07-01: Isomer
* * Rewritten to make this understandable
- * * You can nolonger /whois unregistered clients.
+ * * You can no longer /whois unregistered clients.
*
*
* General rules:
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));
{
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';
}
if (IsDeaf(acptr))
*(buf + len++) = '-';
+ if (!ShowChannel(sptr, chptr))
+ *(buf + len++) = '*';
if (IsDelayedJoin(chan) && (sptr != acptr))
*(buf + len++) = '<';
else if (IsChanOp(chan))
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)
{
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));
}
}
*/
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;
int invis; /* does +i apply? */
int member; /* Is this user on any channels? */
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))
{
/*
* 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)) {
/*
* '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
* the target user(s) are on;
*/
user = cli_user(acptr);
- name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr);
assert(user);
invis = (acptr != sptr) && IsInvisible(acptr);