diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-28 20:18:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-28 20:18:10 +0000 |
commit | ceb22bce3d8a04e7951dd2e4fbb52f37135c3708 (patch) | |
tree | 8291b30df7bb72409d77d76fcf9648339a7955e3 /src/commands.cpp | |
parent | 76204b5c8415fb5f9c563ef1eda9b80e63c01b23 (diff) |
Added support for /SQUIT <mask> and checks against /SQUIT *
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1249 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands.cpp')
-rw-r--r-- | src/commands.cpp | 64 |
1 files changed, 38 insertions, 26 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 9bafb9da9..00ee9a20f 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1538,39 +1538,51 @@ 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; + 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; + 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]); + 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]); } } } |