diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 13:08:31 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-11 13:08:31 +0000 |
commit | c12034634020cac5c17b6845613c2c168d174d3d (patch) | |
tree | 7c2cb55433c3cde9ca6daabb12d6a43f779cd38b /src | |
parent | ec8a311cccb90f1397dca47c200300678a4e36aa (diff) |
Added 'i' and 't' type link datagrams
Fixed /mode #channel +b glitch
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@521 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.layout | 42 | ||||
-rw-r--r-- | src/inspircd.cpp | 127 | ||||
-rw-r--r-- | src/modules.cpp | 5 |
3 files changed, 141 insertions, 33 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 001dbf33f..20f417d4d 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -1,5 +1,5 @@ [Editors] -Focused=1 +Focused=-1 Order=1,2,-1,4,6,3,7,25,5 [Editor_0] @@ -12,10 +12,10 @@ LeftChar=1 [Editor_1] Open=1 -Top=1 -CursorCol=53 -CursorRow=1768 -TopLine=1725 +Top=0 +CursorCol=25 +CursorRow=5168 +TopLine=5141 LeftChar=1 [Editor_2] @@ -37,9 +37,9 @@ LeftChar=1 [Editor_4] Open=1 Top=0 -CursorCol=60 -CursorRow=164 -TopLine=133 +CursorCol=57 +CursorRow=180 +TopLine=145 LeftChar=1 [Editor_5] @@ -83,11 +83,11 @@ TopLine=1 LeftChar=1 [Editor_10] -Open=0 +Open=1 Top=0 CursorCol=31 CursorRow=75 -TopLine=37 +TopLine=94 LeftChar=1 [Editor_11] @@ -115,10 +115,10 @@ TopLine=18 LeftChar=1 [Editor_14] -Open=0 -Top=0 +Open=1 +Top=1 CursorCol=1 -CursorRow=23 +CursorRow=45 TopLine=1 LeftChar=1 @@ -141,9 +141,9 @@ LeftChar=1 [Editor_17] Open=1 Top=0 -CursorCol=86 -CursorRow=111 -TopLine=60 +CursorCol=25 +CursorRow=115 +TopLine=62 LeftChar=1 [Editor_18] @@ -165,9 +165,9 @@ LeftChar=1 [Editor_20] Open=1 Top=0 -CursorCol=20 -CursorRow=517 -TopLine=472 +CursorCol=36 +CursorRow=471 +TopLine=425 LeftChar=1 [Editor_21] @@ -246,8 +246,8 @@ LeftChar=4 [Editor_31] Open=1 Top=0 -CursorCol=22 -CursorRow=32 +CursorCol=2 +CursorRow=40 TopLine=8 LeftChar=1 [Editor_32] diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 7ef71ff3a..a6cd98139 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2988,6 +2988,7 @@ void handle_mode(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"367 %s %s %s %s %d",user->nick, Ptr->name, i->data, i->set_by, i->set_time); } WriteServ(user->fd,"368 %s %s :End of channel ban list",user->nick, Ptr->name); + return; } } @@ -4024,6 +4025,21 @@ void handle_invite(char **parameters, int pcnt, userrec *user) u->InviteTo(c->name); WriteFrom(u->fd,user,"INVITE %s :%s",u->nick,c->name); WriteServ(user->fd,"341 %s %s %s",user->nick,u->nick,c->name); + + // i token must go to ALL servers!!! + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"i %s %s %s",u->nick,user->nick,c->name); + 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 i token"); + } + } + } } void handle_topic(char **parameters, int pcnt, userrec *user) @@ -4078,6 +4094,21 @@ void handle_topic(char **parameters, int pcnt, userrec *user) strcpy(Ptr->setby,user->nick); Ptr->topicset = time(NULL); WriteChannel(Ptr,user,"TOPIC %s :%s",Ptr->name, Ptr->topic); + + // t token must go to ALL servers!!! + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"t %s %s :%s",user->nick,Ptr->name,topic); + 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 t token"); + } + } + } } else { @@ -4644,6 +4675,20 @@ void handle_whois(char **parameters, int pcnt, userrec *user) } } +void send_network_quit(const char* nick, const char* reason) +{ + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"Q %s :%s",nick,reason); + 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 Q token"); + } + } +} + void handle_quit(char **parameters, int pcnt, userrec *user) { user_hash::iterator iter = clientlist.find(user->nick); @@ -4675,12 +4720,9 @@ void handle_quit(char **parameters, int pcnt, userrec *user) { if (servers[j] != NULL) { - if (CommonOnThisServer(user,servers[j]->name)) - { - me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); - log(DEBUG,"Sent Q token"); - } - } + me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); + log(DEBUG,"Sent Q token"); + } } } else @@ -4695,12 +4737,9 @@ void handle_quit(char **parameters, int pcnt, userrec *user) { if (servers[j] != NULL) { - if (CommonOnThisServer(user,servers[j]->name)) - { - me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); - log(DEBUG,"Sent Q token"); - } - } + me[defaultRoute]->SendPacket(buffer,servers[j]->internal_addr,servers[j]->internal_port,MyKey); + log(DEBUG,"Sent Q token"); + } } } FOREACH_MOD OnUserQuit(user); @@ -5146,6 +5185,28 @@ void handle_modules(char **parameters, int pcnt, userrec *user) } } +// calls a handler function for a command + +void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user) +{ + for (int i = 0; i < cmdlist.size(); i++) + { + if (!strcasecmp(cmdlist[i].command,commandname)) + { + if (cmdlist[i].handler_function) + { + if (pcnt>=cmdlist[i].min_params) + { + if (strchr(user->modes,cmdlist[i].flags_needed)) + { + cmdlist[i].handler_function(parameters,pcnt,user); + } + } + } + } + } +} + void handle_stats(char **parameters, int pcnt, userrec *user) { if (pcnt != 1) @@ -6001,6 +6062,37 @@ void handle_P(char token,char* params,serverrec* source,serverrec* reply, char* } +void handle_i(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) +{ + char* nick = strtok(params," "); + char* from = strtok(params," "); + char* channel = strtok(NULL," "); + userrec* u = Find(nick); + userrec* user = Find(from); + chanrec* c = FindChan(channel); + if ((c) && (u) && (user)) + { + u->InviteTo(c->name); + WriteFrom(u->fd,user,"INVITE %s :%s",u->nick,c->name); + } +} + +void handle_t(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) +{ + char* setby = strtok(params," "); + char* channel = strtok(NULL," :"); + char* topic = strtok(NULL,"\r\n"); + topic++; + userrec* u = Find(setby); + chanrec* c = FindChan(channel); + if ((c) && (u)) + { + WriteChannelLocal(c,u,"TOPIC %s :%s",c->name,topic); + strncpy(c->topic,topic,MAXTOPIC); + strncpy(c->setby,u->nick,NICKMAX); + } +} + void handle_T(char token,char* params,serverrec* source,serverrec* reply, char* udp_host,int udp_port) { @@ -6296,7 +6388,18 @@ void process_restricted_commands(char token,char* params,serverrec* source,serve case 'N': handle_N(token,params,source,reply,udp_host,udp_port); break; + // t <NICK> <CHANNEL> :<TOPIC> + // change a channel topic + case 't': + handle_t(token,params,source,reply,udp_host,udp_port); + break; + // i <NICK> <CHANNEL> + // invite a user to a channel + case 'i': + handle_i(token,params,source,reply,udp_host,udp_port); + break; // k <SOURCE> <DEST> <CHANNEL> :<REASON> + // kick a user from a channel case 'k': handle_k(token,params,source,reply,udp_host,udp_port); break; diff --git a/src/modules.cpp b/src/modules.cpp index d2c3f21f9..548f6fdcb 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -171,9 +171,14 @@ void Server::ChangeUserNick(userrec* user, std::string nickname) void Server::QuitUser(userrec* user, std::string reason) { + send_network_quit(user->nick,reason.c_str()); kill_link(user,reason.c_str()); } +void Server::CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user) +{ + call_handler(commandname.c_str(),parameters,pcnt,user); +} void Server::Log(int level, std::string s) { |