+ /** Destructor
+ */
+ ~RLine()
+ {
+ delete regex;
+ }
+
+ bool Matches(User *u)
+ {
+ LocalUser* lu = IS_LOCAL(u);
+ if (lu && lu->exempt)
+ return false;
+
+ std::string compare = u->nick + "!" + u->ident + "@" + u->host + " " + u->fullname;
+ return regex->Matches(compare);
+ }
+
+ bool Matches(const std::string &compare)
+ {
+ return regex->Matches(compare);
+ }
+
+ void Apply(User* u)
+ {
+ if (ZlineOnMatch)
+ {
+ ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString());
+ if (ServerInstance->XLines->AddLine(zl, NULL))
+ {
+ std::string timestr = InspIRCd::TimeString(zl->expiry);
+ ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on *@%s%s%s: %s",
+ zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? timestr.c_str() : "", zl->reason.c_str());
+ added_zline = true;
+ }
+ else
+ delete zl;
+ }
+ DefaultApply(u, "R", false);
+ }
+
+ const std::string& Displayable()
+ {
+ return matchtext;
+ }
+
+ std::string matchtext;
+
+ Regex *regex;