summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-01 16:55:00 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-06-01 16:55:00 +0000
commitb117a1ec84b813cec22e9c6a45434ded3efb8d9c (patch)
tree5a4ea505de704a20e9959ac10d6d09cebbd935f2
parent46121d8880ab48d9a925f5b046216016d290b356 (diff)
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
-rw-r--r--src/channels.cpp24
1 files changed, 10 insertions, 14 deletions
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;
}
/*