summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/channels.h4
-rw-r--r--include/configreader.h6
-rw-r--r--src/channels.cpp19
-rw-r--r--src/configreader.cpp5
4 files changed, 30 insertions, 4 deletions
diff --git a/include/channels.h b/include/channels.h
index 950275974..20454e0b9 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -122,6 +122,10 @@ class CoreExport chanrec : public Extensible
*/
static chanrec* ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, const std::string &privs);
+ /** Set default modes for the channel on creation
+ */
+ void SetDefaultModes();
+
prefixlist prefixes;
/** Maximum number of bans (cached)
diff --git a/include/configreader.h b/include/configreader.h
index 70b1bc800..e596e409d 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -494,6 +494,10 @@ class CoreExport ServerConfig : public Extensible
*/
std::string logpath;
+ /** Default channel modes
+ */
+ char DefaultModes[MAXBUF];
+
/** Custom version string, which if defined can replace the system info in VERSION.
*/
char CustomVersion[MAXBUF];
@@ -504,7 +508,7 @@ class CoreExport ServerConfig : public Extensible
/** Max banlist sizes for channels (the std::string is a glob)
*/
- std::map<std::string,int> maxbans;
+ std::map<std::string, int> maxbans;
/** Directory where the inspircd binary resides
*/
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},