diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/InspIRCd.layout | 34 | ||||
-rw-r--r-- | src/commands.cpp | 70 | ||||
-rw-r--r-- | src/inspircd.cpp | 2 | ||||
-rw-r--r-- | src/inspircd_io.cpp | 6 | ||||
-rw-r--r-- | src/mode.cpp | 24 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
6 files changed, 102 insertions, 36 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout index 487179601..227c6af8f 100644 --- a/src/InspIRCd.layout +++ b/src/InspIRCd.layout @@ -13,9 +13,9 @@ LeftChar=1 [Editor_1] Open=1 Top=0 -CursorCol=2 -CursorRow=845 -TopLine=833 +CursorCol=99 +CursorRow=1570 +TopLine=1552 LeftChar=1 [Editor_2] @@ -204,8 +204,8 @@ LeftChar=1 [Editor_25] Open=1 Top=0 -CursorCol=6 -CursorRow=10 +CursorCol=4 +CursorRow=39 TopLine=1 LeftChar=1 [Editor_26] @@ -302,8 +302,8 @@ LeftChar=1 [Editor_39] Open=1 Top=0 -CursorCol=11 -CursorRow=245 +CursorCol=16 +CursorRow=263 TopLine=220 LeftChar=1 [Editor_40] @@ -323,21 +323,21 @@ LeftChar=1 [Editor_42] Open=1 Top=0 -CursorCol=21 -CursorRow=36 -TopLine=16 +CursorCol=4 +CursorRow=1729 +TopLine=1685 LeftChar=1 [Editor_43] Open=1 Top=1 -CursorCol=22 -CursorRow=2152 -TopLine=2109 +CursorCol=3 +CursorRow=2166 +TopLine=2146 LeftChar=1 [Editor_44] -Open=0 +Open=1 Top=0 -CursorCol=89 -CursorRow=89 -TopLine=32 +CursorCol=4 +CursorRow=92 +TopLine=40 LeftChar=1 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]; + } } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index c31464733..f55a6f1b6 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1567,7 +1567,7 @@ void kick_channel(userrec *src,userrec *user, chanrec *Ptr, char* reason) WriteServ(src->fd,"441 %s %s %s :They are not on that channel",src->nick, user->nick, Ptr->name); return; } - if ((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) + if (((cstatus(src,Ptr) < STATUS_HOP) || (cstatus(src,Ptr) < cstatus(user,Ptr))) && (!is_uline(src->server))) { if (cstatus(src,Ptr) == STATUS_HOP) { diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index b9e7fa40b..b267e98ca 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -331,7 +331,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in const char* buf = config->str().c_str(); long bptr = 0; long len = strlen(buf); - log(DEBUG,"Data length: %d",len); ptr = 0; in_token = 0; @@ -378,7 +377,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in { /* value not found in tag */ strcpy(result,""); - log(DEBUG,"ReadConf: value '%s' was not found in tag",var); return 0; } else @@ -390,7 +388,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in { /* missing quote */ strcpy(result,""); - log(DEBUG,"ReadConf: possible missing quote!"); return 0; } key++; @@ -404,7 +401,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in } } strcpy(result,key); - log(DEBUG,"ReadConf: Got value '%s'",result); return 1; } } @@ -412,7 +408,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in } if (!strcmp(c_tag,tag)) { - log(DEBUG,"Tag name correct but index value incorrect"); /* correct tag, but wrong index */ idx++; } @@ -430,7 +425,6 @@ int ReadConf(std::stringstream *config, const char* tag, const char* var, int in } } } - log(DEBUG,"ReadConf: neither value '%s' or tag '%s' were found at all!",var,tag); strcpy(result,""); // value or its tag not found at all return 0; } diff --git a/src/mode.cpp b/src/mode.cpp index 3458cab28..38756ffcf 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -32,6 +32,7 @@ #include "dynamic.h" #include "wildcard.h" #include "message.h" +#include "commands.h" using namespace std; @@ -64,7 +65,7 @@ int give_ops(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** give_ops was given an invalid parameter"); return 0; } - if (status < STATUS_OP) + if ((status < STATUS_OP) && (!is_uline(user->server))) { log(DEBUG,"%s cant give ops to %s because they nave status %d and needs %d",user->nick,dest,status,STATUS_OP); WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name); @@ -119,7 +120,7 @@ int give_hops(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** give_hops was given an invalid parameter"); return 0; } - if (status != STATUS_OP) + if ((status < STATUS_OP) && (!is_uline(user->server))) { WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name); return 0; @@ -169,7 +170,7 @@ int give_voice(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** give_voice was given an invalid parameter"); return 0; } - if (status < STATUS_HOP) + if ((status < STATUS_HOP) && (!is_uline(user->server))) { WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, chan->name); return 0; @@ -219,7 +220,7 @@ int take_ops(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** take_ops was given an invalid parameter"); return 0; } - if (status < STATUS_OP) + if ((status < STATUS_OP) && (!is_uline(user->server))) { log(DEBUG,"%s cant give ops to %s because they have status %d and needs %d",user->nick,dest,status,STATUS_OP); WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name); @@ -273,7 +274,7 @@ int take_hops(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** take_hops was given an invalid parameter"); return 0; } - if (status != STATUS_OP) + if ((status < STATUS_OP) && (!is_uline(user->server))) { WriteServ(user->fd,"482 %s %s :You're not a channel operator",user->nick, chan->name); return 0; @@ -323,7 +324,7 @@ int take_voice(userrec *user,char *dest,chanrec *chan,int status) log(DEFAULT,"*** BUG *** take_voice was given an invalid parameter"); return 0; } - if (status < STATUS_HOP) + if ((status < STATUS_HOP) && (!is_uline(user->server))) { WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, chan->name); return 0; @@ -1723,12 +1724,15 @@ void merge_mode2(char **parameters, int pcnt, userrec* user) Ptr = FindChan(parameters[0]); if (Ptr) { - if ((cstatus(user,Ptr) < STATUS_HOP) && (Ptr)) + log(DEBUG,"merge_mode2: found channel %s",Ptr->name); + if (Ptr) { - return; + if ((cstatus(user,Ptr) < STATUS_HOP) && (!is_uline(user->server))) + { + return; + } + process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true); } - - process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,true); } } diff --git a/src/modules.cpp b/src/modules.cpp index ca3c2e423..59833b6bd 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -355,14 +355,12 @@ ConfigReader::ConfigReader(std::string filename) std::string ConfigReader::ReadValue(std::string tag, std::string name, int index) { - log(DEBUG,"ConfigReader::ReadValue '%s' '%s' %d",tag.c_str(),name.c_str(),index); char val[MAXBUF]; char t[MAXBUF]; char n[MAXBUF]; strncpy(t,tag.c_str(),MAXBUF); strncpy(n,name.c_str(),MAXBUF); ReadConf(cache,t,n,index,val); - log(DEBUG,"ConfigReader::ReadValue read '%s'",val); return std::string(val); } |