diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:45:44 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-21 23:45:44 +0000 |
commit | a30abe26fc803900eaf5dc4c08a31aa1d3c9c89f (patch) | |
tree | 7d59c15a9c23401b91e100ebb9e98df2c7179e53 /src/modules | |
parent | ff3eef491aa9e107d09d9dd9560ef7715b37b3b3 (diff) |
Change User::oper to an OperInfo reference
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11945 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_check.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operchans.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operlevels.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_opermodes.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_override.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/opertype.cpp | 9 | ||||
-rw-r--r-- | src/modules/m_sqloper.cpp | 27 | ||||
-rw-r--r-- | src/modules/m_swhois.cpp | 27 |
11 files changed, 29 insertions, 63 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 51fee9fe5..158b0c533 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -98,7 +98,7 @@ class CommandCheck : public Command if (IS_OPER(targuser)) { /* user is an oper of type ____ */ - user->SendText(checkstr + " opertype " + irc::Spacify(targuser->oper.c_str())); + user->SendText(checkstr + " opertype " + targuser->oper->NameStr()); } LocalUser* loctarg = IS_LOCAL(targuser); diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3339a9ca8..8899a363e 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -167,7 +167,7 @@ class ModuleHttpStats : public Module if (IS_AWAY(u)) data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>"; if (IS_OPER(u)) - data << "<opertype>" << Sanitize(u->oper) << "</opertype>"; + data << "<opertype>" << Sanitize(u->oper->NameStr()) << "</opertype>"; data << "<modes>" << u->FormatModes() << "</modes><ident>" << Sanitize(u->ident) << "</ident>"; LocalUser* lu = IS_LOCAL(u); if (lu) diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 4f73e0969..205d9a412 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -71,7 +71,7 @@ class ModuleOperChans : public Module { if (mask[0] == 'O' && mask[1] == ':') { - if (IS_OPER(user) && InspIRCd::Match(user->oper, mask.substr(2))) + if (IS_OPER(user) && InspIRCd::Match(user->oper->name, mask.substr(2))) return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 42b30f6fb..469bb6a2c 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -92,7 +92,7 @@ class ModuleOperjoin : public Module if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time()); - std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper); + std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper->name); if (i != operTypeChans.end()) { diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 7a18991c1..6aaa2f48e 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -42,16 +42,8 @@ class ModuleOperLevels : public Module // oper killing an oper? if (IS_OPER(dest) && IS_OPER(source)) { - TagIndex::iterator dest_type = ServerInstance->Config->opertypes.find(dest->oper); - TagIndex::iterator src_type = ServerInstance->Config->opertypes.find(source->oper); - - if (dest_type == ServerInstance->Config->opertypes.end()) - return MOD_RES_PASSTHRU; - if (src_type == ServerInstance->Config->opertypes.end()) - return MOD_RES_PASSTHRU; - - long dest_level = dest_type->second->getInt("level"); - long source_level = src_type->second->getInt("level"); + long dest_level = atol(dest->oper->getConfig("level").c_str()); + long source_level = atol(source->oper->getConfig("level").c_str()); if (dest_level > source_level) { if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str()); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 9db0b5b4a..6b5ca10f9 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -40,13 +40,10 @@ class ModuleModesOnOper : public Module virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername) { - TagIndex::iterator typetag = ServerInstance->Config->opertypes.find(opertype); - if (typetag == ServerInstance->Config->opertypes.end()) - return; // whenever a user opers, go through the oper types, find their <type:modes>, // and if they have one apply their modes. The mode string can contain +modes // to add modes to the user or -modes to take modes from the user. - std::string ThisOpersModes = typetag->second->getString("modes"); + std::string ThisOpersModes = user->oper->getConfig("modes"); if (!ThisOpersModes.empty()) { ApplyModes(user, ThisOpersModes); diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 8a3fcdd62..cf18495b5 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -61,7 +61,7 @@ class ModuleOverride : public Module bool CanOverride(User* source, const char* token) { // checks to see if the oper's type has <type:override> - override_t::iterator j = overrides.find(source->oper); + override_t::iterator j = overrides.find(source->oper->name); if (j != overrides.end()) { diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 5f47c690b..82b6c2b68 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -259,7 +259,7 @@ void TreeSocket::SendUsers(TreeServer* Current) this->WriteLine(data); if (IS_OPER(u->second)) { - snprintf(data,MAXBUF,":%s OPERTYPE %s", u->second->uuid.c_str(), u->second->oper.c_str()); + snprintf(data,MAXBUF,":%s OPERTYPE %s", u->second->uuid.c_str(), u->second->oper->name.c_str()); this->WriteLine(data); } if (IS_AWAY(u->second)) diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp index dc9c0064f..32ffa4fc7 100644 --- a/src/modules/m_spanningtree/opertype.cpp +++ b/src/modules/m_spanningtree/opertype.cpp @@ -35,7 +35,14 @@ bool TreeSocket::OperType(const std::string &prefix, parameterlist ¶ms) if (!IS_OPER(u)) ServerInstance->Users->all_opers.push_back(u); u->modes[UM_OPERATOR] = 1; - u->oper.assign(opertype, 0, 512); + OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype); + if (iter != ServerInstance->Config->oper_blocks.end()) + u->oper = iter->second; + else + { + u->oper = new OperInfo; + u->oper->name = opertype; + } Utils->DoOneToAllButSender(u->uuid, "OPERTYPE", params, u->server); TreeServer* remoteserver = Utils->FindServer(u->server); diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index c4eaa6911..a6da1ddaa 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -275,26 +275,21 @@ public: bool OperUser(User* user, const std::string &pattern, const std::string &type) { - ConfigReader Conf; - - for (int j = 0; j < Conf.Enumerate("type"); j++) - { - std::string tname = Conf.ReadValue("type","name",j); - std::string hostname(user->ident); + OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + type); + if (iter == ServerInstance->Config->oper_blocks.end()) + return false; + OperInfo* ifo = iter->second; - hostname.append("@").append(user->host); + std::string hostname(user->ident); - if ((tname == type) && OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str())) - { - /* Opertype and host match, looks like this is it. */ - std::string operhost = Conf.ReadValue("type", "host", j); + hostname.append("@").append(user->host); - if (operhost.size()) - user->ChangeDisplayedHost(operhost.c_str()); + if (OneOfMatches(hostname.c_str(), user->GetIPString(), pattern.c_str())) + { + /* Opertype and host match, looks like this is it. */ - user->Oper(type, tname); - return true; - } + user->Oper(ifo); + return true; } return false; diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 8949c21ef..4c262c9ca 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -106,32 +106,7 @@ class ModuleSWhois : public Module return; ConfigReader Conf; - std::string swhois; - - for (int i = 0; i < Conf.Enumerate("oper"); i++) - { - std::string name = Conf.ReadValue("oper", "name", i); - - if (name == params[0]) - { - swhois = Conf.ReadValue("oper", "swhois", i); - break; - } - } - - if (!swhois.length()) - { - for (int i = 0; i < Conf.Enumerate("type"); i++) - { - std::string type = Conf.ReadValue("type", "name", i); - - if (type == user->oper) - { - swhois = Conf.ReadValue("type", "swhois", i); - break; - } - } - } + std::string swhois = user->oper->getConfig("swhois"); if (!swhois.length()) return; |