diff options
author | Adam <Adam@anope.org> | 2013-02-05 09:45:48 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-02-05 09:45:48 -0500 |
commit | 25cec015e8276ea6e1de3e290696071fa5c0b66f (patch) | |
tree | 536cf9ea6b424a550d0e912c49f8b0619892b5cf /src | |
parent | 62e3c8c4f8ccbba3cc6e62fb970d38be25a654e4 (diff) |
Made access del by nick and other functions from 326f1a really delete objects
Diffstat (limited to 'src')
-rw-r--r-- | src/access.cpp | 8 | ||||
-rw-r--r-- | src/regchannel.cpp | 35 |
2 files changed, 17 insertions, 26 deletions
diff --git a/src/access.cpp b/src/access.cpp index 49c49851c..467f37047 100644 --- a/src/access.cpp +++ b/src/access.cpp @@ -97,8 +97,12 @@ ChanAccess::ChanAccess(AccessProvider *p) : Serializable("ChanAccess"), provider ChanAccess::~ChanAccess() { - if (ci) - ci->EraseAccess(this); + if (this->ci) + { + std::vector<ChanAccess *>::iterator it = std::find(this->ci->access->begin(), this->ci->access->end(), this); + if (it != this->ci->access->end()) + this->ci->access->erase(it); + } } void ChanAccess::Serialize(Serialize::Data &data) const diff --git a/src/regchannel.cpp b/src/regchannel.cpp index ab9caf27d..257eca0ee 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -29,8 +29,12 @@ BadWord::BadWord() : Serializable("BadWord") BadWord::~BadWord() { - if (ci) - ci->EraseBadWord(this); + if (this->ci) + { + std::vector<BadWord *>::iterator it = std::find(this->ci->badwords->begin(), this->ci->badwords->end(), this); + if (it != this->ci->badwords->end()) + this->ci->badwords->erase(it); + } } void BadWord::Serialize(Serialize::Data &data) const @@ -74,7 +78,11 @@ AutoKick::AutoKick() : Serializable("AutoKick") AutoKick::~AutoKick() { if (this->ci) - this->ci->EraseAkick(this); + { + std::vector<AutoKick *>::iterator it = std::find(this->ci->akick->begin(), this->ci->akick->end(), this); + if (it != this->ci->akick->end()) + this->ci->akick->erase(it); + } } void AutoKick::Serialize(Serialize::Data &data) const @@ -613,13 +621,6 @@ void ChannelInfo::EraseAccess(unsigned index) this->access->at(index)->Destroy(); } -void ChannelInfo::EraseAccess(const ChanAccess *taccess) -{ - std::vector<ChanAccess *>::iterator it = std::find(this->access->begin(), this->access->end(), taccess); - if (it != this->access->end()) - this->access->erase(it); -} - void ChannelInfo::ClearAccess() { for (unsigned i = this->access->size(); i > 0; --i) @@ -672,13 +673,6 @@ unsigned ChannelInfo::GetAkickCount() const return this->akick->size(); } -void ChannelInfo::EraseAkick(const AutoKick *takick) -{ - std::vector<AutoKick *>::iterator it = std::find(this->akick->begin(), this->akick->end(), takick); - if (it != this->akick->end()) - this->akick->erase(it); -} - void ChannelInfo::EraseAkick(unsigned index) { if (this->akick->empty() || index >= this->akick->size()) @@ -722,13 +716,6 @@ unsigned ChannelInfo::GetBadWordCount() const return this->badwords->size(); } -void ChannelInfo::EraseBadWord(const BadWord *bw) -{ - std::vector<BadWord *>::iterator it = std::find(this->badwords->begin(), this->badwords->end(), bw); - if (it != this->badwords->end()) - this->badwords->erase(it); -} - void ChannelInfo::EraseBadWord(unsigned index) { if (this->badwords->empty() || index >= this->badwords->size()) |