diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-22 13:55:16 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-22 13:55:16 +0000 |
commit | 443016b4f2fccca39755c1d7e33edfe1ec61718f (patch) | |
tree | 1c10cb6363f51f473ba367c4039ac77bd3fad956 /src/commands.cpp | |
parent | c605a319a7502bd930cdc9649115877b51fbcbd8 (diff) |
Added tons of services/uline stuff. DO NOT USE YET! services data isnt replicated across the network!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@688 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands.cpp')
-rw-r--r-- | src/commands.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 41906537e..0e8d5e872 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1256,6 +1256,22 @@ void handle_map(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"007 %s :End of /MAP",user->nick); } +bool is_uline(const char* server) +{ + char ServName[MAXBUF]; + int i,j; + + for (int i = 0; i < ConfValueEnum("uline",&config_f); i++) + { + ConfValue("uline","server",i,ServName,&config_f); + if (!strcasecmp(server,ServName)) + { + return true; + } + } + return false; +} + void handle_oper(char **parameters, int pcnt, userrec *user) { @@ -1277,6 +1293,9 @@ void handle_oper(char **parameters, int pcnt, userrec *user) WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType); WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType); WriteServ(user->fd,"MODE %s :+o",user->nick); + char global[MAXBUF]; + snprintf(global,MAXBUF,"M %s +o",user->nick); + NetSendToAll(global); for (j =0; j < ConfValueEnum("type",&config_f); j++) { ConfValue("type","name",j,TypeName,&config_f); @@ -1471,6 +1490,7 @@ void handle_t(char token,char* params,serverrec* source,serverrec* reply, char* WriteChannelLocal(c,u,"TOPIC %s :%s",c->name,topic); strncpy(c->topic,topic,MAXTOPIC); strncpy(c->setby,u->nick,NICKMAX); + c->topicset = time(NULL); } } @@ -1642,6 +1662,13 @@ void handle_n(char token,char* params,serverrec* source,serverrec* reply, char* if (user) { WriteCommon(user,"NICK %s",newnick); + if (is_uline(tcp_host)) + { + // broadcast this because its a services thingy + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"n %s %s",user->nick,newnick); + NetSendToAll(buffer); + } user = ReHashNick(user->nick, newnick); if (!user) return; if (!user->nick) return; @@ -1664,6 +1691,14 @@ void handle_k(char token,char* params,serverrec* source,serverrec* reply, char* if ((s) && (d) && (c)) { kick_channel(s,d,c,reason); + return; + } + d = Find(channel); + c = FindChan(dest); + if ((s) && (d) && (c)) + { + kick_channel(s,d,c,reason); + return; } } @@ -2136,18 +2171,47 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) strcpy(source,src); strcpy(command,comd); udp_msg = old; + + // unused numeric: + // :services-dev.chatspike.net 433 Craig Craig :Nickname is registered to someone else + if (!strcmp(command,"433")) + { + token = '*'; + } if (!strcmp(command,"NOTICE")) { snprintf(udp_msg,MAXBUF,"V %s %s",source,data); log(DEBUG,"Rewrote NOTICE from services to: '%s'",udp_msg); token = udp_msg[0]; } + if (!strcmp(command,"QUIT")) + { + if (!strcmp(data,":")) + { + strcpy(data,":No reason"); + } + snprintf(udp_msg,MAXBUF,"Q %s %s",source,data); + log(DEBUG,"Rewrote QUIT from services to: '%s'",udp_msg); + token = udp_msg[0]; + } + if (!strcmp(command,"SQUIT")) + { + snprintf(udp_msg,MAXBUF,"& %s",source); + log(DEBUG,"Rewrote SQUIT from services to: '%s'",udp_msg); + token = udp_msg[0]; + } if (!strcmp(command,"SVSMODE")) { snprintf(udp_msg,MAXBUF,"M %s",data); log(DEBUG,"Rewrote SVSMODE from services to: '%s'",udp_msg); token = udp_msg[0]; } + if (!strcmp(command,"SVS2MODE")) + { + snprintf(udp_msg,MAXBUF,"M %s",data); + log(DEBUG,"Rewrote SVSMODE from services to: '%s'",udp_msg); + token = udp_msg[0]; + } // todo: this wont work without u:lines // in give_ops etc allow nick on a u:lined serv to do just about anything if (!strcmp(command,"MODE")) @@ -2156,6 +2220,12 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) log(DEBUG,"Rewrote MODE from services to: '%s'",udp_msg); token = udp_msg[0]; } + if (!strcmp(command,"KICK")) + { + snprintf(udp_msg,MAXBUF,"k %s %s",source,data); + log(DEBUG,"Rewrote KICK from services to: '%s'",udp_msg); + token = udp_msg[0]; + } } |