added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / m_whois.c
index 5ba4a460fbb8deb2fd9124d759531d0dadb89a4f..01c9db55db3d1d8311a6b89f76bc40ffa79a9930 100644 (file)
 /*
  * 2000-07-01: Isomer
  *  * Rewritten to make this understandable
- *  * You can nolonger /whois unregistered clients.
+ *  * You can no longer /whois unregistered clients.
  *  
  *
  * General rules:
@@ -137,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));
@@ -175,7 +176,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc)
        }
        if (IsDeaf(acptr))
          *(buf + len++) = '-';
-       if (IsOper(sptr) && !ShowChannel(sptr, chptr))
+       if (!ShowChannel(sptr, chptr))
          *(buf + len++) = '*';
        if (IsDelayedJoin(chan) && (sptr != acptr))
          *(buf + len++) = '<';
@@ -196,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)
   {
@@ -237,16 +233,15 @@ 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; 
   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))
   {
@@ -258,7 +253,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)) {
@@ -269,15 +264,14 @@ 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
      *   the target user(s) are on;
      */
     user = cli_user(acptr);
-    name = (!*(cli_name(acptr))) ? "?" : cli_name(acptr);
     assert(user);
 
     invis = (acptr != sptr) && IsInvisible(acptr);