X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands.cpp;h=610b694bc31a8d033b491d4e1c73d3d5f6029ddc;hb=db11f2b24c6aeb5ab7ba4678638890bc68b1d0c1;hp=9bafb9da9cdadd11bb1b44ec1d8221a6f9e78b06;hpb=76204b5c8415fb5f9c563ef1eda9b80e63c01b23;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands.cpp b/src/commands.cpp index 9bafb9da9..610b694bc 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1292,6 +1292,7 @@ void handle_modules(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"900 %s :%s",user->nick,CleanFilename(modulename)); } } + WriteServ(user->fd,"901 %s :End of MODULES list",user->nick); } void handle_stats(char **parameters, int pcnt, userrec *user) @@ -1538,39 +1539,53 @@ void handle_squit(char **parameters, int pcnt, userrec *user) } else { + if (!strcasecmp("*",parameters[0])) + { + WriteServ(user->fd,"NOTICE %s :*** You cannot issue an SQUIT this wide! If this is REALLY what you want, use a less wide mask.",user->nick); + WriteOpers("*** WARNING! %s tried to SQUIT all servers at once!",user->nick); + return; + } if (!strcasecmp(ServerName,parameters[0])) { WriteServ(user->fd,"NOTICE %s :*** To take the local server out of the mesh, just use /SQUIT with no parameters instead.",user->nick); return; } - bool have_this_server = false; - for (int j = 0; j < 32; j++) - { - if (me[j] != NULL) - { - for (int x = 0; x < me[j]->connectors.size(); x++) - { - if (!strcasecmp(me[j]->connectors[x].GetServerName().c_str(),parameters[0])) - { - // found a valid ircd_connector. - have_this_server = true; - break; - } - } - } - } - if (have_this_server) - { - WriteOpers("SQUIT command issued by %s to remove %s from the mesh",user->nick,parameters[0]); - WriteServ(user->fd,"NOTICE %s :*** Removing remote server %s.",user->nick,parameters[0]); - char buffer[MAXBUF]; - snprintf(buffer,MAXBUF,"& %s",parameters[0]); - NetSendToAll(buffer); - DoSplit(parameters[0]); + bool have_this_server = true; + int n_count = 0; + std::string server_to_squit = ""; + while (have_this_server) + { + have_this_server = false; + for (int j = 0; j < 32; j++) + { + if (me[j] != NULL) + { + for (int x = 0; x < me[j]->connectors.size(); x++) + { + if (match(me[j]->connectors[x].GetServerName().c_str(),parameters[0])) + { + // found a valid ircd_connector. + have_this_server = true; + server_to_squit = me[j]->connectors[x].GetServerName().c_str(); + break; + } + } + } + } + if (have_this_server) + { + WriteOpers("SQUIT command issued by %s to remove %s from the mesh",user->nick,server_to_squit.c_str()); + WriteServ(user->fd,"NOTICE %s :*** Removing remote server %s.",user->nick,server_to_squit.c_str()); + char buffer[MAXBUF]; + snprintf(buffer,MAXBUF,"& %s",server_to_squit.c_str()); + NetSendToAll(buffer); + DoSplit(server_to_squit.c_str()); + n_count++; + } } - else + if (!n_count) { - WriteServ(user->fd,"NOTICE %s :*** No such server exists in the mesh.",user->nick); + WriteServ(user->fd,"402 %s %s :Your pattern did not match any servers.",user->nick,parameters[0]); } } } @@ -1848,18 +1863,25 @@ void handle_V(char token,char* params,serverrec* source,serverrec* reply, char* userrec* user = Find(src); if (user) { - userrec* dst = Find(dest); - - if (dst) + // notice all - only issuable by a server + if (strcmp(dest,"*")) { - WriteTo(user, dst, "NOTICE %s :%s", dst->nick, text); + NoticeAll(user,true,"%s",text); } else { - chanrec* d = FindChan(dest); - if (d) + userrec* dst = Find(dest); + if (dst) + { + WriteTo(user, dst, "NOTICE %s :%s", dst->nick, text); + } + else { - ChanExceptSender(d, user, "NOTICE %s :%s", d->name, text); + chanrec* d = FindChan(dest); + if (d) + { + ChanExceptSender(d, user, "NOTICE %s :%s", d->name, text); + } } } }