summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-05-19 06:17:55 +0000
committerAdam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864>2010-05-19 06:17:55 +0000
commit3860856dd284353966fe682b2256a6dd6b5f48fe (patch)
treee28535836fad521e2df662e2562da8e5b4319ce4
parent2b4d834f8c5716a7b9309ad2e4eb5d00b48742e7 (diff)
Moved opertype access checking to NickAlises constructor, cleans up some code and fixes bug #1163
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2968 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--include/extern.h5
-rw-r--r--src/core/ns_group.c2
-rw-r--r--src/core/ns_register.c2
-rw-r--r--src/init.c33
-rw-r--r--src/nickalias.cpp20
-rw-r--r--src/nickserv.c34
6 files changed, 21 insertions, 75 deletions
diff --git a/include/extern.h b/include/extern.h
index 2b8b8ca0e..4194338e9 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -395,11 +395,6 @@ E NickAlias *findnick(const std::string &nick);
E NickCore *findcore(const char *nick);
E bool is_on_access(User *u, NickCore *nc);
-/** Set the correct oper type for a nickcore
- * @param nc The nick core
- */
-E void SetOperType(NickCore *nc);
-
/**** operserv.c ****/
E SList akills, sglines, sqlines, szlines;
diff --git a/src/core/ns_group.c b/src/core/ns_group.c
index bdf80d38d..ce88641fe 100644
--- a/src/core/ns_group.c
+++ b/src/core/ns_group.c
@@ -74,7 +74,7 @@ class CommandNSGroup : public Command
}
else if (target && target->nc->HasFlag(NI_SUSPENDED))
{
- Alog() << Config.s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick;
+ Alog() << Config.s_NickServ << ": " << u->GetMask() << " tried to use GROUP for SUSPENDED nick " << target->nick;
notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, target->nick);
}
else if (target->HasFlag(NS_FORBIDDEN))
diff --git a/src/core/ns_register.c b/src/core/ns_register.c
index 519266747..12c811f1c 100644
--- a/src/core/ns_register.c
+++ b/src/core/ns_register.c
@@ -56,8 +56,6 @@ class CommandNSConfirm : public Command
if (nr->email)
na->nc->email = sstrdup(nr->email);
- SetOperType(na->nc);
-
if (!force)
{
u->Login(na->nc);
diff --git a/src/init.c b/src/init.c
index d71366968..cafb30ada 100644
--- a/src/init.c
+++ b/src/init.c
@@ -437,39 +437,6 @@ int init_secondary(int ac, char **av)
FOREACH_RESULT(I_OnLoadDatabase, OnLoadDatabase());
Alog() << "Databases loaded";
- // XXX: this is duplicated in type loading.
- for (std::list<std::pair<std::string, std::string> >::iterator it = Config.Opers.begin(); it != Config.Opers.end(); it++)
- {
- std::string nick = it->first;
- std::string type = it->second;
-
- NickAlias *na = findnick(nick);
- if (!na)
- {
- // Nonexistant nick
- Alog() << "Oper nick '" << nick << "' is not registered";
- continue;
- }
-
- if (!na->nc)
- {
- // Nick with no core (wtf?)
- abort();
- }
-
- for (std::list<OperType *>::iterator tit = Config.MyOperTypes.begin(); tit != Config.MyOperTypes.end(); tit++)
- {
- OperType *ot = *tit;
- if (ot->GetName() == type)
- {
- Alog() << "Tied oper " << na->nc->display << " to type " << type;
- na->nc->ot = ot;
- }
- }
- }
- // END DUPLICATION
-
-
/* this is only used on the first run of Anope. */
if (!nbots)
{
diff --git a/src/nickalias.cpp b/src/nickalias.cpp
index edb717133..669f66c01 100644
--- a/src/nickalias.cpp
+++ b/src/nickalias.cpp
@@ -52,6 +52,26 @@ NickAlias::NickAlias(const std::string &nickname, NickCore *nickcore)
this->nc = nickcore;
slist_add(&nc->aliases, this);
alpha_insert_alias(this);
+
+ for (std::list<std::pair<std::string, std::string> >::iterator it = Config.Opers.begin(); it != Config.Opers.end(); it++)
+ {
+ if (nc->ot)
+ break;
+ if (it->first != this->nick)
+ continue;
+
+ for (std::list<OperType *>::iterator tit = Config.MyOperTypes.begin(); tit != Config.MyOperTypes.end(); tit++)
+ {
+ OperType *ot = *tit;
+
+ if (ot->GetName() == it->second)
+ {
+ Alog() << "Tied oper " << nc->display << " to type " << ot->GetName();
+ nc->ot = ot;
+ break;
+ }
+ }
+ }
}
/** Default destructor
diff --git a/src/nickserv.c b/src/nickserv.c
index b9e39fac7..aef24eecf 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -779,40 +779,6 @@ void del_ns_timeout(NickAlias * na, int type)
NickServRelease::ClearTimers(na);
}
-/** Set the correct oper type for a nickcore
- * @param nc The nick core
- */
-void SetOperType(NickCore *nc)
-{
- for (std::list<std::pair<std::string, std::string> >::iterator it = Config.Opers.begin(); it != Config.Opers.end(); ++it)
- {
- std::string nick = it->first;
- std::string type = it->second;
-
- NickAlias *na = findnick(nick);
-
- if (!na)
- {
- /* Nonexistant nick */
- continue;
- }
-
- if (na->nc == nc)
- {
- for (std::list<OperType *>::iterator tit = Config.MyOperTypes.begin(); tit != Config.MyOperTypes.end(); ++tit)
- {
- OperType *ot = *tit;
-
- if (ot->GetName() == type)
- {
- nc->ot = ot;
- Alog() << Config.s_OperServ << ": Tied oper " << nc->display << " to type " << type;
- }
- }
- }
- }
-}
-
/*************************************************************************/
/*********************** NickServ command routines ***********************/
/*************************************************************************/