summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-11-10 23:33:19 +0100
committerAlexander Barton <alex@barton.de>2012-11-10 23:33:19 +0100
commit53917fa4b80753fc189ed5a516c06c804f2cf415 (patch)
tree0f91712252ec7b06dbcc6da31815ec76d71598c2 /src
parent646218e6f4d936b7448b2b407ffb6a53650658de (diff)
downloadngircd-53917fa4b80753fc189ed5a516c06c804f2cf415.tar.gz
ngircd-53917fa4b80753fc189ed5a516c06c804f2cf415.zip
Add new IRC+ server flag "X": "XOP modes supported"
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.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/defines.h2
-rw-r--r--src/ngircd/numeric.c17
2 files changed, 10 insertions, 9 deletions
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index b2de98d5..dcdd440c 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -157,7 +157,7 @@
 
 #ifdef IRCPLUS
 /** Standard IRC+ flags. */
-# define IRCPLUSFLAGS "CHLMS"
+# define IRCPLUSFLAGS "CHLMSX"
 #endif
 
 /** Supported user modes. */
diff --git a/src/ngircd/numeric.c b/src/ngircd/numeric.c
index 3fc8c461..f48cc214 100644
--- a/src/ngircd/numeric.c
+++ b/src/ngircd/numeric.c
@@ -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));