diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-13 05:27:53 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-05-13 05:27:53 +0000 |
commit | ddc77036f61620d15faad818b228a147dbd88852 (patch) | |
tree | 855d72382d386329b1e9e18631266170036509a0 | |
parent | 23a98c8fe1f255fe5f20c26c726da817d2796c9a (diff) |
Replace loopCall detection in OnUserKick with a check for the m_spanningtree fake user
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11377 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/fakeuser.h | 2 | ||||
-rw-r--r-- | include/modules.h | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 18 |
3 files changed, 13 insertions, 14 deletions
diff --git a/include/fakeuser.h b/include/fakeuser.h index 5d62b7060..3237d4c5b 100644 --- a/include/fakeuser.h +++ b/include/fakeuser.h @@ -21,7 +21,7 @@ class CoreExport FakeUser : public User public: FakeUser(InspIRCd* Instance) : User(Instance, "!") { - SetFd(FD_MAGIC_NUMBER); + SetFd(FD_FAKEUSER_NUMBER); } virtual const std::string GetFullHost() { return server; } diff --git a/include/modules.h b/include/modules.h index 2f0f48b00..cc9f10d2c 100644 --- a/include/modules.h +++ b/include/modules.h @@ -247,13 +247,18 @@ do { \ * (in fact, any FD less than -1 does) */ #define FD_MAGIC_NUMBER -42 +/** Represents a fake user (i.e. a server) + */ +#define FD_FAKEUSER_NUMBER -7 /* Useful macros */ /** Is a local user */ -#define IS_LOCAL(x) ((x->GetFd() > -1)) +#define IS_LOCAL(x) (x->GetFd() > -1) /** Is a remote user */ #define IS_REMOTE(x) (x->GetFd() < 0) +/** Is a fake user */ +#define IS_FAKE(x) (x->GetFd() == FD_FAKEUSER_NUMBER) /** Is a module created user */ #define IS_MODULE_CREATED(x) (x->GetFd() == FD_MAGIC_NUMBER) /** Is an oper */ diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b38929ad0..37ed06c3a 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -677,22 +677,16 @@ 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<std::string> params; + params.push_back(chan->name); + params.push_back(user->uuid); + params.push_back(":"+reason); + if (IS_LOCAL(source)) { - std::deque<std::string> params; - params.push_back(chan->name); - params.push_back(user->uuid); - params.push_back(":"+reason); Utils->DoOneToMany(source->uuid,"KICK",params); } - else if (!source) + else if (IS_FAKE(source) && source != Utils->ServerUser) { - std::deque<std::string> params; - params.push_back(chan->name); - params.push_back(user->uuid); - params.push_back(":"+reason); Utils->DoOneToMany(ServerInstance->Config->GetSID(),"KICK",params); } } |