Author: Ghostwolf <foxxe@wtfs.net>
authorJoseph Bongaarts <foxxe@wtfs.net>
Mon, 18 Feb 2002 09:23:57 +0000 (09:23 +0000)
committerJoseph Bongaarts <foxxe@wtfs.net>
Mon, 18 Feb 2002 09:23:57 +0000 (09:23 +0000)
Log message:
Some cleanup and bug fixes. Added HEAD_IN_SAND_KILLWHO.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@642 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/ircd_policy.h
ircd/m_kill.c

index 2a2096052bd7f21688885daa1581ce980d6c3ea2..197a1342f65e5650358a525b519480c1a13ac70f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 2002-02-18 Joseph Bongaarts <foxxe@wtfs.net>
 
        * ircd/m_kill.c: Changed m_kill() to do_kill() because its not
-       a message handler.
+       a message handler, and some general cleanups and bug fixes. 
+
+       * include/ircd_policy.h: Added HEAD_IN_SAND_KILLWHO for hiding
+       kill source.
        
 2002-02-16  Tim Vogelsang <net@astrolink.org>
 
index ea9abca39b79f56e12250267d198fcf8f1bf649d..a3833b3022e548cdc9bf0facedd9cf310553ecee 100644 (file)
 /* don't show which server set a ban */
 #define HEAD_IN_SAND_BANWHO
 
+/* Don't show which server or oper performed a kill */
+#define HEAD_IN_SAND_KILLWHO
+
 /* remap remote numerics to come from the local server */
 #define HEAD_IN_SAND_REWRITE
 
index 2d12e9d10013b8eda2527e82b743aa8e48ff1acc..f51be2e720e5f1f86a07b59c2e45d2aa03e1b8b7 100644 (file)
@@ -118,20 +118,11 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
      if (!(comment = strchr(path, ' ')))
        comment = "No reason supplied";
      else
-       *comment++; /* Remove first character (space) */
-  }
-  else {
-    /*
-     * Do not allow operator specified reasons to exceed TOPICLEN.
-     */
-    if (strlen(path) > TOPICLEN)
-      path[TOPICLEN] = '\0';
-    comment = path;
+       comment++; /* Remove first character (space) */
   }
 
-#ifdef HEAD_IN_SAND_SERVERNAME
-  ircd_snprintf(0, buf, sizeof(buf), "%s (%s)", IsServer(sptr) ?
-                HEAD_IN_SAND_SERVERNAME : cli_name(sptr), comment);
+#ifdef HEAD_IN_SAND_KILLWHO
+  ircd_snprintf(0, buf, sizeof(buf), "%s (%s)", HEAD_IN_SAND_SERVERNAME, comment);
 #else
   ircd_snprintf(0, buf, sizeof(buf), "%s (%s)", cli_name(sptr),
                 comment);
@@ -172,37 +163,23 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
     cli_flags(victim) |= FLAGS_KILLED;
   }
 
+  /*
+   * Tell the victim she/he has been zapped, but *only* if
+   * the victim is on current server--no sense in sending the
+   * notification chasing the above kill, it won't get far
+   * anyway (as this user don't exist there any more either)
+   * In accordance with the new hiding rules, the victim
+   * always sees the kill as coming from me.
+   */
   if (MyConnect(victim)) {
-    /*
-     * We *can* have crossed a NICK with this numeric... --Run
-     *
-     * Note the following situation:
-     *  KILL SAA -->       X
-     *  <-- S NICK ... SAA | <-- SAA QUIT <-- S NICK ... SAA <-- SQUIT S
-     * Where the KILL reaches point X before the QUIT does.
-     * This would then *still* cause an orphan because the KILL doesn't reach S
-     * (because of the SQUIT), the QUIT is ignored (because of the KILL)
-     * and the second NICK ... SAA causes an orphan on the server at the
-     * right (which then isn't removed when the SQUIT arrives).
-     * Therefore we still need to detect numeric nick collisions too.
-     *
-     * Bounce the kill back to the originator, if the client can't be found
-     * by the next hop (short lag) the bounce won't propagate further.
-     */
-    if (IsServer(cptr))
-      sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s!%s (Ghost 5 Numeric Collided)",
-                    victim, inpath, path);
-
-    /*
-     * Tell the victim she/he has been zapped, but *only* if
-     * the victim is on current server--no sense in sending the
-     * notification chasing the above kill, it won't get far
-     * anyway (as this user don't exist there any more either)
-     */
-    sendcmdto_one(IsServer(sptr) ? &me : sptr, CMD_KILL, victim, "%C :%s", victim,
+#ifdef HEAD_IN_SAND_KILLWHO
+    sendcmdto_one(&me, CMD_KILL, victim, "%C :%s", victim,
+                  comment);
+#else
+    sendcmdto_one(sptr, CMD_KILL, victim, "%C :%s", victim,
                   comment);
+#endif
   }
-
   return exit_client_msg(cptr, victim, sptr, "Killed (%s)", comment);
 }
 
@@ -218,8 +195,6 @@ static int do_kill(struct Client* cptr, struct Client* sptr,
 int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client* victim;
-  const char*    inpath;
-  char*          user;
   char*          path;
 
   assert(0 != cptr);
@@ -235,7 +210,6 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return need_more_params(sptr, "KILL");
   }
 
-  user = parv[1];
   path = parv[parc - 1];        /* Either defined or NULL (parc >= 3) */
 
   if (!(victim = findNUser(parv[1]))) {
@@ -245,6 +219,26 @@ int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return 0;
   }
 
+  /*
+   * We *can* have crossed a NICK with this numeric... --Run
+   *
+   * Note the following situation:
+   *  KILL SAA -->       X
+   *  <-- S NICK ... SAA | <-- SAA QUIT <-- S NICK ... SAA <-- SQUIT S
+   * Where the KILL reaches point X before the QUIT does.
+   * This would then *still* cause an orphan because the KILL doesn't reach S
+   * (because of the SQUIT), the QUIT is ignored (because of the KILL)
+   * and the second NICK ... SAA causes an orphan on the server at the
+   * right (which then isn't removed when the SQUIT arrives).
+   * Therefore we still need to detect numeric nick collisions too.
+   *
+   * Bounce the kill back to the originator, if the client can't be found
+   * by the next hop (short lag) the bounce won't propagate further.
+   */
+  if (MyConnect(victim)) {
+    sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s!%s (Ghost 5 Numeric Collided)",
+                  victim, inpath, path);
+  }
   return do_kill(cptr, sptr, victim, path);
 }
 
@@ -277,6 +271,10 @@ int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   user = parv[1];
   path = parv[parc - 1];
+
+  if (strlen(path) > TOPICLEN)
+    path[TOPICLEN] = '\0';
+
   if (!(victim = FindClient(user))) {
     /*
      * If the user has recently changed nick, we automaticly