]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Add new IRC+ server flag "X": "XOP modes supported"
authorAlexander Barton <alex@barton.de>
Sat, 10 Nov 2012 22:33:19 +0000 (23:33 +0100)
committerAlexander Barton <alex@barton.de>
Sat, 10 Nov 2012 22:33:19 +0000 (23:33 +0100)
This flag indicates, that the server supports the enhanced "xop channel
user modes", like channel owner, admin, and halfop. This information is
used to make sure that no unsupported CHANINFO commands are sent to
servers not supporting such mode prefixes, for example.

doc/Protocol.txt
src/ngircd/defines.h
src/ngircd/numeric.c

index 516a4a4c914bd45138c9cea81e19d6ba2e1d920d..9a8ddf6fdcefa96674200764876b7e7895cd2b74 100644 (file)
@@ -89,6 +89,9 @@ The following <serverflags> are defined at the moment:
 
 - S: The server supports the SERVICE command (on this link).
 
+- X: Server supports XOP channel modes (owner, admin, halfop) and supports
+     these user prefixes in CHANINFO commands, for example.
+
 - Z: Compressed server links are supported by the server.
 
 Example for a complete <flags> string: "ngircd|0.7.5:CZ".
index b2de98d5e94a4627e0f7965d00ae86da0b10a887..dcdd440c45b606f3c67d475f9fcc106d9c123532 100644 (file)
 
 #ifdef IRCPLUS
 /** Standard IRC+ flags. */
-# define IRCPLUSFLAGS "CHLMS"
+# define IRCPLUSFLAGS "CHLMSX"
 #endif
 
 /** Supported user modes. */
index 3fc8c461bf73f1455731bf21f818a63455cd619d..f48cc2147f470124cf120e0d9c063c23ce0ac8dc 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));