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/modes/cmode_l.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/modes/cmode_l.cpp')
-rw-r--r-- | src/modes/cmode_l.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modes/cmode_l.cpp b/src/modes/cmode_l.cpp index e87a524b2..3d37fc900 100644 --- a/src/modes/cmode_l.cpp +++ b/src/modes/cmode_l.cpp @@ -54,8 +54,7 @@ ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::s parameter = ConvToStr(limit); /* Set new limit */ - channel->SetModeParam('l', parameter.c_str(), true); - channel->modes[CM_LIMIT] = 1; + channel->SetMode('l', parameter); return MODEACTION_ALLOW; } @@ -71,9 +70,7 @@ ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::s } /* Removing old limit, no checks here */ - channel->SetModeParam('l', "", false); - channel->modes[CM_LIMIT] = 0; - + channel->SetMode('l', ""); return MODEACTION_ALLOW; } } |