* @param parameter The parameter string to associate with this mode character
* @param mode_on True if you want to set the mode or false if you want to remove it
*/
- void SetModeParam(char mode,char* parameter,bool mode_on);
+ void SetModeParam(char mode,const char* parameter,bool mode_on);
/** Returns true if a mode is set on a channel
* @param mode The mode character you wish to query
}
-void chanrec::SetModeParam(char mode,char* parameter,bool mode_on)
+void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on)
{
log(DEBUG,"SetModeParam called");
{
joinfloodsettings *f = new joinfloodsettings(nsecs,njoins);
channel->Extend("joinflood",(char*)f);
+ channel->SetMode('j', true);
+ channel->SetModeParam('j', parameter.c_str(), true);
return MODEACTION_ALLOW;
}
}
joinfloodsettings *f = (joinfloodsettings*)channel->GetExt("joinflood");
DELETE(f);
channel->Shrink("joinflood");
+ channel->SetMode('j', false);
return MODEACTION_ALLOW;
}
}
}
if ((!adding) || (atoi(parameter.c_str()) > 0))
{
+ channel->SetModeParam('J', parameter.c_str(), adding);
+ channel->SetMode('J', adding);
return MODEACTION_ALLOW;
}
else
{
floodsettings *f = new floodsettings(ban,nsecs,nlines);
channel->Extend("flood",(char*)f);
+ channel->SetMode('f', true);
+ channel->SetModeParam('f', parameter.c_str(), true);
return MODEACTION_ALLOW;
}
}
floodsettings *f = (floodsettings*)channel->GetExt("flood");
DELETE(f);
channel->Shrink("flood");
+ channel->SetMode('f', false);
return MODEACTION_ALLOW;
}
}
/* $ModDesc: Provides channel mode +L (limit redirection) */
+class Redirect : public ModeHandler
+{
+ public:
+ Redirect() : ModeHandler('L', 1, 0, false, MODETYPE_CHANNEL, false) { }
+
+ ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
+ {
+ if (adding)
+ {
+ chanrec* c = NULL;
+
+ if (!IsValidChannelName(parameter.c_str()))
+ {
+ WriteServ(user->fd,"403 %s %s :Invalid channel name",user->nick, parameter.c_str());
+ parameter = "";
+ return MODEACTION_DENY;
+ }
+
+ c = Srv->FindChannel(parameter);
+ if (c)
+ {
+ /* Fix by brain: Dont let a channel be linked to *itself* either */
+ if ((c == target) || (c->IsModeSet('L')))
+ {
+ WriteServ(user->fd,"690 %s :Circular redirection, mode +L to %s not allowed.",user->nick,parameter.c_str());
+ parameter = "";
+ return MODEACTION_DENY;
+ }
+ }
+
+ c->SetMode('L', true);
+ c->SetModeParam('L', parameter);
+ return MODEACTION_ALLOW;
+ }
+ }
+};
class ModuleRedirect : public Module
{