summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/regchannel.h16
-rw-r--r--modules/commands/cs_access.cpp2
-rw-r--r--modules/commands/cs_flags.cpp4
-rw-r--r--modules/commands/cs_xop.cpp2
-rw-r--r--modules/extra/webcpanel/pages/chanserv/access.cpp2
-rw-r--r--src/access.cpp8
-rw-r--r--src/regchannel.cpp35
7 files changed, 26 insertions, 43 deletions
diff --git a/include/regchannel.h b/include/regchannel.h
index d98456e97..02d637800 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -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
*/
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index 5cbe3024e..28e5fbf7b 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -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;
}
diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp
index 9824ab22f..6eb8c7721 100644
--- a/modules/commands/cs_flags.cpp
+++ b/modules/commands/cs_flags.cpp
@@ -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);
diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp
index 72197aeec..d0ad0a049 100644
--- a/modules/commands/cs_xop.cpp
+++ b/modules/commands/cs_xop.cpp
@@ -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;
}
diff --git a/modules/extra/webcpanel/pages/chanserv/access.cpp b/modules/extra/webcpanel/pages/chanserv/access.cpp
index 23644efb1..235a49d1c 100644
--- a/modules/extra/webcpanel/pages/chanserv/access.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/access.cpp
@@ -70,7 +70,7 @@ bool WebCPanel::ChanServ::Access::OnRequest(HTTPProvider *server, const Anope::s
denied = true;
}
else
- ci->EraseAccess(acc);
+ acc->Destroy();
break;
}
}
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())