Cosmetic changes to banning bare IPv6 addresses and kicking +D-hidden users.
[ircu2.10.12-pk.git] / ircd / m_kick.c
index 97b59e4d1b18f77d76555d5164b454175dbc28db..f77bee5d7e76deed972bae0e410fe238360cc41f 100644 (file)
@@ -85,6 +85,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
@@ -93,7 +94,7 @@
 #include "send.h"
 #include "ircd_features.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
 /*
  * m_kick - generic message handler
@@ -142,7 +143,7 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     return send_reply(sptr, ERR_USERNOTINCHANNEL, cli_name(who), chptr->chname);
 
   /* Don't allow to kick member with a higher or equal op-level */
-  if ((OpLevel(member) <= OpLevel(member2)) && feature_bool(FEAT_OPLEVELS))
+  if (chptr->mode.apass[0] && OpLevel(member) <= OpLevel(member2))
     return send_reply(sptr, ERR_NOTLOWEROPLEVEL, cli_name(who), chptr->chname,
        OpLevel(member2), OpLevel(member), "kick",
        OpLevel(member) == OpLevel(member2) ? "the same" : "a higher");
@@ -154,8 +155,17 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     sendcmdto_serv_butone(sptr, CMD_KICK, cptr, "%H %C :%s", chptr, who,
                          comment);
 
-  sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, "%H %C :%s", chptr, who,
-                           comment);
+  if (IsDelayedJoin(member)) {
+    /* If it's a delayed join, only send the KICK to the person doing
+     * the kicking and the victim */
+    if (MyUser(who))
+      sendcmdto_one(sptr, CMD_KICK, who, "%H %C :%s", chptr, who, comment);
+    sendcmdto_one(who, CMD_JOIN, sptr, "%H", chptr);
+    sendcmdto_one(sptr, CMD_KICK, sptr, "%H %C :%s", chptr, who, comment);
+    CheckDelayedJoins(chptr);
+  } else
+    sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, 0, "%H %C :%s", chptr, who,
+                                     comment);
 
   make_zombie(member, who, cptr, sptr, chptr);
 
@@ -237,7 +247,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
     if (member) { /* and tell the channel about it */
       sendcmdto_channel_butserv_butone(IsServer(sptr) ? &me : sptr, CMD_KICK,
-                                      chptr, NULL, "%H %C :%s", chptr, who,
+                                      chptr, NULL, 0, "%H %C :%s", chptr, who,
                                       comment);
 
       make_zombie(member, who, cptr, sptr, chptr);