X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_regex_pcre.cpp;h=e270ca039888aadeadeb5185217c0a7704144637;hb=c0aba5b728b0a921d95ec120aa638dab1520b42f;hp=01cf4717824c3267a07bd4413f8d0f61fd8abb6f;hpb=0e7f74a7c8e804a0223b4d88bf637649838f0412;p=user%2Fhenk%2Fcode%2Finspircd.git
diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp
index 01cf47178..e270ca039 100644
--- a/src/modules/extra/m_regex_pcre.cpp
+++ b/src/modules/extra/m_regex_pcre.cpp
@@ -17,14 +17,18 @@
* along with this program. If not, see .
*/
+/// $CompilerFlags: execute("pcre-config --cflags" "PCRE_CXXFLAGS")
+/// $LinkerFlags: execute("pcre-config --libs" "PCRE_LDFLAGS" "-lpcre")
+
+/// $PackageInfo: require_system("centos") pcre-devel pkgconfig
+/// $PackageInfo: require_system("darwin") pcre pkg-config
+/// $PackageInfo: require_system("ubuntu") libpcre3-dev pkg-config
+
#include "inspircd.h"
#include
#include "modules/regex.h"
-/* $CompileFlags: exec("pcre-config --cflags") */
-/* $LinkerFlags: exec("pcre-config --libs") rpath("pcre-config --libs") -lpcre */
-
#ifdef _WIN32
# pragma comment(lib, "libpcre.lib")
#endif
@@ -51,14 +55,9 @@ class PCRERegex : public Regex
pcre_free(regex);
}
- bool Matches(const std::string& text)
+ bool Matches(const std::string& text) CXX11_OVERRIDE
{
- if (pcre_exec(regex, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) > -1)
- {
- // Bang. :D
- return true;
- }
- return false;
+ return (pcre_exec(regex, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) >= 0);
}
};
@@ -66,7 +65,7 @@ class PCREFactory : public RegexFactory
{
public:
PCREFactory(Module* m) : RegexFactory(m, "regex/pcre") {}
- Regex* Create(const std::string& expr)
+ Regex* Create(const std::string& expr) CXX11_OVERRIDE
{
return new PCRERegex(expr);
}
@@ -78,7 +77,6 @@ class ModuleRegexPCRE : public Module
PCREFactory ref;
ModuleRegexPCRE() : ref(this)
{
- ServerInstance->Modules->AddService(ref);
}
Version GetVersion() CXX11_OVERRIDE