From b117a1ec84b813cec22e9c6a45434ded3efb8d9c Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 1 Jun 2007 16:55:00 +0000 Subject: This is a better fix, as it calls the mode handler giving the modules etc chance to allocate structs git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7198 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index dec68341e..7629c8bb6 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -43,12 +43,6 @@ void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on) { if (n == custom_mode_params.end()) custom_mode_params[mode] = strdup(parameter); - - /* TODO: We really need to do away with this in 1.2 */ - if (mode == 'l') - this->limit = atoi(parameter); - else if (mode == 'k') - strlcpy(this->key, parameter, sizeof(this->key)); } else { @@ -57,12 +51,6 @@ void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on) free(n->second); custom_mode_params.erase(n); } - - /* TODO: See above */ - if (mode == 'l') - this->limit = 0; - else if (mode == 'k') - *this->key = 0; } } @@ -188,17 +176,25 @@ void chanrec::SetDefaultModes() { irc::spacesepstream list(ServerInstance->Config->DefaultModes); std::string modeseq = list.GetToken(); + std::string parameter; + userrec* dummyuser = new userrec(ServerInstance); + dummyuser->SetFd(FD_MAGIC_NUMBER); 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); + parameter = list.GetToken().c_str(); + else + parameter = ""; + + mode->OnModeChange(dummyuser, dummyuser, this, parameter, true); } } + + delete dummyuser; } /* -- cgit v1.2.3