]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/core/m_nick.c
Add chmode +N, which prevents nickchanges.
[irc/rqf/shadowircd.git] / modules / core / m_nick.c
index 81d5c6b94703018e656795bfc678ea24337ab6fe..eec78faf9d8a75e3ac2a17e9d3ff6cd7b89d6c24 100644 (file)
@@ -108,7 +108,6 @@ static int perform_nickchange_collides(struct Client *, struct Client *,
                                       struct Client *, int, const char **, time_t, const char *);
 
 /* mr_nick()
- *       parv[0] = sender prefix
  *       parv[1] = nickname
  */
 static int
@@ -145,7 +144,7 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
        if(!clean_nick(nick, 1))
        {
                sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME),
-                          me.name, EmptyString(parv[0]) ? "*" : parv[0], parv[1]);
+                          me.name, EmptyString(source_p->name) ? "*" : source_p->name, parv[1]);
                return 0;
        }
 
@@ -175,7 +174,6 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
 }
 
 /* m_nick()
- *     parv[0] = sender prefix
  *     parv[1] = nickname
  */
 static int
@@ -208,7 +206,7 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
        /* check the nickname is ok */
        if(!clean_nick(nick, 1))
        {
-               sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, parv[0], nick);
+               sendto_one(source_p, form_str(ERR_ERRONEUSNICKNAME), me.name, source_p->name, nick);
                return 0;
        }
 
@@ -245,7 +243,7 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
                        change_local_nick(client_p, source_p, nick, 1);
                }
                else
-                       sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, parv[0], nick);
+                       sendto_one(source_p, form_str(ERR_NICKNAMEINUSE), me.name, source_p->name, nick);
 
                return 0;
        }
@@ -258,7 +256,6 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
 /* mc_nick()
  *      
  * server -> server nick change
- *    parv[0] = sender prefix
  *    parv[1] = nickname
  *    parv[2] = TS when nick change
  */
@@ -389,7 +386,7 @@ ms_uid(struct Client *client_p, struct Client *source_p, int parc, const char *p
        {
                char *s = LOCAL_COPY(parv[9]);
                sendto_realops_snomask(SNO_GENERAL, L_ALL, "Long realname from server %s for %s",
-                                    parv[0], parv[1]);
+                                    source_p->name, parv[1]);
                s[REALLEN] = '\0';
                parv[9] = s;
        }
@@ -490,7 +487,7 @@ ms_euid(struct Client *client_p, struct Client *source_p, int parc, const char *
        {
                char *s = LOCAL_COPY(parv[11]);
                sendto_realops_snomask(SNO_GENERAL, L_ALL, "Long realname from server %s for %s",
-                                    parv[0], parv[1]);
+                                    source_p->name, parv[1]);
                s[REALLEN] = '\0';
                parv[11] = s;
        }
@@ -694,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;