diff options
-rw-r--r-- | include/configreader.h | 7 | ||||
-rw-r--r-- | src/commands/cmd_stats.cpp | 5 | ||||
-rw-r--r-- | src/configreader.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/opertype.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sqloper.cpp | 4 |
5 files changed, 14 insertions, 14 deletions
diff --git a/include/configreader.h b/include/configreader.h index ee58c3bc9..2aab0a075 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -507,11 +507,14 @@ class CoreExport ServerConfig */ 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; diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 9fef7bbd4..846af57db 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -325,11 +325,8 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) 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; diff --git a/src/configreader.cpp b/src/configreader.cpp index af7a8ca59..957adc829 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -123,11 +123,11 @@ void ServerConfig::CrossCheckOperClassType() 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; @@ -152,8 +152,8 @@ void ServerConfig::CrossCheckOperClassType() 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()); diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index 9e8c8ed9d..6402b89dc 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -36,8 +36,8 @@ CmdResult CommandOpertype::Handle(const std::vector<std::string>& params, User * 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 { diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index b9a883043..295f4aa94 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -78,8 +78,8 @@ class OpMeQuery : public SQLQuery 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; |