1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 01:23:13 +02:00

Added opertype:modes

This commit is contained in:
Adam
2011-08-02 01:50:09 -04:00
parent 41b40f6504
commit d43e1fb800
5 changed files with 29 additions and 3 deletions
+10
View File
@@ -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
+4
View File
@@ -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
+2
View File
@@ -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
+5 -3
View File
@@ -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", ""},
+8
View File
@@ -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());
}
}