From 642b665fb0967dc9dcbaed5f54b52276ea230e12 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 12 Apr 2004 12:54:51 +0000 Subject: Added 'a' amd 'b' server link tokens (change gecos, change host) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@562 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index bd0198e5f..3929138d6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -949,6 +949,42 @@ void WriteMode(const char* modes, int flags, const char* text, ...) } } +void ChangeName(userrec* user, const char* gecos) +{ + strncpy(user->fullname,gecos,MAXBUF); + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"a %s :%s",user->nick,gecos); + for (int j = 0; j < 255; j++) + { + if (servers[j] != NULL) + { + if (strcmp(servers[j]->name,ServerName)) + { + me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); + log(DEBUG,"Sent a token"); + } + } + } +} + +void ChangeDisplayedHost(userrec* user, const char* host) +{ + strncpy(user->dhost,host,160); + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"b %s :%s",user->nick,host); + for (int j = 0; j < 255; j++) + { + if (servers[j] != NULL) + { + if (strcmp(servers[j]->name,ServerName)) + { + me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); + log(DEBUG,"Sent b token"); + } + } + } +} + void WriteWallOps(userrec *source, bool local_only, char* text, ...) { if ((!text) || (!source)) @@ -6443,6 +6479,29 @@ void handle_F(char token,char* params,serverrec* source,serverrec* reply, char* WriteOpers("TS split for %s -> %s: %d",source->name,reply->name,tdiff); } +void handle_a(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) +{ + char* nick = strtok(params," :"); + char* gecos = strtok(NULL,"\r\n"); + + userrec* user = Find(nick); + + if (user) + strncpy(user->fullname,gecos,MAXBUF); +} + +void handle_b(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) +{ + char* nick = strtok(params," :"); + char* host = strtok(NULL,"\r\n"); + + userrec* user = Find(nick); + + if (user) + strncpy(user->dhost,host,160); +} + + void handle_J(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) { // IMPORTANT NOTE @@ -6523,6 +6582,16 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve case 'N': handle_N(token,params,source,reply,udp_host,udp_port); break; + // a : + // change GECOS (SETNAME) + case 'a': + handle_a(token,params,source,reply,udp_host,udp_port); + break; + // b : + // change displayed host (SETHOST) + case 'b': + handle_b(token,params,source,reply,udp_host,udp_port); + break; // t : // change a channel topic case 't': -- cgit v1.2.3