summaryrefslogtreecommitdiff
path: root/src/modules/m_kicknorejoin.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_kicknorejoin.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_kicknorejoin.cpp')
-rw-r--r--src/modules/m_kicknorejoin.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 527022c11..c5abc80c2 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -65,7 +65,7 @@ class KickRejoin : public ModeHandler
}
else
{
- channel->SetMode('J', false);
+ channel->SetMode('J', "");
return MODEACTION_ALLOW;
}
}
@@ -74,8 +74,7 @@ class KickRejoin : public ModeHandler
if (!channel->IsModeSet('J'))
{
parameter = ConvToStr(atoi(parameter.c_str()));
- channel->SetModeParam('J', parameter.c_str(), adding);
- channel->SetMode('J', adding);
+ channel->SetMode('J', parameter);
return MODEACTION_ALLOW;
}
else
@@ -90,11 +89,9 @@ class KickRejoin : public ModeHandler
{
// new mode param, replace old with new
parameter = ConvToStr(atoi(parameter.c_str()));
- cur_param = ConvToStr(atoi(cur_param.c_str()));
if (parameter != "0")
{
- channel->SetModeParam('J', cur_param.c_str(), false);
- channel->SetModeParam('J', parameter.c_str(), adding);
+ channel->SetMode('J', parameter);
return MODEACTION_ALLOW;
}
else