diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-11 12:15:11 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-11 12:15:11 +0000 |
commit | e4694e467513a7d4d298e55027e58bf9a7917958 (patch) | |
tree | f63fdf9bee5aeca2f58cf2f9d11422fe8858ee6c | |
parent | a1f682a211c3a073143d4ece7a2ea915a5ff089b (diff) |
Oops, add special-case for user killing themselves (their userrec is gone when the function returns)
Also put checks in LoopCall to check that the user didnt vanish half way through the comma seperated list, if they did, abort at that element of the list.
This means if your nick is 'a' and you do "/kill b,c,a,f,g die" only you, b and c will be removed from irc. (this is to be expected, really)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5684 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_kill.cpp | 3 | ||||
-rw-r--r-- | src/command_parse.cpp | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index fb5dba245..e2a8d8824 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -88,6 +88,9 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) ServerInstance->SNO->WriteToSnoMask('k',"Local Kill by %s: %s!%s@%s (%s)", user->nick, u->nick, u->ident, u->host, parameters[1]); snprintf(killreason,MAXQUIT,"Killed (%s (%s))", user->nick, parameters[1]); userrec::QuitUser(ServerInstance, u, killreason); + + if (u == user) + return CMD_USER_DELETED; } } else diff --git a/src/command_parse.cpp b/src/command_parse.cpp index b67b269d2..0abfc5b04 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -241,7 +241,8 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p new_parameters[splithere] = item.c_str(); new_parameters[extra] = extrastuff.c_str(); - CommandObj->Handle(new_parameters,pcnt,user); + if (CommandObj->Handle(new_parameters,pcnt,user) == CMD_USER_DELETED) + return 1; dupes[item.c_str()] = true; } @@ -281,7 +282,13 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p new_parameters[splithere] = item.c_str(); parameters[splithere] = item.c_str(); - CommandObj->Handle(new_parameters,pcnt,user); + + /* Execute the command handler over and over. If someone pulls our user + * record out from under us (e.g. if we /kill a comma sep list, and we're + * in that list ourselves) abort if we're gone. + */ + if (CommandObj->Handle(new_parameters,pcnt,user) == CMD_USER_DELETED) + return 1; dupes[item.c_str()] = true; } |