diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-04-02 23:53:29 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-04-02 23:53:29 +0000 |
commit | 57608fe351cff19679b1d78fb5cbfb7cad89dfc1 (patch) | |
tree | d88625afe327da2794cd34bd4d723d87df251cb7 /src/modules | |
parent | 80959555778404b7f0cdd4bd171ea7e1fe6116e9 (diff) |
Fixes for bug #493, tidyups to clearing of channel modes on losing FJOIN. Module unloads may also be tidied at a future date but it means reordering some loops in mode.cpp. See around the comment added.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9283 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_chanprotect.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 22 |
2 files changed, 34 insertions, 10 deletions
diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index daa728e61..0cc4fe8d7 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -62,7 +62,7 @@ class FounderProtectBase return std::make_pair(false, parameter); } - void RemoveMode(Channel* channel, char mc) + void RemoveMode(Channel* channel, char mc, irc::modestacker* stack) { CUList* cl = channel->GetUsers(); std::string item = extend + std::string(channel->name); @@ -75,10 +75,16 @@ class FounderProtectBase { if (i->first->GetExt(item)) { - modestack.Push(mc, i->first->nick); + if (stack) + stack->Push(mc, i->first->nick); + else + modestack.Push(mc, i->first->nick); } } + if (stack) + return; + while (modestack.GetStackedLine(stackresult)) { for (size_t j = 0; j < stackresult.size(); j++) @@ -165,12 +171,12 @@ class ChanFounder : public ModeHandler, public FounderProtectBase return FounderProtectBase::ModeSet(source, dest, channel, parameter); } - void RemoveMode(Channel* channel) + void RemoveMode(Channel* channel, irc::modestacker* stack) { - FounderProtectBase::RemoveMode(channel, this->GetModeChar()); + FounderProtectBase::RemoveMode(channel, this->GetModeChar(), stack); } - void RemoveMode(User* user) + void RemoveMode(User* user, irc::modestacker* stack) { } @@ -231,12 +237,12 @@ class ChanProtect : public ModeHandler, public FounderProtectBase return FounderProtectBase::ModeSet(source, dest, channel, parameter); } - void RemoveMode(Channel* channel) + void RemoveMode(Channel* channel, irc::modestacker* stack) { - FounderProtectBase::RemoveMode(channel, this->GetModeChar()); + FounderProtectBase::RemoveMode(channel, this->GetModeChar(), stack); } - void RemoveMode(User* user) + void RemoveMode(User* user, irc::modestacker* stack) { } diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 0bddb4da7..3d119ee78 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -189,11 +189,29 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, std::deque<std::string> if (c) { - for (char modeletter = 'A'; modeletter <= 'z'; modeletter++) + irc::modestacker stack(false); + std::deque<std::string> stackresult; + const char* mode_junk[MAXMODES+2]; + mode_junk[0] = c->name; + + for (char modeletter = 'A'; modeletter <= 'z'; ++modeletter) { ModeHandler* mh = Instance->Modes->FindMode(modeletter, MODETYPE_CHANNEL); + + /* Passing a pointer to a modestacker here causes the mode to be put onto the mode stack, + * rather than applied immediately. Module unloads require this to be done immediately, + * for this function we require tidyness instead. Fixes bug #493 + */ if (mh) - mh->RemoveMode(c); + mh->RemoveMode(c, &stack); + } + + while (stack.GetStackedLine(stackresult)) + { + for (size_t j = 0; j < stackresult.size(); j++) + mode_junk[j+1] = stackresult[j].c_str(); + + Instance->SendMode(mode_junk, stackresult.size() + 1, Instance->FakeClient); } } return true; |