summaryrefslogtreecommitdiff
path: root/src/modules/m_nickflood.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 13:54:53 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 13:54:53 +0000
commit2dfc384cde46ba63ed7c2f4420712596096123ca (patch)
tree0427aad7d9f9c1655adb4022dc3c2c32ecb626d0 /src/modules/m_nickflood.cpp
parentc6f1e7997d846cabe33bb031d9d5fcf0790b83fa (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_nickflood.cpp')
-rw-r--r--src/modules/m_nickflood.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index f91694625..0a8e9a31d 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -144,8 +144,7 @@ class NickFlood : public ModeHandler
parameter = ConvToStr(nnicks) + ":" +ConvToStr(nsecs);
nickfloodsettings *f = new nickfloodsettings(ServerInstance, nsecs, nnicks);
channel->Extend("nickflood", f);
- channel->SetMode('F', true);
- channel->SetModeParam('F', parameter.c_str(), true);
+ channel->SetMode('F', parameter);
return MODEACTION_ALLOW;
}
else
@@ -168,8 +167,7 @@ class NickFlood : public ModeHandler
f = new nickfloodsettings(ServerInstance, nsecs, nnicks);
channel->Shrink("nickflood");
channel->Extend("nickflood", f);
- channel->SetModeParam('F', cur_param.c_str(), false);
- channel->SetModeParam('F', parameter.c_str(), true);
+ channel->SetMode('F', parameter);
return MODEACTION_ALLOW;
}
else
@@ -194,7 +192,7 @@ class NickFlood : public ModeHandler
channel->GetExt("nickflood", f);
delete f;
channel->Shrink("nickflood");
- channel->SetMode('F', false);
+ channel->SetMode('F', "");
return MODEACTION_ALLOW;
}
}