- if (cli_from(acptr) != cptr) {
- if ((differ && lastnick >= cli_lastnick(acptr)) ||
- (!differ && lastnick <= cli_lastnick(acptr))) {
- if (!IsServer(sptr)) {
- ++ServerStats->is_kill;
- sendcmdto_serv_butone(&me, CMD_KILL, sptr, "%C :%s (Nick collision)",
- sptr, cli_name(&me));
- assert(!MyConnect(sptr));
-
- cli_flags(sptr) |= FLAGS_KILLED;
- exit_client(cptr, sptr, &me,
- "Killed (" HEAD_IN_SAND_SERVERNAME " (Nick collision))");
- /*
- * we have killed sptr off, zero out it's pointer so if it's used
- * again we'll know about it --Bleep
- */
- sptr = 0;
- }
- if (lastnick != cli_lastnick(acptr))
- return 0; /* Ignore the NICK */
+ if ((differ && lastnick >= cli_lastnick(acptr)) ||
+ (!differ && lastnick <= cli_lastnick(acptr)))
+ {
+ /* We need to bounce this kill straight back... Although the nick message
+ * for acptr is probably waiting in their recvq from me, its also possible
+ * that sptr will change their nick on cptr before cptr receives the
+ * nick message for acptr, which would leave acptr and sptr both alive
+ * on cptr, but only acptr alive on me, i.e. desync. This extra kill
+ * message has been absent for a while in ircu although it was a major
+ * problem when it was tried on efnet, so I don't know how big an issue it
+ * is. Probably best that this be left here, anyway...
+ */
+ ServerStats->is_kill++;
+ sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (%s)",
+ nick, cli_name(&me), type);
+ /* But if this was a nick change and not a nick introduction,
+ * we also need to ensure that we remove our local state
+ * record of the original client... Also, the rest of the
+ * net should be informed...
+ */
+ if (!IsServer(sptr))
+ {
+ assert(!MyConnect(sptr));
+ /* Inform the rest of the net... */
+ sendcmdto_serv_butone(&me, CMD_KILL, cptr, "%s :%s (%s)",
+ nick, cli_name(&me), type);
+ /* Don't go sending off a QUIT message... */
+ cli_flags(sptr) |= FLAGS_KILLED;
+ /* Remove them locally. */
+ exit_client_msg(cptr, sptr, &me,
+ "Killed (" HEAD_IN_SAND_SERVERNAME " (Nick collision))",
+ type);
+ /*
+ * We have killed sptr off, zero out it's pointer so if it's used
+ * again we'll know about it --Bleep
+ */
+ sptr = NULL;