From 4a50237d63ae019fbfaf0901ef59a772e66080df Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 27 May 2007 12:02:10 +0000 Subject: 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 --- src/channels.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/channels.cpp') 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; -- cgit v1.2.3