[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Moderating nick changes : a test patch.



As a follow up to my earlier posting, I thought I'd post this patch
which gives a server admin the choice of moderating nick changes by
defining the new setting NO_MODERATED_NICKCHANGE in config.h.

If defined, then if a client is without power of speech on a channel,
then he will be unable to change nick, and will instead be sent a
message like the following:

:irc.whatever.net 404 Wull #ModChan :Cannot send to channel

If NO_MODERATED_NICKCHANGE is undefined, then nick changes will be 
allowed as normal.

Btw - the current 2.10.3 behaviour seems to do a check on whether the
client is banned on any channel. The odd thing about this check is it
seems to have no purpose, and doesn't do anything except waste a little
CPU (unless I'm missing something!). Anyone have any ideas here?

Perhaps someone can build on this patch anyway...

Wull@IRCnet
diff -rcN irc2.10.3/ircd/s_user.c irc2.10.3.nonick/ircd/s_user.c
*** irc2.10.3/ircd/s_user.c	Sat Jul 17 12:47:50 1999
--- irc2.10.3.nonick/ircd/s_user.c	Tue Sep 07 21:56:50 1999
***************
*** 1008,1017 ****
--- 1008,1027 ----
  					   err_str(ERR_RESTRICTED, nick));
  				return 2;
  			    }
+ #ifdef	NO_MODERATED_NICKCHANGE
+ 			for (lp = sptr->user->channel; lp; lp = lp->next)
+ 				if (!IsQuiet(lp->value.chptr) && (can_send(sptr, lp->value.chptr) != 0))
+ 					{
+ 					sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN,
+ 					   parv[0]), lp->value.chptr->chname);
+ 					return 2;
+ 					}
+ #else
  			/* is the user banned on any channel ? */
  			for (lp = sptr->user->channel; lp; lp = lp->next)
  				if (can_send(sptr, lp->value.chptr) ==MODE_BAN)
  					break;
+ #endif
  		}
  		/*
  		** Client just changing his/her nick. If he/she is
diff -rcN irc2.10.3/support/config.h.dist irc2.10.3.nonick/support/config.h.dist
*** irc2.10.3/support/config.h.dist	Sun Jul 11 23:11:18 1999
--- irc2.10.3.nonick/support/config.h.dist	Tue Sep 07 21:52:26 1999
***************
*** 374,379 ****
--- 374,387 ----
   */
  #undef	CLONE_CHECK
  
+ /*
+  * If this is defined, then your clients will find themselves unable to change
+  * nick when they are on one or more channels where they lack the power of
+  * speech.
+  */
+ #define NO_MODERATED_NICKCHANGE 
+ 
+ 
  /*   STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP  */
  /*   STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP  */
  /*   STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP STOP  */