}
};
-class cmd_filter;
+class CommandFilter;
class FilterBase : public Module
{
- cmd_filter* filtcommand;
+ CommandFilter* filtcommand;
int flags;
public:
FilterBase(InspIRCd* Me, const std::string &source);
bool AppliesToMe(User* user, FilterResult* filter, int flags);
};
-class cmd_filter : public Command
+class CommandFilter : public Command
{
FilterBase* Base;
public:
- cmd_filter(FilterBase* f, InspIRCd* Me, const std::string &source) : Command(Me, "FILTER", 'o', 1), Base(f)
+ CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &source) : Command(Me, "FILTER", 'o', 1), Base(f)
{
this->source = source;
this->syntax = "<filter-definition> <type> <flags> [<gline-duration>] :<reason>";
FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me)
{
- filtcommand = new cmd_filter(this, Me, source);
+ filtcommand = new CommandFilter(this, Me, source);
ServerInstance->AddCommand(filtcommand);
}
}
if (f->action == "gline")
{
- if (ServerInstance->XLines->add_gline(f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), user->MakeHostIP()))
+ GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString());
+ if (ServerInstance->XLines->AddLine(gl,NULL))
{
- ServerInstance->XLines->apply_lines(APPLY_GLINES);
- FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP()));
+ ServerInstance->XLines->ApplyLines();
}
+ else
+ delete gl;
}
ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action);
if (f->action == "gline")
{
/* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */
- std::string wild = "*@";
- wild.append(user->GetIPString());
-
- if (ServerInstance->XLines->add_gline(f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), wild.c_str()))
+ GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString());
+ if (ServerInstance->XLines->AddLine(gl,NULL))
{
- ServerInstance->XLines->apply_lines(APPLY_GLINES);
- FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP()));
+ ServerInstance->XLines->ApplyLines();
}
+ else
+ delete gl;
}
return 1;
}