summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd_kill.cpp3
-rw-r--r--src/command_parse.cpp11
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;
}