diff options
-rw-r--r-- | include/listmode.h | 4 | ||||
-rw-r--r-- | include/mode.h | 8 | ||||
-rw-r--r-- | src/listmode.cpp | 4 | ||||
-rw-r--r-- | src/mode.cpp | 31 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 6 |
5 files changed, 22 insertions, 31 deletions
diff --git a/include/listmode.h b/include/listmode.h index ec3feb943..04044948c 100644 --- a/include/listmode.h +++ b/include/listmode.h @@ -149,9 +149,9 @@ class CoreExport ListModeBase : public ModeHandler * this mode from the channel. * See mode.h for more details. * @param channel The channel to remove all instances of the mode from - * @param stack The mode stack to add the mode change to + * @param changelist Mode change list to populate with the removal of this mode */ - virtual void RemoveMode(Channel* channel, irc::modestacker& stack); + virtual void RemoveMode(Channel* channel, Modes::ChangeList& changelist); /** Perform a rehash of this mode's configuration data */ diff --git a/include/mode.h b/include/mode.h index 7dc718a27..868f3437d 100644 --- a/include/mode.h +++ b/include/mode.h @@ -294,9 +294,9 @@ class CoreExport ModeHandler : public ServiceProvider * so if you inherit from it or your mode can be removed by the default implementation then you do not have to implement * this function). * @param channel The channel which the server wants to remove your mode from - * @param stack The mode stack to add the mode change to + * @param changelist Mode change list to populate with the removal of this mode */ - virtual void RemoveMode(Channel* channel, irc::modestacker& stack); + virtual void RemoveMode(Channel* channel, Modes::ChangeList& changelist); inline unsigned int GetLevelRequired() const { return levelrequired; } @@ -359,9 +359,9 @@ class CoreExport PrefixMode : public ModeHandler /** * Removes this prefix mode from all users on the given channel * @param chan The channel which the server wants to remove your mode from - * @param stack The mode stack to add the mode change to + * @param changelist Mode change list to populate with the removal of this mode */ - void RemoveMode(Channel* chan, irc::modestacker& stack); + void RemoveMode(Channel* channel, Modes::ChangeList& changelist); /** * Mode prefix or 0. If this is defined, you should diff --git a/src/listmode.cpp b/src/listmode.cpp index 0f139bb01..9b2a0a90f 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -45,14 +45,14 @@ void ListModeBase::DisplayEmptyList(User* user, Channel* channel) user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); } -void ListModeBase::RemoveMode(Channel* channel, irc::modestacker& stack) +void ListModeBase::RemoveMode(Channel* channel, Modes::ChangeList& changelist) { ChanData* cd = extItem.get(channel); if (cd) { for (ModeList::iterator it = cd->list.begin(); it != cd->list.end(); it++) { - stack.Push(this->GetModeChar(), it->mask); + changelist.push_remove(this, it->mask); } } } diff --git a/src/mode.cpp b/src/mode.cpp index 2c22a6c65..d9dba196d 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -778,16 +778,9 @@ bool ModeParser::DelMode(ModeHandler* mh) Channel* chan = i->second; ++i; - irc::modestacker stack(false); - mh->RemoveMode(chan, stack); - - std::vector<std::string> stackresult; - stackresult.push_back(chan->name); - while (stack.GetStackedLine(stackresult)) - { - this->Process(stackresult, ServerInstance->FakeClient, MODE_LOCALONLY); - stackresult.erase(stackresult.begin() + 1, stackresult.end()); - } + Modes::ChangeList changelist; + mh->RemoveMode(chan, changelist); + this->Process(ServerInstance->FakeClient, chan, NULL, changelist, MODE_LOCALONLY); } } break; @@ -959,33 +952,31 @@ void ModeHandler::RemoveMode(User* user) // Remove the mode if it's set on the user if (user->IsModeSet(this->GetModeChar())) { - std::vector<std::string> parameters; - parameters.push_back(user->nick); - parameters.push_back("-"); - parameters[1].push_back(this->GetModeChar()); - ServerInstance->Modes->Process(parameters, ServerInstance->FakeClient, ModeParser::MODE_LOCALONLY); + Modes::ChangeList changelist; + changelist.push_remove(this); + ServerInstance->Modes->Process(ServerInstance->FakeClient, NULL, user, changelist, ModeParser::MODE_LOCALONLY); } } -void ModeHandler::RemoveMode(Channel* channel, irc::modestacker& stack) +void ModeHandler::RemoveMode(Channel* channel, Modes::ChangeList& changelist) { if (channel->IsModeSet(this)) { if (this->GetNumParams(false)) // Removing this mode requires a parameter - stack.Push(this->GetModeChar(), channel->GetModeParameter(this)); + changelist.push_remove(this, channel->GetModeParameter(this)); else - stack.Push(this->GetModeChar()); + changelist.push_remove(this); } } -void PrefixMode::RemoveMode(Channel* chan, irc::modestacker& stack) +void PrefixMode::RemoveMode(Channel* chan, Modes::ChangeList& changelist) { const Channel::MemberMap& userlist = chan->GetUsers(); for (Channel::MemberMap::const_iterator i = userlist.begin(); i != userlist.end(); ++i) { if (i->second->hasMode(this->GetModeChar())) - stack.Push(this->GetModeChar(), i->first->nick); + changelist.push_remove(this, i->first->nick); } } diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index cb1126ac7..9e418b0a2 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -209,7 +209,7 @@ void CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeServer* sour void CommandFJoin::RemoveStatus(Channel* c) { - irc::modestacker stack(false); + Modes::ChangeList changelist; const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL); for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i) @@ -220,10 +220,10 @@ void CommandFJoin::RemoveStatus(Channel* c) * rather than applied immediately. Module unloads require this to be done immediately, * for this function we require tidyness instead. Fixes bug #493 */ - mh->RemoveMode(c, stack); + mh->RemoveMode(c, changelist); } - ApplyModeStack(ServerInstance->FakeClient, c, stack); + ServerInstance->Modes->Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY); } void CommandFJoin::ApplyModeStack(User* srcuser, Channel* c, irc::modestacker& stack) |