summaryrefslogtreecommitdiff
path: root/src/opertype.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-12-19 20:35:09 -0500
committerAdam <Adam@anope.org>2013-12-19 20:35:09 -0500
commitab6cd3b26caf127d1052e58e9f906d8ed5c3d986 (patch)
tree501563e7cd9b3d2c838727ce8df759ef3b08f527 /src/opertype.cpp
parent275f2fd374a75896b356297c1d9de8b13a894d1c (diff)
Fix a few commands not being able to find non conf opers
Diffstat (limited to 'src/opertype.cpp')
-rw-r--r--src/opertype.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/opertype.cpp b/src/opertype.cpp
index 0db17464d..153b735ab 100644
--- a/src/opertype.cpp
+++ b/src/opertype.cpp
@@ -12,11 +12,25 @@
#include "opertype.h"
#include "config.h"
+std::vector<Oper *> Oper::opers;
+
+Oper::Oper(const Anope::string &n, OperType *o) : name(n), ot(o), require_oper(false), config(false)
+{
+ opers.push_back(this);
+}
+
+Oper::~Oper()
+{
+ std::vector<Oper *>::iterator it = std::find(opers.begin(), opers.end(), this);
+ if (it != opers.end())
+ opers.erase(it);
+}
+
Oper *Oper::Find(const Anope::string &name)
{
- for (unsigned i = 0; i < Config->Opers.size(); ++i)
+ for (unsigned i = 0; i < opers.size(); ++i)
{
- Oper *o = Config->Opers[i];
+ Oper *o = opers[i];
if (o->name.equals_ci(name))
return o;