mirror of
https://github.com/anope/anope.git
synced 2026-07-06 21:43:13 +02:00
Remove the m_regex_pcre module.
Users should migrate to m_regex_pcre2 instead.
This commit is contained in:
@@ -21,14 +21,13 @@ jobs:
|
||||
libldap2-dev \
|
||||
libmysqlclient-dev \
|
||||
libpcre2-dev \
|
||||
libpcre3-dev \
|
||||
libsqlite3-dev \
|
||||
libssl-dev \
|
||||
libtre-dev \
|
||||
ninja-build
|
||||
- name: Enable extras
|
||||
run: |
|
||||
for MODULE in m_ldap.cpp m_ldap_authentication.cpp m_ldap_oper.cpp m_mysql.cpp m_regex_pcre.cpp m_regex_pcre2.cpp m_regex_posix.cpp m_regex_tre.cpp m_sql_authentication.cpp m_sql_log.cpp m_sql_oper.cpp m_sqlite.cpp m_ssl_gnutls.cpp m_ssl_openssl.cpp stats
|
||||
for MODULE in m_ldap.cpp m_ldap_authentication.cpp m_ldap_oper.cpp m_mysql.cpp m_regex_pcre2.cpp m_regex_posix.cpp m_regex_tre.cpp m_sql_authentication.cpp m_sql_log.cpp m_sql_oper.cpp m_sqlite.cpp m_ssl_gnutls.cpp m_ssl_openssl.cpp stats
|
||||
do
|
||||
ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules
|
||||
done
|
||||
|
||||
@@ -400,19 +400,11 @@ module { name = "help" }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* m_regex_pcre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/pcre, which uses version 1 of the Perl Compatible Regular
|
||||
* Expressions library. This can not be loaded at the same time as the m_regex_pcre2 module.
|
||||
*/
|
||||
#module { name = "m_regex_pcre" }
|
||||
|
||||
/*
|
||||
* m_regex_pcre2 [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/pcre, which uses version 2 of the Perl Compatible Regular
|
||||
* Expressions library. This can not be loaded at the same time as the m_regex_pcre module.
|
||||
* Expressions library.
|
||||
#module { name = "m_regex_pcre2" }
|
||||
|
||||
/*
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Anope Version 2.1.1-git
|
||||
-----------------------
|
||||
No significant changes.
|
||||
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
|
||||
|
||||
Anope Version 2.1.0
|
||||
-------------------
|
||||
@@ -9,7 +9,7 @@ Removed nickserv:strictpasswords as it is obsolete now nickserv:minpasslen exist
|
||||
Removed the inspircd12 and inspircd20 modules (use inspircd instead).
|
||||
Removed the ns_getpass module (no supported encryption modules).
|
||||
Removed the os_oline module (no supported IRCds).
|
||||
Removed the unreal module (use unrealircd instead)
|
||||
Removed the unreal module (use unrealircd instead).
|
||||
Renamed nickserv:passlen to nickserv:maxpasslen.
|
||||
Renamed the charybdis module to solanum.
|
||||
Renamed the inspircd3 module to inspircd.
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user