[ircd-ratbox] [PATCH] ratbox-services: refine VOICE management

Ralf S. Engelschall rse at engelschall.com
Mon May 2 13:46:32 UTC 2005


Experience over the last weeks on irc.openpkg.net with the latest
Ratbox-Services CVS snapshots (as of 200504XX) showed that the recently
introduced NOVOICES feature should be even further refined by splitting
it into a REFUSEVOICES (still allowing manual operator voice granting)
and a SHUTUPVOICES (enforcing no voice at all).

The SHUTUPVOICES is exactly the already implemented NOVOICES (just
renamed to avoid those confusing double negations as in "NOVOICES OFF")
and covers the REFUSEVOICES, too. The REFUSEVOICES now only controls the
VOICE request and AUTOVOICE handling in ChanServ and this way allows
operators to still assign VOICE to users manually.

The appended patch now finally allows a moderated IRC channel to be used
very similar to a real-world moderated conference.

Thanks for the great Ratbox IRCd and Ratbox-Services.

Yours,
                                       Ralf S. Engelschall
                                       rse at engelschall.com
                                       www.engelschall.com

Index: help/chanserv/set
===================================================================
RCS file: /cvsroot/rserv/help/chanserv/set,v
retrieving revision 1.8
diff -u -d -u -d -r1.8 set
--- help/chanserv/set	24 Apr 2005 20:03:01 -0000	1.8
+++ help/chanserv/set	2 May 2005 13:30:19 -0000
@@ -4,7 +4,8 @@
                          automatically enabled by NOOPS/NOVOICES.
   NOOPS        [on|off]: Disallow any user being opped.
   RESTRICTOPS  [on|off]: Disallow any users without OP access being opped.
-  NOVOICES     [on|off]: Disallow any user being voiced.
+  REFUSEVOICES [on|off]: Disallow any user being voiced.
+  SHUTUPVOICES [on|off]: Disallow any user stay  voiced.
   WARNOVERRIDE [on|off]: Warns chanops when INVITE/GETKEY are used.
                          Requires AUTOJOIN.
   CREATEMODES  [modes] : Channel modes used on channel creation.  Set to "+"
Index: include/s_chanserv.h
===================================================================
RCS file: /cvsroot/rserv/include/s_chanserv.h,v
retrieving revision 1.26
diff -u -d -u -d -r1.26 s_chanserv.h
--- include/s_chanserv.h	18 Apr 2005 14:29:34 -0000	1.26
+++ include/s_chanserv.h	2 May 2005 13:30:19 -0000
@@ -11,12 +11,13 @@
 #define CS_FLAGS_AUTOJOIN	0x0004
 #define CS_FLAGS_WARNOVERRIDE	0x0008
 #define CS_FLAGS_RESTRICTOPS	0x0010
-#define CS_FLAGS_NOVOICES	0x0020
+#define CS_FLAGS_REFUSEVOICES	0x0020
+#define CS_FLAGS_SHUTUPVOICES	0x0040

 /* those flags shown in CHANSERV::INFO */
 #define CS_FLAGS_SHOW	(CS_FLAGS_NOOPS|CS_FLAGS_AUTOJOIN|\
 			 CS_FLAGS_WARNOVERRIDE|CS_FLAGS_RESTRICTOPS|\
-			 CS_FLAGS_NOVOICES)
+			 CS_FLAGS_REFUSEVOICES|CS_FLAGS_SHUTUPVOICES)

 /* Flags not stored in the DB: 0xFFFF0000 */
 #define CS_FLAGS_NEEDUPDATE	0x00010000
Index: src/s_chanserv.c
===================================================================
RCS file: /cvsroot/rserv/src/s_chanserv.c,v
retrieving revision 1.74
diff -u -d -u -d -r1.74 s_chanserv.c
--- src/s_chanserv.c	28 Apr 2005 13:37:01 -0000	1.74
+++ src/s_chanserv.c	2 May 2005 13:30:19 -0000
@@ -941,7 +941,7 @@
 		return 0;

 	/* only thing we're testing here.. */
-	if(!(chreg_p->flags & CS_FLAGS_NOVOICES))
+	if(!(chreg_p->flags & CS_FLAGS_SHUTUPVOICES))
 		return 0;

 	modebuild_start(chanserv_p, chptr);
@@ -1127,7 +1127,7 @@
 			hit++;
 		}

-		if(is_voiced(member_p) && (chreg_p->flags & CS_FLAGS_NOVOICES))
+		if(is_voiced(member_p) && (chreg_p->flags & CS_FLAGS_SHUTUPVOICES))
 		{
 			if(dlink_list_length(&chptr->users) == 1)
 				enable_autojoin(chreg_p);
@@ -1155,7 +1155,7 @@
 			}
 			else if(mreg_p->flags & CS_MEMBER_AUTOVOICE &&
 				!is_voiced(member_p) &&
-				!(chreg_p->flags & CS_FLAGS_NOVOICES))
+				!(chreg_p->flags & (CS_FLAGS_REFUSEVOICES|CS_FLAGS_SHUTUPVOICES)))
 			{
 				modebuild_add(DIR_ADD, "v",
 					member_p->client_p->name);
@@ -1223,7 +1223,7 @@
 		}
 		else if(mreg_p->flags & CS_MEMBER_AUTOVOICE &&
 			!is_voiced(member_p) &&
-			!(chreg_p->flags & CS_FLAGS_NOVOICES))
+			!(chreg_p->flags & (CS_FLAGS_REFUSEVOICES|CS_FLAGS_SHUTUPVOICES)))
 		{
 			sendto_server(":%s MODE %s +v %s",
 					chanserv_p->name, chptr->name,
@@ -2103,9 +2103,14 @@

 		return 1;
 	}
-	else if(!strcasecmp(parv[1], "NOVOICES"))
+	else if(!strcasecmp(parv[1], "REFUSEVOICES"))
 	{
-		retval = s_chan_set_flag(client_p, chreg_p, parv[1], arg, CS_FLAGS_NOVOICES);
+		s_chan_set_flag(client_p, chreg_p, parv[1], arg, CS_FLAGS_REFUSEVOICES);
+		return 1;
+	}
+	else if(!strcasecmp(parv[1], "SHUTUPVOICES"))
+	{
+		retval = s_chan_set_flag(client_p, chreg_p, parv[1], arg, CS_FLAGS_SHUTUPVOICES);

 		if(retval == 1)
 		{
@@ -2398,15 +2403,23 @@
 	if((reg_p = verify_member_reg_name(client_p, &chptr, parv[0], S_C_USER)) == NULL)
 		return 1;

-	/* noone is allowed to be voiced.. */
-	if(reg_p->channel_reg->flags & CS_FLAGS_NOVOICES)
+	/* noone is allowed to receive voice... */
+	if(reg_p->channel_reg->flags & (CS_FLAGS_REFUSEVOICES))
 	{
 		service_error(chanserv_p, client_p,
-			"Channel %s is set NOVOICES",
+			"Channel %s is set REFUSEVOICES",
 			reg_p->channel_reg->name);
 		return 1;
 	}

+	/* noone is allowed to keep voice... */
+	if(reg_p->channel_reg->flags & (CS_FLAGS_SHUTUPVOICES))
+	{
+		service_error(chanserv_p, client_p,
+			"Channel %s is set SHUTUPVOICES",
+			reg_p->channel_reg->name);
+		return 1;
+	}

 	if((msptr = find_chmember(chptr, client_p)) == NULL)
 	{
@@ -2902,11 +2915,12 @@

 	if(chreg_p->flags & CS_FLAGS_SHOW)
 		service_send(chanserv_p, client_p, conn_p,
-			"[%s] Settings: %s%s%s%s%s",
+			"[%s] Settings: %s%s%s%s%s%s",
 			chreg_p->name,
 			(chreg_p->flags & CS_FLAGS_AUTOJOIN) ? "AUTOJOIN " : "",
 			(chreg_p->flags & CS_FLAGS_NOOPS) ? "NOOPS " : "",
-			(chreg_p->flags & CS_FLAGS_NOVOICES) ? "NOVOICES " : "",
+			(chreg_p->flags & CS_FLAGS_REFUSEVOICES) ? "REFUSEVOICES " : "",
+			(chreg_p->flags & CS_FLAGS_SHUTUPVOICES) ? "SHUTUPVOICES " : "",
 			(chreg_p->flags & CS_FLAGS_RESTRICTOPS) ? "RESTRICTOPS " : "",
 			(chreg_p->flags & CS_FLAGS_WARNOVERRIDE) ? "WARNOVERRIDE" : "");



More information about the ircd-ratbox mailing list