From: danieldg Date: Mon, 20 Apr 2009 13:29:58 +0000 (+0000) Subject: Use loopCall to protect OnUserKick rather than the triggerevents hack X-Git-Tag: v2.0.23~1903 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=828f256a9bd8278540bf4beede36c485e2c3e86f;hp=2d7ac3a99bd7eba9b01165acde224dcc1e9cc46e;p=user%2Fhenk%2Fcode%2Finspircd.git Use loopCall to protect OnUserKick rather than the triggerevents hack git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11321 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/include/channels.h b/include/channels.h index 3bbcf0672..dfee69dc0 100644 --- a/include/channels.h +++ b/include/channels.h @@ -336,7 +336,7 @@ class CoreExport Channel : public Extensible * @return The number of users left on the channel. If this is zero * when the method returns, you MUST delete the Channel immediately! */ - long ServerKickUser(User* user, const char* reason, bool triggerevents, const char* servername = NULL); + long ServerKickUser(User* user, const char* reason, const char* servername = NULL); /** Part a user from this channel with the given reason. * If the reason field is NULL, no reason will be sent. diff --git a/src/channels.cpp b/src/channels.cpp index 99b118d0d..c1a5a59a3 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -592,7 +592,7 @@ long Channel::PartUser(User *user, std::string &reason) return this->GetUserCounter(); } -long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents, const char* servername) +long Channel::ServerKickUser(User* user, const char* reason, const char* servername) { bool silent = false; @@ -611,10 +611,7 @@ long Channel::ServerKickUser(User* user, const char* reason, bool triggerevents, if (servername == NULL || *ServerInstance->Config->HideWhoisServer) servername = ServerInstance->Config->ServerName; - if (triggerevents) - { - FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent)); - } + FOREACH_MOD(I_OnUserKick,OnUserKick(NULL, user, this, reason, silent)); UCListIter i = user->chans.find(this); if (i != user->chans.end()) diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index f2082da33..fb9d2bbc2 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -243,7 +243,7 @@ class ModuleMsgFlood : public Module char kickmessage[MAXBUF]; snprintf(kickmessage, MAXBUF, "Channel flood triggered (limit is %d lines in %d secs)", f->lines, f->secs); - if (!dest->ServerKickUser(user, kickmessage, true)) + if (!dest->ServerKickUser(user, kickmessage)) { delete dest; } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index a9e7c3c0e..769aed7ce 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -57,7 +57,7 @@ class CommandSakick : public Command */ if (IS_LOCAL(dest)) { - if (!channel->ServerKickUser(dest, reason, true, servername)) + if (!channel->ServerKickUser(dest, reason, servername)) delete channel; Channel* n = ServerInstance->FindChan(parameters[1]); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 01048e4d1..b38929ad0 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -677,6 +677,8 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) void ModuleSpanningTree::OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent) { + if (loopCall) + return; if ((source) && (IS_LOCAL(source))) { std::deque params; diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 3e3fbd71e..b298ae369 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -451,7 +451,7 @@ bool TreeSocket::ProcessLine(std::string &line) User* user = this->ServerInstance->FindNick(nick); if (user) { - if (!chan->ServerKickUser(user, params[2].c_str(), false, pf->GetName().c_str())) + if (!chan->ServerKickUser(user, params[2].c_str(), pf->GetName().c_str())) /* Yikes, the channels gone! */ delete chan; }