From 3d019b14ec0025ff38bbd40c868ddccd0b13d8a3 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 10 Jul 2013 15:23:46 +0100 Subject: Require privs given on initial join to be in . --- docs/conf/inspircd.conf.example | 2 +- src/channels.cpp | 7 +++++-- src/configreader.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index ee268dcd2..0e5d40c08 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -617,7 +617,7 @@ # defaultmodes: What modes are set on a empty channel when a user # joins it and it is unregistered. This is similar to Asuka's # autochanmodes. - defaultmodes="nt" + defaultmodes="not" # xlinemessage: This is the text that is sent to a user when they are # banned from the server. diff --git a/src/channels.cpp b/src/channels.cpp index d82ad6c23..c7913606f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -162,6 +162,9 @@ void Channel::SetDefaultModes() ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL); if (mode) { + if (mode->GetPrefixRank()) + continue; + if (mode->GetNumParams(true)) list.GetToken(parameter); else @@ -223,7 +226,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co if (!chan) { - privs = "o"; + privs = ServerInstance->Config->DefaultModes.substr(0, ServerInstance->Config->DefaultModes.find(' ')); 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) { ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL); - if (mh) + if (mh && mh->GetPrefixRank()) { std::string nick = user->nick; /* Set, and make sure that the mode handler knows this mode was now set */ diff --git a/src/configreader.cpp b/src/configreader.cpp index d7d448bc4..27b9e5c77 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -401,7 +401,7 @@ void ServerConfig::Fill() UndernetMsgPrefix = options->getBool("ircumsgprefix"); FullHostInTopic = options->getBool("hostintopic"); MaxTargets = security->getInt("maxtargets", 20, 1, 31); - DefaultModes = options->getString("defaultmodes", "nt"); + DefaultModes = options->getString("defaultmodes", "not"); PID = ConfValue("pid")->getString("file"); MaxChans = ConfValue("channels")->getInt("users", 20); OperMaxChans = ConfValue("channels")->getInt("opers", 60); -- cgit v1.3.1-10-gc9f91