1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 09:26:38 +02:00

Made access del by nick and other functions from 326f1a really delete objects

This commit is contained in:
Adam
2013-02-05 09:45:48 -05:00
parent 62e3c8c4f8
commit 25cec015e8
7 changed files with 26 additions and 43 deletions
+11 -24
View File
@@ -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())