mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Yeet regex_pcre into contrib.
This commit is contained in:
parent
3fa012b75b
commit
e11c3c8095
3
.github/workflows/ci-linux.yml
vendored
3
.github/workflows/ci-linux.yml
vendored
@ -28,7 +28,6 @@ jobs:
|
||||
libmbedtls-dev \
|
||||
libmysqlclient-dev \
|
||||
libpcre2-dev \
|
||||
libpcre3-dev \
|
||||
libpq-dev \
|
||||
libre2-dev \
|
||||
libsqlite3-dev \
|
||||
@ -43,7 +42,7 @@ jobs:
|
||||
|
||||
- name: Run configure
|
||||
run: |
|
||||
./configure --enable-extras "argon2 geo_maxmind ldap mysql pgsql regex_pcre regex_pcre2 regex_posix regex_re2 sqlite3 ssl_gnutls ssl_mbedtls ssl_openssl sslrehashsignal"
|
||||
./configure --enable-extras "argon2 geo_maxmind ldap mysql pgsql regex_pcre2 regex_posix regex_re2 sqlite3 ssl_gnutls ssl_mbedtls ssl_openssl sslrehashsignal"
|
||||
./configure --development --disable-auto-extras --socketengine ${{ matrix.socketengine }}
|
||||
|
||||
- name: Build core
|
||||
|
4
.github/workflows/ci-macos.yml
vendored
4
.github/workflows/ci-macos.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew update || true
|
||||
for PACKAGE in pkg-config argon2 gnutls libmaxminddb libpq mbedtls mysql-client openssl@1.1 pcre pcre2 re2 sqlite;
|
||||
for PACKAGE in pkg-config argon2 gnutls libmaxminddb libpq mbedtls mysql-client openssl@1.1 pcre2 re2 sqlite;
|
||||
do
|
||||
brew install $PACKAGE || brew upgrade $PACKAGE
|
||||
done
|
||||
@ -26,7 +26,7 @@ jobs:
|
||||
|
||||
- name: Run configure
|
||||
run: |
|
||||
./configure --enable-extras "argon2 geo_maxmind ldap mysql pgsql regex_pcre regex_pcre2 regex_posix regex_re2 sqlite3 ssl_gnutls ssl_mbedtls ssl_openssl sslrehashsignal"
|
||||
./configure --enable-extras "argon2 geo_maxmind ldap mysql pgsql regex_pcre2 regex_posix regex_re2 sqlite3 ssl_gnutls ssl_mbedtls ssl_openssl sslrehashsignal"
|
||||
./configure --development --disable-auto-extras --socketengine ${{ matrix.socketengine }}
|
||||
|
||||
- name: Build core
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,7 +19,6 @@
|
||||
/src/modules/m_ldap.cpp
|
||||
/src/modules/m_mysql.cpp
|
||||
/src/modules/m_pgsql.cpp
|
||||
/src/modules/m_regex_pcre.cpp
|
||||
/src/modules/m_regex_pcre2.cpp
|
||||
/src/modules/m_regex_posix.cpp
|
||||
/src/modules/m_regex_re2.cpp
|
||||
|
1
configure
vendored
1
configure
vendored
@ -393,7 +393,6 @@ if (prompt_bool $interactive, $question, 0) {
|
||||
'm_mysql.cpp' => 'mysql_config --version',
|
||||
'm_pgsql.cpp' => 'pg_config --version',
|
||||
'm_ldap.cpp' => "echo '#include <ldap.h>' | $config{CXX} -E -",
|
||||
'm_regex_pcre.cpp' => 'pcre-config --version',
|
||||
'm_regex_pcre2.cpp' => 'pkg-config --exists libpcre2-8',
|
||||
'm_regex_posix.cpp' => undef,
|
||||
'm_regex_re2.cpp' => 'pkg-config --exists re2',
|
||||
|
@ -870,14 +870,14 @@
|
||||
# Filter module: Provides message filtering, similar to SPAMFILTER. #
|
||||
#<module name="filter">
|
||||
# #
|
||||
# This module depends upon a regex provider such as regex_pcre or #
|
||||
# This module depends upon a regex provider such as regex_stdlib or #
|
||||
# regex_glob to function. You must specify which of these you want #
|
||||
# the filter module to use via the tag below. #
|
||||
# #
|
||||
# Valid engines are: #
|
||||
# #
|
||||
# glob - Glob patterns, provided via regex_glob. #
|
||||
# pcre - PCRE regexps, provided via regex_pcre, needs libpcre. #
|
||||
# pcre2 - PCRE regexps, provided via regex_pcre2, needs libpcre2. #
|
||||
# posix - POSIX regexps, provided via regex_posix, not available #
|
||||
# on Windows, no dependencies on other operating systems. #
|
||||
# stdregex - stdlib regexps, provided via regex_stdlib, see comment #
|
||||
@ -1752,13 +1752,6 @@
|
||||
# matching already present in InspIRCd core.
|
||||
#<module name="regex_glob">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Regular expression provider for PCRE (Perl-Compatible Regular
|
||||
# Expressions). You need libpcre installed to compile and load this
|
||||
# module. You must have at least 1 provider loaded to use the filter or
|
||||
# R-line modules.
|
||||
#<module name="regex_pcre">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Regular expression provider for PCRE2 (Perl-Compatible Regular
|
||||
# Expressions). You need libpcre2 installed to compile and load this
|
||||
|
@ -1,5 +1,5 @@
|
||||
This directory stores modules which require external libraries to compile.
|
||||
For example, m_regex_pcre requires the PCRE libraries.
|
||||
For example, m_regex_pcre2 requires the PCRE libraries.
|
||||
|
||||
To compile any of these modules first ensure you have the required dependencies
|
||||
(read the online documentation at https://docs.inspircd.org) and then symlink
|
||||
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* InspIRCd -- Internet Relay Chat Daemon
|
||||
*
|
||||
* Copyright (C) 2013, 2016, 2019, 2021 Sadie Powell <sadie@witchery.services>
|
||||
* Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
|
||||
* Copyright (C) 2012 Robby <robby@chatbelgie.be>
|
||||
* Copyright (C) 2012 ChrisTX <xpipe@hotmail.de>
|
||||
* Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
|
||||
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
|
||||
* Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
|
||||
*
|
||||
* This file is part of InspIRCd. InspIRCd is free software: you can
|
||||
* redistribute it and/or modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// $CompilerFlags: execute("pcre-config --cflags" "PCRE_CXXFLAGS")
|
||||
/// $LinkerFlags: execute("pcre-config --libs" "PCRE_LDFLAGS" "-lpcre")
|
||||
|
||||
/// $PackageInfo: require_system("arch") pcre
|
||||
/// $PackageInfo: require_system("centos") pcre-devel
|
||||
/// $PackageInfo: require_system("darwin") pcre
|
||||
/// $PackageInfo: require_system("debian") libpcre3-dev
|
||||
/// $PackageInfo: require_system("ubuntu") libpcre3-dev
|
||||
|
||||
|
||||
#include "inspircd.h"
|
||||
#include "modules/regex.h"
|
||||
|
||||
#include <pcre.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
# pragma comment(lib, "pcre.lib")
|
||||
#endif
|
||||
|
||||
class PCREPattern final
|
||||
: public Regex::Pattern
|
||||
{
|
||||
private:
|
||||
pcre* regex;
|
||||
|
||||
public:
|
||||
PCREPattern(const std::string& pattern, uint8_t options)
|
||||
: Regex::Pattern(pattern, options)
|
||||
{
|
||||
int flags = 0;
|
||||
if (options & Regex::OPT_CASE_INSENSITIVE)
|
||||
flags &= PCRE_CASELESS;
|
||||
|
||||
const char* error;
|
||||
int erroroffset;
|
||||
regex = pcre_compile(pattern.c_str(), flags, &error, &erroroffset, NULL);
|
||||
if (!regex)
|
||||
throw Regex::Exception(pattern, error, erroroffset);
|
||||
}
|
||||
|
||||
~PCREPattern() override
|
||||
{
|
||||
pcre_free(regex);
|
||||
}
|
||||
|
||||
bool IsMatch(const std::string& text) override
|
||||
{
|
||||
// This cast is potentially unsafe but it's what pcre_exec expects.
|
||||
return pcre_exec(regex, NULL, text.c_str(), int(text.length()), 0, 0, NULL, 0) >= 0;
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleRegexPCRE : public Module
|
||||
{
|
||||
private:
|
||||
Regex::SimpleEngine<PCREPattern> regex;
|
||||
|
||||
public:
|
||||
ModuleRegexPCRE()
|
||||
: Module(VF_VENDOR, "Provides the pcre regular expression engine which uses the PCRE library.")
|
||||
, regex(this, "pcre")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(ModuleRegexPCRE)
|
@ -23,7 +23,6 @@ libpq:shared=True
|
||||
# mbedtls:shared=True
|
||||
mysql-connector:shared=True
|
||||
# openssl:shared=True
|
||||
pcre:shared=True
|
||||
pcre2:shared=True
|
||||
re2:shared=True
|
||||
sqlite3:shared=True
|
||||
|
@ -2,7 +2,6 @@ if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_argon2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_pgsql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_mysql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_pcre.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_pcre2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_re2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_sqlite3.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/")
|
||||
|
Loading…
x
Reference in New Issue
Block a user