From 1daa5273d70105f112d93a7528032826c9a66983 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 21 Sep 2008 12:24:25 +0000 Subject: Fixes. Dont try and catch exceptions within the RLine ctor, we dont always want crud outputting to snomask x in every situation. Its up to the caller that creates the object as to what they want to do with the exception and if they want it shown. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10578 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_rline.cpp | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 3b15ec89e..8fb60385e 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -42,15 +42,10 @@ class CoreExport RLine : public XLine throw ModuleException("Regex engine not set or loaded!"); } - try - { - regex = RegexFactoryRequest(mymodule, rxengine, regexs).Create(); - } - catch (ModuleException& ex) - { - ServerInstance->SNO->WriteToSnoMask('x', "Bad regex: %s", ex.GetReason()); - throw ex; - } + /* This can throw on failure, but if it does we DONT catch it here, we catch it and display it + * where the object is created, we might not ALWAYS want it to output stuff to snomask x all the time + */ + regex = RegexFactoryRequest(mymodule, rxengine, regexs).Create(); } /** Destructor @@ -62,28 +57,13 @@ class CoreExport RLine : public XLine bool Matches(User *u) { - std::string compare = std::string(u->nick) + "!" + u->ident + "@" + u->host + " " + u->fullname; - - ServerInstance->Logs->Log("m_rline",DEBUG, "Matching " + matchtext + " against string " + compare); - - if (regex->Matches(compare)) - { - // Bang. :D - return true; - } - - return false; + std::string compare = u->nick + "!" + u->ident + "@" + u->host + " " + u->fullname; + return regex->Matches(compare); } bool Matches(const std::string &compare) { - if (regex->Matches(compare)) - { - // Bang. :D - return true; - } - - return false; + return regex->Matches(compare); } void Apply(User* u) -- cgit v1.2.3