Author: Ghostwolf <foxxe@wtfs.net>
[ircu2.10.12-pk.git] / ircd / m_kick.c
index f5a488a933d770e9333a27be74cec793b7547dcc..51c848e6e4aad693ddea4f635a4b1e3f5ca4c45e 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
 #include "channel.h"
 #include "client.h"
 #include "hash.h"
@@ -115,7 +109,7 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   struct Membership *member = 0;
   char *name, *comment;
 
-  sptr->flags &= ~FLAGS_TS8;
+  cli_flags(sptr) &= ~FLAGS_TS8;
 
   if (parc < 3 || *parv[1] == '\0')
     return need_more_params(sptr, "KICK");
@@ -134,17 +128,15 @@ int m_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   /* Don't allow the channel service to be kicked */
   if (IsChannelService(who))
-    return send_reply(sptr, ERR_ISCHANSERVICE, who->name, chptr->chname);
+    return send_reply(sptr, ERR_ISCHANSERVICE, cli_name(who), chptr->chname);
 
-#ifdef NO_OPER_DEOP_LCHAN
   /* Prevent kicking opers from local channels -DM- */
-  if (IsOperOnLocalChannel(who, chptr->chname))
-    return send_reply(sptr, ERR_ISOPERLCHAN, who->name, chptr->chname);
-#endif
+  if (IsLocalChannel(chptr->chname) && HasPriv(who, PRIV_DEOP_LCHAN))
+    return send_reply(sptr, ERR_ISOPERLCHAN, cli_name(who), chptr->chname);
 
   /* check if kicked user is actually on the channel */
   if (!(member = find_member_link(chptr, who)) || IsZombie(member))
-    return send_reply(sptr, ERR_USERNOTINCHANNEL, who->name, chptr->chname);
+    return send_reply(sptr, ERR_USERNOTINCHANNEL, cli_name(who), chptr->chname);
 
   /* We rely on ircd_snprintf to truncate the comment */
   comment = EmptyString(parv[parc - 1]) ? parv[0] : parv[parc - 1];
@@ -153,7 +145,7 @@ 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(sptr, CMD_KICK, chptr, "%H %C :%s", chptr, who,
+  sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, "%H %C :%s", chptr, who,
                            comment);
 
   make_zombie(member, who, cptr, sptr, chptr);
@@ -176,7 +168,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   struct Membership *member = 0, *sptr_link = 0;
   char *name, *comment;
 
-  sptr->flags &= ~FLAGS_TS8;
+  cli_flags(sptr) &= ~FLAGS_TS8;
 
   if (parc < 3 || *parv[1] == '\0')
     return need_more_params(sptr, "KICK");
@@ -203,7 +195,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
    * here), if kicker is not on channel, or if kicker is not a channel
    * operator, bounce the kick
    */
-  if (!IsServer(sptr) && member && who->from != cptr &&
+  if (!IsServer(sptr) && member && cli_from(who) != cptr &&
       (!(sptr_link = find_member_link(chptr, sptr)) || !IsChanOp(sptr_link))) {
     sendto_opmask_butone(0, SNO_HACK2, "HACK: %C KICK %H %C %s", sptr, chptr,
                         who, comment);
@@ -232,7 +224,7 @@ int ms_kick(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
                          comment);
 
     if (member) { /* and tell the channel about it */
-      sendcmdto_channel_butserv(sptr, CMD_KICK, chptr, "%H %C :%s", chptr, who,
+      sendcmdto_channel_butserv_butone(sptr, CMD_KICK, chptr, NULL, "%H %C :%s", chptr, who,
                                comment);
 
       make_zombie(member, who, cptr, sptr, chptr);