diff options
-rw-r--r-- | data/example.conf | 10 | ||||
-rw-r--r-- | include/opertype.h | 4 | ||||
-rw-r--r-- | modules/core/os_oper.cpp | 2 | ||||
-rw-r--r-- | src/config.cpp | 8 | ||||
-rw-r--r-- | src/users.cpp | 8 |
5 files changed, 29 insertions, 3 deletions
diff --git a/data/example.conf b/data/example.conf index d5bf7f9af..e77c276fb 100644 --- a/data/example.conf +++ b/data/example.conf @@ -1457,6 +1457,16 @@ opertype /* What privs (see above) this opertype has */ privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm" + + /* + * Modes to be set on users when they identify to accounts linked to this opertype. + * + * This can be used to automatically oper users who identify for services operator accounts, and is + * useful for setting modes such as Plexus's user mode +N. + * + * Note that some IRCds, such as InspIRCd, do not allow directly setting +o, and this will not work. + */ + #modes = "+o" } opertype diff --git a/include/opertype.h b/include/opertype.h index bf76d71eb..0c0d329c7 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -55,6 +55,10 @@ class CoreExport OperType */ std::set<OperType *> inheritances; public: + /** Modes to set when someone identifys using this opertype + */ + Anope::string modes; + /** Find an oper type by name * @param name The name * @return The oper type diff --git a/modules/core/os_oper.cpp b/modules/core/os_oper.cpp index 8352fb89f..8c4745c2a 100644 --- a/modules/core/os_oper.cpp +++ b/modules/core/os_oper.cpp @@ -144,6 +144,8 @@ class CommandOSOper : public Command buf.clear(); } } + if (!ot->modes.empty()) + source.Reply(_("Opertype \2%s\2 receives modes \2%s\2 once identifying."), ot->GetName().c_str(), ot->modes.c_str()); } } else diff --git a/src/config.cpp b/src/config.cpp index 4790cd34d..ae27d7273 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -583,12 +583,14 @@ static bool DoOperType(ServerConfig *config, const Anope::string &, const Anope: Anope::string inherits = values[1].GetValue(); Anope::string commands = values[2].GetValue(); Anope::string privs = values[3].GetValue(); + Anope::string modes = values[4].GetValue(); ValueItem vi(name); if (!ValidateNotEmpty(config, "opertype", "name", vi)) throw ConfigException("One or more values in your configuration file failed to validate. Please see your log for more information."); OperType *ot = new OperType(name); + ot->modes = modes; Anope::string tok; spacesepstream cmdstr(commands); @@ -1220,9 +1222,9 @@ ConfigItems::ConfigItems(ServerConfig *conf) {DT_STRING}, InitModules, DoModule, DoneModules}, {"opertype", - {"name", "inherits", "commands", "privs", ""}, - {"", "", "", "", ""}, - {DT_STRING, DT_STRING, DT_STRING, DT_STRING}, + {"name", "inherits", "commands", "privs", "modes", ""}, + {"", "", "", "", "", ""}, + {DT_STRING, DT_STRING, DT_STRING, DT_STRING, DT_STRING}, InitOperTypes, DoOperType, DoneOperTypes}, {"oper", {"name", "type", "password", "certfp", ""}, diff --git a/src/users.cpp b/src/users.cpp index 343ef058a..214f3c91b 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -363,6 +363,14 @@ void User::Identify(NickAlias *na) ircdproto->SetAutoIdentificationToken(this); FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(this)); + + if (na->nc->o != NULL && na->nc->o->ot != NULL && !na->nc->o->ot->modes.empty()) + { + BotInfo *bi = findbot(Config->OperServ); + this->SetModes(bi, "%s", na->nc->o->ot->modes.c_str()); + if (bi != NULL) + this->SendMessage(bi, "Changing your usermodes to \002%s\002", na->nc->o->ot->modes.c_str()); + } } |