From b9bf72c4572875b8d67c9423f16bf72741d5e146 Mon Sep 17 00:00:00 2001 From: adam- Date: Wed, 12 Aug 2009 23:52:25 +0000 Subject: [PATCH] Set the correct opertypes on newly registered users git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2450 5417fbe8-f217-4b02-8779-1006273d7864 --- include/extern.h | 5 +++++ src/core/ns_register.c | 2 ++ src/nickserv.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/extern.h b/include/extern.h index 32f8ba1b9..366396682 100644 --- a/include/extern.h +++ b/include/extern.h @@ -726,6 +726,11 @@ E NickAlias *findnick(const std::string &nick); E NickCore *findcore(const char *nick); E int 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_register.c b/src/core/ns_register.c index 9ed66529b..958e4d94b 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -64,6 +64,8 @@ class CommandNSConfirm : public Command if (nr->email) na->nc->email = sstrdup(nr->email); + SetOperType(na->nc); + if (!force) { u->nc = na->nc; diff --git a/src/nickserv.c b/src/nickserv.c index 88371b3db..032d1fd4e 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -1344,6 +1344,40 @@ 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 >::iterator it = svsopers_in_config.begin(); it != svsopers_in_config.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::iterator tit = MyOperTypes.begin(); tit != MyOperTypes.end(); ++tit) + { + OperType *ot = *tit; + + if (ot->GetName() == type) + { + nc->ot = ot; + alog("%s: Tied oper %s to type %s", s_OperServ, nc->display, type.c_str()); + } + } + } + } +} + /*************************************************************************/ /*********************** NickServ command routines ***********************/ /*************************************************************************/