Overloading SetMode seems to cause the compiler to interpret "" as a bool and not a string. Fixes bug #849

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11335 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
danieldg 2009-04-29 02:43:16 +00:00
parent 1064b67329
commit d2a71fd344
9 changed files with 20 additions and 20 deletions

View File

@ -207,7 +207,7 @@ class CoreExport Channel : public Extensible
* @param parameter The parameter string to associate with this mode character.
* If it is empty, the mode is unset; if it is nonempty, the mode is set.
*/
void SetMode(char mode, std::string parameter);
void SetModeParam(char mode, std::string parameter);
/** Returns true if a mode is set on a channel
* @param mode The mode character you wish to query

View File

@ -36,7 +36,7 @@ void Channel::SetMode(char mode,bool mode_on)
modes[mode-65] = mode_on;
}
void Channel::SetMode(char mode, std::string parameter)
void Channel::SetModeParam(char mode, std::string parameter)
{
CustomModeList::iterator n = custom_mode_params.find(mode);
// always erase, even if changing, so that the map gets the new value

View File

@ -99,11 +99,11 @@ ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, s
std::string ckey;
ckey.assign(parameter, 0, 32);
parameter = ckey;
channel->SetMode('k', parameter);
channel->SetModeParam('k', parameter);
}
else
{
channel->SetMode('k', "");
channel->SetModeParam('k', "");
}
return MODEACTION_ALLOW;
}

View File

@ -54,7 +54,7 @@ ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::s
parameter = ConvToStr(limit);
/* Set new limit */
channel->SetMode('l', parameter);
channel->SetModeParam('l', parameter);
return MODEACTION_ALLOW;
}
@ -70,7 +70,7 @@ ModeAction ModeChannelLimit::OnModeChange(User*, User*, Channel* channel, std::s
}
/* Removing old limit, no checks here */
channel->SetMode('l', "");
channel->SetModeParam('l', "");
return MODEACTION_ALLOW;
}
}

View File

@ -144,7 +144,7 @@ class JoinFlood : public ModeHandler
parameter = ConvToStr(njoins) + ":" +ConvToStr(nsecs);
joinfloodsettings *f = new joinfloodsettings(ServerInstance, nsecs, njoins);
channel->Extend("joinflood", f);
channel->SetMode('j', parameter);
channel->SetModeParam('j', parameter);
return MODEACTION_ALLOW;
}
else
@ -167,7 +167,7 @@ class JoinFlood : public ModeHandler
f = new joinfloodsettings(ServerInstance, nsecs, njoins);
channel->Shrink("joinflood");
channel->Extend("joinflood", f);
channel->SetMode('j', parameter);
channel->SetModeParam('j', parameter);
return MODEACTION_ALLOW;
}
else
@ -192,7 +192,7 @@ class JoinFlood : public ModeHandler
channel->GetExt("joinflood", f);
delete f;
channel->Shrink("joinflood");
channel->SetMode('j', "");
channel->SetModeParam('j', "");
return MODEACTION_ALLOW;
}
}

View File

@ -65,7 +65,7 @@ class KickRejoin : public ModeHandler
}
else
{
channel->SetMode('J', "");
channel->SetModeParam('J', "");
return MODEACTION_ALLOW;
}
}
@ -74,7 +74,7 @@ class KickRejoin : public ModeHandler
if (!channel->IsModeSet('J'))
{
parameter = ConvToStr(atoi(parameter.c_str()));
channel->SetMode('J', parameter);
channel->SetModeParam('J', parameter);
return MODEACTION_ALLOW;
}
else
@ -91,7 +91,7 @@ class KickRejoin : public ModeHandler
parameter = ConvToStr(atoi(parameter.c_str()));
if (parameter != "0")
{
channel->SetMode('J', parameter);
channel->SetModeParam('J', parameter);
return MODEACTION_ALLOW;
}
else

View File

@ -143,7 +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', parameter);
channel->SetModeParam('f', parameter);
return MODEACTION_ALLOW;
}
else
@ -163,7 +163,7 @@ class MsgFlood : public ModeHandler
floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines);
channel->Shrink("flood");
channel->Extend("flood",fs);
channel->SetMode('f', parameter);
channel->SetModeParam('f', parameter);
return MODEACTION_ALLOW;
}
else
@ -187,7 +187,7 @@ class MsgFlood : public ModeHandler
{
delete f;
channel->Shrink("flood");
channel->SetMode('f', "");
channel->SetModeParam('f', "");
return MODEACTION_ALLOW;
}
}

View File

@ -144,7 +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', parameter);
channel->SetModeParam('F', parameter);
return MODEACTION_ALLOW;
}
else
@ -167,7 +167,7 @@ class NickFlood : public ModeHandler
f = new nickfloodsettings(ServerInstance, nsecs, nnicks);
channel->Shrink("nickflood");
channel->Extend("nickflood", f);
channel->SetMode('F', parameter);
channel->SetModeParam('F', parameter);
return MODEACTION_ALLOW;
}
else
@ -192,7 +192,7 @@ class NickFlood : public ModeHandler
channel->GetExt("nickflood", f);
delete f;
channel->Shrink("nickflood");
channel->SetMode('F', "");
channel->SetModeParam('F', "");
return MODEACTION_ALLOW;
}
}

View File

@ -68,14 +68,14 @@ class Redirect : public ModeHandler
* We used to do some checking for circular +L here, but there is no real need for this any more especially as we
* now catch +L looping in PreJoin. Remove it, since O(n) logic makes me sad, and we catch it anyway. :) -- w00t
*/
channel->SetMode('L', parameter);
channel->SetModeParam('L', parameter);
return MODEACTION_ALLOW;
}
else
{
if (channel->IsModeSet('L'))
{
channel->SetMode('L', "");
channel->SetModeParam('L', "");
return MODEACTION_ALLOW;
}
}