]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/numeric.c
Make configure[.ng] compatible with autoconf 1.10 again
[ngircd-alex.git] / src / ngircd / numeric.c
index 4bce60fb12a947908f14118b7aa200439f4284df..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);
@@ -63,17 +62,19 @@ Announce_Channel(CLIENT *Client, CHANNEL *Chan)
                assert(cl != NULL);
 
                if (njoin) {
-                       /* RFC 2813: send NJOIN with nick names and modes
+                       /* RFC 2813: send NJOIN with nicknames and modes
                         * (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 */
 
 
@@ -420,12 +437,12 @@ IRC_Num_ISUPPORT(CLIENT * Client, REQUEST * Req)
                        if ((unsigned int)atol(value) == Conf_MaxNickLength - 1)
                                continue;
 
-                       /* Nick name length settings are different! */
+                       /* Nickname length settings are different! */
                        Log(LOG_ERR,
-                           "Peer uses incompatible nick name length (%d/%d)! Disconnecting ...",
+                           "Peer uses incompatible nickname length (%d/%d)! Disconnecting ...",
                            Conf_MaxNickLength - 1, atoi(value));
                        Conn_Close(Client_Conn(Client),
-                                  "Incompatible nick name length",
+                                  "Incompatible nickname length",
                                   NULL, false);
                        return DISCONNECTED;
                }