X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands.cpp;h=dc757c80328d8e8acf3bb2fa590a0d582dcb585a;hb=406ab09f22f46a6cee5559e96f0325768188ffa4;hp=edbff1272957ba45149bd28bdbe53a6bb7ab81ae;hpb=e3b0f2a2e8e7abca7f9d2e700d86b11dad27a095;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands.cpp b/src/commands.cpp index edbff1272..dc757c803 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -264,7 +264,6 @@ void handle_kick(char **parameters, int pcnt, userrec *user) } // this must be propogated so that channel membership is kept in step network-wide - char buffer[MAXBUF]; snprintf(buffer,MAXBUF,"k %s %s %s :%s",user->nick,u->nick,Ptr->name,reason); NetSendToAll(buffer); @@ -366,9 +365,11 @@ void handle_kill(char **parameters, int pcnt, userrec *user) log(DEBUG,"kill: %s %s",parameters[0],parameters[1]); if (u) { + log(DEBUG,"into kill mechanism"); int MOD_RESULT = 0; FOREACH_RESULT(OnKill(user,u,parameters[1])); if (MOD_RESULT) { + log(DEBUG,"A module prevented the kill with result %d",MOD_RESULT); return; } @@ -389,14 +390,15 @@ void handle_kill(char **parameters, int pcnt, userrec *user) log(DEBUG,"deleting user hash value %d",iter->second); if ((iter->second) && (user->registered == 7)) { delete iter->second; - } - clientlist.erase(iter); + } + clientlist.erase(iter); } purge_empty_chans(); } else { // local kill + log(DEFAULT,"LOCAL KILL: %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]); WriteTo(user, u, "KILL %s :%s!%s!%s (%s)", u->nick, ServerName,user->dhost,user->nick,parameters[1]); WriteOpers("*** Local Kill by %s: %s!%s@%s (%s)",user->nick,u->nick,u->ident,u->host,parameters[1]); snprintf(killreason,MAXBUF,"Killed (%s (%s))",user->nick,parameters[1]); @@ -570,6 +572,12 @@ void handle_names(char **parameters, int pcnt, userrec *user) { chanrec* c; + if (!pcnt) + { + WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick); + return; + } + if (loop_call(handle_names,parameters,pcnt,user,0,pcnt-1,0)) return; c = FindChan(parameters[0]); @@ -1616,7 +1624,7 @@ void handle_oper(char **parameters, int pcnt, userrec *user) if (!fail2) { WriteServ(user->fd,"491 %s :Invalid oper credentials",user->nick); - WriteOpers("*** WARNING! qFailed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host); + WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!",user->nick,user->ident,user->host); log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.",user->nick,user->ident,user->host); } else @@ -2354,7 +2362,7 @@ void handle_hash(char token,char* params,serverrec* source,serverrec* reply, cha char* create_time = strtok(NULL," "); char* duration = strtok(NULL," :"); char* reason = strtok(NULL,"\r\n"); - add_gline(atoi(duration),who,reason,mask); + add_gline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask); // we must update the creation time on this gline // now that we've added it, or it wont expire at the right time. gline_set_creation_time(mask,atoi(create_time)); @@ -2376,7 +2384,7 @@ void handle_dot(char token,char* params,serverrec* source,serverrec* reply, char char* who = strtok(NULL," "); if (mask) { - if (del_gline(mask)) + if (del_gline((const char*)mask)) { if (who) { @@ -2395,7 +2403,7 @@ void handle_add_sqline(char token,char* params,serverrec* source,serverrec* repl char* create_time = strtok(NULL," "); char* duration = strtok(NULL," :"); char* reason = strtok(NULL,"\r\n"); - add_qline(atoi(duration),who,reason,mask); + add_qline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask); // we must update the creation time on this gline // now that we've added it, or it wont expire at the right time. qline_set_creation_time(mask,atoi(create_time)); @@ -2418,7 +2426,7 @@ void handle_del_sqline(char token,char* params,serverrec* source,serverrec* repl char* who = strtok(NULL," "); if (mask) { - if (del_qline(mask)) + if (del_qline((const char*)mask)) { if (who) { @@ -2437,7 +2445,7 @@ void handle_add_szline(char token,char* params,serverrec* source,serverrec* repl char* create_time = strtok(NULL," "); char* duration = strtok(NULL," :"); char* reason = strtok(NULL,"\r\n"); - add_zline(atoi(duration),who,reason,mask); + add_zline(atoi(duration),(const char*)who,(const char*)reason,(const char*)mask); // we must update the creation time on this gline // now that we've added it, or it wont expire at the right time. zline_set_creation_time(mask,atoi(create_time)); @@ -2460,7 +2468,7 @@ void handle_del_szline(char token,char* params,serverrec* source,serverrec* repl char* who = strtok(NULL," "); if (mask) { - if (del_zline(mask)) + if (del_zline((const char*)mask)) { if (who) { @@ -2751,6 +2759,10 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) { token = '*'; } + if (!strcmp(command,"PING")) + { + token = '*'; + } if (!strcmp(command,"NOTICE")) { snprintf(udp_msg,MAXBUF,"V %s %s",source,data); @@ -3052,6 +3064,8 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) char Link_Pass[1024]; char Link_SendPass[1024]; int LinkPort = 0; + + log(DEBUG,"U-token linked server detected."); // search for a corresponding block in the config files for (int i = 0; i < ConfValueEnum("link",&config_f); i++) @@ -3142,14 +3156,14 @@ void handle_link_packet(char* udp_msg, char* tcp_host, serverrec *serv) } } -long duration(char* str) +long duration(const char* str) { char n_field[MAXBUF]; long total = 0; - char* str_end = str + strlen(str); + const char* str_end = str + strlen(str); n_field[0] = 0; - for (char* i = str; i < str_end; i++) + for (char* i = (char*)str; i < str_end; i++) { // if we have digits, build up a string for the value in n_field, // up to 10 digits in size.