diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-10 16:18:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-10 16:18:57 +0000 |
commit | 079c22bed5339d8bccacf3e137f335c4b0b4c951 (patch) | |
tree | 7ba5928569d9e23fe98a12153374f654b91e371d /src | |
parent | d5a06be69d5405b31c140dd7e918125e181c3a2a (diff) |
Added 'n' token for nickchanges
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@503 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index db0546e83..54f9fb524 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -5154,6 +5154,19 @@ void handle_nick(char **parameters, int pcnt, userrec *user) if (user->registered == 7) { WriteCommon(user,"NICK %s",parameters[0]); + + // Q token must go to ALL servers!!! + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"n %s %s",user->nick,parameters[0]); + for (int j = 0; j < 255; j++) + { + if (servers[j] != NULL) + { + me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); + log(DEBUG,"Sent n token"); + } + } + } /* change the nick of the user in the users_hash */ @@ -5783,6 +5796,23 @@ void handle_Q(char token,char* params,serverrec* source,serverrec* reply, char* } } +void handle_n(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) +{ + char* oldnick = strtok(params," "); + char* newnick = strtok(NULL," "); + + userrec* user = Find(oldnick); + + if (!user) + { + WriteCommon(user,"NICK %s",newnick); + user = ReHashNick(user->nick, newnick); + if (!user) return; + if (!user->nick) return; + strncpy(user->nick, newnick,NICKMAX); + log(DEBUG,"new nick set: %s",user->nick); + } +} void handle_N(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) { @@ -5908,6 +5938,13 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve case 'N': handle_N(token,params,source,reply,udp_host,udp_port); break; + // n <NICK> <NEWNICK> + // change nickname of client -- a server should only be able to + // change the nicknames of clients that reside on it unless + // they are ulined. + case 'n': + handle_n(token,params,source,reply,udp_host,udp_port); + break; // J <NICK> <CHANLIST> // Join user to channel list, merge channel permissions case 'J': |