*/
bool FullHostInTopic;
- /** Oper block and type index.
- * For anonymous oper blocks (type only), prefix with a space.
+ /** Oper blocks keyed by their name
*/
OperIndex oper_blocks;
+ /** Oper types keyed by their name
+ */
+ OperIndex OperTypes;
+
/** Max channels per user
*/
unsigned int MaxChans;
break;
case 'O':
{
- for(OperIndex::iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); i++)
+ for (OperIndex::const_iterator i = ServerInstance->Config->OperTypes.begin(); i != ServerInstance->Config->OperTypes.end(); ++i)
{
- // just the types, not the actual oper blocks...
- if (i->first[0] != ' ')
- continue;
OperInfo* tag = i->second;
tag->init();
std::string umodes;
std::string name = tag->getString("name");
if (name.empty())
throw CoreException("<type:name> is missing from tag at " + tag->getTagLocation());
- if (oper_blocks.find(" " + name) != oper_blocks.end())
+ if (OperTypes.find(name) != OperTypes.end())
throw CoreException("Duplicate type block with name " + name + " at " + tag->getTagLocation());
OperInfo* ifo = new OperInfo;
- oper_blocks[" " + name] = ifo;
+ OperTypes[name] = ifo;
ifo->name = name;
ifo->type_block = tag;
throw CoreException("<oper:name> missing from tag at " + tag->getTagLocation());
std::string type = tag->getString("type");
- OperIndex::iterator tblk = oper_blocks.find(" " + type);
- if (tblk == oper_blocks.end())
+ OperIndex::iterator tblk = OperTypes.find(type);
+ if (tblk == OperTypes.end())
throw CoreException("Oper block " + name + " has missing type " + type);
if (oper_blocks.find(name) != oper_blocks.end())
throw CoreException("Duplicate oper block with name " + name + " at " + tag->getTagLocation());
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
u->SetMode(opermh, true);
- OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype);
- if (iter != ServerInstance->Config->oper_blocks.end())
+ OperIndex::iterator iter = ServerInstance->Config->OperTypes.find(opertype);
+ if (iter != ServerInstance->Config->OperTypes.end())
u->oper = iter->second;
else
{
bool OperUser(User* user, const std::string &pattern, const std::string &type)
{
- OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + type);
- if (iter == ServerInstance->Config->oper_blocks.end())
+ OperIndex::iterator iter = ServerInstance->Config->OperTypes.find(type);
+ if (iter == ServerInstance->Config->OperTypes.end())
{
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "bad type '%s' in returned row for oper %s", type.c_str(), username.c_str());
return false;