diff options
author | Sadie Powell <sadie@witchery.services> | 2023-12-17 13:46:34 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-12-17 13:46:34 +0000 |
commit | eb0e5c89b2a1e59091001ffd0e54582c2ff04212 (patch) | |
tree | 6caad8512fd05dd74a890edf0e8658731b4e63c2 /modules/extra/m_regex_pcre.cpp | |
parent | 84c2f8d3fc417e97ed336c48b8a5c4eea71b52aa (diff) |
Remove the m_regex_pcre module.
Users should migrate to m_regex_pcre2 instead.
Diffstat (limited to 'modules/extra/m_regex_pcre.cpp')
-rw-r--r-- | modules/extra/m_regex_pcre.cpp | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/modules/extra/m_regex_pcre.cpp b/modules/extra/m_regex_pcre.cpp deleted file mode 100644 index 8fd18bebe..000000000 --- a/modules/extra/m_regex_pcre.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * (C) 2012-2023 Anope Team - * Contact us at team@anope.org - * - * Please read COPYING and README for further details. - */ - -/* RequiredLibraries: pcre */ -/* RequiredWindowsLibraries: libpcre */ - -#include "module.h" -#include <pcre.h> - -class PCRERegex : public Regex -{ - pcre *regex; - - public: - PCRERegex(const Anope::string &expr) : Regex(expr) - { - const char *error; - int erroffset; - this->regex = pcre_compile(expr.c_str(), PCRE_CASELESS, &error, &erroffset, NULL); - if (!this->regex) - throw RegexException("Error in regex " + expr + " at offset " + stringify(erroffset) + ": " + error); - } - - ~PCRERegex() - { - pcre_free(this->regex); - } - - bool Matches(const Anope::string &str) - { - return pcre_exec(this->regex, NULL, str.c_str(), str.length(), 0, 0, NULL, 0) > -1; - } -}; - -class PCRERegexProvider : public RegexProvider -{ - public: - PCRERegexProvider(Module *creator) : RegexProvider(creator, "regex/pcre") { } - - Regex *Compile(const Anope::string &expression) override - { - return new PCRERegex(expression); - } -}; - -class ModuleRegexPCRE : public Module -{ - PCRERegexProvider pcre_regex_provider; - - public: - ModuleRegexPCRE(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), - pcre_regex_provider(this) - { - this->SetPermanent(true); - } - - ~ModuleRegexPCRE() - { - for (auto *xlm : XLineManager::XLineManagers) - { - for (auto *x : xlm->GetList()) - { - if (x->regex && dynamic_cast<PCRERegex *>(x->regex)) - { - delete x->regex; - x->regex = NULL; - } - } - } - } -}; - -MODULE_INIT(ModuleRegexPCRE) |