+ return CMD_SUCCESS;
+ }
+
+ RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ {
+ if (IS_LOCAL(user))
+ return ROUTE_LOCALONLY; // spanningtree will send ADDLINE
+
+ return ROUTE_BROADCAST;
+ }
+};
+
+class ModuleRLine : public Module
+{
+ dynamic_reference<RegexFactory> rxfactory;
+ RLineFactory f;
+ CommandRLine r;
+ bool MatchOnNickChange;
+ bool initing;
+ RegexFactory* factory;
+
+ public:
+ ModuleRLine()
+ : rxfactory(this, "regex"), f(rxfactory), r(this, f)
+ , initing(true)
+ {
+ }
+
+ void init() CXX11_OVERRIDE
+ {
+ ServerInstance->XLines->RegisterFactory(&f);
+ }
+
+ ~ModuleRLine()
+ {
+ ServerInstance->XLines->DelAll("R");
+ ServerInstance->XLines->UnregisterFactory(&f);
+ }
+
+ Version GetVersion() CXX11_OVERRIDE
+ {
+ return Version("RLINE: Regexp user banning.", VF_COMMON | VF_VENDOR, rxfactory ? rxfactory->name : "");
+ }
+
+ ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE
+ {
+ // Apply lines on user connect
+ XLine *rl = ServerInstance->XLines->MatchesLine("R", user);
+
+ if (rl)
+ {
+ // Bang. :P
+ rl->Apply(user);
+ return MOD_RES_DENY;