]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-info.c
ngIRCd Release 27
[ngircd-alex.git] / src / ngircd / irc-info.c
index 03127b229f4008d203ce0fd700d9ca4173250043..7287f3cad31735d9e2896d93a8c6647f79c93fe8 100644 (file)
@@ -818,7 +818,7 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
 
        /* Now print all clients which are not in any channel */
        c = Client_First();
-       snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), "*", "*");
+       snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG, Client_ID(from), '*', "*");
        while (c) {
                if (Client_Type(c) == CLIENT_USER
                    && Channel_FirstChannelOf(c) == NULL
@@ -830,11 +830,11 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req )
                        strlcat(rpl, Client_ID(c), sizeof(rpl));
 
                        if (strlen(rpl) > COMMAND_LEN - CLIENT_NICK_LEN - 4) {
-                               /* Line is gwoing too long, send now */
+                               /* Line is going too long, send now */
                                if (!IRC_WriteStrClient(from, "%s", rpl))
                                        return DISCONNECTED;
                                snprintf(rpl, sizeof(rpl), RPL_NAMREPLY_MSG,
-                                        Client_ID(from), "*", "*");
+                                        Client_ID(from), '*', "*");
                        }
                }
                c = Client_Next(c);
@@ -910,7 +910,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
                if (!Op_Check(from, Req))
                        return Op_NoPrivileges(from, Req);
                more_links = true;
-
+               /* fall through */
        case 'l':       /* Link status (servers and own link) */
                time_now = time(NULL);
                for (con = Conn_First(); con != NONE; con = Conn_Next(con)) {
@@ -1265,6 +1265,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
 
                        if (Client_Type(c) != CLIENT_USER)
                                continue;
+                       if (Client_HasMode(c, 'i'))
+                               continue;
                        if (!MatchCaseInsensitive(query, Client_ID(c)))
                                continue;
                        if (!IRC_WHOIS_SendReply(Client, from, c))
@@ -1373,7 +1375,7 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req )
 /**
  * Send LUSERS reply to a client.
  *
- * @param Client The receipient of the information.
+ * @param Client The recipient of the information.
  * @return CONNECTED or DISCONNECTED.
  */
 GLOBAL bool
@@ -1498,6 +1500,8 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
        char str[COMMAND_LEN];
        CL2CHAN *cl2chan;
        CLIENT *cl;
+       bool secret_channel;
+       char chan_symbol;
 
        assert(Client != NULL);
        assert(Chan != NULL);
@@ -1512,10 +1516,13 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
                return CONNECTED;
 
        /* Secret channel? */
-       if (!is_member && Channel_HasMode(Chan, 's'))
+       secret_channel = Channel_HasMode(Chan, 's');
+       if (!is_member && secret_channel)
                return CONNECTED;
 
-       snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), "=",
+       chan_symbol = secret_channel ? '@' : '=';
+
+       snprintf(str, sizeof(str), RPL_NAMREPLY_MSG, Client_ID(Client), chan_symbol,
                 Channel_Name(Chan));
        cl2chan = Channel_FirstMember(Chan);
        while (cl2chan) {
@@ -1538,7 +1545,7 @@ IRC_Send_NAMES(CLIENT * Client, CHANNEL * Chan)
                                if (!IRC_WriteStrClient(Client, "%s", str))
                                        return DISCONNECTED;
                                snprintf(str, sizeof(str), RPL_NAMREPLY_MSG,
-                                        Client_ID(Client), "=",
+                                        Client_ID(Client), chan_symbol,
                                         Channel_Name(Chan));
                        }
                }