diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-02 17:40:33 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-02 17:40:33 +0000 |
commit | 26e4582c2ebaa82b63ba1d85d52be7b69d1f468d (patch) | |
tree | 0d937b05476ff0d1651eb3306be25d1dfca5546d | |
parent | e7c31868d1787071a063c31eae0a8de5389a9419 (diff) |
Actually make +ovhk removable with DelMode (just in case somebody wants to, or we have need to in the future)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5112 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modes/cmode_b.h | 2 | ||||
-rw-r--r-- | include/modes/cmode_h.h | 2 | ||||
-rw-r--r-- | include/modes/cmode_k.h | 2 | ||||
-rw-r--r-- | include/modes/cmode_o.h | 2 | ||||
-rw-r--r-- | include/modes/cmode_v.h | 2 | ||||
-rw-r--r-- | src/modes/cmode_b.cpp | 25 | ||||
-rw-r--r-- | src/modes/cmode_h.cpp | 26 | ||||
-rw-r--r-- | src/modes/cmode_k.cpp | 24 | ||||
-rw-r--r-- | src/modes/cmode_o.cpp | 27 | ||||
-rw-r--r-- | src/modes/cmode_v.cpp | 26 |
10 files changed, 137 insertions, 1 deletions
diff --git a/include/modes/cmode_b.h b/include/modes/cmode_b.h index eea061751..f024a3b3d 100644 --- a/include/modes/cmode_b.h +++ b/include/modes/cmode_b.h @@ -16,5 +16,7 @@ class ModeChannelBan : public ModeHandler std::string& DelBan(userrec *user,std::string& dest,chanrec *chan,int status); void DisplayList(userrec* user, chanrec* channel); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); + void RemoveMode(userrec* user); + void RemoveMode(chanrec* channel); }; diff --git a/include/modes/cmode_h.h b/include/modes/cmode_h.h index 277d89625..d71896a1e 100644 --- a/include/modes/cmode_h.h +++ b/include/modes/cmode_h.h @@ -15,5 +15,7 @@ class ModeChannelHalfOp : public ModeHandler std::string DelHalfOp(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); unsigned int GetPrefixRank(); + void RemoveMode(chanrec* channel); + void RemoveMode(userrec* user); }; diff --git a/include/modes/cmode_k.h b/include/modes/cmode_k.h index 4c52e6443..64d30cb73 100644 --- a/include/modes/cmode_k.h +++ b/include/modes/cmode_k.h @@ -11,4 +11,6 @@ class ModeChannelKey : public ModeHandler ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel); + void RemoveMode(chanrec* channel); + void RemoveMode(userrec* user); }; diff --git a/include/modes/cmode_o.h b/include/modes/cmode_o.h index 3fe097ec3..5690221e0 100644 --- a/include/modes/cmode_o.h +++ b/include/modes/cmode_o.h @@ -15,5 +15,7 @@ class ModeChannelOp : public ModeHandler std::string DelOp(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); unsigned int GetPrefixRank(); + void RemoveMode(chanrec* channel); + void RemoveMode(userrec* user); }; diff --git a/include/modes/cmode_v.h b/include/modes/cmode_v.h index b7e9b800e..ef90a3781 100644 --- a/include/modes/cmode_v.h +++ b/include/modes/cmode_v.h @@ -15,5 +15,7 @@ class ModeChannelVoice : public ModeHandler std::string DelVoice(userrec *user,const char *dest,chanrec *chan,int status); ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter); unsigned int GetPrefixRank(); + void RemoveMode(userrec* user); + void RemoveMode(chanrec* channel); }; diff --git a/src/modes/cmode_b.cpp b/src/modes/cmode_b.cpp index 546bcb30f..9e2c777f0 100644 --- a/src/modes/cmode_b.cpp +++ b/src/modes/cmode_b.cpp @@ -37,6 +37,31 @@ ModeAction ModeChannelBan::OnModeChange(userrec* source, userrec* dest, chanrec* return MODEACTION_ALLOW; } +void ModeChannelBan::RemoveMode(chanrec* channel) +{ + BanList copy; + char moderemove[MAXBUF]; + userrec* n = new userrec(ServerInstance); + n->SetFd(FD_MAGIC_NUMBER); + + for (BanList::iterator i = channel->bans.begin(); i != channel->bans.end(); i++) + { + copy.push_back(*i); + } + 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, n); + } + + delete n; +} + +void ModeChannelBan::RemoveMode(userrec* user) +{ +} + void ModeChannelBan::DisplayList(userrec* user, chanrec* channel) { /* Display the channel banlist */ diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 9197cbd72..667402ace 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -32,6 +32,32 @@ ModePair ModeChannelHalfOp::ModeSet(userrec* source, userrec* dest, chanrec* cha return std::make_pair(false, parameter); } +void ModeChannelHalfOp::RemoveMode(chanrec* channel) +{ + CUList* list = channel->GetHalfoppedUsers(); + CUList copy; + char moderemove[MAXBUF]; + userrec* n = new userrec(ServerInstance); + n->SetFd(FD_MAGIC_NUMBER); + + for (CUList::iterator i = list->begin(); i != list->end(); i++) + { + userrec* n = i->second; + copy.insert(std::make_pair(n,n)); + } + for (CUList::iterator i = copy.begin(); i != copy.end(); i++) + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->second->nick }; + ServerInstance->SendMode(parameters, 3, n); + } + delete n; +} + +void ModeChannelHalfOp::RemoveMode(userrec* user) +{ +} + ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { /* If halfops are not enabled in the conf, we don't execute diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 4f95f3ad1..b32ad5c2b 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -18,7 +18,29 @@ ModePair ModeChannelKey::ModeSet(userrec* source, userrec* dest, chanrec* channe { return std::make_pair(false, parameter); } -} +} + +void ModeChannelKey::RemoveMode(chanrec* channel) +{ + char moderemove[MAXBUF]; + const char* parameters[] = { channel->name, moderemove, channel->key }; + + if (channel->IsModeSet(this->GetModeChar())) + { + userrec* n = new userrec(ServerInstance); + + sprintf(moderemove,"-%c",this->GetModeChar()); + n->SetFd(FD_MAGIC_NUMBER); + + ServerInstance->SendMode(parameters, 3, n); + + delete n; + } +} + +void ModeChannelKey::RemoveMode(userrec* user) +{ +} bool ModeChannelKey::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel) { diff --git a/src/modes/cmode_o.cpp b/src/modes/cmode_o.cpp index 85eb08c38..b9fb0208b 100644 --- a/src/modes/cmode_o.cpp +++ b/src/modes/cmode_o.cpp @@ -32,6 +32,33 @@ ModePair ModeChannelOp::ModeSet(userrec* source, userrec* dest, chanrec* channel return std::make_pair(false, parameter); } + +void ModeChannelOp::RemoveMode(chanrec* channel) +{ + CUList* list = channel->GetOppedUsers(); + CUList copy; + char moderemove[MAXBUF]; + userrec* n = new userrec(ServerInstance); + n->SetFd(FD_MAGIC_NUMBER); + + for (CUList::iterator i = list->begin(); i != list->end(); i++) + { + userrec* n = i->second; + copy.insert(std::make_pair(n,n)); + } + for (CUList::iterator i = copy.begin(); i != copy.end(); i++) + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->second->nick }; + ServerInstance->SendMode(parameters, 3, n); + } + delete n; +} + +void ModeChannelOp::RemoveMode(userrec* user) +{ +} + ModeAction ModeChannelOp::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = channel->GetStatus(source); diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 50b74cef7..9fd5df7bd 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -32,6 +32,32 @@ ModePair ModeChannelVoice::ModeSet(userrec* source, userrec* dest, chanrec* chan return std::make_pair(false, parameter); } +void ModeChannelVoice::RemoveMode(chanrec* channel) +{ + CUList* list = channel->GetVoicedUsers(); + CUList copy; + char moderemove[MAXBUF]; + userrec* n = new userrec(ServerInstance); + n->SetFd(FD_MAGIC_NUMBER); + + for (CUList::iterator i = list->begin(); i != list->end(); i++) + { + userrec* n = i->second; + copy.insert(std::make_pair(n,n)); + } + for (CUList::iterator i = copy.begin(); i != copy.end(); i++) + { + sprintf(moderemove,"-%c",this->GetModeChar()); + const char* parameters[] = { channel->name, moderemove, i->second->nick }; + ServerInstance->SendMode(parameters, 3, n); + } + delete n; +} + +void ModeChannelVoice::RemoveMode(userrec* user) +{ +} + ModeAction ModeChannelVoice::OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { int status = channel->GetStatus(source); |