summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-27 12:02:10 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-27 12:02:10 +0000
commit4a50237d63ae019fbfaf0901ef59a772e66080df (patch)
treef4282f212cb5eb805919e8f12ae52f0e07e53421 /src
parent140b01ba4927e7d6b85504ff740ae443b0f2df2a (diff)
Config option for default channel modes -- more to follow, don't use yet
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7163 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp19
-rw-r--r--src/configreader.cpp5
2 files changed, 21 insertions, 3 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 11a5c944d..7ed166982 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -172,6 +172,23 @@ CUList* chanrec::GetVoicedUsers()
return &internal_voice_userlist;
}
+void chanrec::SetDefaultModes()
+{
+ irc::spacesepstream list(ServerInstance->Config->DefaultModes);
+ std::string modeseq = list.GetToken();
+
+ for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n)
+ {
+ ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
+ if (mode)
+ {
+ this->SetMode(*n, true);
+ if (mode->GetNumParams(true))
+ this->SetModeParam(*n, list.GetToken().c_str(), true);
+ }
+ }
+}
+
/*
* add a channel to a user, creating the record for it if needed and linking
* it to the user record
@@ -213,7 +230,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
/* As spotted by jilles, dont bother to set this on remote users */
if (IS_LOCAL(user))
- Ptr->modes[CM_TOPICLOCK] = Ptr->modes[CM_NOEXTERNAL] = 1;
+ Ptr->SetDefaultModes();
Ptr->created = TS ? TS : Instance->Time();
Ptr->age = Ptr->created;
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 5ec60d1c3..6e9b75c43 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -26,7 +26,7 @@ ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
this->ClearStack();
*ServerName = *Network = *ServerDesc = *AdminName = '\0';
*HideWhoisServer = *AdminEmail = *AdminNick = *diepass = *restartpass = *FixedQuit = *HideKillsServer = '\0';
- *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
+ *DefaultModes = *CustomVersion = *motd = *rules = *PrefixQuit = *DieValue = *DNSServer = '\0';
*UserStats = *ModPath = *MyExecutable = *DisabledCommands = *PID = *SuffixQuit = '\0';
WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0;
log_file = NULL;
@@ -620,7 +620,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "hidesplits", "0", new ValueContainerBool (&this->HideSplits), DT_BOOLEAN, NoValidation},
{"options", "hidebans", "0", new ValueContainerBool (&this->HideBans), DT_BOOLEAN, NoValidation},
{"options", "hidewhois", "", new ValueContainerChar (this->HideWhoisServer), DT_CHARPTR, NoValidation},
- {"options", "hidekills", "", new ValueContainerChar (this->HideKillsServer), DT_CHARPTR, NoValidation},
+ {"options", "hidekills", "", new ValueContainerChar (this->HideKillsServer), DT_CHARPTR, NoValidation},
{"options", "operspywhois", "0", new ValueContainerBool (&this->OperSpyWhois), DT_BOOLEAN, NoValidation},
{"options", "nouserdns", "0", new ValueContainerBool (&this->NoUserDns), DT_BOOLEAN, NoValidation},
{"options", "syntaxhints", "0", new ValueContainerBool (&this->SyntaxHints), DT_BOOLEAN, NoValidation},
@@ -630,6 +630,7 @@ void ServerConfig::Read(bool bail, userrec* user)
{"options", "hostintopic", "1", new ValueContainerBool (&this->FullHostInTopic), DT_BOOLEAN, NoValidation},
{"options", "hidemodes", "", new ValueContainerChar (hidemodes), DT_CHARPTR, ValidateModeLists},
{"options", "exemptchanops","", new ValueContainerChar (exemptchanops), DT_CHARPTR, ValidateExemptChanOps},
+ {"options", "defaultmodes", "nt", new ValueContainerChar (this->DefaultModes), DT_CHARPTR, NoValidation},
{"pid", "file", "", new ValueContainerChar (this->PID), DT_CHARPTR, NoValidation},
{"whowas", "groupsize", "10", new ValueContainerInt (&this->WhoWasGroupSize), DT_INTEGER, NoValidation},
{"whowas", "maxgroups", "10240", new ValueContainerInt (&this->WhoWasMaxGroups), DT_INTEGER, NoValidation},