- if (IsServer(sptr)
-#if defined(NO_INVITE_NETRIDE)
- && !IsBurstOrBurstAck(sptr)
-#endif
- ) {
- send_hack_notice(cptr, sptr, parc, parv, 1, 3);
- }
-
- if (IsServer(sptr) ||
- ((member = find_member_link(chptr, who)) && !IsZombie(member)))
- {
- struct Membership* sptr_link = find_member_link(chptr, sptr);
- if (who->from != cptr &&
- ((sptr_link && IsDeopped(sptr_link)) || (!sptr_link && IsUser(sptr))))
- {
- /*
- * Bounce here:
- * cptr must be a server (or cptr == sptr and
- * sptr->flags can't have DEOPPED set
- * when CHANOP is set).
- */
- sendto_one(cptr, "%s%s " TOK_JOIN " %s", NumNick(who), chptr->chname);
- if (IsChanOp(member))
- {
- sendto_one(cptr, "%s " TOK_MODE " %s +o %s%s " TIME_T_FMT,
- NumServ(&me), chptr->chname, NumNick(who), chptr->creationtime);
- }
- if (HasVoice(member))
- {
- sendto_one(cptr, "%s " TOK_MODE " %s +v %s%s " TIME_T_FMT,
- NumServ(&me), chptr->chname, NumNick(who), chptr->creationtime);
- }
- }
- else
- {
- char* comment = (EmptyString(parv[parc - 1])) ? parv[0] : parv[parc - 1];
- if (strlen(comment) > TOPICLEN)
- comment[TOPICLEN] = '\0';
-
- if (!IsLocalChannel(channel_name))
- {
- sendto_highprot_butone(cptr, 10, "%s%s " TOK_KICK " %s %s%s :%s",
- NumNick(sptr), chptr->chname, NumNick(who), comment);
- }
- if (member) {
- sendto_channel_butserv(chptr, sptr,
- ":%s KICK %s %s :%s", parv[0], chptr->chname, who->name, comment);
- make_zombie(member, who, cptr, sptr, chptr);
- }
- }
- }
- else if (MyUser(sptr))
- sendto_one(sptr, err_str(ERR_USERNOTINCHANNEL),
- me.name, parv[0], who->name, chptr->chname);
+ if (OpLevel(member) < OpLevel(member2)
+ || (OpLevel(member) == OpLevel(member2)
+ && OpLevel(member) < MAXOPLEVEL))
+ return send_reply(sptr, ERR_NOTLOWEROPLEVEL, cli_name(who), chptr->chname,
+ OpLevel(member2), OpLevel(member), "kick",
+ OpLevel(member) == OpLevel(member2) ? "the same" : "a higher");
+
+ /* We rely on ircd_snprintf to truncate the comment */
+ comment = EmptyString(parv[parc - 1]) ? parv[0] : parv[parc - 1];
+
+ if (!IsLocalChannel(name))
+ sendcmdto_serv_butone(sptr, CMD_KICK, cptr, "%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);