Require privs given on initial join to be in <options:defaultmodes>.

This commit is contained in:
Peter Powell 2013-07-10 15:23:46 +01:00
parent 4509cbcc0b
commit 3d019b14ec
3 changed files with 7 additions and 4 deletions

View File

@ -617,7 +617,7 @@
# defaultmodes: What modes are set on a empty channel when a user # defaultmodes: What modes are set on a empty channel when a user
# joins it and it is unregistered. This is similar to Asuka's # joins it and it is unregistered. This is similar to Asuka's
# autochanmodes. # autochanmodes.
defaultmodes="nt" defaultmodes="not"
# xlinemessage: This is the text that is sent to a user when they are # xlinemessage: This is the text that is sent to a user when they are
# banned from the server. # banned from the server.

View File

@ -162,6 +162,9 @@ void Channel::SetDefaultModes()
ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL); ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
if (mode) if (mode)
{ {
if (mode->GetPrefixRank())
continue;
if (mode->GetNumParams(true)) if (mode->GetNumParams(true))
list.GetToken(parameter); list.GetToken(parameter);
else else
@ -223,7 +226,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co
if (!chan) if (!chan)
{ {
privs = "o"; privs = ServerInstance->Config->DefaultModes.substr(0, ServerInstance->Config->DefaultModes.find(' '));
if (override == false) if (override == false)
{ {
@ -343,7 +346,7 @@ void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, boo
for (std::string::const_iterator i = privs->begin(); i != privs->end(); ++i) for (std::string::const_iterator i = privs->begin(); i != privs->end(); ++i)
{ {
ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL); ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL);
if (mh) if (mh && mh->GetPrefixRank())
{ {
std::string nick = user->nick; std::string nick = user->nick;
/* Set, and make sure that the mode handler knows this mode was now set */ /* Set, and make sure that the mode handler knows this mode was now set */

View File

@ -401,7 +401,7 @@ void ServerConfig::Fill()
UndernetMsgPrefix = options->getBool("ircumsgprefix"); UndernetMsgPrefix = options->getBool("ircumsgprefix");
FullHostInTopic = options->getBool("hostintopic"); FullHostInTopic = options->getBool("hostintopic");
MaxTargets = security->getInt("maxtargets", 20, 1, 31); MaxTargets = security->getInt("maxtargets", 20, 1, 31);
DefaultModes = options->getString("defaultmodes", "nt"); DefaultModes = options->getString("defaultmodes", "not");
PID = ConfValue("pid")->getString("file"); PID = ConfValue("pid")->getString("file");
MaxChans = ConfValue("channels")->getInt("users", 20); MaxChans = ConfValue("channels")->getInt("users", 20);
OperMaxChans = ConfValue("channels")->getInt("opers", 60); OperMaxChans = ConfValue("channels")->getInt("opers", 60);