- /* note: NOT else if! */
- if (this->sendq.empty())
- {
- FOREACH_MOD(I_OnBufferFlushed,OnBufferFlushed(this));
- }
-}
-
-void User::Oper(const std::string &opertype, const std::string &opername)
-{
- if (this->IsModeSet('o'))
- this->UnOper();
-
- this->modes[UM_OPERATOR] = 1;
- this->WriteServ("MODE %s :+o", this->nick.c_str());
- FOREACH_MOD(I_OnOper, OnOper(this, opertype));
-
- ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", this->nick.c_str(), this->ident.c_str(), this->host.c_str(), irc::Spacify(opertype.c_str()), opername.c_str());
- this->WriteNumeric(381, "%s :You are now %s %s", this->nick.c_str(), strchr("aeiouAEIOU", *opertype.c_str()) ? "an" : "a", irc::Spacify(opertype.c_str()));
-
- ServerInstance->Logs->Log("OPER", DEFAULT, "%s!%s@%s opered as type: %s", this->nick.c_str(), this->ident.c_str(), this->host.c_str(), opertype.c_str());
- this->oper.assign(opertype, 0, 512);
- ServerInstance->Users->all_opers.push_back(this);
-
- /*
- * This might look like it's in the wrong place.
- * It is *not*!
- *
- * For multi-network servers, we may not have the opertypes of the remote server, but we still want to mark the user as an oper of that type.
- * -- w00t
- */
- 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>;
-
- 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))