]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Add chmode +N, which prevents nickchanges.
authorB.Greenham <redacted>
Thu, 25 Feb 2010 06:14:38 +0000 (01:14 -0500)
committerB.Greenham <redacted>
Thu, 25 Feb 2010 06:14:38 +0000 (01:14 -0500)
help/opers/cmode
include/channel.h
include/numeric.h
modules/core/m_nick.c
src/channel.c
src/chmode.c
src/messages.tab

index 751c1a08d4372900ab932570ab044779858338ef..0bef5f697e8871815c61028bbc9ae9c05593a79f 100644 (file)
@@ -33,6 +33,8 @@ NO PARAMETERS:
      +T     - Disable notice. All notices to the channel are disallowed.
      +E     - No kicks. Chanops will not be able to use /kick on this
               channel.
+     +N     - No nickchanges. People on the channel will not be able to
+              change nick.
 
 WITH PARAMETERS:
      +f     - Forward.  Forwards users who cannot join because of +i,
index 4939ff96da8dbe25226835fad66c5aa680f550b8..c7a6ecf3bc7cc70c5d31045b16b358b0b05f7021 100644 (file)
@@ -175,6 +175,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
 #define MODE_NONOTICE  0x16000 /* Block notices directed to this channel */
 #define MODE_NOACTION  0x32000 /* Block CTCP ACTION directed to this channel */
 #define MODE_NOKICK    0x64000 /* Disable /kick on this channel */
+#define MODE_NONICK    0x128000 /* Disable /nick for anyone on this channel */
 
 #define CHFL_BAN        0x10000000     /* ban channel flag */
 #define CHFL_EXCEPTION  0x20000000     /* exception to ban channel flag */
@@ -243,6 +244,8 @@ const char *channel_modes(struct Channel *chptr, struct Client *who);
 
 extern struct Channel *find_bannickchange_channel(struct Client *client_p);
 
+extern struct Channel *find_nonickchange_channel(struct Client *client_p);
+
 extern void check_spambot_warning(struct Client *source_p, const char *name);
 
 extern void check_splitmode(void *);
index e8cc0f24842100435c916958b0b135ba5f4d8443..3b9f30f30dabd2bc00484828aa778bb1cd65f489 100644 (file)
@@ -264,6 +264,8 @@ extern const char *form_str(int);
 
 #define ERR_NOINVITE        447
 
+#define ERR_NONICK          449
+
 #define ERR_NOTREGISTERED    451
 
 #define ERR_ACCEPTFULL       456
index 4deeed60594615e77bd4d85fd8a5fd3c964426fd..eec78faf9d8a75e3ac2a17e9d3ff6cd7b89d6c24 100644 (file)
@@ -691,6 +691,16 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
                                        nick, chptr->chname);
                        return;
                }
+
+               chptr = find_nonickchange_channel(source_p);
+               if (chptr != NULL)
+               {
+                       sendto_one_numeric(source_p, ERR_NONICK,
+                                       form_str(ERR_NONICK),
+                                       chptr->chname);
+                       return;
+               }
+
                if((source_p->localClient->last_nick_change + ConfigFileEntry.max_nick_time) < rb_current_time())
                        source_p->localClient->number_of_nick_changes = 0;
 
index 9134b57783d52941f84b14dcb6c2d8a60c9e0384..1e35f3d8f8ae97302eef6ea20ed08859088ab0b5 100644 (file)
@@ -904,6 +904,32 @@ find_bannickchange_channel(struct Client *client_p)
        return NULL;
 }
 
+/* find_nonickchange_channel()
+ * Input: client to check
+ * Output: channel preventing nick change
+ */
+struct Channel *
+find_nonickchange_channel(struct Client *client_p)
+{
+       struct Channel *chptr;
+       struct membership *msptr;
+       rb_dlink_node *ptr;
+
+       if (!MyClient(client_p))
+               return NULL;
+
+       RB_DLINK_FOREACH(ptr, client_p->user->channel.head)
+       {
+               msptr = ptr->data;
+               chptr = msptr->chptr;
+               if (is_chanop_voiced(msptr))
+                       continue;               
+               if (chptr->mode.mode & MODE_NONICK)
+                       return chptr;
+       }
+       return NULL;
+}
+
 /* void check_spambot_warning(struct Client *source_p)
  * Input: Client to check, channel name or NULL if this is a part.
  * Output: none
index a1fbbce8941686bf7b75b112d14e0067270832e9..49c570468eabe835a335c75e0ac90e7eee89e44f 100644 (file)
@@ -1410,7 +1410,7 @@ struct ChannelMode chmode_table[256] =
   {chm_nosuch, 0 },                    /* K */
   {chm_staff,  MODE_EXLIMIT },         /* L */
   {chm_nosuch, 0 },                    /* M */
-  {chm_nosuch, 0 },                    /* N */
+  {chm_simple, MODE_NONICK },          /* N */
   {chm_nosuch, 0 },                    /* O */
   {chm_staff,  MODE_PERMANENT },       /* P */
   {chm_simple, MODE_DISFORWARD },      /* Q */
index c24ebd25de271a082ce7bcfead18816d238e5b1a..2ce93991ad9d4edce4d0475c3291edb2303932fa 100644 (file)
@@ -470,7 +470,7 @@ static  const char *  replies[] = {
 /* 446 ERR_USERSDISABLED, */   NULL,
 /* 447 ERR_NOINVITE */         ":Can't send invite to %s (+V set)",
 /* 448 */       NULL,
-/* 449 */       NULL,
+/* 449 ERR_NONICK */           "%s :Cannot change nickname while on channel (+N set)",
 /* 450 */       NULL,
 /* 451 ERR_NOTREGISTERED, */    ":%s 451 * :You have not registered",
 /* 452 */       NULL,