[ircd-ratbox] [PATCH] ratbox-services: ChanServ NOVOICE channel flag

Ralf S. Engelschall rse at engelschall.com
Mon Apr 18 09:03:29 UTC 2005


Add a NOVOICE channel flag to Ratbox-Service's ChanServ for allowing an
exclusive manual voice control on a channel.

Index: ratbox-services/help/chanserv/set
--- ratbox-services/help/chanserv/set.orig	2005-04-07 01:00:11 +0200
+++ ratbox-services/help/chanserv/set	2005-04-18 10:05:31 +0200
@@ -2,6 +2,7 @@
   AUTOJOIN     [on|off]: Places services within the channel.
   NOOPS        [on|off]: Disallow any user being opped.
   RESTRICTOPS  [on|off]: Disallow any users without OP access being opped.
+  NOVOICE      [on|off]: Disallow any users to request voice.
   WARNOVERRIDE [on|off]: Warns chanops when INVITE/GETKEY are used.
                          Requires AUTOJOIN.
   CREATEMODES  [modes] : Channel modes used on channel creation.  Set to "+"
--- ratbox-services/include/s_chanserv.h.orig	2005-02-09 16:08:13 +0100
+++ ratbox-services/include/s_chanserv.h	2005-04-18 10:05:43 +0200
@@ -11,10 +11,11 @@
 #define CS_FLAGS_AUTOJOIN	0x0004
 #define CS_FLAGS_WARNOVERRIDE	0x0008
 #define CS_FLAGS_RESTRICTOPS	0x0010
+#define CS_FLAGS_NOVOICE	0x0020

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

 /* Flags not stored in the DB: 0xFFFF0000 */
 #define CS_FLAGS_NEEDUPDATE	0x00010000
--- ratbox-services/src/s_chanserv.c.orig	2005-04-07 15:12:33 +0200
+++ ratbox-services/src/s_chanserv.c	2005-04-18 10:19:20 +0200
@@ -2009,6 +2009,11 @@

 		return 1;
 	}
+	else if(!strcasecmp(parv[1], "NOVOICE"))
+	{
+		retval = s_chan_set_flag(client_p, chreg_p, parv[1], arg, CS_FLAGS_NOVOICE);
+		return 1;
+	}
 	else if(!strcasecmp(parv[1], "AUTOJOIN"))
 	{
 		retval = s_chan_set_flag(client_p, chreg_p, parv[1], arg, CS_FLAGS_AUTOJOIN);
@@ -2284,12 +2289,21 @@
 s_chan_voice(struct client *client_p, struct lconn *conn_p, const char *parv[], int parc)
 {
 	struct member_reg *reg_p;
+	struct chan_reg *chreg_p;
 	struct channel *chptr;
 	struct chmember *msptr;

 	if((reg_p = verify_member_reg_name(client_p, &chptr, parv[0], S_C_USER)) == NULL)
 		return 1;

+	if((chreg_p = find_channel_reg(client_p, parv[0])) == NULL)
+	    return 1;
+	if((chreg_p->flags & CS_FLAGS_NOVOICE) != 0)
+	{
+		service_error(chanserv_p, client_p, "Channel %s has restricted voice policy", parv[0]);
+		return 1;
+	}
+
 	if((msptr = find_chmember(chptr, client_p)) == NULL)
 	{
 		service_error(chanserv_p, client_p, "You are not on %s", parv[0]);
@@ -2784,11 +2798,12 @@

 	if(chreg_p->flags & CS_FLAGS_SHOW)
 		service_send(chanserv_p, client_p, conn_p,
-			"[%s] Settings: %s%s%s%s",
+			"[%s] Settings: %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_RESTRICTOPS) ? "RESTRICTOPS " : "",
+			(chreg_p->flags & CS_FLAGS_NOVOICE) ? "NOVOICE " : "",
 			(chreg_p->flags & CS_FLAGS_WARNOVERRIDE) ? "WARNOVERRIDE" : "");

 	if(!EmptyString(chreg_p->topic))

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



More information about the ircd-ratbox mailing list