+ bool HandleOper(LocalUser* user, const std::string& opername, const std::string& inputpass)
+ {
+ OperIndex::iterator it = ServerInstance->Config->oper_blocks.find(opername);
+ if (it == ServerInstance->Config->oper_blocks.end())
+ return false;
+
+ ConfigTag* tag = it->second->oper_block;
+ if (!tag)
+ return false;
+
+ std::string acceptedhosts = tag->getString("host");
+ std::string hostname = user->ident + "@" + user->host;
+ if (!OneOfMatches(hostname.c_str(), user->GetIPString(), acceptedhosts))
+ return false;
+
+ if (!LookupOper(opername, inputpass))
+ return false;
+
+ user->Oper(it->second);
+ return true;
+ }
+