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/mode.cpp | |
parent | 4634151efc02ff016e19c5f123d75824d0d6c811 (diff) |
Use Modes::ChangeList in ModeHandler::RemoveMode()
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
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); } } |