summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradam- <adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-12 23:52:25 +0000
committeradam- <adam-@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-12 23:52:25 +0000
commitb9bf72c4572875b8d67c9423f16bf72741d5e146 (patch)
tree2697b691775d587137a8cc1504a9945cfa0f3757
parent577870bb45b537889f6e6a102e0dbc52ee4fa841 (diff)
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
-rw-r--r--include/extern.h5
-rw-r--r--src/core/ns_register.c2
-rw-r--r--src/nickserv.c34
3 files changed, 41 insertions, 0 deletions
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<std::pair<std::string, std::string> >::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<OperType *>::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 ***********************/
/*************************************************************************/