+ /* Not on channel */
+ return this->GetUserCounter();
+ }
+ }
+
+ if (triggerevents)
+ {
+ FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent));
+ }
+
+ UCListIter i = user->chans.find(this);
+ if (i != user->chans.end())
+ {
+ if (!silent)
+ this->WriteChannelWithServ(ServerInstance->Config->ServerName, "KICK %s %s :%s", this->name, user->nick, reason);
+
+ user->chans.erase(i);
+ this->RemoveAllPrefixes(user);
+ }
+
+ if (!this->DelUser(user))
+ {
+ chan_hash::iterator iter = ServerInstance->chanlist->find(this->name);
+ /* kill the record */
+ if (iter != ServerInstance->chanlist->end())
+ {
+ FOREACH_MOD(I_OnChannelDelete,OnChannelDelete(this));
+ ServerInstance->chanlist->erase(iter);
+ }
+ return 0;
+ }
+
+ return this->GetUserCounter();
+}
+
+long chanrec::KickUser(userrec *src, userrec *user, const char* reason)
+{
+ bool silent = false;
+
+ 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)))