- if (!src || !user || !reason)
- return this->GetUserCounter();
-
- if (IS_LOCAL(src))
- {
- if (!this->HasUser(user))
- {
- src->WriteServ("441 %s %s %s :They are not on that channel",src->nick, user->nick, this->name);
- return this->GetUserCounter();
- }
- if ((ServerInstance->ULine(user->server)) && (!ServerInstance->ULine(src->server)))
- {
- src->WriteServ("482 %s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name);
- return this->GetUserCounter();
- }
- int MOD_RESULT = 0;
-
- if (!ServerInstance->ULine(src->server))
- {
- MOD_RESULT = 0;
- FOREACH_RESULT(I_OnUserPreKick,OnUserPreKick(src,user,this,reason));
- if (MOD_RESULT == 1)
- return this->GetUserCounter();
- }
- /* Set to -1 by OnUserPreKick if explicit allow was set */
- if (MOD_RESULT != -1)
- {
- FOREACH_RESULT(I_OnAccessCheck,OnAccessCheck(src,user,this,AC_KICK));
- if ((MOD_RESULT == ACR_DENY) && (!ServerInstance->ULine(src->server)))
- return this->GetUserCounter();
-
- if ((MOD_RESULT == ACR_DEFAULT) || (!ServerInstance->ULine(src->server)))
- {
- int them = this->GetStatus(src);
- int us = this->GetStatus(user);
- if ((them < STATUS_HOP) || (them < us))
- {
- src->WriteServ("482 %s %s :You must be a channel %soperator",src->nick, this->name, them == STATUS_HOP ? "" : "half-");
- return this->GetUserCounter();
- }
- }
- }
- }