]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/numeric.c
Adjust severity levels of some log messages
[ngircd-alex.git] / src / ngircd / numeric.c
index 3fc8c461bf73f1455731bf21f818a63455cd619d..9b8240bdca0227f7e9862d4fb6d5e0646d36ce7a 100644 (file)
@@ -48,12 +48,11 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
        CL2CHAN *cl2chan;
        CLIENT *cl;
        char str[LINE_LEN], *ptr;
-       bool njoin;
+       bool njoin, xop;
 
-       if (Conn_Options(Client_Conn(Client)) & CONN_RFC1459)
-               njoin = false;
-       else
-               njoin = true;
+       /* Check features of remote server */
+       njoin = Conn_Options(Client_Conn(Client)) & CONN_RFC1459 ? false : true;
+       xop = strchr(Client_Flags(Client), 'X') ? true : false;
 
        /* Get all the members of this channel */
        cl2chan = Channel_FirstMember(Chan);
@@ -67,13 +66,15 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
                         * (if user is channel operator or has voice) */
                        if (str[strlen(str) - 1] != ':')
                                strlcat(str, ",", sizeof(str));
-                       if (strchr(Channel_UserModes(Chan, cl), 'q'))
+
+                       /* Prepare user prefix (ChanOp, voiced, ...) */
+                       if (xop && strchr(Channel_UserModes(Chan, cl), 'q'))
                                strlcat(str, "~", sizeof(str));
-                       if (strchr(Channel_UserModes(Chan, cl), 'a'))
+                       if (xop && strchr(Channel_UserModes(Chan, cl), 'a'))
                                strlcat(str, "&", sizeof(str));
                        if (strchr(Channel_UserModes(Chan, cl), 'o'))
                                strlcat(str, "@", sizeof(str));
-                       if (strchr(Channel_UserModes(Chan, cl), 'h'))
+                       if (xop && strchr(Channel_UserModes(Chan, cl), 'h'))
                                strlcat(str, "%", sizeof(str));
                        if (strchr(Channel_UserModes(Chan, cl), 'v'))
                                strlcat(str, "+", sizeof(str));
@@ -178,24 +179,40 @@ Announce_User(CLIENT * Client, CLIENT * User)
                                     Client_ID(User), Client_ID(User),
                                     modes);
                }
-               return CONNECTED;
        } else {
                /* RFC 2813 mode: one combined NICK or SERVICE command */
                if (Client_Type(User) == CLIENT_SERVICE
-                   && strchr(Client_Flags(Client), 'S'))
-                       return IRC_WriteStrClient(Client,
-                               "SERVICE %s %d * +%s %d :%s", Client_Mask(User),
-                               Client_MyToken(Client_Introducer(User)),
-                               Client_Modes(User), Client_Hops(User) + 1,
-                               Client_Info(User));
-               else
-                       return IRC_WriteStrClient(Client,
-                               "NICK %s %d %s %s %d +%s :%s",
-                               Client_ID(User), Client_Hops(User) + 1,
-                               Client_User(User), Client_Hostname(User),
-                               Client_MyToken(Client_Introducer(User)),
-                               Client_Modes(User), Client_Info(User));
+                   && strchr(Client_Flags(Client), 'S')) {
+                       if (!IRC_WriteStrClient(Client,
+                                       "SERVICE %s %d * +%s %d :%s",
+                                       Client_Mask(User),
+                                       Client_MyToken(Client_Introducer(User)),
+                                       Client_Modes(User), Client_Hops(User) + 1,
+                                       Client_Info(User)))
+                               return DISCONNECTED;
+               } else {
+                       if (!IRC_WriteStrClient(Client,
+                                       "NICK %s %d %s %s %d +%s :%s",
+                                       Client_ID(User), Client_Hops(User) + 1,
+                                       Client_User(User), Client_Hostname(User),
+                                       Client_MyToken(Client_Introducer(User)),
+                                       Client_Modes(User), Client_Info(User)))
+                               return DISCONNECTED;
+               }
        }
+
+       if (strchr(Client_Flags(Client), 'M')) {
+               /* Synchronize metadata */
+               if (Client_HostnameCloaked(User)) {
+                       if (!IRC_WriteStrClient(Client,
+                                               "METADATA %s cloakhost :%s",
+                                               Client_ID(User),
+                                               Client_HostnameCloaked(User)))
+                               return DISCONNECTED;
+               }
+       }
+
+       return CONNECTED;
 } /* Announce_User */