diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-09-03 15:35:13 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-09-03 15:35:13 +0200 |
commit | 5bea41d726f9c93ca1914ae9b6259765991d383c (patch) | |
tree | 1e45fa01158cefba99aeab489be402cf48016df7 /src | |
parent | 4634151efc02ff016e19c5f123d75824d0d6c811 (diff) |
Use Modes::ChangeList in ModeHandler::RemoveMode()
Diffstat (limited to 'src')
-rw-r--r-- | src/listmode.cpp | 4 | ||||
-rw-r--r-- | src/mode.cpp | 31 | ||||
-rw-r--r-- | src/modules/m_spanningtree/fjoin.cpp | 6 |
3 files changed, 16 insertions, 25 deletions
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) |