summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-03 21:44:10 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-03 21:44:10 +0000
commit9c5fa4bd60ff800850922dd2b26cd2865b2ad751 (patch)
treeb503cd3f60bf673dc09aba7310979c369ecc335f /src
parentf956a4cc6c4d0789d0bab6304707967edf5dddf5 (diff)
Revert "Don't do all the oper gubbins if the opertype doesn't exist. I've absolutely no idea why we did this before but it's definitely not good."
This reverts commit d8ee5433eab5c67e9094d9114e3696728f1cab2a. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11476 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp95
1 files changed, 46 insertions, 49 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 2e4a49c3f..2871653bb 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -747,13 +747,6 @@ void User::Oper(const std::string &opertype, const std::string &opername)
if (this->IsModeSet('o'))
this->UnOper();
- opertype_t::iterator iter_opertype = ServerInstance->Config->opertypes.find(this->oper.c_str());
- if (iter_opertype == ServerInstance->Config->opertypes.end())
- {
- ServerInstance->Logs->Log("OPER", DEBUG, "%s!%s@%s opered as type: %s which didn't exist, failing", this->nick.c_str(), this->ident.c_str(), this->host.c_str(), opertype.c_str());
- return;
- }
-
this->modes[UM_OPERATOR] = 1;
this->WriteServ("MODE %s :+o", this->nick.c_str());
FOREACH_MOD(I_OnOper, OnOper(this, opertype));
@@ -765,61 +758,65 @@ void User::Oper(const std::string &opertype, const std::string &opername)
this->oper.assign(opertype, 0, 512);
ServerInstance->Users->all_opers.push_back(this);
- if (AllowedOperCommands)
- AllowedOperCommands->clear();
- else
- AllowedOperCommands = new std::set<std::string>;
+ opertype_t::iterator iter_opertype = ServerInstance->Config->opertypes.find(this->oper.c_str());
+ if (iter_opertype != ServerInstance->Config->opertypes.end())
+ {
+ if (AllowedOperCommands)
+ AllowedOperCommands->clear();
+ else
+ AllowedOperCommands = new std::set<std::string>;
- if (AllowedPrivs)
- AllowedPrivs->clear();
- else
- AllowedPrivs = new std::set<std::string>;
+ if (AllowedPrivs)
+ AllowedPrivs->clear();
+ else
+ AllowedPrivs = new std::set<std::string>;
- AllowedUserModes.reset();
- AllowedChanModes.reset();
- this->AllowedUserModes['o' - 'A'] = true; // Call me paranoid if you want.
+ AllowedUserModes.reset();
+ AllowedChanModes.reset();
+ this->AllowedUserModes['o' - 'A'] = true; // Call me paranoid if you want.
- std::string myclass, mycmd, mypriv;
- irc::spacesepstream Classes(iter_opertype->second.c_str());
- while (Classes.GetToken(myclass))
- {
- operclass_t::iterator iter_operclass = ServerInstance->Config->operclass.find(myclass.c_str());
- if (iter_operclass != ServerInstance->Config->operclass.end())
+ std::string myclass, mycmd, mypriv;
+ irc::spacesepstream Classes(iter_opertype->second.c_str());
+ while (Classes.GetToken(myclass))
{
- /* Process commands */
- irc::spacesepstream CommandList(iter_operclass->second.commandlist);
- while (CommandList.GetToken(mycmd))
- {
- this->AllowedOperCommands->insert(mycmd);
- }
-
- irc::spacesepstream PrivList(iter_operclass->second.privs);
- while (PrivList.GetToken(mypriv))
+ operclass_t::iterator iter_operclass = ServerInstance->Config->operclass.find(myclass.c_str());
+ if (iter_operclass != ServerInstance->Config->operclass.end())
{
- this->AllowedPrivs->insert(mypriv);
- }
-
- for (unsigned char* c = (unsigned char*)iter_operclass->second.umodelist; *c; ++c)
- {
- if (*c == '*')
+ /* Process commands */
+ irc::spacesepstream CommandList(iter_operclass->second.commandlist);
+ while (CommandList.GetToken(mycmd))
{
- this->AllowedUserModes.set();
+ this->AllowedOperCommands->insert(mycmd);
}
- else
+
+ irc::spacesepstream PrivList(iter_operclass->second.privs);
+ while (PrivList.GetToken(mypriv))
{
- this->AllowedUserModes[*c - 'A'] = true;
+ this->AllowedPrivs->insert(mypriv);
}
- }
- for (unsigned char* c = (unsigned char*)iter_operclass->second.cmodelist; *c; ++c)
- {
- if (*c == '*')
+ for (unsigned char* c = (unsigned char*)iter_operclass->second.umodelist; *c; ++c)
{
- this->AllowedChanModes.set();
+ if (*c == '*')
+ {
+ this->AllowedUserModes.set();
+ }
+ else
+ {
+ this->AllowedUserModes[*c - 'A'] = true;
+ }
}
- else
+
+ for (unsigned char* c = (unsigned char*)iter_operclass->second.cmodelist; *c; ++c)
{
- this->AllowedChanModes[*c - 'A'] = true;
+ if (*c == '*')
+ {
+ this->AllowedChanModes.set();
+ }
+ else
+ {
+ this->AllowedChanModes[*c - 'A'] = true;
+ }
}
}
}