diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-17 13:54:53 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-04-17 13:54:53 +0000 |
commit | 2dfc384cde46ba63ed7c2f4420712596096123ca (patch) | |
tree | 0427aad7d9f9c1655adb4022dc3c2c32ecb626d0 /src/modules/m_messageflood.cpp | |
parent | c6f1e7997d846cabe33bb031d9d5fcf0790b83fa (diff) |
Fix SetModeParam to use std::string and handle edge cases.
Previously, changing the vaule of a mode could require 3 calls to SetMode and SetModeParam.
This also fixes memory leaks caused by the strdup() not always being paired with a free().
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11307 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_messageflood.cpp')
-rw-r--r-- | src/modules/m_messageflood.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index ed40fca5b..f2082da33 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -143,8 +143,7 @@ class MsgFlood : public ModeHandler parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs); floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); channel->Extend("flood",fs); - channel->SetMode('f', true); - channel->SetModeParam('f', parameter.c_str(), true); + channel->SetMode('f', parameter); return MODEACTION_ALLOW; } else @@ -164,8 +163,7 @@ class MsgFlood : public ModeHandler floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); channel->Shrink("flood"); channel->Extend("flood",fs); - channel->SetModeParam('f', cur_param.c_str(), false); - channel->SetModeParam('f', parameter.c_str(), true); + channel->SetMode('f', parameter); return MODEACTION_ALLOW; } else @@ -189,7 +187,7 @@ class MsgFlood : public ModeHandler { delete f; channel->Shrink("flood"); - channel->SetMode('f', false); + channel->SetMode('f', ""); return MODEACTION_ALLOW; } } |