mirror of
https://github.com/anope/anope.git
synced 2026-06-30 20:46:38 +02:00
Made access del by nick and other functions from 326f1a really delete objects
This commit is contained in:
+4
-12
@@ -165,6 +165,10 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
std::map<Anope::string, int16_t> levels;
|
||||
|
||||
public:
|
||||
friend class ChanAccess;
|
||||
friend class AutoKick;
|
||||
friend class BadWord;
|
||||
|
||||
typedef std::multimap<Anope::string, ModeLock *> ModeList;
|
||||
Serialize::Checker<ModeList> mode_locks;
|
||||
Serialize::Checker<std::vector<LogSetting *> > log_settings;
|
||||
@@ -257,14 +261,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
*/
|
||||
void EraseAccess(unsigned index);
|
||||
|
||||
/** Erase an entry from the channel access list
|
||||
*
|
||||
* @param taccess The access to remove
|
||||
*
|
||||
* Clears the memory used by the given access entry and removes it from the vector.
|
||||
*/
|
||||
void EraseAccess(const ChanAccess *taccess);
|
||||
|
||||
/** Clear the entire channel access list
|
||||
*
|
||||
* Clears the entire access list by deleting every item and then clearing the vector.
|
||||
@@ -300,8 +296,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
*/
|
||||
unsigned GetAkickCount() const;
|
||||
|
||||
void EraseAkick(const AutoKick *akick);
|
||||
|
||||
/** Erase an entry from the channel akick list
|
||||
* @param index The index of the akick
|
||||
*/
|
||||
@@ -329,8 +323,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
*/
|
||||
unsigned GetBadWordCount() const;
|
||||
|
||||
void EraseBadWord(const BadWord *bw);
|
||||
|
||||
/** Remove a badword
|
||||
* @param index The index of the badword
|
||||
*/
|
||||
|
||||
@@ -286,7 +286,7 @@ class CommandCSAccess : public Command
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask;
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, access));
|
||||
ci->EraseAccess(access);
|
||||
access->Destroy();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class CommandCSFlags : public Command
|
||||
if (current != NULL)
|
||||
{
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, current));
|
||||
ci->EraseAccess(current);
|
||||
current->Destroy();
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
|
||||
source.Reply(_("\002%s\002 removed from the %s access list."), mask.c_str(), ci->name.c_str());
|
||||
}
|
||||
@@ -203,7 +203,7 @@ class CommandCSFlags : public Command
|
||||
access->flags = current_flags;
|
||||
|
||||
if (current != NULL)
|
||||
ci->EraseAccess(current);
|
||||
current->Destroy();
|
||||
|
||||
ci->AddAccess(access);
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ class XOPBase : public Command
|
||||
source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str());
|
||||
|
||||
FOREACH_MOD(I_OnAccessDel, OnAccessDel(ci, source, a));
|
||||
ci->EraseAccess(a);
|
||||
a->Destroy();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
|
||||
denied = true;
|
||||
}
|
||||
else
|
||||
ci->EraseAccess(acc);
|
||||
acc->Destroy();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -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
|
||||
|
||||
+11
-24
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user