+ void OnSetUserIP(LocalUser* user) CXX11_OVERRIDE
+ {
+ if (user->quitting)
+ return;
+
+ user->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ user->CheckLines(true);
+ }
+
+ void OnChangeRealHost(User* user, const std::string& newhost) CXX11_OVERRIDE
+ {
+ LocalUser* luser = IS_LOCAL(user);
+ if (!luser || luser->quitting)
+ return;
+
+ luser->exempt = (ServerInstance->XLines->MatchesLine("E", user) != NULL);
+ luser->CheckLines(false);
+ }
+
+ ModResult OnUserPreNick(LocalUser* user, const std::string& newnick) CXX11_OVERRIDE
+ {
+ // Check Q-lines (for local nick changes only, remote servers have our Q-lines to enforce themselves)
+
+ XLine* xline = ServerInstance->XLines->MatchesLine("Q", newnick);
+ if (!xline)
+ return MOD_RES_PASSTHRU; // No match
+
+ // A Q-line matched the new nick, tell opers if the user is registered
+ if (user->registered == REG_ALL)
+ {
+ ServerInstance->SNO->WriteGlobalSno('x', "Q-lined nickname %s from %s: %s",
+ newnick.c_str(), user->GetFullRealHost().c_str(), xline->reason.c_str());
+ }
+
+ // Send a numeric because if we deny then the core doesn't reply anything
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Invalid nickname: %s", xline->reason.c_str()));
+ return MOD_RES_DENY;
+ }
+
+ void OnGarbageCollect() CXX11_OVERRIDE
+ {
+ // HACK: ELines are not expired properly at the moment but it can't be fixed
+ // as the XLine system is a spaghetti nightmare. Instead we skip over expired
+ // ELines in XLineManager::CheckELines() and expire them here instead.
+ ServerInstance->XLines->GetAll("E");
+ }
+