]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-info.c
Adjust severity levels of some log messages
[ngircd-alex.git] / src / ngircd / irc-info.c
index 89defc3829ffaf4bba4e05cbcb25377e87ec7a22..e9c1ff532ae7a4d4420d9e972f0f8e3904036f33 100644 (file)
@@ -727,7 +727,7 @@ IRC_USERHOST(CLIENT *Client, REQUEST *Req)
                                strlcat(rpl, "+", sizeof(rpl));
                        strlcat(rpl, Client_User(c), sizeof(rpl));
                        strlcat(rpl, "@", sizeof(rpl));
-                       strlcat(rpl, Client_HostnameCloaked(c), sizeof(rpl));
+                       strlcat(rpl, Client_HostnameDisplayed(c), sizeof(rpl));
                        strlcat(rpl, " ", sizeof(rpl));
                }
        }
@@ -792,7 +792,7 @@ write_whoreply(CLIENT *Client, CLIENT *c, const char *channelname, const char *f
 {
        return IRC_WriteStrClient(Client, RPL_WHOREPLY_MSG, Client_ID(Client),
                                  channelname, Client_User(c),
-                                 Client_HostnameCloaked(c),
+                                 Client_HostnameDisplayed(c),
                                  Client_ID(Client_Introducer(c)), Client_ID(c),
                                  flags, Client_Hops(c), Client_Info(c));
 }
@@ -893,7 +893,8 @@ IRC_WHO_Channel(CLIENT *Client, CHANNEL *Chan, bool OnlyOps)
 
                is_visible = strchr(client_modes, 'i') == NULL;
                if (is_member || is_visible) {
-                       strcpy(flags, who_flags_status(client_modes));
+                       strlcpy(flags, who_flags_status(client_modes),
+                               sizeof(flags));
                        if (is_ircop)
                                strlcat(flags, "*", sizeof(flags));
 
@@ -987,7 +988,7 @@ IRC_WHO_Mask(CLIENT *Client, char *Mask, bool OnlyOps)
                if (IRC_CheckListTooBig(Client, count, MAX_RPL_WHO, "WHO"))
                        break;
 
-               strcpy(flags, who_flags_status(Client_Modes(c)));
+               strlcpy(flags, who_flags_status(Client_Modes(c)), sizeof(flags));
                if (strchr(Client_Modes(c), 'o'))
                        strlcat(flags, "*", sizeof(flags));
 
@@ -1080,7 +1081,7 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
        /* Nick, user, hostname and client info */
        if (!IRC_WriteStrClient(from, RPL_WHOISUSER_MSG, Client_ID(from),
                                Client_ID(c), Client_User(c),
-                               Client_HostnameCloaked(c), Client_Info(c)))
+                               Client_HostnameDisplayed(c), Client_Info(c)))
                return DISCONNECTED;
 
        /* Server */
@@ -1132,14 +1133,20 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
                        return DISCONNECTED;
        }
 
+       /* Service? */
+       if (Client_Type(c) == CLIENT_SERVICE &&
+           !IRC_WriteStrClient(from, RPL_WHOISSERVICE_MSG,
+                               Client_ID(from), Client_ID(c)))
+               return DISCONNECTED;
+
        /* IRC-Operator? */
-       if (Client_HasMode(c, 'o') &&
+       if (Client_HasMode(c, 'o') && Client_Type(c) != CLIENT_SERVICE &&
            !IRC_WriteStrClient(from, RPL_WHOISOPERATOR_MSG,
                                Client_ID(from), Client_ID(c)))
                return DISCONNECTED;
 
        /* IRC-Bot? */
-       if (Client_HasMode(c, 'B') &&
+       if (Client_HasMode(c, 'B') && Client_Type(c) != CLIENT_SERVICE &&
            !IRC_WriteStrClient(from, RPL_WHOISBOT_MSG,
                                Client_ID(from), Client_ID(c)))
                return DISCONNECTED;
@@ -1150,23 +1157,25 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
                                Client_ID(c)))
                return DISCONNECTED;
 
-       /* Registered nick name? */
+       /* Registered nickname? */
        if (Client_HasMode(c, 'R') &&
            !IRC_WriteStrClient(from, RPL_WHOISREGNICK_MSG,
                                Client_ID(from), Client_ID(c)))
                return DISCONNECTED;
 
+       /* Local client and requester is the user itself or an IRC Op? */
        if (Client_Conn(c) > NONE &&
-           (from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o'))) &&
-           !IRC_WriteStrClient(from, RPL_WHOISMODES_MSG, Client_ID(from),
-                               Client_ID(c), Client_Modes(c)))
-               return DISCONNECTED;
-
-       if (Client_Conn(c) > NONE && (Client_OperByMe(from) || from == c) &&
-           !IRC_WriteStrClient(from, RPL_WHOISHOST_MSG, Client_ID(from),
-                               Client_ID(c), Client_Hostname(c),
-                               Conn_GetIPAInfo(Client_Conn(c))))
-               return DISCONNECTED;
+           (from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) {
+               /* Client hostname */
+               if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG,
+                   Client_ID(from), Client_ID(c), Client_Hostname(c),
+                   Conn_GetIPAInfo(Client_Conn(c))))
+                       return DISCONNECTED;
+               /* Client modes */
+               if (!IRC_WriteStrClient(from, RPL_WHOISMODES_MSG,
+                   Client_ID(from), Client_ID(c), Client_Modes(c)))
+                       return DISCONNECTED;
+       }
 
        /* Idle and signon time (local clients only!) */
        if (!Conf_MorePrivacy && Client_Conn(c) > NONE &&
@@ -1226,7 +1235,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
        /* Get target server for this command */
        if (Req->argc > 1) {
                /* Search the target server, which can be specified as a
-                * nick name on that server as well: */
+                * nickname on that server as well: */
                target = Client_Search(Req->argv[0]);
                if (!target)
                        return IRC_WriteStrClient(from, ERR_NOSUCHSERVER_MSG,
@@ -1259,7 +1268,8 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req )
                 */
                if (!has_wildcards || is_remote) {
                        c = Client_Search(query);
-                       if (c && Client_Type(c) == CLIENT_USER) {
+                       if (c && (Client_Type(c) == CLIENT_USER
+                                 || Client_Type(c) == CLIENT_SERVICE)) {
                                if (!IRC_WHOIS_SendReply(Client, from, c))
                                        return DISCONNECTED;
                        } else {