about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-08-27 21:22:58 +0200
committerAlexander Barton <alex@barton.de>2012-08-27 21:22:58 +0200
commitc519ba9920d2d9b12016d0825382cd236219112c (patch)
tree38f5a26cb72275f9b62b97e68327506d9008ac29
parent55859c1befa7cd04a130f1816cb73a9629637105 (diff)
parentfee8ff37b3a8bedf1403e67d8384a7227c4f7b40 (diff)
downloadngircd-c519ba9920d2d9b12016d0825382cd236219112c.tar.gz
ngircd-c519ba9920d2d9b12016d0825382cd236219112c.zip
Merge branch 'cmode-M'
By Alexander Barton (2) and DNS777 (1)

* cmode-M:
  Add new channel mode "M" to doc/Modes.txt
  Remove Can_Send_To_Channel_Identified()
  Implement channel mode "M"
-rw-r--r--doc/Modes.txt1
-rw-r--r--src/ngircd/channel.c4
-rw-r--r--src/ngircd/defines.h2
-rw-r--r--src/ngircd/irc-mode.c1
-rw-r--r--src/ngircd/messages.h2
5 files changed, 8 insertions, 2 deletions
diff --git a/doc/Modes.txt b/doc/Modes.txt
index e47e2707..2b700f0c 100644
--- a/doc/Modes.txt
+++ b/doc/Modes.txt
@@ -49,6 +49,7 @@ users to lists (e.g. "invite list", "ban list"), others have parameters
   k	0.6.0	Channel has a "key" (a password).
   l	0.6.0	Channel has a user limit.
   m	0.3.0	Channel is moderated, only "voiced" users can send messages.
+  M	20	Only registered users (and IRC Ops) can send messages.
   n	0.3.0	Channel doesn't allow messages of users not being members.
   O	18	Only IRC operators are allowed to join this channel.
   P	0.5.0	Channel is "persistent".
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index ff470246..0f21a459 100644
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -832,6 +832,10 @@ Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From)
 	if (strchr(Channel_Modes(Chan), 'n') && !is_member)
 		return false;
 
+	if (strchr(Channel_Modes(Chan), 'M') && !Client_HasMode(From, 'R')
+	    && !Client_HasMode(From, 'o'))
+		return false;
+
 	if (is_op || has_voice)
 		return true;
 
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index cd0a1666..310e0699 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -164,7 +164,7 @@
 #define USERMODES "acCiorRswx"
 
 /** Supported channel modes. */
-#define CHANMODES "beiIklmnoOPrRstvz"
+#define CHANMODES "beiIklmMnoOPrRstvz"
 
 /** Away message for users connected to linked servers. */
 #define DEFAULT_AWAY_MSG "Away"
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index fa35cdd0..f91a28c6 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -500,6 +500,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 		switch (*mode_ptr) {
 		/* --- Channel modes --- */
 		case 'i': /* Invite only */
+		case 'M': /* Only identified nicks can write */
 		case 'm': /* Moderated */
 		case 'n': /* Only members can write */
 		case 'R': /* Registered users only */
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index d2e04dbf..53637b44 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -21,7 +21,7 @@
 #define RPL_YOURHOST_MSG		"002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
 #define RPL_CREATED_MSG			"003 %s :This server has been started %s"
 #define RPL_MYINFO_MSG			"004 %s %s ngircd-%s %s %s"
-#define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=beI,k,l,imnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
+#define RPL_ISUPPORT1_MSG		"005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
 #define RPL_ISUPPORT2_MSG		"005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"
 
 #define RPL_TRACELINK_MSG		"200 %s Link %s-%s %s %s V%s %ld %d %d"