Author: Jan Krueger <jast@heapsort.de> (by way of Kev <klmitch@mit.edu>)
[ircu2.10.12-pk.git] / ircd / m_kill.c
index 1a47c9bff00e5744dea157390da94619f4044bf4..9c4f0e02673e5d09d02909cf4807386f1428c9a4 100644 (file)
@@ -84,8 +84,8 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_features.h"
 #include "ircd_log.h"
-#include "ircd_policy.h"
 #include "ircd_reply.h"
 #include "ircd_snprintf.h"
 #include "ircd_string.h"
@@ -96,7 +96,7 @@
 #include "send.h"
 #include "whowas.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <string.h>
 
 /*
  *
  */
 static int do_kill(struct Client* cptr, struct Client* sptr,
-                  struct Client* victim, char* inpath, char* path, char *msg)
+                  struct Client* victim, char* inpath, char* path, charmsg)
 {
   assert(0 != cptr);
   assert(0 != sptr);
-  assert(IsUser(victim));
+  assert(!IsServer(victim));
 
   /*
    * Notify all *local* opers about the KILL (this includes the one
@@ -135,11 +135,11 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
                           inpath, path, msg);
 
     /*
-     * Set FLAGS_KILLED. This prevents exit_one_client from sending
+     * Set FLAG_KILLED. This prevents exit_one_client from sending
      * the unnecessary QUIT for this. (This flag should never be
      * set in any other place)
      */
-    cli_flags(victim) |= FLAGS_KILLED;
+    SetFlag(victim, FLAG_KILLED);
   }
 
   /*
@@ -150,23 +150,19 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
    * In accordance with the new hiding rules, the victim
    * always sees the kill as coming from me.
    */
-#ifdef HEAD_IN_SAND_KILLWHO
   if (MyConnect(victim))
-    sendcmdto_one(&me, CMD_KILL, victim, "%C :%s %s", victim,
-                  HEAD_IN_SAND_SERVERNAME, msg);
-  return exit_client_msg(cptr, victim, &me, "Killed (%s %s)",
-                        HEAD_IN_SAND_SERVERNAME, msg);
-#else
-  if (MyConnect(victim))
-    sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s %s", victim,
-                  cli_name(sptr), msg);
-  return exit_client_msg(cptr, victim, sptr, "Killed (%s %s)", cli_name(sptr),
+    sendcmdto_one(feature_bool(FEAT_HIS_KILLWHO) ? &his : sptr, CMD_KILL,
+                 victim, "%C :%s %s", victim, feature_bool(FEAT_HIS_KILLWHO)
+                 ? feature_str(FEAT_HIS_SERVERNAME) : cli_name(sptr), msg);
+  return exit_client_msg(cptr, victim, feature_bool(FEAT_HIS_KILLWHO)
+                        ? &me : sptr, "Killed (%s %s)",
+                        feature_bool(FEAT_HIS_KILLWHO) ?
+                        feature_str(FEAT_HIS_SERVERNAME) : cli_name(sptr),
                         msg);
-#endif
 }
 
 /*
- * ms_kill - server message handler template
+ * ms_kill - server message handler
  *
  * NOTE: IsServer(cptr) == true;
  *
@@ -231,7 +227,7 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 }
 
 /*
- * mo_kill - oper message handler template
+ * mo_kill - oper message handler
  *
  * NOTE: IsPrivileged(sptr), IsAnOper(sptr) == true
  *       IsServer(cptr), IsServer(sptr) == false
@@ -262,7 +258,7 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   if (!(victim = FindClient(user))) {
     /*
-     * If the user has recently changed nick, we automaticly
+     * If the user has recently changed nick, we automatically
      * rewrite the KILL for this new nickname--this keeps
      * servers in synch when nick change and kill collide
      */
@@ -286,7 +282,7 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
 
   if (!MyConnect(victim) && !HasPriv(sptr, PRIV_KILL)) {
-    sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Nick %s isnt on your server",
+    sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Nick %s isn't on your server",
                  sptr, cli_name(victim));
     return 0;
   }