diff options
Diffstat (limited to 'src/modes')
-rw-r--r-- | src/modes/cmode_b.cpp | 17 | ||||
-rw-r--r-- | src/modes/cmode_h.cpp | 17 | ||||
-rw-r--r-- | src/modes/cmode_k.cpp | 13 | ||||
-rw-r--r-- | src/modes/cmode_o.cpp | 15 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 15 |
5 files changed, 53 insertions, 24 deletions
diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 1efb5d399..4eea2e44d 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -49,7 +49,7 @@ ModeAction ModeChannelBan::OnModeChange(User* source, User*, Channel* channel, s return MODEACTION_ALLOW; } -void ModeChannelBan::RemoveMode(Channel* channel) +void ModeChannelBan::RemoveMode(Channel* channel, irc::modestacker* stack) { BanList copy; char moderemove[MAXBUF]; @@ -61,13 +61,20 @@ void ModeChannelBan::RemoveMode(Channel* channel) for (BanList::iterator i = copy.begin(); i != copy.end(); i++) { - sprintf(moderemove,"-%c",this->GetModeChar()); - const char* parameters[] = { channel->name, moderemove, i->data }; - ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + if (stack) + { + stack->Push(this->GetModeChar(), i->data); + } + else + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->data }; + ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + } } } -void ModeChannelBan::RemoveMode(User*) +void ModeChannelBan::RemoveMode(User*, irc::modestacker* stack) { } diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 26ec55de3..8217ccc2d 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -45,7 +45,7 @@ ModePair ModeChannelHalfOp::ModeSet(User*, User*, Channel* channel, const std::s return std::make_pair(false, parameter); } -void ModeChannelHalfOp::RemoveMode(Channel* channel) +void ModeChannelHalfOp::RemoveMode(Channel* channel, irc::modestacker* stack) { CUList* clist = channel->GetHalfoppedUsers(); CUList copy; @@ -59,14 +59,21 @@ void ModeChannelHalfOp::RemoveMode(Channel* channel) for (CUList::iterator i = copy.begin(); i != copy.end(); i++) { - sprintf(moderemove,"-%c",this->GetModeChar()); - const char* parameters[] = { channel->name, moderemove, i->first->nick }; - ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + if (stack) + { + stack->Push(this->GetModeChar(), i->first->nick); + } + else + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->first->nick }; + ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + } } } -void ModeChannelHalfOp::RemoveMode(User*) +void ModeChannelHalfOp::RemoveMode(User*, irc::modestacker* stack) { } diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 21b5d8464..194c0efcb 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -33,7 +33,7 @@ ModePair ModeChannelKey::ModeSet(User*, User*, Channel* channel, const std::stri } } -void ModeChannelKey::RemoveMode(Channel* channel) +void ModeChannelKey::RemoveMode(Channel* channel, irc::modestacker* stack) { /** +k needs a parameter when being removed, * so we have a special-case RemoveMode here for it @@ -43,12 +43,17 @@ void ModeChannelKey::RemoveMode(Channel* channel) if (channel->IsModeSet(this->GetModeChar())) { - sprintf(moderemove,"-%c",this->GetModeChar()); - ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + if (stack) + stack->Push(this->GetModeChar(), channel->key); + else + { + sprintf(moderemove,"-%c",this->GetModeChar()); + ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + } } } -void ModeChannelKey::RemoveMode(User*) +void ModeChannelKey::RemoveMode(User*, irc::modestacker* stack) { } diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index f62635658..c4e3c241e 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -46,7 +46,7 @@ ModePair ModeChannelOp::ModeSet(User*, User*, Channel* channel, const std::strin } -void ModeChannelOp::RemoveMode(Channel* channel) +void ModeChannelOp::RemoveMode(Channel* channel, irc::modestacker* stack) { CUList* clist = channel->GetOppedUsers(); CUList copy; @@ -60,13 +60,18 @@ void ModeChannelOp::RemoveMode(Channel* channel) for (CUList::iterator i = copy.begin(); i != copy.end(); i++) { - sprintf(moderemove,"-%c",this->GetModeChar()); - const char* parameters[] = { channel->name, moderemove, i->first->nick }; - ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + if (stack) + stack->Push(this->GetModeChar(), i->first->nick); + else + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->first->nick }; + ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + } } } -void ModeChannelOp::RemoveMode(User*) +void ModeChannelOp::RemoveMode(User*, irc::modestacker* stack) { } diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 45a9e1879..15196d4a8 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -46,7 +46,7 @@ ModePair ModeChannelVoice::ModeSet(User*, User*, Channel* channel, const std::st return std::make_pair(false, parameter); } -void ModeChannelVoice::RemoveMode(Channel* channel) +void ModeChannelVoice::RemoveMode(Channel* channel, irc::modestacker* stack) { CUList* clist = channel->GetVoicedUsers(); CUList copy; @@ -60,13 +60,18 @@ void ModeChannelVoice::RemoveMode(Channel* channel) for (CUList::iterator i = copy.begin(); i != copy.end(); i++) { - sprintf(moderemove,"-%c",this->GetModeChar()); - const char* parameters[] = { channel->name, moderemove, i->first->nick }; - ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + if (stack) + stack->Push(this->GetModeChar(), i->first->nick); + else + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->first->nick }; + ServerInstance->SendMode(parameters, 3, ServerInstance->FakeClient); + } } } -void ModeChannelVoice::RemoveMode(User*) +void ModeChannelVoice::RemoveMode(User*, irc::modestacker* stack) { } |