mirror of
https://github.com/anope/anope.git
synced 2026-06-12 18:14:47 +02:00
Compare commits
270 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 258daf6c26 | |||
| 57e8b4305e | |||
| db4f845fe7 | |||
| d15ac93a8f | |||
| 4e0f94bcce | |||
| 1c1645096f | |||
| e0ac5509b4 | |||
| 190c37a68b | |||
| a67bef2dee | |||
| 893bbf9251 | |||
| 5441093211 | |||
| 579af3c442 | |||
| 25bdcfcbc4 | |||
| 26919f41d2 | |||
| 9c80f9e34e | |||
| b5b3c74477 | |||
| 73d4ac6de0 | |||
| 7640fad30c | |||
| 9f6d378755 | |||
| 642e68f53a | |||
| eb658f87a3 | |||
| 1e87849e5c | |||
| 5fa4acb195 | |||
| 79f215606d | |||
| 2fd4b45f81 | |||
| d3b4a4bd05 | |||
| d914febbec | |||
| 2962a0be8c | |||
| 6be4df3b39 | |||
| 4789751e50 | |||
| 57674f5869 | |||
| c6cb4ba159 | |||
| e341cac8d6 | |||
| 83dd96b9f2 | |||
| cabaa079df | |||
| 273e7f249c | |||
| 8c9ca23900 | |||
| 8e3da86283 | |||
| 97b65b2255 | |||
| b26f198489 | |||
| a99a00d7c5 | |||
| 283137841f | |||
| 3290ebd36a | |||
| c4e9c0bf85 | |||
| 84ad85ee85 | |||
| 9789c3bd8c | |||
| a75afb597b | |||
| f93d9e7698 | |||
| 7423fa9998 | |||
| 7cba665270 | |||
| 9502567453 | |||
| 14472c5a95 | |||
| d4f4bcf23c | |||
| 82fa7e1467 | |||
| aefbb4fbda | |||
| 9b77fdf5b6 | |||
| 7a6979c814 | |||
| c4ab550ec7 | |||
| 3ecf6b495b | |||
| 8475697e3b | |||
| 85687781d1 | |||
| ccfaca32a2 | |||
| 07373c8cf2 | |||
| 89594d4557 | |||
| b478a1cb53 | |||
| 1fb77e414d | |||
| 22fe5bb724 | |||
| 909b9b2679 | |||
| 49ea709027 | |||
| e47ad6ed3f | |||
| f3b14694c6 | |||
| e9424b529c | |||
| a60c796cf6 | |||
| fcf16ab20a | |||
| a25d0aa60e | |||
| c50d1dc2b5 | |||
| 274bb19d03 | |||
| 2c5b84bd1d | |||
| 5c50bcb9c7 | |||
| cef56abea4 | |||
| 30b9f12711 | |||
| 5337326cc9 | |||
| 6237245ab7 | |||
| ae1829e5a8 | |||
| 026661c9a2 | |||
| ec7223ace2 | |||
| 1f31621bbf | |||
| dfd41b9b94 | |||
| fdd4aade3b | |||
| 0a53f4c26e | |||
| 484160eb4e | |||
| 7ac1fe5847 | |||
| 72acef4e15 | |||
| a6a0f6c447 | |||
| 398d674cf4 | |||
| 1467de1c7e | |||
| c5023fdfa0 | |||
| 97782248af | |||
| d6ced86021 | |||
| 0d8d1675f7 | |||
| 4056af00e3 | |||
| 99b4305573 | |||
| 113301dbba | |||
| 349ae043b6 | |||
| 710e7dd3a2 | |||
| 1e9c6d7931 | |||
| 5772b924cc | |||
| fce5f4cc0f | |||
| fa7ad6b3df | |||
| fc2df00cfc | |||
| f92c5471c2 | |||
| 0439e3b21b | |||
| 5b23fae8bf | |||
| aac4b0f0a3 | |||
| f083795c79 | |||
| 5db79c1e24 | |||
| a4dddfd5f1 | |||
| 7ddc865cde | |||
| 688ecf1c1d | |||
| c0453cfec1 | |||
| a9ab0c72a6 | |||
| de918ef9cf | |||
| 0ee9874112 | |||
| 388858aee6 | |||
| f22703df59 | |||
| 4715b76dbe | |||
| 50bd385ccf | |||
| e738da9b11 | |||
| 4573e1925d | |||
| a40f8e0b9d | |||
| 9db49ec790 | |||
| e8cd2909a5 | |||
| e7a57aa754 | |||
| 1c30f69bd0 | |||
| 36c43683e5 | |||
| 0b63a4244d | |||
| 4a62259695 | |||
| 87e3d5a045 | |||
| 2b8384bb39 | |||
| 6d981960da | |||
| 6acbd326f3 | |||
| cb533b63ac | |||
| 6538641e87 | |||
| eb0e5c89b2 | |||
| 84c2f8d3fc | |||
| 8d99b3e2d7 | |||
| b3ec2a5463 | |||
| 4c67f4393f | |||
| 4e9a2df827 | |||
| 2d2d1972e9 | |||
| 2b21264fb0 | |||
| 3f61b52db3 | |||
| f5fa4ff0e9 | |||
| 251551c8c3 | |||
| e2d546ad46 | |||
| 949176c3e0 | |||
| 3371941be5 | |||
| 70d72b62df | |||
| 46209895e3 | |||
| b28180d680 | |||
| 0f1f0c5a22 | |||
| 6e16e71fda | |||
| 38d5b93e4a | |||
| 78398a4481 | |||
| 0f32d2e553 | |||
| 8e1c7e1e44 | |||
| a3241065c5 | |||
| dc371aad6d | |||
| adf820c08a | |||
| 377ba87d52 | |||
| aa619f1eeb | |||
| b7458c5da1 | |||
| 4a6f4bc92f | |||
| 1c30205af5 | |||
| 9d0a6ddc67 | |||
| 29db25dac7 | |||
| d210cd2695 | |||
| fc8e6ee338 | |||
| ebe3fd7e57 | |||
| 885462d98e | |||
| 6395107be6 | |||
| 24b881c427 | |||
| 28be881886 | |||
| 5bc560a743 | |||
| b235da2e9c | |||
| 3f3062a077 | |||
| 8a8fb7725b | |||
| f6e5e6a2b4 | |||
| dfdcd3021a | |||
| 5fa3d8f929 | |||
| 1a2da82106 | |||
| 9d92de1157 | |||
| 1664689eb7 | |||
| b96519d85c | |||
| ac98ed615b | |||
| f2bcf449cd | |||
| 09c587bed0 | |||
| a8724b5f03 | |||
| b7e85f5161 | |||
| 773ed39d5d | |||
| 15d51ff033 | |||
| 83bf5ba255 | |||
| 2881ba112b | |||
| 1ee81580c6 | |||
| 4f421db5a9 | |||
| 091c0eea28 | |||
| eaaabd8de0 | |||
| 40ce51a1a9 | |||
| 23ac008cc1 | |||
| 6486956401 | |||
| 33b42ce86e | |||
| a631028660 | |||
| 4e5fc9797c | |||
| 9befb13ea4 | |||
| 8eb6a4da71 | |||
| ec7dfb3675 | |||
| 106750db77 | |||
| 7d1047490e | |||
| c9f93eeaed | |||
| db6b2225b1 | |||
| c6c9d9591c | |||
| c1f6a79c72 | |||
| eb81f22a5b | |||
| a31a7f5a6c | |||
| 7531e90499 | |||
| dfcc025a19 | |||
| a5f7aac295 | |||
| d76d747196 | |||
| aee1e53cb3 | |||
| fd1ca96e2c | |||
| 6a7488edc1 | |||
| 4af8dfa549 | |||
| 4efc2c219b | |||
| 84ec0903ee | |||
| 754c82d047 | |||
| 17fa704278 | |||
| b9ccd4bb0b | |||
| 595bc09ec1 | |||
| 27cff11e31 | |||
| b7da27ad3a | |||
| e5075d2dc2 | |||
| e7e8447fa3 | |||
| 561b205c4a | |||
| 376053e0ac | |||
| cadc6f48e6 | |||
| b6665d5eb9 | |||
| 95955ae069 | |||
| df4313f5bb | |||
| 53cd3f47b5 | |||
| c21f6eb5a3 | |||
| e2aeab970b | |||
| ef4fd869ae | |||
| dfc8bd4aa2 | |||
| fd774bd52a | |||
| 16fac79b78 | |||
| 622a8ea7e9 | |||
| 0a518f4bbd | |||
| 3f6e694e50 | |||
| c2646d67bb | |||
| c68b81eac8 | |||
| 8b2c1548ab | |||
| 5dd5fa4644 | |||
| 9d6dd4af11 | |||
| f430522b41 | |||
| 907aa60380 | |||
| c7e26c5f67 | |||
| 8e0e1806a4 | |||
| 7f39fb14f2 | |||
| fb86705d3f | |||
| f4fa5b3733 |
@@ -7,11 +7,11 @@
|
||||
| |
|
||||
|_| IRC Services
|
||||
CURVER
|
||||
This program will help you to compile your Services, and ask you
|
||||
This program will help you to compile your services, and ask you
|
||||
questions regarding the compile-time settings of it during the
|
||||
process. For more options type SOURCE_DIR/Config --help
|
||||
|
||||
Anope is a set of Services for IRC networks that allows users to
|
||||
Anope is a set of services for IRC networks that allows users to
|
||||
manage their nicks and channels in a secure and efficient way,
|
||||
and administrators to manage their network with powerful tools.
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
name: Alpine CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip alpine ci]')"
|
||||
container: alpine:edge
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
CXXFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
|
||||
apk update
|
||||
apk add \
|
||||
clang \
|
||||
cmake \
|
||||
g++ \
|
||||
gettext \
|
||||
git \
|
||||
gnutls-dev \
|
||||
mariadb-dev \
|
||||
openldap-dev \
|
||||
openssl-dev \
|
||||
pcre2-dev \
|
||||
samurai \
|
||||
sqlite-dev \
|
||||
tre-dev
|
||||
|
||||
- name: Enable extras
|
||||
run: |
|
||||
for MODULE in ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
|
||||
do
|
||||
ln -s $PWD/modules/extra/$MODULE.cpp $PWD/modules
|
||||
done
|
||||
|
||||
- name: Run CMake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=$(readlink -f ../run) ..
|
||||
|
||||
- name: Build Anope
|
||||
run: |
|
||||
ninja -C build install
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler:
|
||||
- clang++
|
||||
- g++
|
||||
@@ -8,7 +8,7 @@ jobs:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
CXXFLAGS: -std=${{ matrix.standard }}
|
||||
CXXFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -24,7 +24,6 @@ jobs:
|
||||
libldap2-dev \
|
||||
libmysqlclient-dev \
|
||||
libpcre2-dev \
|
||||
libpcre3-dev \
|
||||
libsqlite3-dev \
|
||||
libssl-dev \
|
||||
libtre-dev \
|
||||
@@ -32,9 +31,9 @@ jobs:
|
||||
|
||||
- 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 ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
|
||||
do
|
||||
ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules
|
||||
ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules
|
||||
done
|
||||
|
||||
- name: Run CMake
|
||||
@@ -52,6 +51,3 @@ jobs:
|
||||
compiler:
|
||||
- clang++
|
||||
- g++
|
||||
standard:
|
||||
- c++98
|
||||
- c++17
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Windows CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.3
|
||||
|
||||
- name: Setup Conan
|
||||
uses: turtlebrowser/get-conan@v1.2
|
||||
with:
|
||||
version: 1.59.0
|
||||
|
||||
- name: Install libraries
|
||||
run: |
|
||||
conan install ${{ github.workspace }}\src\win32 --build=missing
|
||||
|
||||
- name: Run CMake
|
||||
run: |
|
||||
mkdir ${{ github.workspace }}\build
|
||||
cd ${{ github.workspace }}\build
|
||||
cmake -A "x64" -G "Visual Studio 16 2019" ..
|
||||
|
||||
- name: Build Anope
|
||||
working-directory: ${{ github.workspace }}\build
|
||||
run: |
|
||||
msbuild PACKAGE.vcxproj /M:3 /P:Configuration=Release /P:Platform=x64 /VERBOSITY:MINIMAL
|
||||
+14
-14
@@ -1,19 +1,19 @@
|
||||
build/
|
||||
config.cache
|
||||
include/sysconf.h
|
||||
modules/m_ldap.cpp
|
||||
modules/m_ldap_authentication.cpp
|
||||
modules/m_ldap_oper.cpp
|
||||
modules/m_mysql.cpp
|
||||
modules/m_regex_pcre.cpp
|
||||
modules/m_regex_pcre2.cpp
|
||||
modules/m_regex_posix.cpp
|
||||
modules/m_regex_tre.cpp
|
||||
modules/m_sql_authentication.cpp
|
||||
modules/m_sql_log.cpp
|
||||
modules/m_sql_oper.cpp
|
||||
modules/m_sqlite.cpp
|
||||
modules/m_ssl_gnutls.cpp
|
||||
modules/m_ssl_openssl.cpp
|
||||
modules/ldap.cpp
|
||||
modules/ldap_authentication.cpp
|
||||
modules/ldap_oper.cpp
|
||||
modules/mysql.cpp
|
||||
modules/regex_pcre2.cpp
|
||||
modules/regex_posix.cpp
|
||||
modules/regex_tre.cpp
|
||||
modules/sql_authentication.cpp
|
||||
modules/sql_log.cpp
|
||||
modules/sql_oper.cpp
|
||||
modules/sqlite.cpp
|
||||
modules/ssl_gnutls.cpp
|
||||
modules/ssl_openssl.cpp
|
||||
modules/stats
|
||||
run/
|
||||
*.mo
|
||||
|
||||
+106
-249
@@ -1,73 +1,10 @@
|
||||
# This usage of CMake requires at least version 2.4 (checks are made to determine what to use when certain versions lack functions)
|
||||
cmake_minimum_required(VERSION 2.4 FATAL_ERROR)
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
if(POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif(POLICY CMP0026)
|
||||
if(POLICY CMP0007)
|
||||
cmake_policy(SET CMP0007 OLD)
|
||||
endif(POLICY CMP0007)
|
||||
endif(COMMAND cmake_policy)
|
||||
# This usage of CMake requires at least version 3.8
|
||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
||||
|
||||
# Set the project as C++ primarily, but have C enabled for the checks required later
|
||||
project(Anope CXX)
|
||||
enable_language(C)
|
||||
|
||||
# Detect the version of CMake for the later conditional checks
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --version OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "cmake version 2\\.(.*)" "\\1" ONLY_VERSION "${VERSION}")
|
||||
string(REGEX MATCH "-patch .*$" HAS_PATCH "${ONLY_VERSION}")
|
||||
if(HAS_PATCH)
|
||||
string(REGEX REPLACE "(.*)-patch .*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
string(REGEX REPLACE ".*-patch (.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
|
||||
else(HAS_PATCH)
|
||||
string(REGEX MATCH "\\." HAS_DOT "${ONLY_VERSION}")
|
||||
if(HAS_DOT)
|
||||
string(REGEX REPLACE "(.*)\\..*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
string(REGEX REPLACE ".*\\.(.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
|
||||
else(HAS_DOT)
|
||||
string(REGEX REPLACE "(.*)-beta" "\\1" MINOR_VERSION "${ONLY_VERSION}")
|
||||
if(MINOR_VERSION STREQUAL "4-1\n")
|
||||
set(PATCH_VERSION 1)
|
||||
else(MINOR_VERSION STREQUAL "4-1\n")
|
||||
set(PATCH_VERSION 0)
|
||||
endif(MINOR_VERSION STREQUAL "4-1\n")
|
||||
set(MINOR_VERSION 4)
|
||||
endif(HAS_DOT)
|
||||
endif(HAS_PATCH)
|
||||
|
||||
# Detect is we are using CMake 2.6 or better, these versions include functions that require less work than CMake 2.4 does
|
||||
if(MINOR_VERSION GREATER 5)
|
||||
set(CMAKE26_OR_BETTER TRUE)
|
||||
set(CMAKE248_OR_BETTER TRUE)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(MINOR_VERSION GREATER 5)
|
||||
set(CMAKE26_OR_BETTER FALSE)
|
||||
# Also detect if we are using CMake 2.4.8 or better, the FIND sub-command of list() is nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 7)
|
||||
set(CMAKE248_OR_BETTER TRUE)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 7)
|
||||
set(CMAKE248_OR_BETTER FALSE)
|
||||
# Also detect if we are using CMake 2.4.4 or better, the CheckCXXCompilerFlag module and SORT sub-command of list() are nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 3)
|
||||
set(CMAKE244_OR_BETTER TRUE)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 3)
|
||||
set(CMAKE244_OR_BETTER FALSE)
|
||||
# ALSO detect if we are using CMake 2.4.2 or better, the APPEND sub-command of list() is nonexistent in earlier versions
|
||||
if(PATCH_VERSION GREATER 1)
|
||||
set(CMAKE242_OR_BETTER TRUE)
|
||||
else(PATCH_VERSION GREATER 1)
|
||||
set(CMAKE242_OR_BETTER FALSE)
|
||||
endif(PATCH_VERSION GREATER 1)
|
||||
endif(PATCH_VERSION GREATER 3)
|
||||
endif(PATCH_VERSION GREATER 7)
|
||||
endif(MINOR_VERSION GREATER 5)
|
||||
|
||||
# Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template
|
||||
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake)
|
||||
|
||||
@@ -80,14 +17,13 @@ set(ENV{LC_ALL} C)
|
||||
set(DEFAULT_LIBRARY_DIRS)
|
||||
set(DEFAULT_INCLUDE_DIRS)
|
||||
|
||||
# Check that we aren't running on an ancient broken GCC
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_FULL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX REPLACE "^(\\d+\\.\\d+)" "\\1" GCC_VERSION ${GCC_FULL_VERSION})
|
||||
if(GCC_VERSION LESS 4.2)
|
||||
message(FATAL_ERROR "Your compiler is too old to build Anope. Upgrade to GCC 4.2 or newer!")
|
||||
endif(GCC_VERSION LESS 4.2)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# We require C++17 to build
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Put modules in their own folder
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# If we are using a GNU compiler (have to use CXX because it seems to fail on C), we will be able to determine it's default paths for libraries and includes
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
@@ -98,9 +34,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line
|
||||
if(NOT MINGW)
|
||||
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
|
||||
else(NOT MINGW)
|
||||
else()
|
||||
set(LIBRARIES "${LINE}")
|
||||
endif(NOT MINGW)
|
||||
endif()
|
||||
# Iterate through the libraries
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
# Check if the first character is an equal sign, and skip that library directory as it is (I believe) the primary default and shows up later in the list anyways
|
||||
@@ -108,13 +44,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
if(NOT FIRST_CHAR STREQUAL "=")
|
||||
# If the directory had no = in front of it, make sure it's absolute and add it to the list of default library directories
|
||||
get_filename_component(LIBRARY ${LIBRARY} ABSOLUTE)
|
||||
append_to_list(DEFAULT_LIBRARY_DIRS ${LIBRARY})
|
||||
endif(NOT FIRST_CHAR STREQUAL "=")
|
||||
endforeach(LIBRARY)
|
||||
list(APPEND DEFAULT_LIBRARY_DIRS ${LIBRARY})
|
||||
endif()
|
||||
endforeach()
|
||||
# Remove duplicate entries from the list
|
||||
if(DEFAULT_LIBRARY_DIRS)
|
||||
remove_list_duplicates(DEFAULT_LIBRARY_DIRS)
|
||||
endif(DEFAULT_LIBRARY_DIRS)
|
||||
list(REMOVE_DUPLICATES DEFAULT_LIBRARY_DIRS)
|
||||
endif()
|
||||
# Create a temporary file to test for the default include directories
|
||||
FILE(WRITE empty.cpp "")
|
||||
# Next, we look for the compiler's default include directories
|
||||
@@ -131,11 +67,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# If the line has the following on it, the next lines will contain directory names
|
||||
if(LINE STREQUAL "#include <...> search starts here:")
|
||||
set(IN_SEARCH TRUE)
|
||||
else(LINE STREQUAL "#include <...> search starts here:")
|
||||
else()
|
||||
# If the line has the following on it, we hit the end of the list
|
||||
if(LINE STREQUAL "End of search list.")
|
||||
set(IN_SEARCH FALSE)
|
||||
else(LINE STREQUAL "End of search list.")
|
||||
else()
|
||||
# If we are within the block between the above two lines...
|
||||
if(IN_SEARCH)
|
||||
# Get everything but the first character of the line
|
||||
@@ -147,47 +83,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
# Convert the path to an absolute one, just in case it wasn't
|
||||
get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE)
|
||||
# Add that directory to the list of default include directories
|
||||
append_to_list(DEFAULT_INCLUDE_DIRS ${INCLUDE})
|
||||
endif(IN_SEARCH)
|
||||
endif(LINE STREQUAL "End of search list.")
|
||||
endif(LINE STREQUAL "#include <...> search starts here:")
|
||||
endforeach(LINE)
|
||||
list(APPEND DEFAULT_INCLUDE_DIRS ${INCLUDE})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
# Remove duplicate entries from the list
|
||||
if(DEFAULT_INCLUDE_DIRS)
|
||||
remove_list_duplicates(DEFAULT_INCLUDE_DIRS)
|
||||
endif(DEFAULT_INCLUDE_DIRS)
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
||||
|
||||
# If we are using Visual Studio, locate the path of the Windows Server 2008 SDK or Windows Server 2003 Platform SDK, depending on which is installed
|
||||
if(MSVC)
|
||||
# If the path comes up as "/registry" from any of these, the path wasn't found, otherwise, we'll set WSDK_PATH to the corresponding path
|
||||
# Look for the 2008 SDK under HKLM first
|
||||
get_filename_component(WSDK2008_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
|
||||
if(WSDK2008_PATH STREQUAL "/registry")
|
||||
# If not found, look for the 2003 SDK under HKLM
|
||||
get_filename_component(WSDK2003_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1;Install Dir]" ABSOLUTE CACHE)
|
||||
if(WSDK2003_PATH STREQUAL "/registry")
|
||||
# If not found, look for the 2008 SDK under HKCU
|
||||
get_filename_component(WSDK2008_PATH "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
|
||||
if(WSDK2008_PATH STREQUAL "/registry")
|
||||
# If not found, look for the 2003 SDK under HKCU
|
||||
get_filename_component(WSDK2003_PATH "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1;Install Dir]" ABSOLUTE CACHE)
|
||||
if(WSDK2003_PATH STREQUAL "/registry")
|
||||
# The SDK was never found, set the path to nothing
|
||||
set(WSDK_PATH "")
|
||||
else(WSDK2003_PATH STREQUAL "/registry")
|
||||
set(WSDK_PATH "${WSDK2003_PATH}")
|
||||
endif(WSDK2003_PATH STREQUAL "/registry")
|
||||
else(WSDK2008_PATH STREQUAL "/registry")
|
||||
set(WSDK_PATH "${WSDK2008_PATH}")
|
||||
endif(WSDK2008_PATH STREQUAL "/registry")
|
||||
else(WSDK2003_PATH STREQUAL "/registry")
|
||||
set(WSDK_PATH "${WSDK2003_PATH}")
|
||||
endif(WSDK2003_PATH STREQUAL "/registry")
|
||||
else(WSDK2008_PATH STREQUAL "/registry")
|
||||
set(WSDK_PATH "${WSDK2008_PATH}")
|
||||
endif(WSDK2008_PATH STREQUAL "/registry")
|
||||
endif(MSVC)
|
||||
list(REMOVE_DUPLICATES DEFAULT_INCLUDE_DIRS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition
|
||||
# and dump it in the cache along with proper documentation, otherwise set CMAKE_BUILD_TYPE
|
||||
@@ -196,38 +101,33 @@ endif(MSVC)
|
||||
if(NOT MSVC)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
else(CMAKE_BUILD_TYPE)
|
||||
else()
|
||||
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif(CMAKE_BUILD_TYPE)
|
||||
endif(NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake)
|
||||
if(MINGW)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
enable_language(RC)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
|
||||
endif(MINGW)
|
||||
endif()
|
||||
|
||||
# Include the checking functions used later in this CMakeLists.txt
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckTypeSize)
|
||||
include(CheckLibraryExists)
|
||||
if(CMAKE244_OR_BETTER)
|
||||
include(CheckCXXCompilerFlag)
|
||||
else(CMAKE244_OR_BETTER)
|
||||
include(TestCXXAcceptsFlag)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
# If extra include directories were specified, tell cmake about them.
|
||||
if(EXTRA_INCLUDE)
|
||||
include_directories(${EXTRA_INCLUDE})
|
||||
endif(EXTRA_INCLUDE)
|
||||
endif()
|
||||
|
||||
# If extra library directories were specified, tell cmake about them.
|
||||
if(EXTRA_LIBS)
|
||||
link_directories(${EXTRA_LIBS})
|
||||
endif(EXTRA_LIBS)
|
||||
endif()
|
||||
|
||||
# setup conan
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
|
||||
@@ -237,25 +137,31 @@ endif()
|
||||
|
||||
# Find gettext
|
||||
find_package(Gettext)
|
||||
|
||||
option(USE_PCH "Use precompiled headers" OFF)
|
||||
find_package(Intl)
|
||||
if(GETTEXT_FOUND AND Intl_FOUND)
|
||||
set(HAVE_LOCALIZATION ON)
|
||||
include_directories(${Intl_INCLUDE_DIRS})
|
||||
else()
|
||||
message("Unable to find gettext and libintl; disabling localization")
|
||||
set(HAVE_LOCALIZATION OFF)
|
||||
endif()
|
||||
|
||||
# Use the following directories as includes
|
||||
# Note that it is important the binary include directory comes before the
|
||||
# source include directory so the precompiled headers work correctly.
|
||||
include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language ${Anope_SOURCE_DIR}/modules/pseudoclients)
|
||||
include_directories(
|
||||
${Anope_BINARY_DIR}/include
|
||||
${Anope_SOURCE_DIR}/include
|
||||
${Anope_SOURCE_DIR}/vendor
|
||||
)
|
||||
|
||||
# Pass on REPRODUCIBLE_BUILD
|
||||
if(REPRODUCIBLE_BUILD)
|
||||
add_definitions(-DREPRODUCIBLE_BUILD)
|
||||
endif(REPRODUCIBLE_BUILD)
|
||||
endif()
|
||||
|
||||
# If using Windows, always add the _WIN32 define
|
||||
if(WIN32)
|
||||
add_definitions(-D_WIN32)
|
||||
# And include the windows specific folder for our anope_windows.h
|
||||
# If using Windows, include the windows specific folder for anope_windows.h
|
||||
include_directories(${Anope_SOURCE_DIR}/src/win32)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
# If using Visual Studio, set the C++ flags accordingly
|
||||
if(MSVC)
|
||||
@@ -264,108 +170,60 @@ if(MSVC)
|
||||
string(REPLACE "/GX " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
|
||||
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
|
||||
add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
|
||||
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4267 /wd4275 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
# Otherwise, we're not using Visual Studio
|
||||
else(MSVC)
|
||||
else()
|
||||
# Set the compile flags to have all warnings on (including shadowed variables)
|
||||
set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow")
|
||||
# If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler)
|
||||
if(UNIX)
|
||||
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic ${CMAKE_CXX_FLAGS}")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(CXXFLAGS "${CXXFLAGS} -Wno-long-long -fno-leading-underscore")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# If we aren't on a *nix system, we are using MinGW
|
||||
else(UNIX)
|
||||
# Also, if we are building under MinGW, add another define for MinGW
|
||||
if(MINGW)
|
||||
add_definitions(-DMINGW)
|
||||
endif(MINGW)
|
||||
endif(UNIX)
|
||||
endif(MSVC)
|
||||
set(CXXFLAGS "${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wformat=2 -Wmissing-format-attribute -Wpedantic -Wno-format-nonliteral -Wno-format-zero-length -Wno-unused-parameter ${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
# If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags
|
||||
if(CMAKE_DL_LIBS)
|
||||
append_to_list(LINK_LIBS ${CMAKE_DL_LIBS})
|
||||
endif(CMAKE_DL_LIBS)
|
||||
list(APPEND LINK_LIBS ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
# Find the linker flags required for using threads.
|
||||
find_package("Threads" REQUIRED)
|
||||
if(CMAKE_THREAD_LIBS_INIT)
|
||||
list(APPEND LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries
|
||||
if(MINGW)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
|
||||
endif(MINGW)
|
||||
endif()
|
||||
|
||||
if(NOT PROGRAM_NAME)
|
||||
# Under Windows, we set the executable name for Anope to be anope
|
||||
if(WIN32)
|
||||
set(PROGRAM_NAME anope)
|
||||
# Under *nix, we set the executable name for Anope to be services
|
||||
else(WIN32)
|
||||
set(PROGRAM_NAME services)
|
||||
endif(WIN32)
|
||||
endif(NOT PROGRAM_NAME)
|
||||
set(PROGRAM_NAME anope)
|
||||
endif()
|
||||
|
||||
# If we are not using Visual Studio, we'll run the following checks
|
||||
if(NOT MSVC)
|
||||
# Check if the C++ compiler can accept the -pipe flag, and add it to the compile flags if it works
|
||||
if(CMAKE244_OR_BETTER)
|
||||
# If using CMake 2.4.4 or better, we can use check_cxx_compiler_flag
|
||||
check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG)
|
||||
else(CMAKE244_OR_BETTER)
|
||||
# If using CMake 2.4.3 or older, we will use check_cxx_accepts_flags instead
|
||||
check_cxx_accepts_flag(-pipe HAVE_PIPE_FLAG)
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG)
|
||||
# If the flag was accepted, add it to the list of flags
|
||||
if(HAVE_PIPE_FLAG)
|
||||
set(CXXFLAGS "${CXXFLAGS} -pipe")
|
||||
endif(HAVE_PIPE_FLAG)
|
||||
|
||||
# The following are additional library checks, they are not required for Windows
|
||||
if(NOT WIN32)
|
||||
# Check if socket is within the socket library (if the library exists), and add it to the linker flags if needed
|
||||
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
|
||||
if(HAVE_SOCKET_LIB)
|
||||
append_to_list(LINK_LIBS socket)
|
||||
endif(HAVE_SOCKET_LIB)
|
||||
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
|
||||
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
|
||||
if(HAVE_NSL_LIB)
|
||||
append_to_list(LINK_LIBS nsl)
|
||||
endif(HAVE_NSL_LIB)
|
||||
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
|
||||
check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
|
||||
if(HAVE_PTHREAD)
|
||||
if(NOT APPLE)
|
||||
set(LDFLAGS "${LDFLAGS} -pthread")
|
||||
endif(NOT APPLE)
|
||||
else(HAVE_PTHREAD)
|
||||
message(FATAL_ERROR "The pthread library is required to build Anope")
|
||||
endif(HAVE_PTHREAD)
|
||||
endif(NOT WIN32)
|
||||
endif(NOT MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
|
||||
if(NOT DEFUMASK)
|
||||
if(RUNGROUP)
|
||||
set(DEFUMASK "007")
|
||||
else(RUNGROUP)
|
||||
else()
|
||||
set(DEFUMASK "077")
|
||||
endif(RUNGROUP)
|
||||
endif(NOT DEFUMASK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the DEBUG_BUILD for sysconf.h
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(DEBUG_BUILD TRUE)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
|
||||
|
||||
# Check for the existence of the following include files
|
||||
check_include_file(cstdint HAVE_CSTDINT)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(strings.h HAVE_STRINGS_H)
|
||||
endif()
|
||||
|
||||
# Check for the existence of the following functions
|
||||
check_function_exists(strcasecmp HAVE_STRCASECMP)
|
||||
check_function_exists(stricmp HAVE_STRICMP)
|
||||
check_function_exists(umask HAVE_UMASK)
|
||||
check_function_exists(epoll_wait HAVE_EPOLL)
|
||||
check_function_exists(poll HAVE_POLL)
|
||||
@@ -373,63 +231,62 @@ check_function_exists(kqueue HAVE_KQUEUE)
|
||||
|
||||
# Strip the leading and trailing spaces from the compile flags
|
||||
if(CXXFLAGS)
|
||||
strip_string(${CXXFLAGS} CXXFLAGS)
|
||||
endif(CXXFLAGS)
|
||||
string(STRIP ${CXXFLAGS} CXXFLAGS)
|
||||
endif()
|
||||
# Strip the leading and trailing spaces from the linker flags
|
||||
if(LDFLAGS)
|
||||
strip_string(${LDFLAGS} LDFLAGS)
|
||||
endif(LDFLAGS)
|
||||
string(STRIP ${LDFLAGS} LDFLAGS)
|
||||
endif()
|
||||
|
||||
# Search for the following programs
|
||||
find_program(GREP grep)
|
||||
find_program(SH sh)
|
||||
find_program(CHGRP chgrp)
|
||||
find_program(CHMOD chmod)
|
||||
if(NOT WIN32 AND RUNGROUP)
|
||||
find_program(CHGRP "chgrp" REQUIRED)
|
||||
find_program(CHMOD "chmod" REQUIRED)
|
||||
endif()
|
||||
|
||||
# If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the services directory under the user's home directory
|
||||
# If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the anope directory under the user's home directory
|
||||
if(INSTDIR)
|
||||
set(CMAKE_INSTALL_PREFIX "${INSTDIR}")
|
||||
elseif(NOT CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/services")
|
||||
endif(INSTDIR)
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/anope")
|
||||
endif()
|
||||
|
||||
# Set default paths for various directories if not already defined
|
||||
if(NOT BIN_DIR)
|
||||
set(BIN_DIR "bin")
|
||||
endif(NOT BIN_DIR)
|
||||
endif()
|
||||
if(NOT DB_DIR)
|
||||
set(DB_DIR "data")
|
||||
endif(NOT DB_DIR)
|
||||
endif()
|
||||
if(NOT DOC_DIR)
|
||||
set(DOC_DIR "doc")
|
||||
endif(NOT DOC_DIR)
|
||||
endif()
|
||||
if(NOT CONF_DIR)
|
||||
set(CONF_DIR "conf")
|
||||
endif(NOT CONF_DIR)
|
||||
endif()
|
||||
if(NOT LIB_DIR)
|
||||
set(LIB_DIR "lib")
|
||||
endif(NOT LIB_DIR)
|
||||
endif()
|
||||
if(NOT LOCALE_DIR)
|
||||
set(LOCALE_DIR "locale")
|
||||
endif(NOT LOCALE_DIR)
|
||||
endif()
|
||||
if(NOT LOGS_DIR)
|
||||
set(LOGS_DIR "logs")
|
||||
endif(NOT LOGS_DIR)
|
||||
endif()
|
||||
|
||||
# Version number processing
|
||||
# Find all lines in src/version.sh that start with VERSION_
|
||||
read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS)
|
||||
file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^VERSION_")
|
||||
# Iterate through the strings found
|
||||
foreach(VERSION_STR ${VERSIONS})
|
||||
string(REGEX REPLACE "^VERSION_([A-Z]+)=\"?([^\"]*)\"?$" "\\1;\\2" VERSION_OUT ${VERSION_STR})
|
||||
# Depends on CMP0007 OLD
|
||||
list(LENGTH VERSION_OUT VERSION_LEN)
|
||||
list(GET VERSION_OUT 0 VERSION_TYPE)
|
||||
if(${VERSION_LEN} GREATER 1)
|
||||
list(GET VERSION_OUT 1 VERSION_DATA)
|
||||
set(VERSION_${VERSION_TYPE} ${VERSION_DATA})
|
||||
endif(${VERSION_LEN} GREATER 1)
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Default build version to 0
|
||||
set(VERSION_BUILD 0)
|
||||
@@ -437,7 +294,7 @@ set(VERSION_BUILD 0)
|
||||
# Only change the build number if version.h exists
|
||||
if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
# Attempt to read the build number from include/version.h
|
||||
read_from_file(${Anope_SOURCE_DIR}/include/version.h "^#define VERSION_BUILD" VERSIONS)
|
||||
file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^#define VERSION_BUILD")
|
||||
foreach(VERSION_STR ${VERSIONS})
|
||||
# Get the length of the string
|
||||
string(LENGTH ${VERSION_STR} VERSION_LEN)
|
||||
@@ -447,8 +304,8 @@ if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION)
|
||||
# Set VERSION_BUILD correctly
|
||||
set(VERSION_BUILD ${VERSION})
|
||||
endforeach(VERSION_STR ${VERSIONS})
|
||||
endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Set the version variables based on what was found above
|
||||
set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
|
||||
@@ -461,7 +318,7 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
|
||||
if(WIN32)
|
||||
# Generate the win32.rc file using the above variables
|
||||
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
|
||||
add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE)
|
||||
@@ -476,8 +333,8 @@ if(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
|
||||
# If using Visual Studio, add these files as well
|
||||
if(MSVC)
|
||||
add_to_cpack_ignored_files(".vcproj$\;.sln$\;.ncb$\;.suo$\;.dir$\;.ilk$\;.exp$\;.pdb$\;.lib$\;/debug$;/release$;/relwithdebinfo$;/minsizerel$" TRUE)
|
||||
endif(MSVC)
|
||||
endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Go into the following directories and run their CMakeLists.txt as well
|
||||
add_subdirectory(data)
|
||||
@@ -488,7 +345,7 @@ add_subdirectory(modules)
|
||||
add_subdirectory(include)
|
||||
|
||||
# Get the filename of the Anope binary, to use later
|
||||
get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION)
|
||||
set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
|
||||
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
|
||||
|
||||
# At install time, create the following additional directories
|
||||
@@ -496,19 +353,19 @@ install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
|
||||
if(WIN32)
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory
|
||||
if(NOT WIN32 AND RUNGROUP)
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")")
|
||||
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")")
|
||||
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")")
|
||||
endif(NOT WIN32 AND RUNGROUP)
|
||||
endif()
|
||||
# On Windows platforms, install extra files
|
||||
if(WIN32)
|
||||
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
|
||||
DESTINATION ${BIN_DIR}
|
||||
)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
|
||||
|
||||
@@ -549,10 +406,10 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "https://www.anope.org/")
|
||||
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "anope-${VERSION_FULL_NOBUILD}-source")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "$ENV{CPACK_IGNORED_FILES}")
|
||||
set(CPACK_MONOLITHIC_INSTALL TRUE)
|
||||
include(CPack)
|
||||
endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Configuration script for Services.
|
||||
# Configuration script for Anope.
|
||||
#
|
||||
# Anope (C) 2003-2024 Anope Team
|
||||
# Contact us at team@anope.org
|
||||
@@ -62,12 +62,6 @@ Run_Build_System () {
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE"
|
||||
fi
|
||||
|
||||
if [ "$USE_PCH" = "yes" ] ; then
|
||||
PCH="-DUSE_PCH:BOOLEAN=ON"
|
||||
else
|
||||
PCH="-DUSE_PCH:BOOLEAN=OFF"
|
||||
fi
|
||||
|
||||
if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then
|
||||
EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS"
|
||||
fi
|
||||
@@ -76,12 +70,6 @@ Run_Build_System () {
|
||||
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
|
||||
fi
|
||||
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
GEN_TYPE="-G\"MSYS Makefiles\""
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$SOURCE_DIR" = "." ] ; then
|
||||
pwdsave=`pwd`
|
||||
test -d build || mkdir build
|
||||
@@ -91,9 +79,9 @@ Run_Build_System () {
|
||||
REAL_SOURCE_DIR="$SOURCE_DIR"
|
||||
fi
|
||||
|
||||
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
|
||||
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
|
||||
|
||||
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
|
||||
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "You should fix these issues and then run ./Config -quick to rerun CMake."
|
||||
exit 1
|
||||
@@ -125,11 +113,10 @@ export ECHO2 ECHO2SUF
|
||||
# Init values
|
||||
###########################################################################
|
||||
|
||||
INSTDIR=$HOME/services
|
||||
INSTDIR=$HOME/anope
|
||||
RUNGROUP=
|
||||
UMASK=
|
||||
DEBUG="no"
|
||||
USE_PCH="no"
|
||||
EXTRA_INCLUDE_DIRS=
|
||||
EXTRA_LIB_DIRS=
|
||||
EXTRA_CONFIG_ARGS=
|
||||
@@ -176,7 +163,7 @@ done
|
||||
cmake --version 2>&1 > /dev/null
|
||||
if [ $? -ne 0 ] ; then
|
||||
clear
|
||||
echo "Anope requires CMake 2.4 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager."
|
||||
echo "Anope requires CMake 3.8 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager."
|
||||
echo "If you have installed CMake already, ensure it is in your PATH environment variable."
|
||||
exit 0
|
||||
fi
|
||||
@@ -184,24 +171,15 @@ fi
|
||||
###########################################################################
|
||||
|
||||
if [ ! "$NO_INTRO" ] ; then
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
PAGER=less
|
||||
;;
|
||||
*)
|
||||
PAGER=more
|
||||
clear
|
||||
;;
|
||||
esac
|
||||
export MORE='-e'
|
||||
. $SOURCE_DIR/src/version.sh
|
||||
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
|
||||
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | more
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "Beginning Services configuration."
|
||||
echo "Beginning Anope configuration."
|
||||
echo ""
|
||||
|
||||
###########################################################################
|
||||
@@ -240,7 +218,7 @@ while [ $ok -eq 0 ] ; do
|
||||
fi
|
||||
fi
|
||||
elif exists "$INPUT/include/services.h" ; then
|
||||
echo "You cannot use the Services source directory as a target directory."
|
||||
echo "You cannot use the Anope source directory as a target directory."
|
||||
else
|
||||
ok=1
|
||||
fi
|
||||
@@ -252,11 +230,11 @@ echo ""
|
||||
|
||||
OLD_RUNGROUP="$RUNGROUP"
|
||||
if [ "$RUNGROUP" ] ; then
|
||||
echo "Which group should all Services data files be owned by? (If Services"
|
||||
echo "Which group should all Anope data files be owned by? (If Anope"
|
||||
echo "should not force files to be owned by a particular group, type \"none\""
|
||||
echo "(without the quotes) and press Return.)"
|
||||
else
|
||||
echo "Which group should all Services data files be owned by? (If Services"
|
||||
echo "Which group should all Anope data files be owned by? (If Anope"
|
||||
echo "should not force files to be owned by a particular group, just press"
|
||||
echo "Return.)"
|
||||
fi
|
||||
@@ -322,25 +300,6 @@ echo ""
|
||||
|
||||
####
|
||||
|
||||
TEMP_YN="n"
|
||||
if [ "$USE_PCH" = "yes" ] ; then
|
||||
TEMP_YN="y"
|
||||
fi
|
||||
echo "Do you want to build using precompiled headers? This can speed up"
|
||||
echo "the build, but uses more disk space."
|
||||
echo2 "[$TEMP_YN] "
|
||||
read YN
|
||||
if [ "$YN" ] ; then
|
||||
if [ "$YN" = "y" ] ; then
|
||||
USE_PCH="yes"
|
||||
else
|
||||
USE_PCH="no"
|
||||
fi
|
||||
fi
|
||||
echo ""
|
||||
|
||||
####
|
||||
|
||||
echo "Are there any extra include directories you wish to use?"
|
||||
echo "You may only need to do this if CMake is unable to locate"
|
||||
echo "missing dependencies without hints."
|
||||
@@ -403,7 +362,6 @@ INSTDIR="$INSTDIR"
|
||||
RUNGROUP="$RUNGROUP"
|
||||
UMASK=$UMASK
|
||||
DEBUG="$DEBUG"
|
||||
USE_PCH="$USE_PCH"
|
||||
EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS"
|
||||
EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS"
|
||||
EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## About
|
||||
|
||||
Anope is an open source set of IRC Services. It is highly modular, with a vast number of configurable parameters, and is the most used IRC services package. There are also many modules on the [modsite](https://modules.anope.org) to add additional features. It runs on Linux, BSD, and Windows, and supports many modern IRCds, including InspIRCd, UnrealIRCd, and ircd-hybrid. For more details, credits, command line options, and contact information see [docs/README](https://github.com/anope/anope/blob/2.0/docs/README).
|
||||
Anope is an open source set of IRC services. It is highly modular, with a vast number of configurable parameters, and is the most used IRC services package. There are also many modules on the [modsite](https://modules.anope.org) to add additional features. It runs on Linux, BSD, and Windows, and supports many modern IRCds, including InspIRCd, UnrealIRCd, and ircd-hybrid. For more details, credits, command line options, and contact information see [docs/README](https://github.com/anope/anope/blob/2.0/docs/README).
|
||||
|
||||
* [Website](https://anope.org)
|
||||
* [GitHub](https://github.com/anope)
|
||||
@@ -19,7 +19,7 @@ $ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
Now change to the directory where you installed Anope to, e.g. `$ cd ~/services/`
|
||||
Now change to the directory where you installed Anope to, e.g. `$ cd ~/anope/`
|
||||
|
||||
### Windows
|
||||
Download the latest release off of the [releases page](https://github.com/anope/anope/releases) and run the installer.
|
||||
@@ -27,19 +27,19 @@ Download the latest release off of the [releases page](https://github.com/anope/
|
||||
|
||||
## Configuration
|
||||
|
||||
Copy conf/example.conf to conf/services.conf
|
||||
Copy conf/anope.example.conf to conf/anope.conf
|
||||
|
||||
```
|
||||
$ cp conf/example.conf conf/services.conf
|
||||
$ cp conf/anope.example.conf conf/anope.conf
|
||||
```
|
||||
|
||||
Edit services.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the the example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.anope.org](irc://irc.anope.org/#anope).
|
||||
Edit anope.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the anope.example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.anope.org](irc://irc.anope.org/#anope).
|
||||
|
||||
Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `services.conf` to include the new file.
|
||||
Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `anope.conf` to include the new file.
|
||||
|
||||
## Running
|
||||
|
||||
Run `$ ./bin/services` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/services --support`
|
||||
Run `$ ./bin/anope` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/anope --support`
|
||||
|
||||
## Installing extra modules
|
||||
|
||||
|
||||
+32
-481
@@ -1,421 +1,3 @@
|
||||
###############################################################################
|
||||
# strip_string(<input string> <output string>)
|
||||
#
|
||||
# A macro to handle stripping the leading and trailing spaces from a string,
|
||||
# uses string(STRIP) if using CMake 2.6.x or better, otherwise uses
|
||||
# string(REGEX REPLACE).
|
||||
###############################################################################
|
||||
macro(strip_string INPUT_STRING OUTPUT_STRING)
|
||||
if(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.6.x or better, we can just use the STRIP sub-command of string()
|
||||
string(STRIP ${INPUT_STRING} ${OUTPUT_STRING})
|
||||
else(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.4.x, we will have to use the REGEX REPLACE sub-command of string() instead
|
||||
# First check if the input string is empty or not
|
||||
if (${INPUT_STRING} STREQUAL "")
|
||||
set(${OUTPUT_STRING} "")
|
||||
else(${INPUT_STRING} STREQUAL "")
|
||||
# Determine if the string is entirely empty or not
|
||||
string(REGEX MATCH "^[ \t]*$" EMPTY_STRING "${INPUT_STRING}")
|
||||
if(EMPTY_STRING)
|
||||
set(${OUTPUT_STRING} "")
|
||||
else(EMPTY_STRING)
|
||||
# We detect if there is any leading whitespace and remove any if there is
|
||||
string(SUBSTRING "${INPUT_STRING}" 0 1 FIRST_CHAR)
|
||||
if(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
string(REGEX REPLACE "^[ \t]+" "" TEMP_STRING "${INPUT_STRING}")
|
||||
else(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
set(TEMP_STRING "${INPUT_STRING}")
|
||||
endif(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
|
||||
# Next we detect if there is any trailing whitespace and remove any if there is
|
||||
string(LENGTH "${TEMP_STRING}" STRING_LEN)
|
||||
math(EXPR STRING_LEN "${STRING_LEN} - 1")
|
||||
string(SUBSTRING "${TEMP_STRING}" ${STRING_LEN} 1 LAST_CHAR)
|
||||
if(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
string(REGEX REPLACE "[ \t]+$" "" ${OUTPUT_STRING} "${TEMP_STRING}")
|
||||
else(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
set(${OUTPUT_STRING} "${TEMP_STRING}")
|
||||
endif(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
|
||||
endif(EMPTY_STRING)
|
||||
endif(${INPUT_STRING} STREQUAL "")
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
endmacro(strip_string)
|
||||
|
||||
###############################################################################
|
||||
# append_to_list(<list> <args>...)
|
||||
#
|
||||
# A macro to handle appending to lists, uses list(APPEND) if using CMake 2.4.2
|
||||
# or better, otherwise uses set() instead.
|
||||
###############################################################################
|
||||
macro(append_to_list LIST)
|
||||
if(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.2 or better, we can just use the APPEND sub-command of list()
|
||||
list(APPEND ${LIST} ${ARGN})
|
||||
else(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.x before 2.4.2, we have to do this manually use set() instead
|
||||
set(${LIST} ${${LIST}} ${ARGN})
|
||||
endif(CMAKE242_OR_BETTER)
|
||||
endmacro(append_to_list)
|
||||
|
||||
###############################################################################
|
||||
# find_in_list(<list> <value> <output variable>)
|
||||
#
|
||||
# A macro to handle searching within a list, will store the result in the
|
||||
# given <output variable>, uses list(FIND) if using CMake 2.6.x or better
|
||||
# (or CMake 2.4.8 or better), otherwise it iterates through the list to find
|
||||
# the item.
|
||||
###############################################################################
|
||||
macro(find_in_list LIST ITEM_TO_FIND FOUND)
|
||||
if(CMAKE248_OR_BETTER)
|
||||
# For CMake 2.4.8 or better, we can use the FIND sub-command of list()
|
||||
list(FIND ${LIST} ${ITEM_TO_FIND} ITEM_FOUND)
|
||||
else(CMAKE248_OR_BETTER)
|
||||
# For CMake 2.4.x before 2.4.8, we have to do this ourselves (NOTE: This is very slow due to a lack of break() as well)
|
||||
# Firstly we set the position to -1 indicating nothing found, we also use a temporary position
|
||||
set(ITEM_FOUND -1)
|
||||
set(POS 0)
|
||||
# Iterate through the list
|
||||
foreach(ITEM ${${LIST}})
|
||||
# If the item we are looking at is the item we are trying to find, set that we've found the item
|
||||
if(${ITEM} STREQUAL ${ITEM_TO_FIND})
|
||||
set(ITEM_FOUND ${POS})
|
||||
endif(${ITEM} STREQUAL ${ITEM_TO_FIND})
|
||||
# Increase the position value by 1
|
||||
math(EXPR POS "${POS} + 1")
|
||||
endforeach(ITEM)
|
||||
endif(CMAKE248_OR_BETTER)
|
||||
# Set the given FOUND variable to the result
|
||||
set(${FOUND} ${ITEM_FOUND})
|
||||
endmacro(find_in_list)
|
||||
|
||||
###############################################################################
|
||||
# remove_list_duplicates(<list>)
|
||||
#
|
||||
# A macro to handle removing duplicates from a list, uses
|
||||
# list(REMOVE_DUPLICATES) if using CMake 2.6.x or better, otherwise it uses
|
||||
# a slower method of creating a temporary list and only adding to it when
|
||||
# a duplicate item hasn't been found.
|
||||
###############################################################################
|
||||
macro(remove_list_duplicates LIST)
|
||||
if(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.6.x or better, this can be done automatically
|
||||
list(REMOVE_DUPLICATES ${LIST})
|
||||
else(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.4.x, we have to do this ourselves, firstly we'll clear a temporary list
|
||||
set(NEW_LIST)
|
||||
# Iterate through the old list
|
||||
foreach(ITEM ${${LIST}})
|
||||
# Check if the item is in the new list
|
||||
find_in_list(NEW_LIST ${ITEM} FOUND_ITEM)
|
||||
if(FOUND_ITEM EQUAL -1)
|
||||
# If the item was not found, append it to the list
|
||||
append_to_list(NEW_LIST ${ITEM})
|
||||
endif(FOUND_ITEM EQUAL -1)
|
||||
endforeach(ITEM)
|
||||
# Replace the old list with the new list
|
||||
set(${LIST} ${NEW_LIST})
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
endmacro(remove_list_duplicates)
|
||||
|
||||
###############################################################################
|
||||
# remove_item_from_list(<list> <value>)
|
||||
#
|
||||
# A macro to handle removing a value from a list, uses list(REMOVE_ITEM) in
|
||||
# both cases, but can remove the value itself using CMake 2.4.2 or better,
|
||||
# while older versions use a slower method of iterating the list to find the
|
||||
# index of the value to remove.
|
||||
###############################################################################
|
||||
macro(remove_item_from_list LIST VALUE)
|
||||
if(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.2 or better, this can be done automatically
|
||||
list(REMOVE_ITEM ${LIST} ${VALUE})
|
||||
else(CMAKE242_OR_BETTER)
|
||||
# For CMake 2.4.x before 2.4.2, we have to do this ourselves, firstly we set the index and a variable to indicate if the item was found
|
||||
set(INDEX 0)
|
||||
set(FOUND FALSE)
|
||||
# Iterate through the old list
|
||||
foreach(ITEM ${${LIST}})
|
||||
# If the item hasn't been found yet, but the current item is the same, remove it
|
||||
if(NOT FOUND)
|
||||
if(ITEM STREQUAL ${VALUE})
|
||||
set(FOUND TRUE)
|
||||
list(REMOVE_ITEM ${LIST} ${INDEX})
|
||||
endif(ITEM STREQUAL ${VALUE})
|
||||
endif(NOT FOUND)
|
||||
# Increase the index value by 1
|
||||
math(EXPR INDEX "${INDEX} + 1")
|
||||
endforeach(ITEM)
|
||||
endif(CMAKE242_OR_BETTER)
|
||||
endmacro(remove_item_from_list)
|
||||
|
||||
###############################################################################
|
||||
# sort_list(<list>)
|
||||
#
|
||||
# A macro to handle sorting a list, uses list(SORT) if using CMake 2.4.4 or
|
||||
# better, otherwise it uses a slower method of creating a temporary list and
|
||||
# adding elements in alphabetical order.
|
||||
###############################################################################
|
||||
macro(sort_list LIST)
|
||||
if(CMAKE244_OR_BETTER)
|
||||
# For CMake 2.4.4 or better, this can be done automatically
|
||||
list(SORT ${LIST})
|
||||
else(CMAKE244_OR_BETTER)
|
||||
# For CMake 2.4.x before 2.4.4, we have to do this ourselves, firstly we'll create a temporary list
|
||||
set(NEW_LIST)
|
||||
# Iterate through the old list
|
||||
foreach(ITEM ${${LIST}})
|
||||
# Temporary index position for the new list, as well as temporary value to store if the item was ever found
|
||||
set(INDEX 0)
|
||||
set(FOUND FALSE)
|
||||
# Iterate through the new list
|
||||
foreach(NEW_ITEM ${NEW_LIST})
|
||||
# Compare the items, only if nothing was found before
|
||||
if(NOT FOUND)
|
||||
if(NEW_ITEM STRGREATER "${ITEM}")
|
||||
set(FOUND TRUE)
|
||||
list(INSERT NEW_LIST ${INDEX} ${ITEM})
|
||||
endif(NEW_ITEM STRGREATER "${ITEM}")
|
||||
endif(NOT FOUND)
|
||||
# Increase the index value by 1
|
||||
math(EXPR INDEX "${INDEX} + 1")
|
||||
endforeach(NEW_ITEM)
|
||||
# If the item was never found, just append it to the end
|
||||
if(NOT FOUND)
|
||||
append_to_list(NEW_LIST ${ITEM})
|
||||
endif(NOT FOUND)
|
||||
endforeach(ITEM)
|
||||
# Replace the old list with the new list
|
||||
set(${LIST} ${NEW_LIST})
|
||||
endif(CMAKE244_OR_BETTER)
|
||||
endmacro(sort_list)
|
||||
|
||||
###############################################################################
|
||||
# read_from_file(<filename> <regex> <output variable>)
|
||||
#
|
||||
# A macro to handle reading specific lines from a file, uses file(STRINGS) if
|
||||
# using CMake 2.6.x or better, otherwise we read in the entire file and
|
||||
# perform a string(REGEX MATCH) on each line of the file instead. This
|
||||
# macro can also be used to read in all the lines of a file if REGEX is set
|
||||
# to "".
|
||||
###############################################################################
|
||||
macro(read_from_file FILE REGEX STRINGS)
|
||||
if(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.6.x or better, we can just use the STRINGS sub-command to get the lines that match the given regular expression (if one is given, otherwise get all lines)
|
||||
if(REGEX STREQUAL "")
|
||||
file(STRINGS ${FILE} RESULT)
|
||||
else(REGEX STREQUAL "")
|
||||
file(STRINGS ${FILE} RESULT REGEX ${REGEX})
|
||||
endif(REGEX STREQUAL "")
|
||||
else(CMAKE26_OR_BETTER)
|
||||
# For CMake 2.4.x, we need to do this manually, firstly we read the file in
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -DFILE:STRING=${FILE} -P ${Anope_SOURCE_DIR}/cmake/ReadFile.cmake ERROR_VARIABLE ALL_STRINGS)
|
||||
# Next we replace all newlines with semicolons
|
||||
string(REGEX REPLACE "\n" ";" ALL_STRINGS ${ALL_STRINGS})
|
||||
if(REGEX STREQUAL "")
|
||||
# For no regular expression, just set the result to all the lines
|
||||
set(RESULT ${ALL_STRINGS})
|
||||
else(REGEX STREQUAL "")
|
||||
# Clear the result list
|
||||
set(RESULT)
|
||||
# Iterate through all the lines of the file
|
||||
foreach(STRING ${ALL_STRINGS})
|
||||
# Check for a match against the given regular expression
|
||||
string(REGEX MATCH ${REGEX} STRING_MATCH ${STRING})
|
||||
# If we had a match, append the match to the list
|
||||
if(STRING_MATCH)
|
||||
append_to_list(RESULT ${STRING})
|
||||
endif(STRING_MATCH)
|
||||
endforeach(STRING)
|
||||
endif(REGEX STREQUAL "")
|
||||
endif(CMAKE26_OR_BETTER)
|
||||
# Set the given STRINGS variable to the result
|
||||
set(${STRINGS} ${RESULT})
|
||||
endmacro(read_from_file)
|
||||
|
||||
###############################################################################
|
||||
# extract_include_filename(<line> <output variable> [<optional output variable of quote type>])
|
||||
#
|
||||
# This macro will take a #include line and extract the filename.
|
||||
###############################################################################
|
||||
macro(extract_include_filename INCLUDE FILENAME)
|
||||
# Strip the leading and trailing spaces from the include line
|
||||
strip_string(${INCLUDE} INCLUDE_STRIPPED)
|
||||
# Make sure to only do the following if there is a string
|
||||
if(INCLUDE_STRIPPED STREQUAL "")
|
||||
set(FILE "")
|
||||
else(INCLUDE_STRIPPED STREQUAL "")
|
||||
# Extract the filename including the quotes or angle brackets
|
||||
string(REGEX REPLACE "^.*([\"<].*[\">]).*$" "\\1" FILE "${INCLUDE_STRIPPED}")
|
||||
# If an optional 3rd argument is given, we'll store if the quote style was quoted or angle bracketed
|
||||
if(${ARGC} GREATER 2)
|
||||
string(SUBSTRING ${FILE} 0 1 QUOTE)
|
||||
if(QUOTE STREQUAL "<")
|
||||
set(${ARGV2} "angle brackets")
|
||||
else(QUOTE STREQUAL "<")
|
||||
set(${ARGV2} "quotes")
|
||||
endif(QUOTE STREQUAL "<")
|
||||
endif(${ARGC} GREATER 2)
|
||||
# Now remove the quotes or angle brackets
|
||||
string(REGEX REPLACE "^[\"<](.*)[\">]$" "\\1" FILE "${FILE}")
|
||||
endif(INCLUDE_STRIPPED STREQUAL "")
|
||||
# Set the filename to the the given variable
|
||||
set(${FILENAME} "${FILE}")
|
||||
endmacro(extract_include_filename)
|
||||
|
||||
###############################################################################
|
||||
# find_includes(<source filename> <output variable>)
|
||||
#
|
||||
# This macro will search through a file for #include lines, regardless of
|
||||
# whitespace, but only returns the lines that are valid for the current
|
||||
# platform CMake is running on.
|
||||
###############################################################################
|
||||
macro(find_includes SRC INCLUDES)
|
||||
# Read all lines from the file that start with #, regardless of whitespace before the #
|
||||
read_from_file(${SRC} "^[ \t]*#.*$" LINES)
|
||||
# Set that any #include lines found are valid, and create temporary variables for the last found #ifdef/#ifndef
|
||||
set(VALID_LINE TRUE)
|
||||
set(LAST_DEF)
|
||||
set(LAST_CHECK)
|
||||
# Create an empty include list
|
||||
set(INCLUDES_LIST)
|
||||
# Iterate through all the # lines
|
||||
foreach(LINE ${LINES})
|
||||
# Search for #ifdef, #ifndef, #else, #endif, and #include
|
||||
string(REGEX MATCH "^[ \t]*#[ \t]*ifdef[ \t]*.*$" FOUND_IFDEF ${LINE})
|
||||
string(REGEX MATCH "^[ \t]*#[ \t]*ifndef[ \t]*.*$" FOUND_IFNDEF ${LINE})
|
||||
string(REGEX MATCH "^[ \t]*#[ \t]*else.*$" FOUND_ELSE ${LINE})
|
||||
string(REGEX MATCH "^[ \t]*#[ \t]*endif.*$" FOUND_ENDIF ${LINE})
|
||||
string(REGEX MATCH "^[ \t]*#[ \t]*include[ \t]*[\"<].*[\">][\ t]*.*$" FOUND_INCLUDE ${LINE})
|
||||
# If we found a #ifdef on the line, extract the data after the #ifdef and set if the lines after it are valid based on the variables in CMake
|
||||
if(FOUND_IFDEF)
|
||||
# Extract the define
|
||||
string(REGEX REPLACE "^[ \t]*#[ \t]*ifdef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
|
||||
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
|
||||
if(DEFINE STREQUAL "_WIN32")
|
||||
set(DEFINE WIN32)
|
||||
endif(DEFINE STREQUAL "_WIN32")
|
||||
# Set the last define to this one, and set the last check to true, so when #else is encountered, we can do an opposing check
|
||||
set(LAST_DEF ${DEFINE})
|
||||
set(LAST_CHECK TRUE)
|
||||
# If the define is true (it either exists or is a non-false result), the lines following will be checked, otherwise they will be skipped
|
||||
if(${DEFINE})
|
||||
set(VALID_LINE TRUE)
|
||||
else(${DEFINE})
|
||||
set(VALID_LINE FALSE)
|
||||
endif(${DEFINE})
|
||||
else(FOUND_IFDEF)
|
||||
# If we found a #ifndef on the line, the same thing as #ifdef is done, except with the checks in the opposite direction
|
||||
if(FOUND_IFNDEF)
|
||||
# Extract the define
|
||||
string(REGEX REPLACE "^[ \t]*#[ \t]*ifndef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
|
||||
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
|
||||
if(DEFINE STREQUAL "_WIN32")
|
||||
set(DEFINE WIN32)
|
||||
endif(DEFINE STREQUAL "_WIN32")
|
||||
# Set the last define to this one, and set the last check to false, so when #else is encountered, we can do an opposing check
|
||||
set(LAST_DEF ${DEFINE})
|
||||
set(LAST_CHECK FALSE)
|
||||
# If the define is not true (it either doesn't exists or is a false result), the lines following will be checked, otherwise they will be skipped
|
||||
if(${DEFINE})
|
||||
set(VALID_LINE FALSE)
|
||||
else(${DEFINE})
|
||||
set(VALUE_LINE TRUE)
|
||||
endif(${DEFINE})
|
||||
else(FOUND_IFNDEF)
|
||||
# If we found a #else on the line, we check the last define in the opposite direction
|
||||
if(FOUND_ELSE)
|
||||
# When LAST_CHECK is true, we were inside a #ifdef, now act as if we are entering a #ifndef section by doing an opposing check
|
||||
if(LAST_CHECK)
|
||||
if(${LAST_DEF})
|
||||
set(VALID_LINE FALSE)
|
||||
else(${LAST_DEF})
|
||||
set(VALID_LINE TRUE)
|
||||
endif(${LAST_DEF})
|
||||
# When LAST_CHECK is false, we were inside a #ifndef, now act as if we are entering a #ifdef section by doing an opposing check
|
||||
else(LAST_CHECK)
|
||||
if(${LAST_DEF})
|
||||
set(VALID_LINE TRUE)
|
||||
else(${LAST_DEF})
|
||||
set(VALID_LINE FALSE)
|
||||
endif(${LAST_DEF})
|
||||
endif(LAST_CHECK)
|
||||
else(FOUND_ELSE)
|
||||
# If we found a #endif on the line, we'll assume everything following the line is valid until we meet another one of the above lines
|
||||
if(FOUND_ENDIF)
|
||||
set(VALID_LINE TRUE)
|
||||
else(FOUND_ENDIF)
|
||||
# If we found a #include on the line, add the entire line to the list of includes unless the line isn't valid
|
||||
if(FOUND_INCLUDE)
|
||||
if(VALID_LINE)
|
||||
append_to_list(INCLUDES_LIST "${LINE}")
|
||||
endif(VALID_LINE)
|
||||
endif(FOUND_INCLUDE)
|
||||
endif(FOUND_ENDIF)
|
||||
endif(FOUND_ELSE)
|
||||
endif(FOUND_IFNDEF)
|
||||
endif(FOUND_IFDEF)
|
||||
endforeach(LINE)
|
||||
set(${INCLUDES} ${INCLUDES_LIST})
|
||||
endmacro(find_includes)
|
||||
|
||||
###############################################################################
|
||||
# calculate_depends(<source filename> [<optional output variable for includes>])
|
||||
#
|
||||
# This macro is used in most of the src (sub)directories to calculate the
|
||||
# header file dependencies for the given source file.
|
||||
###############################################################################
|
||||
macro(calculate_depends SRC)
|
||||
# Temporarily set that we didn't get a 3rd argument before we actually check if we did get one or not
|
||||
set(CHECK_ANGLE_INCLUDES FALSE)
|
||||
# Check for a third argument
|
||||
if(${ARGC} GREATER 1)
|
||||
set(CHECK_ANGLE_INCLUDES TRUE)
|
||||
endif(${ARGC} GREATER 1)
|
||||
# Find all the lines in the given source file that have any form of #include on them, regardless of whitespace, but only if they are valid for the platform we are on
|
||||
find_includes(${SRC} INCLUDES)
|
||||
# Reset the list of headers to empty
|
||||
set(HEADERS)
|
||||
# Iterate through the strings containing #include (if any)
|
||||
foreach(INCLUDE ${INCLUDES})
|
||||
# Extract the filename from the #include line
|
||||
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
|
||||
if(QUOTE_TYPE STREQUAL "angle brackets")
|
||||
# The following checks will only be done if there was a request for angle includes to be checked
|
||||
if(CHECK_ANGLE_INCLUDES)
|
||||
# Find the path of the include file
|
||||
if(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include ${EXTRA_INCLUDE})
|
||||
else(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} ${EXTRA_INCLUDE})
|
||||
endif(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
# If the include file was found, add it's path to the list of include paths, but only if it doesn't already exist and isn't in the defaults for the compiler
|
||||
if(FOUND_${FILENAME}_INCLUDE)
|
||||
# This used to be find_in_list, but it was changed to this loop to do a find on each default include directory, this fixes Mac OS X trying to get it's framework directories in here
|
||||
set(FOUND_IN_DEFAULTS -1)
|
||||
foreach(DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIRS})
|
||||
string(REGEX REPLACE "\\+" "\\\\+" DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIR})
|
||||
string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE})
|
||||
if(FOUND_DEFAULT)
|
||||
set(FOUND_IN_DEFAULTS 0)
|
||||
endif(FOUND_DEFAULT)
|
||||
endforeach(DEFAULT_INCLUDE_DIR)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
find_in_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
|
||||
if(FOUND_IN_INCLUDES EQUAL -1)
|
||||
append_to_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}")
|
||||
endif(FOUND_IN_INCLUDES EQUAL -1)
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
else(FOUND_${FILENAME}_INCLUDE)
|
||||
# XXX
|
||||
if(NOT ${FILENAME} STREQUAL "libintl.h")
|
||||
message(FATAL_ERROR "${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
|
||||
endif(NOT ${FILENAME} STREQUAL "libintl.h")
|
||||
endif(FOUND_${FILENAME}_INCLUDE)
|
||||
endif(CHECK_ANGLE_INCLUDES)
|
||||
endif(QUOTE_TYPE STREQUAL "angle brackets")
|
||||
endforeach(INCLUDE)
|
||||
endmacro(calculate_depends)
|
||||
|
||||
###############################################################################
|
||||
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
|
||||
#
|
||||
@@ -433,10 +15,10 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
set(LIBRARIES)
|
||||
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
|
||||
if(WIN32)
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
else(WIN32)
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
|
||||
endif(WIN32)
|
||||
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\*/")
|
||||
else()
|
||||
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\*/")
|
||||
endif()
|
||||
# Iterate through those lines
|
||||
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
|
||||
# Strip off the /* RequiredLibraries: and */ from the line
|
||||
@@ -450,86 +32,55 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
|
||||
if (${LIBRARY} MATCHES "^.+\\|.+$")
|
||||
string(REGEX REPLACE ".+\\|(.*)" "\\1" LIBRARY_ALT ${LIBRARY})
|
||||
string(REGEX REPLACE "(.+)\\|.*" "\\1" LIBRARY ${LIBRARY})
|
||||
endif(${LIBRARY} MATCHES "^.+\\|.+$")
|
||||
endif()
|
||||
# Locate the library to see if it exists
|
||||
if(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
|
||||
else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
if(DEFAULT_LIBRARY_DIRS OR DEFINED $ENV{VCINSTALLDIR})
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
|
||||
else()
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} NO_DEFAULT_PATH)
|
||||
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS})
|
||||
endif(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
|
||||
endif()
|
||||
# If the library was found, we will add it to the linker flags
|
||||
if(FOUND_${LIBRARY}_LIBRARY)
|
||||
if(MSVC)
|
||||
# For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies
|
||||
append_to_list(EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
|
||||
else(MSVC)
|
||||
list(APPEND EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
|
||||
else()
|
||||
# Get the path only of the library, to add it to library paths.
|
||||
get_filename_component(LIBRARY_PATH ${FOUND_${LIBRARY}_LIBRARY} PATH)
|
||||
append_to_list(LIBRARY_PATHS "${LIBRARY_PATH}")
|
||||
list(APPEND LIBRARY_PATHS "${LIBRARY_PATH}")
|
||||
# Extract the library short name, add it to the library path
|
||||
get_filename_component(LIBRARY_NAME ${FOUND_${LIBRARY}_LIBRARY} NAME_WE)
|
||||
string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${LIBRARY_NAME})
|
||||
append_to_list(LIBRARIES ${LIBRARY_NAME})
|
||||
endif(MSVC)
|
||||
else(FOUND_${LIBRARY}_LIBRARY)
|
||||
list(APPEND LIBRARIES ${LIBRARY_NAME})
|
||||
endif()
|
||||
else()
|
||||
# In the case of the library not being found, we fatally error so CMake stops trying to generate
|
||||
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
|
||||
endif(FOUND_${LIBRARY}_LIBRARY)
|
||||
endforeach(LIBRARY)
|
||||
endforeach(REQUIRED_LIBRARY)
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
# Remove duplicates from the library paths
|
||||
if(LIBRARY_PATHS)
|
||||
remove_list_duplicates(LIBRARY_PATHS)
|
||||
endif(LIBRARY_PATHS)
|
||||
list(REMOVE_DUPLICATES LIBRARY_PATHS)
|
||||
endif()
|
||||
# Remove diplicates from the libraries
|
||||
if(LIBRARIES)
|
||||
remove_list_duplicates(LIBRARIES)
|
||||
endif(LIBRARIES)
|
||||
list(REMOVE_DUPLICATES LIBRARIES)
|
||||
endif()
|
||||
# Iterate through library paths and add them to the linker flags
|
||||
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
|
||||
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
|
||||
if(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
if(NOT "${LIBRARY_PATH}" IN_LIST DEFAULT_LIBRARY_DIRS)
|
||||
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
|
||||
endif(FOUND_IN_DEFAULTS EQUAL -1)
|
||||
endforeach(LIBRARY_PATH)
|
||||
endif()
|
||||
endforeach()
|
||||
# Iterate through libraries and add them to the linker flags
|
||||
foreach(LIBRARY ${LIBRARIES})
|
||||
append_to_list(EXTRA_DEPENDENCIES "${LIBRARY}")
|
||||
endforeach(LIBRARY)
|
||||
list(APPEND EXTRA_DEPENDENCIES "${LIBRARY}")
|
||||
endforeach()
|
||||
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
|
||||
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
|
||||
endmacro(calculate_libraries)
|
||||
|
||||
###############################################################################
|
||||
# check_functions(<source filename> <output variable set to TRUE on success>)
|
||||
#
|
||||
# This macro is used in most of the module (sub)directories to calculate the
|
||||
# function dependencies for the given source file.
|
||||
###############################################################################
|
||||
macro(check_functions SRC SUCCESS)
|
||||
# Default to true
|
||||
set(${SUCCESS} TRUE)
|
||||
# Check to see if there are any lines matching: /* RequiredFunctions: [something] */
|
||||
read_from_file(${SRC} "/\\\\*[ \t]*RequiredFunctions:[ \t]*.*[ \t]*\\\\*/" REQUIRED_FUNCTIONS)
|
||||
# Iterate through those lines
|
||||
foreach(REQUIRED_FUNCTION ${REQUIRED_FUNCTIONS})
|
||||
# Strip off the /* RequiredFunctions: and */ from the line
|
||||
string(REGEX REPLACE "/\\*[ \t]*RequiredFunctions:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Replace all commas with semicolons
|
||||
string(REGEX REPLACE "," ";" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Iterate through the functions given
|
||||
foreach(FUNCTION ${REQUIRED_FUNCTION})
|
||||
# Check if the function exists
|
||||
check_function_exists(${REQUIRED_FUNCTION} HAVE_${REQUIRED_FUNCTION})
|
||||
# If we don't have the function warn the user and set SUCCESS to FALSE
|
||||
if(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
message("${SRC} needs function ${REQUIRED_FUNCTION} but we were unable to locate that function!")
|
||||
set(${SUCCESS} FALSE)
|
||||
endif(NOT HAVE_${REQUIRED_FUNCTION})
|
||||
endforeach(FUNCTION)
|
||||
endforeach(REQUIRED_FUNCTION)
|
||||
endmacro(check_functions)
|
||||
endmacro()
|
||||
|
||||
###############################################################################
|
||||
# add_to_cpack_ignored_files(<item> [TRUE])
|
||||
@@ -544,12 +95,12 @@ macro(add_to_cpack_ignored_files ITEM)
|
||||
# If we have 2+ arguments, assume that the second one was something like TRUE (doesn't matter really) and convert periods so they will be \\. for CPack
|
||||
if(${ARGC} GREATER 1)
|
||||
string(REPLACE "." "\\\\." REAL_ITEM ${REAL_ITEM})
|
||||
endif(${ARGC} GREATER 1)
|
||||
endif()
|
||||
# If the environment variable is already defined, just tack the item to the end
|
||||
if(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
set(ENV{CPACK_IGNORED_FILES} "$ENV{CPACK_IGNORED_FILES};${REAL_ITEM}")
|
||||
# Otherwise set the environment variable to the item
|
||||
else(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
else()
|
||||
set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}")
|
||||
endif(DEFINED ENV{CPACK_IGNORED_FILES})
|
||||
endmacro(add_to_cpack_ignored_files)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Find the header files, libs, and executables for gettext
|
||||
if(NOT WIN32)
|
||||
find_path(GETTEXT_INCLUDE libintl.h /usr/include /usr/local/include ${EXTRA_INCLUDE})
|
||||
find_library(GETTEXT_LIBRARY intl PATHS /usr/lib /usr/lib64 ${EXTRA_LIBS})
|
||||
find_program(GETTEXT_MSGFMT msgfmt PATHS /usr/bin/ /usr/local/bin ${EXTRA_INCLUDE})
|
||||
if(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
|
||||
set(GETTEXT_FOUND TRUE)
|
||||
if(GETTEXT_LIBRARY)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
|
||||
endif(GETTEXT_LIBRARY)
|
||||
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
|
||||
else(NOT WIN32)
|
||||
find_path(GETTEXT_INCLUDE libintl.h)
|
||||
find_library(GETTEXT_LIBRARY gnuintl)
|
||||
find_program(GETTEXT_MSGFMT msgfmt)
|
||||
if(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
|
||||
set(GETTEXT_FOUND TRUE)
|
||||
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
|
||||
endif(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
|
||||
endif(NOT WIN32)
|
||||
|
||||
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
|
||||
if(GETTEXT_FOUND)
|
||||
include_directories("${GETTEXT_INCLUDE}")
|
||||
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
|
||||
endif(GETTEXT_FOUND)
|
||||
@@ -1,5 +0,0 @@
|
||||
# This file is external to the read_from_file macro in Anope.cmake in order to
|
||||
# get around a possible memory leak in older versions of CMake.
|
||||
|
||||
file(READ "${FILE}" RESULT)
|
||||
message("${RESULT}")
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# Only install example.chk and example.conf from this directory
|
||||
# Only install example.chk and anope.example.conf from this directory
|
||||
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
|
||||
set(DATA example.chk botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf)
|
||||
set(DATA example.chk anope.example.conf botserv.example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf)
|
||||
install(FILES ${DATA}
|
||||
DESTINATION ${CONF_DIR}
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Example configuration file for Services. After making the appropriate
|
||||
* changes to this file, place it in the Services conf directory (as
|
||||
* specified in the "configure" script, default /home/username/services/conf)
|
||||
* under the name "services.conf".
|
||||
* Example configuration file for Anope. After making the appropriate
|
||||
* changes to this file, place it in the Anope conf directory (as
|
||||
* specified in the "Config" script, default /home/username/anope/conf)
|
||||
* under the name "anope.conf".
|
||||
*
|
||||
* The format of this file is fairly simple: three types of comments are supported:
|
||||
* - All text after a '#' on a line is ignored, as in shell scripting
|
||||
@@ -53,7 +53,7 @@
|
||||
* included to indicate whether an option is required:
|
||||
*
|
||||
* [REQUIRED]
|
||||
* Indicates a directive which must be given. Without it, Services will
|
||||
* Indicates a directive which must be given. Without it, Anope will
|
||||
* not start.
|
||||
*
|
||||
* [RECOMMENDED]
|
||||
@@ -71,7 +71,7 @@
|
||||
*
|
||||
* [DEPRECATED]
|
||||
* Indicates a directive which will disappear in a future version of
|
||||
* Services, usually because its functionality has been either
|
||||
* Anope, usually because its functionality has been either
|
||||
* superseded by that of other directives or incorporated into the main
|
||||
* program.
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ define
|
||||
#include
|
||||
{
|
||||
type = "executable"
|
||||
name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/services.conf"
|
||||
name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/anope.conf"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -120,7 +120,7 @@ define
|
||||
* This section can be included multiple times, and Anope will attempt to
|
||||
* connect to each server until it finally connects.
|
||||
*
|
||||
* Each uplink IRCd should have a corresponding configuration to allow Services
|
||||
* Each uplink IRCd should have a corresponding configuration to allow Anope
|
||||
* to link to it.
|
||||
*
|
||||
* An example configuration for InspIRCd that is compatible with the below uplink
|
||||
@@ -161,20 +161,22 @@ define
|
||||
uplink
|
||||
{
|
||||
/*
|
||||
* The IP or hostname of the IRC server you wish to connect Services to.
|
||||
* Usually, you will want to connect Services over 127.0.0.1 (aka localhost).
|
||||
* The IP address, hostname, or UNIX socket path of the IRC server you wish
|
||||
* to connect Anope to.
|
||||
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
|
||||
*
|
||||
* NOTE: On some shell providers, this will not be an option.
|
||||
*/
|
||||
host = "127.0.0.1"
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using IPv6.
|
||||
* The protocol that Anope should use when connecting to the uplink. Can
|
||||
* be set to "ipv4" (the default), "ipv6", or "unix".
|
||||
*/
|
||||
ipv6 = no
|
||||
protocol = "ipv4"
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using SSL.
|
||||
* Enable if Anope should connect using SSL.
|
||||
* You must have an SSL module loaded for this to work.
|
||||
*/
|
||||
ssl = no
|
||||
@@ -200,12 +202,12 @@ uplink
|
||||
/*
|
||||
* [REQUIRED] Server Information
|
||||
*
|
||||
* This section contains information about the Services server.
|
||||
* This section contains information about the services server.
|
||||
*/
|
||||
serverinfo
|
||||
{
|
||||
/*
|
||||
* The hostname that Services will be seen as, it must have no conflicts with any
|
||||
* The hostname that Anope will be seen as, it must have no conflicts with any
|
||||
* other server names on the rest of your IRC network. Note that it does not have
|
||||
* to be an existing hostname, just one that isn't on your network already.
|
||||
*/
|
||||
@@ -215,11 +217,11 @@ serverinfo
|
||||
* The text which should appear as the server's information in /WHOIS and similar
|
||||
* queries.
|
||||
*/
|
||||
description = "Services for IRC Networks"
|
||||
description = "Anope IRC Services"
|
||||
|
||||
/*
|
||||
* The local address that Services will bind to before connecting to the remote
|
||||
* server. This may be useful for multihomed hosts. If omitted, Services will let
|
||||
* The local address that Anope will bind to before connecting to the remote
|
||||
* server. This may be useful for multihomed hosts. If omitted, Anope will let
|
||||
* the Operating System choose the local address. This directive is optional.
|
||||
*
|
||||
* If you don't know what this means or don't need to use it, just leave this
|
||||
@@ -235,16 +237,16 @@ serverinfo
|
||||
#id = "00A"
|
||||
|
||||
/*
|
||||
* The filename containing the Services process ID. The path is relative to the
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
*/
|
||||
pid = "data/services.pid"
|
||||
pid = "data/anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
*/
|
||||
motd = "conf/services.motd"
|
||||
motd = "conf/motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -255,20 +257,17 @@ serverinfo
|
||||
*
|
||||
* Supported:
|
||||
* - bahamut
|
||||
* - charybdis
|
||||
* - hybrid
|
||||
* - inspircd12
|
||||
* - inspircd20
|
||||
* - inspircd3
|
||||
* - inspircd
|
||||
* - ngircd
|
||||
* - plexus
|
||||
* - ratbox
|
||||
* - unreal (for 3.2.x)
|
||||
* - unreal4 (for 4.x or later)
|
||||
* - solanum
|
||||
* - unrealircd
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "inspircd3"
|
||||
name = "inspircd"
|
||||
|
||||
/*
|
||||
* Some protocol modules can enforce mode locks server-side. This reduces the spam caused by
|
||||
@@ -290,48 +289,49 @@ module
|
||||
/*
|
||||
* [REQUIRED] Network Information
|
||||
*
|
||||
* This section contains information about the IRC network that Services will be
|
||||
* This section contains information about the IRC network that Anope will be
|
||||
* connecting to.
|
||||
*/
|
||||
networkinfo
|
||||
{
|
||||
/*
|
||||
* This is the name of the network that Services will be running on.
|
||||
* This is the name of the network that Anope will be running on.
|
||||
*/
|
||||
networkname = "LocalNet"
|
||||
|
||||
/*
|
||||
* Set this to the maximum allowed nick length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 31.
|
||||
*/
|
||||
nicklen = 31
|
||||
#nicklen = 31
|
||||
|
||||
/* Set this to the maximum allowed ident length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 10.
|
||||
*/
|
||||
userlen = 10
|
||||
#userlen = 10
|
||||
|
||||
/* Set this to the maximum allowed hostname length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 64.
|
||||
*/
|
||||
hostlen = 64
|
||||
#hostlen = 64
|
||||
|
||||
/* Set this to the maximum allowed channel length on your network.
|
||||
* Defaults to 32.
|
||||
*/
|
||||
chanlen = 32
|
||||
#chanlen = 32
|
||||
|
||||
/* The maximum number of list modes settable on a channel (such as b, e, I).
|
||||
* Comment out or set to 0 to disable.
|
||||
* Set to 0 to disable. Defaults to 100.
|
||||
*/
|
||||
modelistsize = 100
|
||||
#modelistsize = 100
|
||||
|
||||
/*
|
||||
* Characters allowed in nicknames. This always includes the characters described
|
||||
* in RFC1459, and so does not need to be set for normal behavior. Changing this to
|
||||
* include characters your IRCd doesn't support will cause your IRCd and/or Services
|
||||
* include characters your IRCd doesn't support will cause your IRCd and/or Anope
|
||||
* to break. Multibyte characters are not supported, nor are escape sequences.
|
||||
*
|
||||
* It is recommended you DON'T change this.
|
||||
@@ -343,7 +343,7 @@ networkinfo
|
||||
* to services, such as BotServ bot hostnames and user vhosts. Changing this is not
|
||||
* recommended unless you know for sure your IRCd supports whatever characters you are
|
||||
* wanting to use. Telling services to set a vHost containing characters your IRCd
|
||||
* disallows could potentially break the IRCd and/or Services.
|
||||
* disallows could potentially break the IRCd and/or Anope.
|
||||
*
|
||||
* It is recommended you DON'T change this.
|
||||
*/
|
||||
@@ -368,22 +368,22 @@ networkinfo
|
||||
}
|
||||
|
||||
/*
|
||||
* [REQUIRED] Services Options
|
||||
* [REQUIRED] Anope Options
|
||||
*
|
||||
* This section contains various options which determine how Services will operate.
|
||||
* This section contains various options which determine how Anope will operate.
|
||||
*/
|
||||
options
|
||||
{
|
||||
/*
|
||||
* On Linux/UNIX systems Anope can setuid and setgid to this user and group
|
||||
* after starting up. This is useful if Anope has to bind to privileged ports
|
||||
* after starting up. This is useful if Anope has to bind to privileged ports.
|
||||
*/
|
||||
#user = "anope"
|
||||
#group = "anope"
|
||||
|
||||
/*
|
||||
* The case mapping used by services. This must be set to a valid locale name
|
||||
* installed on your machine. Services use this case map to compare, with
|
||||
* installed on your machine. Anope uses this case map to compare, with
|
||||
* case insensitivity, things such as nick names, channel names, etc.
|
||||
*
|
||||
* We provide two special casemaps shipped with Anope, ascii and rfc1459.
|
||||
@@ -409,23 +409,11 @@ options
|
||||
#seed = 9866235
|
||||
|
||||
/*
|
||||
* If set, Services will perform more stringent checks on passwords. If this
|
||||
* isn't set, Services will only disallow a password if it is the same as the
|
||||
* entity (nickname name) with which it is associated. When set, however,
|
||||
* Services will also check that the password is at least five
|
||||
* characters long, and in the future will probably check other things
|
||||
* as well.
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
*/
|
||||
strictpasswords = yes
|
||||
|
||||
/*
|
||||
* Sets the number of invalid password tries before Services removes a user
|
||||
* Sets the number of invalid password tries before services removes a user
|
||||
* from the network. If a user enters a number of invalid passwords equal to
|
||||
* the given amount for any Services function or combination of functions
|
||||
* during a single IRC session (subject to badpasstimeout, below), Services
|
||||
* will issues a /KILL for the user. If not given, Services will ignore
|
||||
* the given amount for any services function or combination of functions
|
||||
* during a single IRC session (subject to badpasstimeout, below), services
|
||||
* will issues a /KILL for the user. If not given, services will ignore
|
||||
* failed password attempts (though they will be logged in any case).
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
@@ -467,7 +455,7 @@ options
|
||||
/*
|
||||
* Sets the (maximum) frequency at which the timeout list is checked. This,
|
||||
* combined with readtimeout above, determines how accurately timed events,
|
||||
* such as nick kills, occur; it also determines how much CPU time Services
|
||||
* such as nick kills, occur; it also determines how much CPU time services
|
||||
* will use doing this. Higher values will cause less accurate timing but
|
||||
* less CPU usage.
|
||||
*
|
||||
@@ -480,7 +468,7 @@ options
|
||||
timeoutcheck = 3s
|
||||
|
||||
/*
|
||||
* If set, this will allow users to let Services send PRIVMSGs to them
|
||||
* If set, this will allow users to let services send PRIVMSGs to them
|
||||
* instead of NOTICEs. Also see the "msg" option of nickserv:defaults,
|
||||
* which also toggles the default communication (PRIVMSG or NOTICE) to
|
||||
* use for unregistered users.
|
||||
@@ -493,7 +481,7 @@ options
|
||||
#useprivmsg = yes
|
||||
|
||||
/*
|
||||
* If set, will force Services to only respond to PRIVMSGs addresses to
|
||||
* If set, will force services to only respond to PRIVMSGs addresses to
|
||||
* Nick@ServerName - e.g. NickServ@example.com. This should be used in
|
||||
* conjunction with IRCd aliases. This directive is optional.
|
||||
*
|
||||
@@ -502,14 +490,14 @@ options
|
||||
#usestrictprivmsg = yes
|
||||
|
||||
/*
|
||||
* If set, Services will only show /stats o to IRC Operators. This directive
|
||||
* If set, Anope will only show /stats o to IRC Operators. This directive
|
||||
* is optional.
|
||||
*/
|
||||
#hidestatso = yes
|
||||
|
||||
/*
|
||||
* A space-separated list of U-lined servers on your network, it is assumed that
|
||||
* the servers in this list are allowed to set channel modes and Services will
|
||||
* the servers in this list are allowed to set channel modes and Anope will
|
||||
* not attempt to reverse their mode changes.
|
||||
*
|
||||
* WARNING: Do NOT put your normal IRC user servers in this directive.
|
||||
@@ -524,23 +512,29 @@ options
|
||||
retrywait = 60s
|
||||
|
||||
/*
|
||||
* If set, Services will hide commands that users don't have the privilege to execute
|
||||
* If set, services will hide commands that users don't have the privilege to execute
|
||||
* from HELP output.
|
||||
*/
|
||||
hideprivilegedcommands = yes
|
||||
|
||||
/*
|
||||
* If set, Services will hide commands that users can't execute because they are not
|
||||
* If set, services will hide commands that users can't execute because they are not
|
||||
* logged in from HELP output.
|
||||
*/
|
||||
hideregisteredcommands = yes
|
||||
|
||||
/*
|
||||
* If set, the maximum difference between an invalid and valid command name to allow
|
||||
* as a suggestion. Defaults to 4.
|
||||
*/
|
||||
didyoumeandifference = 4
|
||||
|
||||
/* The regex engine to use, as provided by the regex modules.
|
||||
* Leave commented to disable regex matching.
|
||||
*
|
||||
* Note for this to work the regex module providing the regex engine must be loaded.
|
||||
*/
|
||||
#regexengine = "regex/pcre"
|
||||
#regexengine = "regex/stdlib"
|
||||
|
||||
/*
|
||||
* A list of languages to load on startup that will be available in /NICKSERV SET LANGUAGE.
|
||||
@@ -748,7 +742,7 @@ log
|
||||
{
|
||||
bot = "Global"
|
||||
target = "globops"
|
||||
admin = "global/* operserv/chankill operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/oline operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop"
|
||||
admin = "global/* operserv/chankill operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop"
|
||||
servers = "squit"
|
||||
users = "oper"
|
||||
other = "expire/* bados akill/*"
|
||||
@@ -761,7 +755,6 @@ log
|
||||
* You may define groups of commands and privileges, as well as who may use them.
|
||||
*
|
||||
* This block is recommended, as without it you will be unable to access most oper commands.
|
||||
* It replaces the old ServicesRoot directive amongst others.
|
||||
*
|
||||
* The command names below are defaults and are configured in the *serv.conf's. If you configure
|
||||
* additional commands with permissions, such as commands from third party modules, the permissions
|
||||
@@ -779,15 +772,15 @@ log
|
||||
* memoserv/info - Can see any information with /MEMOSERV INFO
|
||||
* memoserv/set-limit - Can set the limit of max stored memos on any user and channel
|
||||
* memoserv/no-limit - Can send memos through limits and throttles
|
||||
* nickserv/access - Can modify other users access and certificate lists
|
||||
* nickserv/alist - Can see the channel access list of other users
|
||||
* nickserv/auspex - Can see any information with /NICKSERV INFO
|
||||
* nickserv/cert - Can modify other users certificate lists
|
||||
* nickserv/confirm - Can confirm other users nicknames
|
||||
* nickserv/drop - Can drop other users nicks
|
||||
* nickserv/recover - Can recover other users nicks
|
||||
* operserv/config - Can modify services's configuration
|
||||
* operserv/oper/modify - Can add and remove operators with at most the same privileges
|
||||
* protected - Can not be kicked from channels by Services
|
||||
* protected - Can not be kicked from channels by services
|
||||
*
|
||||
* Available commands:
|
||||
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private
|
||||
@@ -800,13 +793,12 @@ log
|
||||
*
|
||||
* memoserv/sendall memoserv/staff
|
||||
*
|
||||
* nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin
|
||||
* nickserv/list
|
||||
* nickserv/getemail nickserv/suspend nickserv/ajoin nickserv/list
|
||||
*
|
||||
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
|
||||
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
|
||||
* nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire
|
||||
* nickserv/saset/keepmodes
|
||||
* nickserv/saset/autoop nickserv/saset/display nickserv/saset/email nickserv/saset/greet
|
||||
* nickserv/saset/kill nickserv/saset/keepmodes nickserv/saset/language nickserv/saset/message
|
||||
* nickserv/saset/neverop nickserv/saset/noexpire nickserv/saset/password nickserv/saset/private
|
||||
* nickserv/saset/url
|
||||
*
|
||||
* hostserv/set hostserv/del hostserv/list
|
||||
*
|
||||
@@ -818,7 +810,7 @@ log
|
||||
* operserv/oper operserv/config operserv/umode operserv/logsearch
|
||||
* operserv/modload operserv/jupe operserv/set operserv/noop
|
||||
* operserv/quit operserv/update operserv/reload operserv/restart
|
||||
* operserv/shutdown operserv/svs operserv/oline operserv/kill
|
||||
* operserv/shutdown operserv/svs operserv/kill
|
||||
*
|
||||
* Firstly, we define 'opertypes' which are named whatever we want ('Network Administrator', etc).
|
||||
* These can contain commands for oper-only strings (see above) which grants access to that specific command,
|
||||
@@ -872,7 +864,7 @@ opertype
|
||||
|
||||
inherits = "Services Operator"
|
||||
|
||||
commands = "botserv/* chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/oline operserv/noop operserv/forbid global/*"
|
||||
commands = "botserv/* chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/noop operserv/forbid global/*"
|
||||
|
||||
privs = "*"
|
||||
}
|
||||
@@ -890,10 +882,10 @@ opertype
|
||||
* After defining different types of operators in the above opertype section, we now define who is in these groups
|
||||
* through 'oper' blocks, similar to ircd access.
|
||||
*
|
||||
* The default is to comment these out (so NOBODY will have Services access).
|
||||
* The default is to comment these out (so NOBODY will have access).
|
||||
* You probably want to add yourself and a few other people at minimum.
|
||||
*
|
||||
* As with all permissions, make sure to only give trustworthy people access to Services.
|
||||
* As with all permissions, make sure to only give trustworthy people access.
|
||||
*/
|
||||
|
||||
#oper
|
||||
@@ -904,7 +896,7 @@ opertype
|
||||
/* The opertype this person will have */
|
||||
type = "Services Root"
|
||||
|
||||
/* If set, the user must be an oper on the IRCd to gain their Services
|
||||
/* If set, the user must be an oper on the IRCd to gain their
|
||||
* oper privileges.
|
||||
*/
|
||||
require_oper = yes
|
||||
@@ -939,7 +931,7 @@ opertype
|
||||
/*
|
||||
* [OPTIONAL] Mail Config
|
||||
*
|
||||
* This section contains settings related to the use of e-mail from Services.
|
||||
* This section contains settings related to the use of e-mail from services.
|
||||
* If the usemail directive is set to yes, unless specified otherwise, all other
|
||||
* directives are required.
|
||||
*
|
||||
@@ -950,7 +942,7 @@ opertype
|
||||
mail
|
||||
{
|
||||
/*
|
||||
* If set, this option enables the mail commands in Services. You may choose
|
||||
* If set, this option enables the mail commands in Anope. You may choose
|
||||
* to disable it if you have no Sendmail-compatible mailer installed. Whilst
|
||||
* this directive (and entire block) is optional, it is required if
|
||||
* nickserv:registration is set to yes.
|
||||
@@ -967,6 +959,9 @@ mail
|
||||
* it. This one usually needs no parameters on the command-line. Most
|
||||
* sendmail applications (or replacements of it) require the -t option
|
||||
* to be used.
|
||||
*
|
||||
* If you are running on Windows you should use a Windows sendmail port
|
||||
* like https://www.glob.com.au/sendmail/ for sending emails.
|
||||
*/
|
||||
sendmailpath = "/usr/sbin/sendmail -t"
|
||||
|
||||
@@ -981,7 +976,7 @@ mail
|
||||
* another e-mail after they have sent one. It also controls the minimum time
|
||||
* a user must wait before they can receive another e-mail.
|
||||
*
|
||||
* This feature prevents users from being mail bombed using Services and
|
||||
* This feature prevents users from being mail bombed using services and
|
||||
* it is highly recommended that it be used.
|
||||
*
|
||||
* This directive is optional, but highly recommended.
|
||||
@@ -989,7 +984,7 @@ mail
|
||||
delay = 5m
|
||||
|
||||
/*
|
||||
* If set, Services will not attempt to put quotes around the TO: fields
|
||||
* If set, Anope will not put quotes around the TO: fields
|
||||
* in e-mails.
|
||||
*
|
||||
* This directive is optional, and as far as we know, it's only needed
|
||||
@@ -1126,18 +1121,18 @@ module
|
||||
|
||||
/*
|
||||
* Sets the number of days backups of databases are kept. If you don't give it,
|
||||
* or if you set it to 0, Services won't backup the databases.
|
||||
* or if you set it to 0, Anope won't backup the databases.
|
||||
*
|
||||
* NOTE: Services must run 24 hours a day for this feature to work.
|
||||
* NOTE: Anope must run 24 hours a day for this feature to work.
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
*/
|
||||
keepbackups = 3
|
||||
|
||||
/*
|
||||
* Allows Services to continue file write operations (i.e. database saving)
|
||||
* Allows Anope to continue file write operations (i.e. database saving)
|
||||
* even if the original file cannot be backed up. Enabling this option may
|
||||
* allow Services to continue operation under conditions where it might
|
||||
* allow Anope to continue operation under conditions where it might
|
||||
* otherwise fail, such as a nearly-full disk.
|
||||
*
|
||||
* NOTE: Enabling this option can cause irrecoverable data loss under some
|
||||
@@ -1210,7 +1205,7 @@ module
|
||||
* db_redis.
|
||||
*
|
||||
* This module allows using Redis (https://redis.io/) as a database backend.
|
||||
* This module requires that m_redis is loaded and configured properly.
|
||||
* This module requires that redis is loaded and configured properly.
|
||||
*
|
||||
* Redis 2.8 supports keyspace notifications which allows Redis to push notifications
|
||||
* to Anope about outside modifications to the database. This module supports this and
|
||||
@@ -1222,7 +1217,7 @@ module
|
||||
name = "db_redis"
|
||||
|
||||
/*
|
||||
* Redis database to use. This must be configured with m_redis.
|
||||
* Redis database to use. This must be configured with redis.
|
||||
*/
|
||||
engine = "redis/main"
|
||||
}
|
||||
@@ -1236,7 +1231,7 @@ module
|
||||
*
|
||||
* Without any encryption modules loaded users will not be able to authenticate unless
|
||||
* there is another module loaded that provides authentication checking, such as
|
||||
* m_ldap_authentication or m_sql_authentication.
|
||||
* ldap_authentication or sql_authentication.
|
||||
*
|
||||
* With enc_none, passwords will be stored in plain text, allowing for passwords
|
||||
* to be recovered later but it isn't secure and therefore is not recommended.
|
||||
@@ -1257,14 +1252,13 @@ module
|
||||
#module { name = "enc_bcrypt" }
|
||||
module { name = "enc_sha256" }
|
||||
|
||||
/*
|
||||
* When using enc_none, passwords will be stored without encryption. This isn't secure
|
||||
* therefore it is not recommended.
|
||||
*/
|
||||
#module { name = "enc_none" }
|
||||
|
||||
/* Deprecated encryption modules */
|
||||
/*
|
||||
* [DEPRECATED] Deprecated encryption modules. You can only use these for compatibility with
|
||||
* old databases and will need to load one of the above modules as your primary encryption
|
||||
* module.
|
||||
*/
|
||||
#module { name = "enc_md5" }
|
||||
#module { name = "enc_none" }
|
||||
#module { name = "enc_sha1" }
|
||||
|
||||
/*
|
||||
@@ -323,6 +323,7 @@ command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/
|
||||
privilege
|
||||
{
|
||||
name = "GREET"
|
||||
desc = _("Greet message displayed on join")
|
||||
rank = 40
|
||||
level = 5
|
||||
flag = "g"
|
||||
|
||||
@@ -76,8 +76,6 @@ module
|
||||
* access level or superior
|
||||
* - cs_private: Hide the channel from ChanServ's LIST command
|
||||
* - restricted: Kick/ban users who are restricted from the channel
|
||||
* - cs_secure: Enable channel security, requiring the user to be identified with NickServ in
|
||||
* order to be considered for being on the access list of the channel
|
||||
* - secureops: Only allow operator status to be given if the user is on the access list
|
||||
* - securefounder: Only allow the real founder of the channel to drop the channel, change its
|
||||
* password, or change the founder or successor
|
||||
@@ -93,10 +91,10 @@ module
|
||||
* to be a registered nick, otherwise the channel will be dropped.
|
||||
* - none: No defaults
|
||||
*
|
||||
* This directive is optional, if left blank, the options will default to keeptopic, peace, cs_secure,
|
||||
* This directive is optional, if left blank, the options will default to keeptopic, peace,
|
||||
* securefounder, and signkick. If you really want no defaults, use "none" by itself as the option.
|
||||
*/
|
||||
defaults = "keeptopic peace cs_secure securefounder signkick"
|
||||
defaults = "keeptopic peace securefounder signkick"
|
||||
|
||||
/*
|
||||
* The maximum number of channels which may be registered to a single nickname.
|
||||
@@ -110,9 +108,9 @@ module
|
||||
* The length of time before a channel registration expires.
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
* If not set, the default is 14 days.
|
||||
* If not set, the default is 30 days.
|
||||
*/
|
||||
expire = 14d
|
||||
expire = 30d
|
||||
|
||||
/*
|
||||
* The maximum number of entries on a channel's access list.
|
||||
@@ -216,6 +214,7 @@ module
|
||||
privilege
|
||||
{
|
||||
name = "ACCESS_CHANGE"
|
||||
desc = _("Allowed to modify the access list")
|
||||
rank = 0
|
||||
level = 10
|
||||
flag = "f"
|
||||
@@ -232,6 +231,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "ACCESS_LIST"
|
||||
desc = _("Allowed to view the access list")
|
||||
rank = 10
|
||||
level = 3
|
||||
flag = "f"
|
||||
@@ -248,6 +248,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AKICK"
|
||||
desc = _("Allowed to use the AKICK command")
|
||||
rank = 250
|
||||
level = 10
|
||||
flag = "K"
|
||||
@@ -264,6 +265,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "ASSIGN"
|
||||
desc = _("Allowed to assign/unassign a bot")
|
||||
rank = 270
|
||||
level = "founder"
|
||||
flag = "s"
|
||||
@@ -280,6 +282,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AUTOHALFOP"
|
||||
desc = _("Automatic halfop upon join")
|
||||
rank = 100
|
||||
level = 4
|
||||
flag = "H"
|
||||
@@ -296,6 +299,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AUTOOP"
|
||||
desc = _("Automatic channel operator status upon join")
|
||||
rank = 210
|
||||
level = 5
|
||||
flag = "O"
|
||||
@@ -312,6 +316,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AUTOOWNER"
|
||||
desc = _("Automatic owner upon join")
|
||||
rank = 330
|
||||
level = 9999
|
||||
flag = "Q"
|
||||
@@ -328,6 +333,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AUTOPROTECT"
|
||||
desc = _("Automatic protect upon join")
|
||||
rank = 240
|
||||
level = 10
|
||||
flag = "A"
|
||||
@@ -344,6 +350,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "AUTOVOICE"
|
||||
desc = _("Automatic voice on join")
|
||||
rank = 50
|
||||
level = 3
|
||||
flag = "V"
|
||||
@@ -360,6 +367,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "BADWORDS"
|
||||
desc = _("Allowed to modify channel badwords list")
|
||||
rank = 260
|
||||
level = 10
|
||||
flag = "K"
|
||||
@@ -376,6 +384,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "BAN"
|
||||
desc = _("Allowed to ban users")
|
||||
rank = 150
|
||||
level = 4
|
||||
flag = "b"
|
||||
@@ -392,6 +401,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "FANTASIA"
|
||||
desc = _("Allowed to use fantasy commands")
|
||||
rank = 30
|
||||
level = 3
|
||||
flag = "c"
|
||||
@@ -411,6 +421,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "FOUNDER"
|
||||
desc = _("Allowed to issue commands restricted to channel founders")
|
||||
rank = 360
|
||||
level = 10000
|
||||
flag = "F"
|
||||
@@ -428,6 +439,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "GETKEY"
|
||||
desc = _("Allowed to use GETKEY command")
|
||||
rank = 180
|
||||
level = 5
|
||||
flag = "G"
|
||||
@@ -445,6 +457,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "HALFOP"
|
||||
desc = _("Allowed to (de)halfop users")
|
||||
rank = 120
|
||||
level = 5
|
||||
flag = "h"
|
||||
@@ -462,6 +475,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "HALFOPME"
|
||||
desc = _("Allowed to (de)halfop themself")
|
||||
rank = 110
|
||||
level = 4
|
||||
flag = "h"
|
||||
@@ -479,6 +493,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "INFO"
|
||||
desc = _("Allowed to get full INFO output")
|
||||
rank = 80
|
||||
level = 9999
|
||||
flag = "I"
|
||||
@@ -496,6 +511,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "INVITE"
|
||||
desc = _("Allowed to use the INVITE command")
|
||||
rank = 190
|
||||
level = 5
|
||||
flag = "i"
|
||||
@@ -512,6 +528,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "KICK"
|
||||
desc = _("Allowed to use the KICK command")
|
||||
rank = 130
|
||||
level = 4
|
||||
flag = "k"
|
||||
@@ -529,6 +546,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "MEMO"
|
||||
desc = _("Allowed to read channel memos")
|
||||
rank = 280
|
||||
level = 10
|
||||
flag = "m"
|
||||
@@ -546,6 +564,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "MODE"
|
||||
desc = _("Allowed to use the MODE command")
|
||||
rank = 170
|
||||
level = 9999
|
||||
flag = "s"
|
||||
@@ -562,6 +581,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "NOKICK"
|
||||
desc = _("Prevents users being kicked by services")
|
||||
rank = 20
|
||||
level = 1
|
||||
flag = "N"
|
||||
@@ -579,6 +599,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "OP"
|
||||
desc = _("Allowed to (de)op users")
|
||||
rank = 230
|
||||
level = 5
|
||||
flag = "o"
|
||||
@@ -596,6 +617,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "OPME"
|
||||
desc = _("Allowed to (de)op themself")
|
||||
rank = 220
|
||||
level = 5
|
||||
flag = "o"
|
||||
@@ -613,6 +635,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "OWNER"
|
||||
desc = _("Allowed to (de)owner users")
|
||||
rank = 350
|
||||
level = "founder"
|
||||
flag = "q"
|
||||
@@ -630,6 +653,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "OWNERME"
|
||||
desc = _("Allowed to (de)owner themself")
|
||||
rank = 340
|
||||
level = 9999
|
||||
flag = "q"
|
||||
@@ -647,6 +671,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "PROTECT"
|
||||
desc = _("Allowed to (de)protect users")
|
||||
rank = 310
|
||||
level = 9999
|
||||
flag = "a"
|
||||
@@ -664,6 +689,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "PROTECTME"
|
||||
desc = _("Allowed to (de)protect themself")
|
||||
rank = 300
|
||||
level = 10
|
||||
flag = "a"
|
||||
@@ -681,6 +707,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "SAY"
|
||||
desc = _("Allowed to use SAY and ACT commands")
|
||||
rank = 90
|
||||
level = 5
|
||||
flag = "B"
|
||||
@@ -700,6 +727,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "SET"
|
||||
desc = _("Allowed to set channel settings")
|
||||
rank = 320
|
||||
level = 9999
|
||||
flag = "s"
|
||||
@@ -717,6 +745,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "SIGNKICK"
|
||||
desc = _("No signed kick when SIGNKICK LEVEL is used")
|
||||
rank = 140
|
||||
level = 9999
|
||||
flag = "K"
|
||||
@@ -733,6 +762,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "TOPIC"
|
||||
desc = _("Allowed to change channel topics")
|
||||
rank = 160
|
||||
level = 5
|
||||
flag = "t"
|
||||
@@ -749,12 +779,30 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "UNBAN"
|
||||
desc = _("Allowed to unban users")
|
||||
rank = 200
|
||||
level = 4
|
||||
flag = "u"
|
||||
xop = "HOP"
|
||||
}
|
||||
|
||||
/*
|
||||
* UNBANME privilege.
|
||||
*
|
||||
* Used by chanserv/unban.
|
||||
*
|
||||
* Users with this permission can unban themself through ChanServ.
|
||||
*/
|
||||
privilege
|
||||
{
|
||||
name = "UNBANME"
|
||||
desc = _("Allowed to unban themself")
|
||||
rank = 200
|
||||
level = 4
|
||||
flag = "U"
|
||||
xop = "HOP"
|
||||
}
|
||||
|
||||
/*
|
||||
* VOICE privilege.
|
||||
*
|
||||
@@ -766,6 +814,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "VOICE"
|
||||
desc = _("Allowed to (de)voice users")
|
||||
rank = 70
|
||||
level = 4
|
||||
flag = "v"
|
||||
@@ -783,6 +832,7 @@ privilege
|
||||
privilege
|
||||
{
|
||||
name = "VOICEME"
|
||||
desc = _("Allowed to (de)voice themself")
|
||||
rank = 60
|
||||
level = 3
|
||||
flag = "v"
|
||||
@@ -1209,6 +1259,7 @@ command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc
|
||||
*/
|
||||
module { name = "cs_status" }
|
||||
command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; }
|
||||
command { service = "ChanServ"; name = "WHY"; command = "chanserv/status"; hide = true; }
|
||||
|
||||
/*
|
||||
* cs_suspend
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
module
|
||||
{
|
||||
name = "m_chanstats"
|
||||
name = "chanstats"
|
||||
|
||||
/*
|
||||
* The name of this engine.
|
||||
|
||||
+4
-4
@@ -9,16 +9,16 @@
|
||||
###############################################################
|
||||
|
||||
# Anope binary directory
|
||||
ANOPATH=/home/ircd/services/bin
|
||||
ANOPATH=/home/ircd/anope/bin
|
||||
|
||||
# Anope data directory
|
||||
ANODATA=/home/ircd/services/data
|
||||
ANODATA=/home/ircd/anope/data
|
||||
|
||||
# Name of the pid file
|
||||
ANOPIDF=services.pid
|
||||
ANOPIDF=anope.pid
|
||||
|
||||
# Name of the executable
|
||||
ANOPROG=services
|
||||
ANOPROG=anope
|
||||
|
||||
# Parameters to pass to the executable
|
||||
ANOARGS=""
|
||||
|
||||
@@ -66,7 +66,7 @@ module
|
||||
client = "Global"
|
||||
|
||||
/*
|
||||
* This is the global message that will be sent when Services are being
|
||||
* This is the global message that will be sent when Anope is being
|
||||
* shutdown/restarted.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -74,7 +74,7 @@ module
|
||||
#globaloncycledown = "Services are restarting, they will be back shortly - please be good while they're gone"
|
||||
|
||||
/*
|
||||
* This is the global message that will be sent when Services (re)join the
|
||||
* This is the global message that will be sent when Anope (re)joins the
|
||||
* network.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -82,7 +82,7 @@ module
|
||||
#globaloncycleup = "Services are now back online - have a nice day"
|
||||
|
||||
/*
|
||||
* If set, Services will hide the IRC Operator's nick in a global
|
||||
* If set, Anope will hide the IRC Operator's nick in a global
|
||||
* message/notice.
|
||||
*
|
||||
* This directive is optional.
|
||||
|
||||
@@ -110,12 +110,12 @@ module
|
||||
/*
|
||||
* Upon nickserv/group, this option syncs the nick's main vHost to the grouped nick.
|
||||
*/
|
||||
syncongroup = false
|
||||
syncongroup = true
|
||||
|
||||
/*
|
||||
* This makes vhosts act as if they are per account.
|
||||
*/
|
||||
synconset = false
|
||||
synconset = true
|
||||
}
|
||||
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
|
||||
|
||||
@@ -161,13 +161,13 @@ module
|
||||
name = "hs_request"
|
||||
|
||||
/*
|
||||
* If set, Services will send a memo to the user requesting a vHost when it's been
|
||||
* If set, Anope will send a memo to the user requesting a vHost when it's been
|
||||
* approved or rejected.
|
||||
*/
|
||||
#memouser = yes
|
||||
|
||||
/*
|
||||
* If set, Services will send a memo to all Services staff when a new vHost is requested.
|
||||
* If set, Anope will send a memo to all services staff when a new vHost is requested.
|
||||
*/
|
||||
#memooper = yes
|
||||
}
|
||||
|
||||
+105
-90
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* The following blocks are used to load all non-core modules, including 3rd-party modules.
|
||||
* Modules can be prevented from loading by commenting out the line, other modules can be added by
|
||||
* adding a module block. These modules will be loaded prior to Services connecting to your network.
|
||||
* adding a module block. These modules will be loaded prior to Anope connecting to your network.
|
||||
*
|
||||
* Note that some of these modules are labeled EXTRA, and must be enabled prior to compiling by
|
||||
* running the 'extras' script on Linux and UNIX.
|
||||
@@ -19,14 +19,14 @@
|
||||
module { name = "help" }
|
||||
|
||||
/*
|
||||
* m_dns
|
||||
* dns
|
||||
*
|
||||
* Adds support for the DNS protocol. By itself this module does nothing useful,
|
||||
* but other modules such as m_dnsbl and os_dns require this.
|
||||
* but other modules such as dnsbl and os_dns require this.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_dns"
|
||||
name = "dns"
|
||||
|
||||
/*
|
||||
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
|
||||
@@ -80,7 +80,7 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_dnsbl
|
||||
* dnsbl
|
||||
*
|
||||
* Allows configurable DNS blacklists to check connecting users against. If a user
|
||||
* is found on the blacklist they will be immediately banned. This is a crucial module
|
||||
@@ -88,17 +88,17 @@ module { name = "help" }
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_dnsbl"
|
||||
name = "dnsbl"
|
||||
|
||||
/*
|
||||
* If set, Services will check clients against the DNSBLs when services connect to its uplink.
|
||||
* If set, Anope will check clients against the DNSBLs when services connect to its uplink.
|
||||
* This is not recommended, and on large networks will open a very large amount of DNS queries.
|
||||
* Whilst services are not drastically affected by this, your nameserver/DNSBL might care.
|
||||
*/
|
||||
check_on_connect = no
|
||||
|
||||
/*
|
||||
* If set, Services will check clients when coming back from a netsplit. This can cause a large number
|
||||
* If set, Anope will check clients when coming back from a netsplit. This can cause a large number
|
||||
* of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL
|
||||
* might care.
|
||||
*/
|
||||
@@ -179,19 +179,19 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_helpchan
|
||||
* helpchan
|
||||
*
|
||||
* Gives users who are op in the specified help channel usermode +h (helpop).
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_helpchan"
|
||||
name = "helpchan"
|
||||
|
||||
helpchannel = "#help"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_httpd
|
||||
* httpd
|
||||
*
|
||||
* Allows services to serve web pages. By itself, this module does nothing useful.
|
||||
*
|
||||
@@ -200,7 +200,7 @@ module { name = "help" }
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_httpd"
|
||||
name = "httpd"
|
||||
|
||||
httpd
|
||||
{
|
||||
@@ -233,13 +233,13 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ldap [EXTRA]
|
||||
* ldap [EXTRA]
|
||||
*
|
||||
* This module allows other modules to use LDAP. By itself, this module does nothing useful.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ldap"
|
||||
name = "ldap"
|
||||
|
||||
ldap
|
||||
{
|
||||
@@ -254,14 +254,14 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ldap_authentication [EXTRA]
|
||||
* ldap_authentication [EXTRA]
|
||||
*
|
||||
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
|
||||
* LDAP to authenticate users. Requires m_ldap.
|
||||
* LDAP to authenticate users. Requires ldap.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ldap_authentication"
|
||||
name = "ldap_authentication"
|
||||
|
||||
/*
|
||||
* The distinguished name used for searching for users's accounts.
|
||||
@@ -314,16 +314,16 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ldap_oper [EXTRA]
|
||||
* ldap_oper [EXTRA]
|
||||
*
|
||||
* This module dynamically ties users to Anope opertypes when they identify
|
||||
* via LDAP group membership. Requires m_ldap.
|
||||
* via LDAP group membership. Requires ldap.
|
||||
*
|
||||
* Note that this doesn't give the user privileges on the IRCd, only in Services.
|
||||
* Note that this doesn't give the user privileges on the IRCd, only in Anope.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ldap_oper"
|
||||
name = "ldap_oper"
|
||||
|
||||
/*
|
||||
* An optional binddn to use when searching for groups.
|
||||
@@ -355,13 +355,13 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_mysql [EXTRA]
|
||||
* mysql [EXTRA]
|
||||
*
|
||||
* This module allows other modules to use MySQL.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_mysql"
|
||||
name = "mysql"
|
||||
|
||||
mysql
|
||||
{
|
||||
@@ -376,13 +376,13 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_redis
|
||||
* redis
|
||||
*
|
||||
* This module allows other modules to use Redis.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_redis"
|
||||
name = "redis"
|
||||
|
||||
/* A redis database */
|
||||
redis
|
||||
@@ -401,47 +401,61 @@ 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]
|
||||
* 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" }
|
||||
#module { name = "regex_pcre2" }
|
||||
|
||||
/*
|
||||
* m_regex_posix [EXTRA]
|
||||
* regex_posix [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions.
|
||||
* This is likely the only regex module you will not need extra libraries for.
|
||||
*/
|
||||
#module { name = "m_regex_posix" }
|
||||
#module { name = "regex_posix" }
|
||||
|
||||
/*
|
||||
* m_regex_tre [EXTRA]
|
||||
* regex_stdlib
|
||||
*
|
||||
* Provides the regex engine regex/stdlib, which uses the regular expression library that is part of
|
||||
* the C++ standard library.
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "regex_stdlib"
|
||||
|
||||
/*
|
||||
* The syntax scheme to use. Can be set to awk to use the regular expression grammar used by the
|
||||
* awk utility in POSIX, basic to use the basic POSIX regular expression grammar, ecmascript to
|
||||
* use the modified ECMAScript regular expression grammar, egrep to use the regular expression
|
||||
* grammar used by the grep utility with the -E option in POSIX, extended to use the extended
|
||||
* POSIX regular expression grammar, or grep to use the regular expression grammar used by the
|
||||
* grep utility in POSIX.
|
||||
*
|
||||
* See https://en.cppreference.com/w/cpp/regex/syntax_option_type for more information.
|
||||
*/
|
||||
syntax = "ecmascript"
|
||||
}
|
||||
|
||||
/*
|
||||
* regex_tre [EXTRA]
|
||||
*
|
||||
* Provides the regex engine regex/tre, which uses the TRE regex library.
|
||||
*/
|
||||
#module { name = "m_regex_tre" }
|
||||
#module { name = "regex_tre" }
|
||||
|
||||
/*
|
||||
* m_rewrite
|
||||
* rewrite
|
||||
*
|
||||
* Allows rewriting commands sent to/from clients.
|
||||
*/
|
||||
#module { name = "m_rewrite" }
|
||||
#module { name = "rewrite" }
|
||||
#command
|
||||
{
|
||||
service = "ChanServ"; name = "CLEAR"; command = "rewrite"
|
||||
|
||||
/* Enable m_rewrite. */
|
||||
/* Enable rewrite. */
|
||||
rewrite = true
|
||||
|
||||
/* Source message to match. A $ can be used to match anything. */
|
||||
@@ -462,7 +476,7 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_proxyscan
|
||||
* proxyscan
|
||||
*
|
||||
* This module allows you to scan connecting clients for open proxies.
|
||||
* Note that using this will allow users to get the IP of your services.
|
||||
@@ -476,7 +490,7 @@ module { name = "help" }
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_proxyscan"
|
||||
name = "proxyscan"
|
||||
|
||||
/*
|
||||
* The target IP services tells the proxy to connect back to. This must be a publicly
|
||||
@@ -544,38 +558,38 @@ module { name = "help" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sasl
|
||||
* sasl
|
||||
*
|
||||
* Some IRCds allow "SASL" authentication to let users identify to Services
|
||||
* during the IRCd user registration process. If this module is loaded, Services will allow
|
||||
* Some IRCds allow "SASL" authentication to let users identify to services
|
||||
* during the IRCd user registration process. If this module is loaded, Anope will allow
|
||||
* authenticating users through this mechanism. Supported mechanisms are:
|
||||
* PLAIN, EXTERNAL.
|
||||
*/
|
||||
module { name = "m_sasl" }
|
||||
module { name = "sasl" }
|
||||
|
||||
/*
|
||||
* m_ssl_gnutls [EXTRA]
|
||||
* ssl_gnutls [EXTRA]
|
||||
*
|
||||
* This module provides SSL services to Anope using GnuTLS, for example to
|
||||
* connect to the uplink server(s) via SSL.
|
||||
*
|
||||
* You may only load either m_ssl_gnutls or m_ssl_openssl, but not both.
|
||||
* You may only load either ssl_gnutls or ssl_openssl, but not both.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ssl_gnutls"
|
||||
name = "ssl_gnutls"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for m_ssl_gnutls to give to the uplink.
|
||||
* An optional certificate and key for ssl_gnutls to give to the uplink.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* certtool --generate-privkey --bits 2048 --outfile anope.key
|
||||
* certtool --generate-self-signed --load-privkey anope.key --outfile anope.crt
|
||||
* certtool --generate-privkey --bits 2048 --outfile privkey.pem
|
||||
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
|
||||
*
|
||||
*/
|
||||
cert = "data/anope.crt"
|
||||
key = "data/anope.key"
|
||||
cert = "data/fullchain.pem"
|
||||
key = "data/privkey.pem"
|
||||
|
||||
/*
|
||||
* Diffie-Hellman parameters to use when acting as a server. This is only
|
||||
@@ -592,49 +606,50 @@ module { name = "m_sasl" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_ssl_openssl [EXTRA]
|
||||
* ssl_openssl [EXTRA]
|
||||
*
|
||||
* This module provides SSL services to Anope using OpenSSL, for example to
|
||||
* connect to the uplink server(s) via SSL.
|
||||
*
|
||||
* You may only load either m_ssl_openssl or m_ssl_gnutls, but not both.
|
||||
* You may only load either ssl_openssl or ssl_gnutls, but not both.
|
||||
*
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_ssl_openssl"
|
||||
name = "ssl_openssl"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for m_ssl_openssl to give to the uplink.
|
||||
* An optional certificate and key for ssl_openssl to give to the uplink.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* openssl genrsa -out anope.key 2048
|
||||
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095
|
||||
* openssl genrsa -out privkey.pem 2048
|
||||
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
|
||||
*/
|
||||
cert = "data/anope.crt"
|
||||
key = "data/anope.key"
|
||||
cert = "data/fullchain.pem"
|
||||
key = "data/privkey.pem"
|
||||
|
||||
/*
|
||||
* As of 2014 SSL 3.0 is considered insecure, but it might be enabled
|
||||
* on some systems by default for compatibility reasons.
|
||||
* You can use the following option to enable or disable it explicitly.
|
||||
* Leaving this option not set defaults to the default system behavior.
|
||||
* If you wish to increase security you can disable support for older
|
||||
* versions of TLS with no known vulnerabilities but that provide less
|
||||
* security. For your security SSLv2 and SSLv3 are always disabled.
|
||||
*/
|
||||
#sslv3 = no
|
||||
#tlsv10 = no
|
||||
#tlsv11 = no
|
||||
#tlsv12 = yes
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sql_authentication [EXTRA]
|
||||
* sql_authentication [EXTRA]
|
||||
*
|
||||
* This module allows authenticating users against an external SQL database using a custom
|
||||
* query.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_sql_authentication"
|
||||
name = "sql_authentication"
|
||||
|
||||
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
|
||||
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
|
||||
engine = "mysql/main"
|
||||
|
||||
/* Query to execute to authenticate. A non empty result from this query is considered a success,
|
||||
@@ -676,7 +691,7 @@ module { name = "m_sasl" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sql_log [EXTRA]
|
||||
* sql_log [EXTRA]
|
||||
*
|
||||
* This module adds an additional target option to log{} blocks
|
||||
* that allows logging Service's logs to SQL. To log to SQL, add
|
||||
@@ -693,24 +708,24 @@ module { name = "m_sasl" }
|
||||
* it if it doesn't exist. This module does not create any indexes (keys)
|
||||
* on the table and it is recommended you add them yourself as necessary.
|
||||
*/
|
||||
#module { name = "m_sql_log" }
|
||||
#module { name = "sql_log" }
|
||||
|
||||
/*
|
||||
* m_sql_oper [EXTRA]
|
||||
* sql_oper [EXTRA]
|
||||
*
|
||||
* This module allows granting users services operator privileges and possibly IRC Operator
|
||||
* privileges based on an external SQL database using a custom query.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_sql_oper"
|
||||
name = "sql_oper"
|
||||
|
||||
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
|
||||
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
|
||||
engine = "mysql/main"
|
||||
|
||||
/* Query to execute to determine if a user should have operator privileges.
|
||||
* A field named opertype must be returned in order to link the user to their oper type.
|
||||
* The oper types must be configured earlier in services.conf.
|
||||
* The oper types must be configured earlier in anope.conf.
|
||||
*
|
||||
* If a field named modes is returned from this query then those modes are set on the user.
|
||||
* Without this, only a simple +o is sent.
|
||||
@@ -722,13 +737,13 @@ module { name = "m_sasl" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sqlite [EXTRA]
|
||||
* sqlite [EXTRA]
|
||||
*
|
||||
* This module allows other modules to use SQLite.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_sqlite"
|
||||
name = "sqlite"
|
||||
|
||||
/* A SQLite database */
|
||||
sqlite
|
||||
@@ -748,7 +763,7 @@ module { name = "m_sasl" }
|
||||
* as they could over IRC. If you are using the default configuration you should be able to access
|
||||
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
|
||||
*
|
||||
* This module requires m_httpd.
|
||||
* This module requires httpd.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
@@ -765,23 +780,23 @@ module { name = "m_sasl" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_xmlrpc
|
||||
* xmlrpc
|
||||
*
|
||||
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
|
||||
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
|
||||
* By itself this module does nothing, but allows other modules (xmlrpc_main) to receive and send XMLRPC queries.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_xmlrpc"
|
||||
name = "xmlrpc"
|
||||
|
||||
/* Web service to use. Requires m_httpd. */
|
||||
/* Web service to use. Requires httpd. */
|
||||
server = "httpd/main"
|
||||
}
|
||||
|
||||
/*
|
||||
* m_xmlrpc_main
|
||||
* xmlrpc_main
|
||||
*
|
||||
* Adds the main XMLRPC core functions.
|
||||
* Requires m_xmlrpc.
|
||||
* Requires xmlrpc.
|
||||
*/
|
||||
#module { name = "m_xmlrpc_main" }
|
||||
#module { name = "xmlrpc_main" }
|
||||
|
||||
+34
-77
@@ -96,8 +96,6 @@ module
|
||||
* option and the killprotect option must be specified with this one
|
||||
* - kill_immed: Kill nick immediately if not identified, this one overrides both the killprotect
|
||||
* and kill_quick options and the killprotect option must be specified with this one
|
||||
* - ns_secure: Enable nickname security, requiring the nick's password before any operations
|
||||
* can be done on it
|
||||
* - ns_private: Hide the nick from NickServ's LIST command
|
||||
* - hide_email: Hide the nick's e-mail address from NickServ's INFO command
|
||||
* - hide_mask: Hide the nick's last or current user@host from NickServ's INFO command
|
||||
@@ -107,14 +105,15 @@ module
|
||||
* - memo_receive: Notify user if they have a new memo as soon as it's received
|
||||
* - memo_mail: Notify user if they have a new memo by mail
|
||||
* - autoop: User will be automatically opped in channels they enter and have access to
|
||||
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires
|
||||
* options:useprivmsg to be enabled as well
|
||||
* - neverop: User can not be added to access lists
|
||||
* - msg: Messages will be sent as PRIVMSGs instead of NOTICEs, requires options:useprivmsg
|
||||
* to be enabled as well
|
||||
* - ns_keep_modes: Enables keepmodes, which retains user modes across sessions
|
||||
*
|
||||
* This directive is optional, if left blank, the options will default to ns_secure, memo_signon, and
|
||||
* This directive is optional, if left blank, the options will default to memo_signon, and
|
||||
* memo_receive. If you really want no defaults, use "none" by itself as the option.
|
||||
*/
|
||||
defaults = "killprotect ns_secure ns_private hide_email hide_mask memo_signon memo_receive autoop"
|
||||
defaults = "killprotect ns_private hide_email hide_mask memo_signon memo_receive autoop"
|
||||
|
||||
/*
|
||||
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
|
||||
@@ -125,20 +124,20 @@ module
|
||||
/*
|
||||
* The length of time before a nick's registration expires.
|
||||
*
|
||||
* This directive is optional, but recommended. If not set, the default is 21 days.
|
||||
* This directive is optional, but recommended. If not set, the default is 90 days.
|
||||
*/
|
||||
expire = 21d
|
||||
expire = 90d
|
||||
|
||||
/*
|
||||
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND,
|
||||
* GETPASS and SET PASSWORD commands by services operators on other services operators.
|
||||
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND
|
||||
* and SET PASSWORD commands by services operators on other services operators.
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
*/
|
||||
secureadmins = yes
|
||||
|
||||
/*
|
||||
* If set, Services will set the channel modes a user has access to upon identifying, assuming
|
||||
* If set, Anope will set the channel modes a user has access to upon identifying, assuming
|
||||
* they are not already set.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -146,14 +145,14 @@ module
|
||||
modeonid = yes
|
||||
|
||||
/*
|
||||
* If set, Services will set these user modes on any user who identifies.
|
||||
* If set, Anope will set these user modes on any user who identifies.
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
#modesonid = "+R"
|
||||
|
||||
/*
|
||||
* If set, Services will not show netsplits in the last quit message field
|
||||
* If set, Anope will not show netsplits in the last quit message field
|
||||
* of NickServ's INFO command.
|
||||
*/
|
||||
hidenetsplitquit = no
|
||||
@@ -167,7 +166,7 @@ module
|
||||
|
||||
/*
|
||||
* If set, forbids the registration of nicks that contain an existing
|
||||
* nick with Services access. For example, if Tester is a Services Oper,
|
||||
* nick with services access. For example, if Tester is a Services Oper,
|
||||
* you can't register NewTester or Tester123 unless you are an IRC
|
||||
* Operator.
|
||||
*
|
||||
@@ -180,14 +179,14 @@ module
|
||||
#restrictopernicks = yes
|
||||
|
||||
/*
|
||||
* The username, and possibly hostname, used for fake users created when Services needs to
|
||||
* The username, and possibly hostname, used for fake users created when Anope needs to
|
||||
* hold a nickname.
|
||||
*/
|
||||
enforceruser = "enforcer"
|
||||
enforcerhost = "services.host"
|
||||
|
||||
/*
|
||||
* The length of time Services hold nicknames.
|
||||
* The length of time Anope should hold nicknames for.
|
||||
*
|
||||
* This directive is optional, but recommended. If not set it defaults to 1 minute.
|
||||
*/
|
||||
@@ -203,16 +202,23 @@ module
|
||||
guestnickprefix = "Guest"
|
||||
|
||||
/*
|
||||
* If set, Services do not allow ownership of nick names, only ownership of accounts.
|
||||
* If set, Anope does not allow ownership of nick names, only ownership of accounts.
|
||||
*/
|
||||
nonicknameownership = no
|
||||
|
||||
/*
|
||||
* The minimum length of passwords
|
||||
*
|
||||
* This directive is optional. If not set it defaults to 10.
|
||||
*/
|
||||
minpasslen = 10
|
||||
|
||||
/*
|
||||
* The maximum length of passwords
|
||||
*
|
||||
* This directive is optional. If not set it defaults to 32.
|
||||
* This directive is optional. If not set it defaults to 50.
|
||||
*/
|
||||
passlen = 32
|
||||
maxpasslen = 50
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -240,33 +246,6 @@ command_group
|
||||
/* Give it a help command. */
|
||||
command { service = "NickServ"; name = "HELP"; command = "generic/help"; }
|
||||
|
||||
/*
|
||||
* ns_access
|
||||
*
|
||||
* Provides the command nickserv/access.
|
||||
*
|
||||
* Used for configuring what hosts have access to your account.
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "ns_access"
|
||||
|
||||
/*
|
||||
* The maximum number of entries allowed on a nickname's access list.
|
||||
* If not set, the default is 32. This number cannot be set to 0.
|
||||
*/
|
||||
accessmax = 32
|
||||
|
||||
/*
|
||||
* If set, Services will add the usermask of registering users to the access list of their
|
||||
* newly created account. If not set, users will always have to identify to NickServ before
|
||||
* being recognized, unless they manually add an address to the access list of their account.
|
||||
* This directive is optional.
|
||||
*/
|
||||
addaccessonreg = no
|
||||
}
|
||||
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/access"; }
|
||||
|
||||
/*
|
||||
* ns_ajoin
|
||||
*
|
||||
@@ -334,18 +313,6 @@ command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
|
||||
module { name = "ns_getemail" }
|
||||
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; group = "nickserv/admin"; }
|
||||
|
||||
/*
|
||||
* ns_getpass
|
||||
*
|
||||
* Provides the command nickserv/getpass.
|
||||
*
|
||||
* Used for getting users passwords.
|
||||
*
|
||||
* Requires no encryption is being used.
|
||||
*/
|
||||
#module { name = "ns_getpass" }
|
||||
#command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; permission = "nickserv/getpass"; }
|
||||
|
||||
/*
|
||||
* ns_group
|
||||
*
|
||||
@@ -456,7 +423,7 @@ module
|
||||
name = "ns_recover"
|
||||
|
||||
/*
|
||||
* If set, Services will svsnick and svsjoin users who use the recover
|
||||
* If set, Anope will svsnick and svsjoin users who use the recover
|
||||
* command on an identified user to the nick and channels of the recovered user.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -464,9 +431,10 @@ module
|
||||
restoreonrecover = yes
|
||||
}
|
||||
command { service = "NickServ"; name = "RECOVER"; command = "nickserv/recover"; }
|
||||
# Uncomment below to emulate 1.8's behavior of ghost and release.
|
||||
#command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; }
|
||||
#command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; }
|
||||
|
||||
# For compatibility with Anope 1.8 and Atheme.
|
||||
command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; hide = true; }
|
||||
command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; hide = true; }
|
||||
|
||||
/*
|
||||
* ns_register
|
||||
@@ -533,9 +501,9 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas
|
||||
* nickserv/set/kill, nickserv/saset/kill - Used for configuring nickname protection.
|
||||
* nickserv/set/language, nickserv/saset/language - Used for configuring what language services use.
|
||||
* nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you.
|
||||
* nickserv/set/password, nickserv/saset/password - Used for changing a users password.
|
||||
* nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access.
|
||||
* nickserv/set/neverop, nickserv/saset/neverop - Used to configure whether a user can be added to access lists
|
||||
* nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring.
|
||||
* nickserv/set/password, nickserv/saset/password - Used for changing a users password.
|
||||
*/
|
||||
module
|
||||
{
|
||||
@@ -576,8 +544,8 @@ command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/sase
|
||||
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
|
||||
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; permission = "nickserv/saset/password"; }
|
||||
|
||||
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
|
||||
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
|
||||
command { service = "NickServ"; name = "SET NEVEROP"; command = "nickserv/set/neverop"; }
|
||||
command { service = "NickServ"; name = "SASET NEVEROP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; }
|
||||
|
||||
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; }
|
||||
|
||||
@@ -600,17 +568,6 @@ command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/mi
|
||||
#command { service = "NickServ"; name = "SET MASTODON"; command = "nickserv/set/misc"; misc_description = _("Associate a Mastodon account with your account"); }
|
||||
#command { service = "NickServ"; name = "SASET MASTODON"; command = "nickserv/saset/misc"; misc_description = _("Associate a Mastodon account with this account"); permission = "nickserv/saset/mastodon"; group = "nickserv/admin"; }
|
||||
|
||||
|
||||
/*
|
||||
* ns_status
|
||||
*
|
||||
* Provides the nickserv/status command.
|
||||
*
|
||||
* Used to determine if a user is recognized or identified by services.
|
||||
*/
|
||||
module { name = "ns_status" }
|
||||
command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; }
|
||||
|
||||
/*
|
||||
* ns_suspend
|
||||
*
|
||||
|
||||
+13
-24
@@ -75,7 +75,7 @@ module
|
||||
sqlineexpiry = 30d
|
||||
|
||||
/*
|
||||
* If set, this option will make Services send an AKILL command immediately after it has been
|
||||
* If set, this option will make Anope send an AKILL command immediately after it has been
|
||||
* added with AKILL ADD. This eliminates the need for killing the user after the AKILL has
|
||||
* been added.
|
||||
*
|
||||
@@ -84,7 +84,7 @@ module
|
||||
akillonadd = yes
|
||||
|
||||
/*
|
||||
* If set, this option will make Services send an (SVS)KILL command immediately after SNLINE ADD.
|
||||
* If set, this option will make Anope send an (SVS)KILL command immediately after SNLINE ADD.
|
||||
* This eliminates the need for killing the user after the SNLINE has been added.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -92,7 +92,7 @@ module
|
||||
killonsnline = yes
|
||||
|
||||
/*
|
||||
* If set, this option will make Services send an (SVS)KILL command immediately after SQLINE ADD.
|
||||
* If set, this option will make Anope send an (SVS)KILL command immediately after SQLINE ADD.
|
||||
* This eliminates the need for killing the user after the SQLINE has been added.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -167,7 +167,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
|
||||
name = "os_defcon"
|
||||
|
||||
/*
|
||||
* Default DefCon level (1-5) to use when starting Services up. Level 5 constitutes normal operation
|
||||
* Default DefCon level (1-5) to use when starting Anope up. Level 5 constitutes normal operation
|
||||
* while level 1 constitutes the most restrictive operation. If this setting is left out or set to
|
||||
* 0, DefCon will be disabled and the rest of this block will be ignored.
|
||||
*/
|
||||
@@ -184,8 +184,8 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
|
||||
* - forcechanmodes: Forces all channels to have the modes given in the later chanmodes directive
|
||||
* - reducedsessions: Reduces the session limit to the value given in the later sessionlimit directive
|
||||
* - nonewclients: KILL any new clients trying to connect
|
||||
* - operonly: Services will ignore all non-IRCops
|
||||
* - silentoperonly: Services will silently ignore all non-IRCops
|
||||
* - operonly: Ignore all non-IRCops
|
||||
* - silentoperonly: Silently ignore all non-IRCops
|
||||
* - akillnewclients: AKILL any new clients trying to connect
|
||||
* - nonewmemos: No new memos will be sent to block MemoServ attacks
|
||||
*/
|
||||
@@ -209,7 +209,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
|
||||
* The channel modes to set on all channels when the DefCon channel mode system is in use.
|
||||
*
|
||||
* Note 1: Choose these modes carefully, because when DefCon switches to a level which does NOT have
|
||||
* the mode setting selected, Services will set the reverse on all channels, e.g. if this setting
|
||||
* the mode setting selected, Anope will set the reverse on all channels, e.g. if this setting
|
||||
* is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all
|
||||
* channels will be set to -RN. You don't want to set this to +k for example, because when DefCon
|
||||
* is removed, all channels are set -k, removing the key from previously keyed channels.
|
||||
@@ -227,14 +227,14 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
|
||||
#timeout = 15m
|
||||
|
||||
/*
|
||||
* If set, Services will send a global message on DefCon level changes.
|
||||
* If set, Anope will send a global message on DefCon level changes.
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
#globalondefcon = yes
|
||||
|
||||
/*
|
||||
* If set, Services will send the global message defined in the message directive on DefCon level
|
||||
* If set, Anope will send the global message defined in the message directive on DefCon level
|
||||
* changes.
|
||||
*
|
||||
* This directive is optional.
|
||||
@@ -267,7 +267,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
|
||||
*
|
||||
* Provides the command operserv/dns.
|
||||
*
|
||||
* This module requires that m_dns is loaded.
|
||||
* This module requires that dns is loaded.
|
||||
*
|
||||
* This module allows controlling a DNS zone. This is useful for
|
||||
* controlling what servers users are placed on for load balancing,
|
||||
@@ -348,7 +348,7 @@ command { service = "OperServ"; name = "FORBID"; command = "operserv/forbid"; pe
|
||||
*
|
||||
* Provides the command operserv/ignore.
|
||||
*
|
||||
* Used to make Services ignore users.
|
||||
* Used to make Anope ignore users.
|
||||
*/
|
||||
module { name = "os_ignore" }
|
||||
command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; permission = "operserv/ignore"; }
|
||||
@@ -506,17 +506,6 @@ command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomn
|
||||
module { name = "os_noop" }
|
||||
command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; }
|
||||
|
||||
/*
|
||||
* os_oline
|
||||
*
|
||||
* Provides the command operserv/oline.
|
||||
*
|
||||
* Used to set oper flags on users, and is specific to UnrealIRCd 3.2.
|
||||
* See /helpop ?svso on your IRCd for more information.
|
||||
*/
|
||||
#module { name = "os_oline" }
|
||||
#command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; permission = "operserv/oline"; }
|
||||
|
||||
/*
|
||||
* os_oper
|
||||
*
|
||||
@@ -532,7 +521,7 @@ command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permis
|
||||
*
|
||||
* Provides the command operserv/reload.
|
||||
*
|
||||
* Used to reload the services.conf configuration file.
|
||||
* Used to reload the anope.conf configuration file.
|
||||
*/
|
||||
module { name = "os_reload" }
|
||||
command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; permission = "operserv/reload"; }
|
||||
@@ -595,7 +584,7 @@ module
|
||||
#sessionlimitdetailsloc = "Please visit https://your.website.url/ for more information about session limits."
|
||||
|
||||
/*
|
||||
* If set and is not 0, this directive tells Services to add an AKILL if the number of subsequent kills
|
||||
* If set and is not 0, this directive tells Anope to add an AKILL if the number of subsequent kills
|
||||
* for the same host exceeds this value, preventing the network from experiencing KILL floods.
|
||||
*
|
||||
* This directive is optional.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Example configuration file for Services. After making the appropriate
|
||||
* changes to this file, place it in the Services conf directory (as
|
||||
* specified in the "configure" script, default /home/username/services/conf)
|
||||
* under the name "services.conf".
|
||||
* Example configuration file for Anope. After making the appropriate
|
||||
* changes to this file, place it in the Anope conf directory (as
|
||||
* specified in the "Config" script, default /home/username/anope/conf)
|
||||
* under the name "anope.conf".
|
||||
*
|
||||
* The format of this file is fairly simple: three types of comments are supported:
|
||||
* - All text after a '#' on a line is ignored, as in shell scripting
|
||||
@@ -53,7 +53,7 @@
|
||||
* included to indicate whether an option is required:
|
||||
*
|
||||
* [REQUIRED]
|
||||
* Indicates a directive which must be given. Without it, Services will
|
||||
* Indicates a directive which must be given. Without it, Anope will
|
||||
* not start.
|
||||
*
|
||||
* [RECOMMENDED]
|
||||
@@ -71,7 +71,7 @@
|
||||
*
|
||||
* [DEPRECATED]
|
||||
* Indicates a directive which will disappear in a future version of
|
||||
* Services, usually because its functionality has been either
|
||||
* Anope, usually because its functionality has been either
|
||||
* superseded by that of other directives or incorporated into the main
|
||||
* program.
|
||||
*/
|
||||
@@ -120,7 +120,7 @@ define
|
||||
* This section can be included multiple times, and Anope will attempt to
|
||||
* connect to each server until it finally connects.
|
||||
*
|
||||
* Each uplink IRCd should have a corresponding configuration to allow Services
|
||||
* Each uplink IRCd should have a corresponding configuration to allow Anope
|
||||
* to link to it.
|
||||
*
|
||||
* An example configuration for InspIRCd that is compatible with the below uplink
|
||||
@@ -158,20 +158,22 @@ define
|
||||
uplink
|
||||
{
|
||||
/*
|
||||
* The IP or hostname of the IRC server you wish to connect Services to.
|
||||
* Usually, you will want to connect Services over 127.0.0.1 (aka localhost).
|
||||
* The IP address, hostname, or UNIX socket path of the IRC server you wish
|
||||
* to connect Anope to.
|
||||
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
|
||||
*
|
||||
* NOTE: On some shell providers, this will not be an option.
|
||||
*/
|
||||
host = "127.0.0.1"
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using IPv6.
|
||||
* The protocol that Anope should use when connecting to the uplink. Can
|
||||
* be set to "ipv4" (the default), "ipv6", or "unix".
|
||||
*/
|
||||
ipv6 = no
|
||||
protocol = "ipv4"
|
||||
|
||||
/*
|
||||
* Enable if Services should connect using SSL.
|
||||
* Enable if Anope should connect using SSL.
|
||||
* You must have an SSL module loaded for this to work.
|
||||
*/
|
||||
ssl = no
|
||||
@@ -197,12 +199,12 @@ uplink
|
||||
/*
|
||||
* [REQUIRED] Server Information
|
||||
*
|
||||
* This section contains information about the Services server.
|
||||
* This section contains information about the services server.
|
||||
*/
|
||||
serverinfo
|
||||
{
|
||||
/*
|
||||
* The hostname that Services will be seen as, it must have no conflicts with any
|
||||
* The hostname that Anope will be seen as, it must have no conflicts with any
|
||||
* other server names on the rest of your IRC network. Note that it does not have
|
||||
* to be an existing hostname, just one that isn't on your network already.
|
||||
*/
|
||||
@@ -212,11 +214,11 @@ serverinfo
|
||||
* The text which should appear as the server's information in /WHOIS and similar
|
||||
* queries.
|
||||
*/
|
||||
description = "Stats for IRC Networks"
|
||||
description = "Anope IRC Statistics"
|
||||
|
||||
/*
|
||||
* The local address that Services will bind to before connecting to the remote
|
||||
* server. This may be useful for multihomed hosts. If omitted, Services will let
|
||||
* The local address that Anope will bind to before connecting to the remote
|
||||
* server. This may be useful for multihomed hosts. If omitted, Anope will let
|
||||
* the Operating System choose the local address. This directive is optional.
|
||||
*
|
||||
* If you don't know what this means or don't need to use it, just leave this
|
||||
@@ -232,16 +234,16 @@ serverinfo
|
||||
#id = "00A"
|
||||
|
||||
/*
|
||||
* The filename containing the Services process ID. The path is relative to the
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
*/
|
||||
pid = "data/stats.pid"
|
||||
pid = "data/anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
*/
|
||||
motd = "conf/stats.motd"
|
||||
motd = "conf/motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -252,57 +254,55 @@ serverinfo
|
||||
*
|
||||
* Supported:
|
||||
* - bahamut
|
||||
* - charybdis
|
||||
* - hybrid
|
||||
* - inspircd12
|
||||
* - inspircd20
|
||||
* - inspircd3
|
||||
* - inspircd
|
||||
* - ngircd
|
||||
* - plexus
|
||||
* - ratbox
|
||||
* - unreal (for 3.2.x)
|
||||
* - unreal4 (for 4.x or later)
|
||||
* - solanum
|
||||
* - unrealircd
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "inspircd3"
|
||||
name = "inspircd"
|
||||
}
|
||||
|
||||
/*
|
||||
* [REQUIRED] Network Information
|
||||
*
|
||||
* This section contains information about the IRC network that Services will be
|
||||
* This section contains information about the IRC network that Anope will be
|
||||
* connecting to.
|
||||
*/
|
||||
networkinfo
|
||||
{
|
||||
/*
|
||||
* This is the name of the network that Services will be running on.
|
||||
* This is the name of the network that Anope will be running on.
|
||||
*/
|
||||
networkname = "LocalNet"
|
||||
|
||||
/*
|
||||
* Set this to the maximum allowed nick length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 31.
|
||||
*/
|
||||
nicklen = 31
|
||||
#nicklen = 31
|
||||
|
||||
/* Set this to the maximum allowed ident length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 10.
|
||||
*/
|
||||
userlen = 10
|
||||
#userlen = 10
|
||||
|
||||
/* Set this to the maximum allowed hostname length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Services being disconnected from the network.
|
||||
* Anope being disconnected from the network. Defaults to 64.
|
||||
*/
|
||||
hostlen = 64
|
||||
#hostlen = 64
|
||||
|
||||
/* Set this to the maximum allowed channel length on your network.
|
||||
* Defaults to 64.
|
||||
*/
|
||||
chanlen = 32
|
||||
#chanlen = 32
|
||||
|
||||
/* The maximum number of list modes settable on a channel (such as b, e, I).
|
||||
* Comment out or set to 0 to disable.
|
||||
@@ -314,7 +314,7 @@ networkinfo
|
||||
* to services, such as BotServ bot hostnames and user vhosts. Changing this is not
|
||||
* recommended unless you know for sure your IRCd supports whatever characters you are
|
||||
* wanting to use. Telling services to set a vHost containing characters your IRCd
|
||||
* disallows could potentially break the IRCd and/or Services.
|
||||
* disallows could potentially break the IRCd and/or Anope.
|
||||
*
|
||||
* It is recommended you DON'T change this.
|
||||
*/
|
||||
@@ -339,22 +339,22 @@ networkinfo
|
||||
}
|
||||
|
||||
/*
|
||||
* [REQUIRED] Services Options
|
||||
* [REQUIRED] Anope Options
|
||||
*
|
||||
* This section contains various options which determine how Services will operate.
|
||||
* This section contains various options which determine how Anope will operate.
|
||||
*/
|
||||
options
|
||||
{
|
||||
/*
|
||||
* On Linux/UNIX systems Anope can setuid and setgid to this user and group
|
||||
* after starting up. This is useful if Anope has to bind to privileged ports
|
||||
* after starting up. This is useful if Anope has to bind to privileged ports.
|
||||
*/
|
||||
#user = "anope"
|
||||
#group = "anope"
|
||||
|
||||
/*
|
||||
* The case mapping used by services. This must be set to a valid locale name
|
||||
* installed on your machine. Services use this case map to compare, with
|
||||
* installed on your machine. Anope uses this case map to compare, with
|
||||
* case insensitivity, things such as nick names, channel names, etc.
|
||||
*
|
||||
* We provide two special casemaps shipped with Anope, ascii and rfc1459.
|
||||
@@ -378,14 +378,14 @@ options
|
||||
warningtimeout = 4h
|
||||
|
||||
/*
|
||||
* If set, Services will only show /stats o to IRC Operators. This directive
|
||||
* If set, Anope will only show /stats o to IRC Operators. This directive
|
||||
* is optional.
|
||||
*/
|
||||
#hidestatso = yes
|
||||
|
||||
/*
|
||||
* A space-separated list of U-lined servers on your network, it is assumed that
|
||||
* the servers in this list are allowed to set channel modes and Services will
|
||||
* the servers in this list are allowed to set channel modes and Anope will
|
||||
* not attempt to reverse their mode changes.
|
||||
*
|
||||
* WARNING: Do NOT put your normal IRC user servers in this directive.
|
||||
@@ -484,13 +484,13 @@ log
|
||||
/*
|
||||
* [REQUIRED] MySQL Database configuration.
|
||||
*
|
||||
* m_mysql
|
||||
* mysql
|
||||
*
|
||||
* This module allows other modules to use MySQL.
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "m_mysql"
|
||||
name = "mysql"
|
||||
|
||||
mysql
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
astyle --style=java --indent=tab --brackets=break-closing --indent-switches --indent-cases --brackets=break
|
||||
@@ -1 +0,0 @@
|
||||
For all bug reports / updates please see https://github.com/anope/anope/issues
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
C++-style Casting
|
||||
=================
|
||||
|
||||
In C, you can cast in one of two ways:
|
||||
|
||||
(type)var
|
||||
type(var)
|
||||
|
||||
The problem with C-style casting is that it allows a programmer to get away
|
||||
with too much, and is also not designed to handle C++ classes.
|
||||
|
||||
C++ has 4 types of casting in addition to allowing C-style casting. They are:
|
||||
|
||||
static_cast
|
||||
const_cast
|
||||
dynamic_cast
|
||||
reinterpret_cast
|
||||
|
||||
The syntax is usually *_cast<type>(var).
|
||||
|
||||
static_cast
|
||||
-----------
|
||||
|
||||
From my experience, this cast is closest to C-style casting for non-pointer
|
||||
types as well as between some (but not all) pointer types. This type of cast,
|
||||
like C-style casting, is performed at compile-time. static_cast can also do
|
||||
a downcast of a derived class to a base class, but only if the base class is
|
||||
not a virtual base class. Sometimes the result of this cast can become
|
||||
undefined. static_cast is a bit more strict that C-style casting, though. It
|
||||
disallows certain class conversions that would've been allowed with a C-style
|
||||
cast. static_cast also doesn't allow you to cast to an incomplete type. In
|
||||
these cases, I would try either dynamic_cast or reinterpret_cast.
|
||||
|
||||
const_cast
|
||||
----------
|
||||
|
||||
This cast is mainly to add or remove const-ness or volatile-ness from a
|
||||
variable. This is safer than using a C-style cast to change the const-ness
|
||||
of a variable. In most cases if you try to use one of the other casts and it
|
||||
complains about const-ness, you will want to either use this cast instead or
|
||||
wrap the other cast around this cast. An example:
|
||||
|
||||
const int *a;
|
||||
static_cast<void *>(a); <-- This will fail.
|
||||
|
||||
To remedy the above, you would might try this:
|
||||
|
||||
const int *a;
|
||||
const_cast<void *>(a); <-- But this will still fail.
|
||||
|
||||
The real solution is this:
|
||||
|
||||
const int *a;
|
||||
static_cast<void *>(const_cast<int *>(a));
|
||||
|
||||
It is not recommended to use const_cast on the this variable within a member
|
||||
function of a class that is declared const. Instead you should use the mutable
|
||||
keyword on the variable in the class's definition.
|
||||
|
||||
dynamic_cast
|
||||
------------
|
||||
|
||||
This cast can only be used on pointers or references to classes. It can cast a
|
||||
derived class to a base class, a derived class to another derived class
|
||||
(provided that both are children of the same base class), or a base class to a
|
||||
derived class. You can also use this to cast a class to void *. This cast is
|
||||
done at run-time as opposed to the other casts, and relies on C++'s RTTI to be
|
||||
enabled. It is meant to be used on polymorphic classes, so use static_cast on
|
||||
non-polymorphic classes.
|
||||
|
||||
derived-to-base conversions are actually done statically, so you use either
|
||||
dynamic_cast or static_cast on them, regardless of if the classes are
|
||||
polymorphic or not.
|
||||
|
||||
derived-to-derived or base-to-derived conversions, however, rely on run-time
|
||||
type information, and this cast is used on those classes that are polymorphic.
|
||||
This is safer than C-style casting in that an invalid pointer conversion will
|
||||
return a NULL pointer, and an invalid reference conversion will throw a
|
||||
Bad_cast exception.
|
||||
|
||||
Note that in Anope we prefer if Anope::debug_cast is used.
|
||||
This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
|
||||
and static_cast on release builds, to speed up the program because of dynamic_cast's
|
||||
reliance on RTTI.
|
||||
|
||||
reinterpret_cast
|
||||
----------------
|
||||
|
||||
This cast I would use only as a last resort if static_cast isn't allowed on a
|
||||
conversion. It allows for conversions between two unrelated types, such as
|
||||
going from char * to int *. It can also be used to convert a pointer to an
|
||||
integral type and vica versa. The sites I've read mention how the result is
|
||||
non-portable, which I assume means the resulting object code is non-portable,
|
||||
so since the code is compiled on many systems anyways, I don't see this as
|
||||
being a huge issue. It is recommended to only use this if necessary, though.
|
||||
|
||||
Links
|
||||
=====
|
||||
|
||||
The following links are web sites I've used to get this information, and might
|
||||
describe some of the above a bit better than I have. :P
|
||||
|
||||
https://www.acm.org/crossroads/xrds3-1/ovp3-1.html
|
||||
http://www.cplusplus.com/doc/tutorial/typecasting.html
|
||||
http://www.codeguru.com/forum/showthread.php?t=312456
|
||||
https://web.archive.org/web/20170810222238/http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html
|
||||
https://www.microsoft.com/en-us/download/details.aspx?id=55984
|
||||
https://en.wikibooks.org/wiki/C%2B%2B_Programming/Type_Casting
|
||||
https://web.archive.org/web/20160510114447/http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=134
|
||||
|
||||
-- CyberBotX, Nov 23, 2008
|
||||
+3
-3
@@ -6,10 +6,10 @@ if(WIN32)
|
||||
if(IN_SOURCE)
|
||||
# Add README.txt to list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("README.txt$" TRUE)
|
||||
endif(IN_SOURCE)
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
endif()
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
install(FILES ${DOCS}
|
||||
DESTINATION ${DOC_DIR}
|
||||
)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
|
||||
endif(WIN32)
|
||||
endif()
|
||||
|
||||
-239
@@ -1,239 +0,0 @@
|
||||
Originally pulled from: https://wiki.inspircd.org/Coding_Guidelines
|
||||
|
||||
---
|
||||
|
||||
InspIRCd Coding Guidelines
|
||||
|
||||
The following are a set of guidelines for writing patches to InspIRCd, or for
|
||||
creating modules for distribution with the official package. These guidelines
|
||||
were written a time after InspIRCd development started, and so not all code
|
||||
yet follows these. This will be rectified with time.
|
||||
|
||||
|
||||
1. Comments
|
||||
|
||||
* Multi Line
|
||||
Multiple line comments should follow the C-style comment, for example:
|
||||
/*
|
||||
* This is a multiple line comment, huzzah..
|
||||
*/
|
||||
|
||||
* Single Line
|
||||
Single line comments should also be in the C style, for example:
|
||||
/* This is a boring one-line comment */
|
||||
|
||||
* Doxygen commenting
|
||||
If you wish your comment to show in doxygen, the comment should be directly
|
||||
above the item you are documenting (a class, function, enum, etc) and the
|
||||
first line should be "/**". For example:
|
||||
/** This is a doxygen multiline comment.
|
||||
* Description of thingymebob here.
|
||||
*/
|
||||
|
||||
The first line after the "**" is used as the short description of the item
|
||||
(up to the full stop) and everything afterwards as the detailed description.
|
||||
|
||||
|
||||
2. Indentation
|
||||
|
||||
Tabs. Tabs. ONLY TABS. Use a single tab for each level of indentation,
|
||||
for example:
|
||||
int main()
|
||||
{
|
||||
<tab>if (condition)
|
||||
<tab>{
|
||||
<tab><tab>code
|
||||
<tab>}
|
||||
}
|
||||
|
||||
|
||||
3. Separation
|
||||
|
||||
Always put a space in between a keyword like if/while and the condition,
|
||||
for example:
|
||||
if (foo == bar)
|
||||
NOT
|
||||
if(foo == bar)
|
||||
|
||||
|
||||
4. Braces
|
||||
|
||||
Always put braces opening and closing blocks on separate lines, see the
|
||||
indentation example. For example, place braces like this:
|
||||
if (apples == "green")
|
||||
{
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
|
||||
and not:
|
||||
if (apples == "green") {
|
||||
cout << "Apples are green" << endl;
|
||||
}
|
||||
|
||||
The one exception to this is if you are declaring a class method which is
|
||||
only one line long, in that case the following is acceptable in most cases:
|
||||
class foo : public bar
|
||||
{
|
||||
foo() { }
|
||||
getrandomfoo() { return rand(); }
|
||||
};
|
||||
|
||||
|
||||
5. Templates
|
||||
|
||||
Where possible, use templates rather than #defines. Avoid use of RTTI.
|
||||
|
||||
|
||||
6. Structs
|
||||
|
||||
Structs should be declared in the following fashion:
|
||||
struct BodyPartBasket
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
};
|
||||
and not like this:
|
||||
typedef struct
|
||||
{
|
||||
int arms;
|
||||
int legs;
|
||||
int scrotalsacs;
|
||||
} BodyPartBasket;
|
||||
|
||||
The second way is not required in C++ to be able to do this:
|
||||
BodyPartBasket mybasket;
|
||||
|
||||
Plus, placing the name at the bottom of the declaration makes readability
|
||||
more difficult (as you have to scroll down to the bottom of the struct to
|
||||
find its name). (where possible, call them classes rather than structs.)
|
||||
|
||||
|
||||
7. Variable naming
|
||||
|
||||
Class and struct names should be in camel case with a leading capital letter,
|
||||
for example "MyBagOfBones" and not "my_bag_of_bones" or "mybagofbones".
|
||||
Variable names can be in either camel case with a leading capital letter or
|
||||
alternatively all lower case, so long as the same naming convention is
|
||||
adhered to throughout the class. No classes or variables should be named in
|
||||
capitals unless this makes sense for the name (for example "class DNS").
|
||||
Constants and enum values should always be completely in CAPITALS and
|
||||
underscores may be used, for example:
|
||||
enum DecayState
|
||||
{
|
||||
DECAYED_MOULDY = 0,
|
||||
DECAYED_SMELLY = 1,
|
||||
DECAYED_MAGGOTS = 2
|
||||
};
|
||||
All value names in an enum should be started with the same text which should
|
||||
be related in some way to the enum's use. For example "DNS_CNAME, DNS_A,
|
||||
DNS_AAAA".
|
||||
|
||||
|
||||
8. Use of references
|
||||
|
||||
Wherever possible, when dealing with any complex class, pass a const reference
|
||||
rather than a copy of the class. For example:
|
||||
MyThingy::MyThingy(const std::string &thingyvalue)
|
||||
{
|
||||
}
|
||||
Of course, if you intended to change the string you can just omit the 'const'.
|
||||
|
||||
|
||||
9. Use of char pointers
|
||||
|
||||
Whenever you use char pointers (char*, char**) try to use const equivalents.
|
||||
This is much safer and avoids ugly and dangerous casts. For example:
|
||||
MyThingy::Thingify(const char* const* wotsits)
|
||||
{
|
||||
}
|
||||
If it is possible without performance loss, consider avoiding char pointers
|
||||
altogether and using std::string instead.
|
||||
|
||||
|
||||
10. Use of STL
|
||||
|
||||
For more information on use of STL in InspIRCd, please see the separate
|
||||
STL FAQ.
|
||||
|
||||
|
||||
11. Making copies of data
|
||||
|
||||
Never ever make a copy of a piece of data unless it is absolutely necessary.
|
||||
For example, don't use strlcpy() to make a copy of the const char* string
|
||||
returned by std::string::c_str(), if the change can be done to the std::string
|
||||
itself. The same goes for unnecessary variable assignments, especially those
|
||||
which assign large classes.
|
||||
|
||||
|
||||
12. namespace std
|
||||
|
||||
Avoid the following:
|
||||
using namespace std;
|
||||
It might take a bit more typing, but things work better if you don't set
|
||||
(then later assume) the namespace -- specify it explicitly when you want to
|
||||
use it.
|
||||
|
||||
|
||||
13. Linefeeds
|
||||
|
||||
Unix linefeeds only please. We do not like to see our screens covered in ^M.
|
||||
|
||||
|
||||
14. Portability
|
||||
|
||||
Always make sure your code is portable to all supported operating systems,
|
||||
remember of course that as of 1.1.8 this includes windows. Don't write code
|
||||
that only works on windows, or only works on Linux. Test your code on all
|
||||
platforms or ask for help from other developers who have the platforms you
|
||||
want to test on.
|
||||
|
||||
* new() and delete(), malloc() and free()
|
||||
Apart from the fact that using malloc() and free() is bad practice in C++
|
||||
code, you must never use malloc() or free() in InspIRCd, within its modules
|
||||
or within the core. This is because if you use malloc() or free() in windows,
|
||||
the memory is claimed from the program's local heap.
|
||||
In windows, each shared object (module, dll) has its own heap, which is
|
||||
protected from other dlls and executables. To get around this issue and
|
||||
allow more posix-like memory access from other dlls in the program (other
|
||||
modules), InspIRCd overrides the operators new and delete to ensure that
|
||||
memory allocated by them comes from the windows global heap. If you use
|
||||
malloc() and free() for this, the ircd will segfault when another module
|
||||
tries to access the memory you have allocated!
|
||||
|
||||
* strdup()
|
||||
As with malloc(), above, strdup() should be avoided. Where strdup() is
|
||||
absolutely necessary, use strnewdup() which is our strdup() implementation
|
||||
that calls operator new instead of using malloc().
|
||||
char arrays allocated by strnewdup() should be deleted with operator delete[].
|
||||
|
||||
* CoreExport and DllImport
|
||||
Prefix all types you want to import or export to other modules with CoreExport
|
||||
and DllImport macros. These do nothing in POSIX operating systems, however
|
||||
in windows these are expanded to the instructions __declspec(dllimport) and
|
||||
__declspec(dllexport) respectively depending on where they are used and how.
|
||||
|
||||
|
||||
15. External Dependencies
|
||||
|
||||
If a module is compiled as standard, or the code is part of the core, you must
|
||||
not use any dependencies that are not available as standard on all supported
|
||||
operating systems beyond libstdc++, libc, and whatever else is currently
|
||||
required to build the core. Modules which use nonstandard dependencies belong
|
||||
in the modules/extra directory.
|
||||
|
||||
|
||||
16. Profiling and Performance
|
||||
|
||||
It is one thing to assume that code performs bad, it is another thing to prove
|
||||
that it actually is. A lot of experienced programmers talk about 'premature
|
||||
optimisation', and here is what it means: if you have a piece of code called
|
||||
once on startup that takes 10 seconds instead of one second to run, and a
|
||||
piece of code that takes 0.05 seconds to run when it should take 0.01, and
|
||||
it is called once per second, the second piece of code is the priority.
|
||||
|
||||
In other words, make sure that what you think is slow, and a performance
|
||||
problem in Insp actually is.
|
||||
To do this, use the callgrind tool from Valgrind (valgrind --tool=cachegrind
|
||||
bin/inspircd -nofork -debug), and kcachegrind (or similar) to view the output
|
||||
files.
|
||||
+44
-445
@@ -1,452 +1,51 @@
|
||||
Anope Version 2.0.16-git
|
||||
------------------------
|
||||
No significant changes.
|
||||
Anope Version 2.1.3
|
||||
-------------------
|
||||
Added alternate command suggestions when a user runs an invalid command.
|
||||
Added support for the IRCv3 +draft/channel-context tag.
|
||||
Added support for the IRCv3 +draft/reply tag.
|
||||
Allow using more than one fingerprint in an oper block.
|
||||
Changed chanserv/drop to use confirmation codes to confirm a channel drop.
|
||||
Cleaned up more of the codebase to use Modern C++17.
|
||||
Enabled using more field limits sent by the IRC server instead of requiring the user to configure them.
|
||||
Fixed NickServ lying about the minimum password length.
|
||||
Fixed a crash when sending emails.
|
||||
Fixed bs_kick not using the correct kick message for automatic kicks.
|
||||
Increased the security of randomly generated confirmation codes.
|
||||
Removed the ns_access module and associated cs_secure and ns_secure options.
|
||||
Removed the ns_status module.
|
||||
Reworked how messages are sent in protocol modules to allow sending message tags.
|
||||
|
||||
Anope Version 2.0.15
|
||||
--------------------
|
||||
Fixed a race condition in changing the nick of a user.
|
||||
Fixed being able to reset the password of suspended accounts.
|
||||
Fixed chanserv/suspend info not being visible to regular users.
|
||||
Fixed removing entries by an alias in chanserv/access and chanserv/xop.
|
||||
Fixed various grammar issues in messages.
|
||||
Made the SASL PLAIN implementation more robust.
|
||||
Anope Version 2.1.2
|
||||
-------------------
|
||||
Bumped the minimum OpenSSL version to 1.1.0.
|
||||
Bumped the minumum GnuTLS version to 3.0.0.
|
||||
Disabled SSLv3 support in the m_ssl_openssl module.
|
||||
Modernized mutex and thread code to use Modern C++.
|
||||
Normalised the program exit codes.
|
||||
Updated the Dutch translation.
|
||||
Updated the French translation.
|
||||
Updated the Turkish translation.
|
||||
|
||||
Anope Version 2.0.14
|
||||
--------------------
|
||||
Added support for sqlining channels on UnrealIRCd.
|
||||
Fixed a crash when trying to access config for non-loaded modules.
|
||||
Fixed detection of the InspIRCd nopartmsg module.
|
||||
Fixed not getting memo notifications when authing with SASL.
|
||||
Fixed not serialising dontkickops/dontkickvoices in botserv/kick.
|
||||
Fixed sending emails with the wrong kind of line terminator.
|
||||
Fixed sending log messages from a renamed pseudoclient.
|
||||
Fixed telling users their passcode is incorrect when they need to authenticate in nickserv/confirm.
|
||||
Fixed the Config script freezing on some versions of util-linux.
|
||||
Updated the Windows packaging scripts to use dependencies from Conan.
|
||||
|
||||
Anope Version 2.0.13
|
||||
--------------------
|
||||
Fixed a crash on some compilers when trying to call methods on a null pointer
|
||||
Fixed a crash when encountering an unterminated commented config block
|
||||
Fixed erroneously rejecting spaces in fantasy:name
|
||||
Fixed marking services pseudoclients as an oper on InspIRCd
|
||||
Fixed not checking user@ip as well as user@host when logging into an operator account
|
||||
Fixed setting the vhost/vident during SASL on UnrealIRCd
|
||||
Updated the German translation
|
||||
Updated the Italian translation
|
||||
|
||||
Anope Version 2.0.12
|
||||
--------------------
|
||||
Added account confirmation to the web panel
|
||||
Added the regex_pcre2 module which provides regex/pcre with PCRE2
|
||||
Documented the cs_no_expire channel default
|
||||
Fixed config validation mistakenly allowing spaces in some fields
|
||||
Fixed the bahamut protocol module not knowing about halfops
|
||||
Fixed writing a flatfile database not being atomic
|
||||
Updated the hybrid protocol module for recent protocol changes
|
||||
|
||||
Anope Version 2.0.11
|
||||
--------------------
|
||||
Fixed ldap on OpenLDAP 2.5+
|
||||
Fixed not using utf-8 encoding for outgoing email
|
||||
Fixed ns_resetpass not returning a response for XMLRPC
|
||||
Fixed some message params being sent as <middle> instead of <trailing>
|
||||
Fixed unsetting vhosts on unreal4
|
||||
Fixed username validity checking on ircd-hybrid
|
||||
Send the oper mode for services pseudoclients on InspIRCd
|
||||
Updated the pl_PL translation
|
||||
Updated unreal4 for various protocol changes
|
||||
|
||||
Anope Version 2.0.10
|
||||
--------------------
|
||||
Add support for channel SQLines on InspIRCd
|
||||
Change default protocol module from inspircd20 to inspircd3
|
||||
Change the character set used by chanstats and irc2sql to utf8mb4
|
||||
Fix a ton of typos in messages
|
||||
Fix being able to override MAXLIST on InspIRCd
|
||||
Fix blocking on boot when trying to upgrade SQL databases without account identifiers
|
||||
Fix not flushing the ERROR message on squit
|
||||
Fix using an invalidated iterator when deleting bots
|
||||
Fix various harmless compiler warnings
|
||||
Fix webcpanel not using the forwarded IP
|
||||
Show the account name in nickserv/info
|
||||
|
||||
Anope Version 2.0.9
|
||||
Anope Version 2.1.1
|
||||
-------------------
|
||||
Fix a regression from 2.0.8 that prevented serialising to MySQL
|
||||
Send account identifiers to InspIRCd on SASL logins too
|
||||
Fix a query bug in irc2sql
|
||||
Added the UNBANME privilege to allow users to unban themselves.
|
||||
Fixed building on Windows systems without chgrp/chmod.
|
||||
Fixed creating sockets in the m_dns, m_httpd, m_proxyscan, and m_redis modules.
|
||||
Fixed reading the values of command line arguments.
|
||||
Moved core privilege descriptions to the example configs.
|
||||
Updated the Italian translation.
|
||||
Updated the Polish translation.
|
||||
|
||||
Anope Version 2.0.8
|
||||
Anope Version 2.1.0
|
||||
-------------------
|
||||
Add +K channel mode for ircd-hybrid
|
||||
Add immutable identifiers to user accounts
|
||||
Fix build on systems that use musl libc
|
||||
Fix help of global/global not showing the correct origin nick
|
||||
Fix not removing vhosts when an nick is dropped
|
||||
Fix parsing channel metadata on InspIRCd 3+
|
||||
Fix parsing kicks on InspIRCd 3+
|
||||
Fix parsing topic changes on InspIRCd 3+
|
||||
Fix topiclock on InspIRCd
|
||||
Modernize the ircd-hybrid protocol module
|
||||
|
||||
|
||||
Anope Version 2.0.7
|
||||
-------------------
|
||||
Fix not sending login data on successful NickServ GROUP
|
||||
Fix m_httpd to not consider headers to be case sensitive
|
||||
Add InspIRCd 3 protocol support
|
||||
Add 'n' email token for use in the email change template
|
||||
Add logging for NickServ UNGROUP
|
||||
Fix setting swhois on UnrealIRCd
|
||||
Add nickserv/recover permission to allow opers to recover other users
|
||||
Fix superadmin not being removed when deopering
|
||||
Fix setting nickserv access list in webcpanel
|
||||
Add support for post-handshake SASL in Unreal 4.2.2+
|
||||
Add logging for channel memo deletionso
|
||||
|
||||
Anope Version 2.0.6
|
||||
-------------------
|
||||
Log client IP for web clients running commands via webcpanel
|
||||
Fix log file path for the config file could not be opened log message
|
||||
Allow nickserv/group to be used via XMLRPC
|
||||
Fix logsearch without wildcards
|
||||
Support cidr exempts in m_dnsbl
|
||||
Add support for IPv6 dnsbls
|
||||
Add +u and +L channel modes for ircd-hybrid
|
||||
Set +x after hostserv/off on InspIRCd and UnrealIRCd
|
||||
Fix chanserv/mode not being able to set extbans
|
||||
Send CHGIDENT/CHGHOST on SVSLOGIN on InspIRCd
|
||||
Fix escaping replies from commands in webcpanel
|
||||
Enable require_oper for all opers added via operserv/oper
|
||||
Advertise SASL mechanisms to UnrealIRCd servers
|
||||
|
||||
Anope Version 2.0.5
|
||||
-------------------
|
||||
Fix negative levels to not match users with negative access
|
||||
Fix memo sender to always be the account name of the sender
|
||||
Allow unregistered users to use the ChanServ seen command
|
||||
Fix secureops to not be enforced on operators with the chanserv/administration privilege
|
||||
Fix command name in HELP syntax messages to always be upper case
|
||||
Show unconfirmed nickname messages on registration in webcpanel
|
||||
Fix NickServ SET EMAIL to be executable via XMLRPC
|
||||
Fix OperServ USERLIST/CHANLIST to accept regexes
|
||||
Allow OperServ USERLIST to also match realname syntax (n!u@h#r)
|
||||
Fix db_old importing languages to use the UTF-8 version
|
||||
Fix m_dns to return REFUSED if no answers could be found
|
||||
Fix ns_maxemail to be case insensitive
|
||||
Add MemoServ READ ALL command
|
||||
Add support for NickServ GROUP to be executed via XMLRPC
|
||||
Add support for logging hostname/ip of SASL authentication attempts, if supported by IRCd
|
||||
|
||||
Anope Version 2.0.4
|
||||
-------------------
|
||||
Add notice rpc method to XMLRPC
|
||||
Fix access check in cs_updown to not allow actions on users with equal access
|
||||
Fix randomnews to work when there are more than 'newscount' random news
|
||||
Fix crash from handling nick introduction collisions on unreal4
|
||||
Add support for GCC6
|
||||
Fix handling /join 0 on ratbox
|
||||
Fix saset display to update the account of the proper user
|
||||
Fix nickserv/confirm to send account and +r when appropriate
|
||||
Fix chankill to not add duplicate akills
|
||||
Allow nickserv/maxemail to disregard gmail style aliases when comparing emails
|
||||
Fix chanserv/mode when setting listmodes with CIDR ranges
|
||||
Fix reported expiry time when the time is divisible by 1 year
|
||||
Clarify botserv repeat kicker help and allow setting repeat times to 1
|
||||
Send vident/vhost with SASL login
|
||||
Add support for SASL reauth
|
||||
Fix log and database backup directories to be properly created by the installer
|
||||
|
||||
Anope Version 2.0.3
|
||||
-------------------
|
||||
Add support for UnrealIRCd 4
|
||||
Fix cs_access to respect chanserv/access/list privilege
|
||||
Fix cs_access to match level -1 as every user, not any level <0
|
||||
Fix problems related to object destruction order when using db_sql_live
|
||||
Show memo notify settings in ms_info
|
||||
Fix some actions bumping channels last used time that shouldn't have
|
||||
Add maxlogins configuration directive to limit the number of concurrent logins to one account
|
||||
Fix race with auto svsnick on ghost sometimes causing nick collisions instead
|
||||
Fix saset language reply
|
||||
Show akill/sxlines ids in VIEW
|
||||
Fix crash when an oper is configured in both the configuration and via os_oper
|
||||
Fix m_ldap reconnect logic not properly setting protocol and network timeout settings
|
||||
Fix crash from unloading regex modules when regex xlines exist
|
||||
Fix irc2sql to store away messages
|
||||
Add notice method to m_xmlrpc_main
|
||||
Fix numerics on InspIRCd from being sent to user UID
|
||||
Fix usermode +I on UnrealIRCd to be considered oper only
|
||||
Fix crash in webcpanel when deleting your own access on a channel
|
||||
Fix webcpanel allowing suspended users to login
|
||||
Fix hs_off on InspIRCd to not desync active user host
|
||||
Fix bs_bot to not allow colliding bots into users
|
||||
Don't allow hostserv modules to load if there is no hostserv
|
||||
Fix ns_register allowing bot nicks to be registered through webcpanel
|
||||
Don't update chanserv keepmodes during inhabit
|
||||
Fix build on cmake 2.4
|
||||
Allow searching emails by wildcard in ns_getemail
|
||||
|
||||
Anope Version 2.0.2
|
||||
-------------------
|
||||
Fix keepmodes preventing the first user of a channel from being deopped
|
||||
Fix SQlines that don't begin with # from matching channels
|
||||
Made cs_clone behave like the help describes, copying many settings and lists by default
|
||||
Allow cs_clone to clone levels, too
|
||||
Update Hybrid protocol module for 8.2
|
||||
Fix not unescaping all characters sent over XMLRPC
|
||||
Fix crash when os_mode is used to destroy channels, like when unsetting permanent channel mode from an empty channel
|
||||
Allow users with topic change privilege to change the topic instead of requiring them to use ChanServ's topic command
|
||||
Fix negatively locking param modes in default mlock
|
||||
Change entrymsg to check for the SET privilege, not real founder
|
||||
Allow configuring characters allowed in nicknames
|
||||
Fix crash when non users register channels externally (like XMLRPC)
|
||||
Remove operserv/exception MOVE, it did not function correctly. Instead reorder the list by deleting/adding entries.
|
||||
Allow flood ttb to be 0.
|
||||
Enforce mlock when disabling defcon modes
|
||||
Fix cs_mode not being able to apply mlock on register
|
||||
Add log message when users send memos
|
||||
Fix old collide timers from staying around after successful identify. Fixes being able to identify and logout and still being hit by the old timers.
|
||||
Fix undefined behavior in cs_mode which usually crashes when clearing large list modes
|
||||
Show all opertypes in operserv/info, even if no opers use them
|
||||
|
||||
Anope Version 2.0.1
|
||||
-------------------
|
||||
Fix access entries on accounts sometimes not updating when a user's display name changes
|
||||
Fix ns_group to properly validate the account of the user against the target
|
||||
Fix os_stats not saving max user count and time when using SQL
|
||||
Fix nickalias's 'nc' field sometimes not being updated when using SQL
|
||||
Fix several crashes on Windows related to being unable to load modules
|
||||
Fix bs_bot change not properly reintroducing bots after changing their ident, host, or realname
|
||||
|
||||
Add English language file to allow users to easily modify language strings
|
||||
Add configuring which mode cs_ban sets, and added a MUTE command to BotServ's fantasy
|
||||
Allow SVSPART to take an optional reason
|
||||
Allow cs_list to search channel topics and descriptions
|
||||
|
||||
Anope Version 2.0.0
|
||||
-------------------
|
||||
Added irc2sql stats module
|
||||
|
||||
Anope Version 1.9.9
|
||||
-------------------
|
||||
A Added a better webpanel template, removed the old one
|
||||
A Added SQL logging support
|
||||
A Added Redis database support
|
||||
A Added ability to configure what privileges XOP commands give
|
||||
U Updated Dutch language file, from Robby <robby@chat.be>
|
||||
U Updated Spanish language file, from Isaac Fontal <i_fontal@hotmail.com>
|
||||
F Fix build on Solaris and OSX
|
||||
F Fixed setting BotServ's default settings in the config
|
||||
F Fixed some names of config items, including NickServ's kill protect
|
||||
|
||||
Anope Version 1.9.8
|
||||
-------------------
|
||||
A Ability to configure fantasy commands in the config
|
||||
A Add SVSJOIN and SVSPART commands
|
||||
F Fix "leave" channel log level from not logging
|
||||
F Fix users able to "resend" their registration mail with registration set to admin only
|
||||
F Fix build on OpenBSD
|
||||
F Fix not logging debug logs to the logfile when debug mode is enabled
|
||||
F Fix defcon timeout timer
|
||||
F Fix crash in os_forbid with expiring entries
|
||||
F Fix several issues with db_sql_live
|
||||
|
||||
Anope Version 1.9.7
|
||||
-------------------
|
||||
A Added ability for using regex as patterns for various commands
|
||||
A Extended ability of operserv/akill to also match against nick and realname
|
||||
A Added chanserv:require configuration option
|
||||
A Added nickserv:unregistered_notice and nickserv:registration configuration option
|
||||
A Added options:casemap configuration option
|
||||
A Added a web panel
|
||||
A db_sql_live now allows all tables to be "live", not just a select few
|
||||
|
||||
Anope Version 1.9.6
|
||||
-------------------
|
||||
A Added ability to configure emails sent by services
|
||||
A Added chanserv/up and chanserv/down
|
||||
A Added m_proxyscan
|
||||
A Added more configurability for what vhosts are valid
|
||||
A Added chanserv/log
|
||||
A Added ability to configure ChanServ privileges
|
||||
A Added a new database format
|
||||
A Added SQLite support
|
||||
A Added more verbose messages on startup
|
||||
A Added ability for chanserv/suspend and nickserv/suspend to take an expiry time
|
||||
A Added no nickname ownership config option
|
||||
A Added m_rewrite
|
||||
A Added akill IDs
|
||||
F Fixed crash in clearusers
|
||||
F Fixed crash in /os oper info
|
||||
F Fixed eventfd Config check to work properly on OpenVZ
|
||||
|
||||
Anope Version 1.9.5
|
||||
-------------------
|
||||
A Extended LDAP support
|
||||
A Added os_oper, os_kill, os_forbid, m_statusupdate, cs_sync, and bs_autoassign
|
||||
A Added a new configuration file format
|
||||
A Added a new commands system
|
||||
A Added a new access system, and cs_flags
|
||||
F Fixed not logging debug logs to file
|
||||
F Fixed the mail delay time
|
||||
F Fixed sending account data for unconfirmed nicks
|
||||
F Fixed poll() engine build on FreeBSD
|
||||
F Fixed really large HELP replies being truncated
|
||||
F Fixed sometimes appending !*@* to valid hosts on access lists
|
||||
F Fixed m_ssl sometimes failing connecting for no reason
|
||||
F Fixed crash in cs_entrymsg
|
||||
F Fixed setting -P on channels with only a botserv bot in it
|
||||
F Fixed modemanager complaining about prefixless modes on InspIRCd
|
||||
|
||||
Anope Version 1.9.4
|
||||
-------------------
|
||||
A Automatically set channel founder to the user with the highest access if there is no successor
|
||||
A /chanserv clone command to copy settings from one channel to another.
|
||||
A /chanserv mode command
|
||||
A Ability for users to delete their own access in channels
|
||||
A Added support for Plexus 3
|
||||
A Readded in support for /cs op/deop/etc to op/deop you in all channels
|
||||
A Added LDAP support
|
||||
A Added live SQL support
|
||||
A Added support for learning tracking/storing/locking all modes at runtime
|
||||
A Added m_alias
|
||||
A Added support for XMLRPC queries
|
||||
A Added /botserv set msg
|
||||
A Added /operserv config
|
||||
A Added /ns cert
|
||||
A Added /operserv login
|
||||
F Changed the GHOST command to not allow ghosting unidentified users if the RECOVER command exists
|
||||
F Some failed logic in /operserv exception that prevents proper exceptions from being added
|
||||
F Fixed the anope_os_sxlines MySQL table and code to work after restarting
|
||||
|
||||
Anope Version 1.9.3
|
||||
-------------------
|
||||
A Added italics BotServ kicks support
|
||||
A Tell users when their nicks expire in /ns glist and /ns info
|
||||
A Added SSL support
|
||||
A Prevent negative mode changes, kicks, bans, and autokicks from affecting people with the 'god' user mode (On UnrealIRCd, usermode +q)
|
||||
A Added nickserv/auxpex permission
|
||||
A Added nickserv ungroup command
|
||||
A Renamed the SGLINE to be SNLINE
|
||||
A Added /chanserv saset command
|
||||
A Added threads for mail sending
|
||||
A Added m_dnsbl and an asynchronous DNS system
|
||||
A Added a new language system that uses gettext
|
||||
A Added m_mysql which uses threads to execute queries
|
||||
A Added many subcommand modules for some commands, eg ns_set_autoop, ns_set_email, etc
|
||||
A Added a new logging system that is a bit more flexible
|
||||
A Added cs_set_misc and ns_set_misc to add miscellaneous set commands
|
||||
A Added os_modreload, which allows reloading some modules not normally unloadable, like the protocol module
|
||||
A Added FOUNDER access level
|
||||
A Made OperServ, Global, MemoServ, and ChanServ optional
|
||||
F Shutting down if a config reload fails
|
||||
F Autoid to live through restarts on Unreal
|
||||
F Storing vhosts in MySQL
|
||||
F Not flushing the anope_extra table before rewriting database
|
||||
F Anoperc start/stop to send the globaloncycle global, and fixed anoperc rehash to really rehash
|
||||
F Fixed a potential crash if HostServ or BotServ was disabled
|
||||
|
||||
Anope Version 1.9.2
|
||||
-------------------
|
||||
A K alias to chanserv kick command
|
||||
A KB alias to chanserv ban command
|
||||
A The ability to register empty nonregistered channels
|
||||
A Flatfile plaintext databases and removed old binary ones
|
||||
A Added in live updating SQL and the ability to execute commands through SQL (see docs/MYSQL)
|
||||
A Added support for many more modes into Anope and the ability to have generic support for modes unknown to Anope
|
||||
A Added a mode stacker to combine many mode changes into fewer
|
||||
A Added in the CS SET PERSIST command which can be used to keep service bots in channels even when the channel is empty
|
||||
A Added AUTOOWNER OWNER and OWNERME into CS LEVELS
|
||||
A Added ns_resetpass module to the core
|
||||
A CS ACCESS VIEW which shows who added the access and last time used
|
||||
A Last used time to CS AKICK VIEW
|
||||
A Added a sha_256 encryption module
|
||||
A Added the ability to load multiple encryption modules, and the ability to seamlessly convert your database between different encryptions
|
||||
A Added configuration options to allow Anope to reconnect if it disconnects from the uplink instead of dying
|
||||
A Added support for linking with IPv6
|
||||
F Unban command to accept an optional nick arg
|
||||
F Some typos in services.conf
|
||||
F Crash when users change their host that are identified to a group, but not a nick
|
||||
F Host length checking in HS SET(ALL) and HS REQUEST
|
||||
F Only show if a user is online in NS INFO if they are really identified for the group of the nick they are on
|
||||
F Crash when using BSSmartJoin
|
||||
F Converting access entries to access from xop when a users access is below voice
|
||||
F A bad pointer passed to the OnDelEvent which could cause some 3rd party modules to crash
|
||||
F CS FORBID allows to you forbid unregistered channels
|
||||
F The -nothird command line option to work
|
||||
F ms_rsend to really work
|
||||
F SQUITing juped servers on InspIRCd1.2+
|
||||
|
||||
Anope Version 1.9.1
|
||||
-------------------
|
||||
F Don't enforce akick/forbidden/etc.-restrictions on clients on ulined servers.
|
||||
F Remove modules_unload_all fini + hack that goes with it.
|
||||
F Signal handling cleanup.
|
||||
A Seamless fantasy support on all ChanServ commands, instead of requiring bs_fantasy_*.
|
||||
F Allow fantasy to be disabled on some commands (e.g. FORBID).
|
||||
F Some commands (e.g. !help) need to strip the pre-provided channelname from them.
|
||||
D HelpServ removed
|
||||
F Command parser cleanup: mod_current_buffer removed and replaced with proper parser. Commands now indicate how they want the buffer split.
|
||||
F Make NS ENFORCE/RELEASE stuff more sane, redo timers.
|
||||
A Opertypes (similar to InspIRCd's opertypes)
|
||||
|
||||
Provided by Ankit <ankit@nevitus.com> - 2009
|
||||
F Segfault on shutdown
|
||||
|
||||
Provided by Adam <adam@anope.org> - 2009
|
||||
F NickServ registration is sometimes denied.
|
||||
F Applied patch from Adam to fix some potential screwups
|
||||
F More fixes to bs_bot from Adam, plus an extra fix within DoAdd not covered in Adam's patch.
|
||||
F Fix bs_bot to use the correct parameters, patch from Adam.
|
||||
F Fix for bug #1004, based from second half of patch from Adam.
|
||||
F Partial patch by Adam, commenting fix for #1006 for future reference.
|
||||
F Forward-port r1946: Patch by Adam fixing #1006 (originally caused by #922): modes set by ChanServ are reversed. Thanks!
|
||||
|
||||
Provided by DukePyrolator <dukepyrolator@gmx.de> - 2009
|
||||
F Patch converting all match calls to new method, thanks!
|
||||
F Add 'w' and 'y' support to dotime(), also prevent an overflow.
|
||||
F Allow NS STATUS from unregistered users, thanks DP!
|
||||
F Wild pointers do not a happy Anope make. Thanks DP :)
|
||||
F Allow NS REGISTER to unregistered nicks, silly oversight. Thanks DP! :)
|
||||
F Fix call order, thanks to DP
|
||||
F Pass the right array to do_umode(), fixes mode tracking on Unreal. Thanks to DukePyrolator (yet again :P)
|
||||
F Fix bs_set help, thanks to DukePyrolator! :)
|
||||
F Fix two segfaults, noted by DukePyrolator. Thanks!
|
||||
F Fix part one of #1010, reported by DukePyrolator. (Language settings are not respected in message sending.) Thanks!
|
||||
F Memory leak on +beI modes.
|
||||
|
||||
Provided by Liber <Liber@jasonirc.net> - 2009
|
||||
F Support operoverride and such things (stop reversing changes from nonopped people where unnecessary)
|
||||
|
||||
Anope Version 1.9.0
|
||||
-------------------
|
||||
F Modified compile to use g++
|
||||
F Improve protocol modules support (classes, virtual methods, etc)
|
||||
F Move core services to use BotInfo
|
||||
F Move BotInfo and related methods into a class
|
||||
F Move modules into a class
|
||||
F Fixed ns resending of passcode issue
|
||||
F Modules now delete themselves
|
||||
F additional field where users' masked host can be stored so both masked IP and vhost are available instead of just one.
|
||||
F No struct Uid, ugly, and, unnecessary that we store UID in BotInfo.
|
||||
F Prevent deletion of core services via /bs bot
|
||||
F Module subsystem cleanup ('modules' branch)
|
||||
F Move modules to use classes somewhat (AnopeInit, AnopeFini)
|
||||
F Change MODULE_INIT to return a pointer
|
||||
F Remove duplicate module creation.. have loadModule return a pointer rather than creating one
|
||||
F Remove buffered loading/unloading, this makes os_modunload perm, but who cares
|
||||
F Remove 'delayed' loading, this is necessary because of before/after connected to ircd (ircd is before, rest after), I'm sure this can be done better.
|
||||
A Remove old config, replace with insp-inspired (albeit bind format) config (CBX)
|
||||
F Clean up protocol modules a bit
|
||||
A InspIRCd 1.2 support
|
||||
F Remove old (prior to 1.8.0) db compat
|
||||
F Establish a proper base for services pseudoclients
|
||||
F Add ss_main StatServ Hal9000 to play with :)
|
||||
F Burn automake with fire (CBX)
|
||||
|
||||
Provided by mooncup <mooncup@anonnet.org> - 2009
|
||||
F Automatically reapply vhost on hs off for unreal.
|
||||
Added support for access list entry descriptions.
|
||||
Added support for linking over a UNIX socket.
|
||||
Added support for server-initiated logins and logouts on UnrealIRCd.
|
||||
Added support for server-initiated logouts on InspIRCd.
|
||||
Added support for the ANONYMOUS SASL mechanism.
|
||||
Allowed users to opt-out of being added to channel access lists.
|
||||
Cleaned up the codebase to use Modern C++17.
|
||||
Modernized the build system to use a modern version of CMake.
|
||||
Removed support for using insecure encryption methods as the primary method.
|
||||
Removed the Windows-only anopesmtp tool.
|
||||
Removed the two day X-line cap.
|
||||
Updated all references to IRCServices to refer to Anope instead.
|
||||
|
||||
+39
-229
@@ -1,236 +1,46 @@
|
||||
Anope Version 2.0.16-git
|
||||
------------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.15
|
||||
--------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.14
|
||||
--------------------
|
||||
Added mail:content_type to allow customizing the content type of emails.
|
||||
|
||||
Anope Version 2.0.13
|
||||
--------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.12
|
||||
--------------------
|
||||
Added the regex_pcre2 module
|
||||
|
||||
Anope Version 2.0.11
|
||||
--------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.10
|
||||
--------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.9
|
||||
Anope Version 2.1.3
|
||||
-------------------
|
||||
No significant changes.
|
||||
Added options:didyoumeandifference.
|
||||
Added support for multiple SSL fingerprints in oper:certfp.
|
||||
Added the chanserv/cert oper privilege for modifying other user's certificate lists.
|
||||
Changed networkinfo:chanlen to default to 32 if not set.
|
||||
Changed networkinfo:hostlen to default to 64 if not set.
|
||||
Changed networkinfo:modelistsize to default to 100 if not set.
|
||||
Changed networkinfo:nicklen to default to 31 if not set.
|
||||
Changed networkinfo:userlen to default to 10 if not set.
|
||||
Increased the default maximum password length to 50 characters.
|
||||
Increased the default minimum password length to 10 characters.
|
||||
Removed the cs_secure option in module:defaults from the chanserv module (now always enabled).
|
||||
Removed the nickserv/saset/secure command.
|
||||
Removed the nickserv/saset/secure oper privilege.
|
||||
Removed the nickserv/set/secure command.
|
||||
Removed the nickserv/status command.
|
||||
Removed the ns_access module.
|
||||
Removed the ns_secure option in module:defaults from the nickserv module (now always enabled).
|
||||
|
||||
Anope Version 2.0.8
|
||||
Anope Version 2.1.2
|
||||
-------------------
|
||||
Fix ns_register:unconfirmedexpire not being used
|
||||
Added module:tlsv10 to the ssl_openssl module for configuring whether TLSv1.0 is usable (defaults to no).
|
||||
Added module:tlsv11 to the ssl_openssl module for configuring whether TLSv1.1 is usable (defaults to yes).
|
||||
Added module:tlsv12 to the ssl_openssl module for configuring whether TLSv1.2 is usable (defaults to yes).
|
||||
Removed module:sslv3 from the ssl_openssl module (now always disabled).
|
||||
Removed the m_ prefix from the names of the chanstats, dns, dnsbl, helpchan, httpd, ldap, ldap_oper, mysql, proxyscan, redis, regex_pcre2, regex_posix, regex_stdlib, regex_tre, rewrite, sasl, sql_log, sql_oper, sqlite, ssl_gnutls, ssl_openssl, xmlrpc, and xmlrpc_main modules.
|
||||
|
||||
Anope Version 2.0.7
|
||||
Anope Version 2.1.1
|
||||
-------------------
|
||||
Add nickserv/recover permission
|
||||
Add inspircd3 protocol module
|
||||
Add default permission for chanstats saset chanstats command
|
||||
Added the m_regex_stdlib module.
|
||||
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
|
||||
|
||||
Anope Version 2.0.6
|
||||
Anope Version 2.1.0
|
||||
-------------------
|
||||
Mark enc_md5 and enc_sha1 as deprecated. Their use has been discouraged for years, and they will be removed in a future release.
|
||||
Exempt all of 127.0.0.0/8 from m_dnsbl by default
|
||||
Load m_sasl by default
|
||||
Fix documentation for nickserv default option ns_keep_modes
|
||||
|
||||
Anope Version 2.0.5
|
||||
-------------------
|
||||
No significant changes.
|
||||
|
||||
Anope Version 2.0.4
|
||||
-------------------
|
||||
Removed m_sasl_dh-aes and m_sasl_dh-blowfish
|
||||
|
||||
Anope Version 2.0.3
|
||||
-------------------
|
||||
Add operserv/chankill to default globops log
|
||||
Add ns_identify:maxlogins to limit the max number of concurrent logins per account
|
||||
Document ns_no_expire nickserv default
|
||||
Remove default session exception expiry time
|
||||
|
||||
Anope Version 2.0.2
|
||||
-------------------
|
||||
Add an operserv/oper/modify privilege, required to use oper add and oper del
|
||||
Add a chanserv/access/list privilege, which allow readonly access to ChanServ access and akick lists
|
||||
Changed m_dnsbl's result configuration to be more extensible
|
||||
Add 'max' setting to cs_mode
|
||||
Add 'nickchars' setting to networkinfo
|
||||
Add 'botserv/fantasy', 'chanserv/access/list', and 'operserv/oper/modify' oper privileges
|
||||
Fix 'emailchange_message' to include the proper email address
|
||||
Set a default permission on operserv/defcon
|
||||
|
||||
Anope Version 2.0.1
|
||||
-------------------
|
||||
Add MUTE command to BotServ fantasy configuration
|
||||
Document memo_mail option in nickserv.conf
|
||||
Add 'show' setting to ns_info and cs_info to control which fields are shown to non opers
|
||||
|
||||
Anope Version 2.0.0
|
||||
-------------------
|
||||
options:passlen, enforceruser, enforcerhost, releasetimeout, and guestnickprefix moved to nickserv's module configuration
|
||||
options:hideregisteredcommands added
|
||||
m_ssl renamed to m_ssl_openssl
|
||||
mail:restrict removed
|
||||
|
||||
Anope Version 1.9.9
|
||||
-------------------
|
||||
There is not many config changes between 1.9.8 and 1.9.9, however many of the
|
||||
options have been moved around to make more sense, too many to list here,
|
||||
so get a new config.
|
||||
|
||||
Anope Version 1.9.8
|
||||
-------------------
|
||||
networkinfo:chanlen added
|
||||
options:user and options:group added
|
||||
nickserv:modesonid added to set modes on everyone who identifies
|
||||
nickserv:kill and nickserv:killquick added to configure NickServ's kill timeout
|
||||
nickserv:restoreonrecover added to try to restore a user's session after a ghost
|
||||
command:group added
|
||||
fantasy block added
|
||||
dns block has been moved to modules.conf as a part of m_dns
|
||||
|
||||
Anope Version 1.9.7
|
||||
-------------------
|
||||
operserv:notifications removed in favor of log{} blocks
|
||||
options:regexengine added
|
||||
options:casemap added
|
||||
chanserv:require added
|
||||
nickserv:registration added, emailregistration removed.
|
||||
nickserv:unregistered_notice added
|
||||
|
||||
Anope Version 1.9.6
|
||||
-------------------
|
||||
service:channels added to join services to channels
|
||||
mail block modified to allow configuring of email messages
|
||||
oper:host and oper:vhost added
|
||||
oper:require_oper added
|
||||
options:nonicknameownership added
|
||||
operserv:akillids added
|
||||
nickserv/access oper privilege added
|
||||
|
||||
Anope Version 1.9.5
|
||||
-------------------
|
||||
Don't even try it, get a new config and start over.
|
||||
|
||||
Anope Version 1.9.4
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
memoserv:modules added ms_ignore
|
||||
chanserv:modules added cs_clone and cs_mode
|
||||
nickserv:suspendexpire and nickserv:forbidexpire added
|
||||
chanserv:suspendexpire and chanserv:forbidexpire added
|
||||
module added cs_entrymsg
|
||||
nickserv:modules added ns_ajoin, ns_cert
|
||||
options:nomlock added
|
||||
log:target added globops
|
||||
nickserv:confirmemailchanges added
|
||||
operserv:modules added os_config, os_login
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
operserv:notifications removed osglobal, osmode, oskick, osakill, ossnline, ossqline, osszline, osnoop, osjupe, getpass, setpass, forbid, drop
|
||||
renamed nickserv:preregexpire to nickserv:unconfirmedexpire
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
opertype:commands removed operserv/umode
|
||||
operserv:modules removed os_umode
|
||||
|
||||
Anope Version 1.9.3
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
nickserv/auspex privilege added
|
||||
SSL module added for SSL support
|
||||
opertype:inherits added to allow opertypes to inherit commands and privs from other opertypes
|
||||
Various nickserv/saset/* and chanserv/saset/* opertype command privileges added
|
||||
nickserv:modules added many new ns_set_command modules
|
||||
chanserv:modules added many new cs_set_command modules
|
||||
opertype:commands added nickserv/saset/* and chanserv/saset/*
|
||||
options:socketengine added to choose what socket engine to use
|
||||
module:cs_set_misc and module:ns_set_misc added to replace the old set url/icq/email modules
|
||||
options:hideprivilegedcommands added to hide privileged commands from normal users
|
||||
log block added to customize logging
|
||||
dns block added to configure dns settings
|
||||
m_dnsbl added
|
||||
mysql configuration block added
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
opertype:commands changed operserv/sgline to opserv/snline
|
||||
operserv:modules changed os_sgline to os_snline
|
||||
operserv:modules added os_modreload
|
||||
operserv:sglineexpiry changed to operserv:snlineexpiry
|
||||
operserv:killonsgline changed to operserv:killonsnline
|
||||
operserv:notifications ossgline changed ossnline
|
||||
memoserv was made optional
|
||||
moved operserv:global configuration into its own global block
|
||||
chanserv was made optional
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
serverinfo:helpchannel removed because it has been readded in m_helpchan
|
||||
networkinfo:logchannel, logbot, logusers, logmaxusers, logchannel, and options:keeplogs removed because of the log block
|
||||
dumpcore because it really didn't do anything
|
||||
|
||||
Anope Version 1.9.2
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
options:enablelogchannel added to auto turn on the logchannel on startup
|
||||
options:mlock added to configure the default mlock modes on new channels
|
||||
options:database added for the database modules
|
||||
options:botmodes added to configure modes BotServ bots should use
|
||||
options:userlen added to configure maximum ident length
|
||||
options:hostlen added to configure maximum hostname length
|
||||
options:database added to configure what database modules to use
|
||||
options:passlen added to specify the maximum length of passwords
|
||||
uplink:ipv6 added to enable IPv6 connectivity
|
||||
options:maxretries added to specify the number of reconnect attempts allowed
|
||||
options:retrywait added to specify how long to wait between reconnect attempts
|
||||
opertype command chanserv/aop/list removed as it was unnecessary, use chanserv/access/list instead
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
options:encryption added enc_sha256
|
||||
chanserv:modules added cs_unban
|
||||
nickserv:modules added ns_resetpass
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
nickserv:database deleted because of new database system
|
||||
nickserv:prenickdatabase deleted because of new database system
|
||||
chanserv:database deleted because of the new database system
|
||||
botserv:database deleted because of the new database system
|
||||
hostserv:database deleted because of the new database system
|
||||
operserv:database deleted because of the new database system
|
||||
operserv:newsdatabase deleted because of the new database system
|
||||
operserv:exceptiondatabase deleted because of the new database system
|
||||
hs_request:database deleted because of the new database system
|
||||
os_ignore:database deleted because of the new database system
|
||||
serverinfo:localport deleted
|
||||
|
||||
Anope Version 1.9.1
|
||||
-------------------
|
||||
** ADDED CONFIGURATION DIRECTIVES **
|
||||
Opertypes have been added, through the opertype blocks.
|
||||
Services Operators are now specified in the oper blocks.
|
||||
|
||||
** MODIFIED CONFIGURATION DIRECTIVES **
|
||||
botserv:modules no longer contains bs_fantasy* modules, fantasy is now seamless.
|
||||
operserv:modules has replaced os_logonnews, os_opernews, and os_randomnews with os_news.
|
||||
operserv:modules no longer contains os_admin and os_oper modules, removed in favor of oper blocks.
|
||||
operserv:notifications no longer contains osraw due to removal of OS RAW.
|
||||
|
||||
** DELETED CONFIGURATION DIRECTIVES **
|
||||
Nick tracking has been removed as an option.
|
||||
Restricting of NS GETPASS and CS GETPASS removed in favor of opertypes.
|
||||
Host Setters were removed in favor of opertypes.
|
||||
HelpServ has been removed entirely.
|
||||
operserv:disableraw removed due to removal of OS RAW.
|
||||
Added nickserv:minpasslen for configuring the minimum password length (defaults to 8).
|
||||
Removed nickserv:strictpasswords as it is obsolete now nickserv:minpasslen exists.
|
||||
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).
|
||||
Renamed nickserv:passlen to nickserv:maxpasslen.
|
||||
Renamed the charybdis module to solanum.
|
||||
Renamed the inspircd3 module to inspircd.
|
||||
Renamed the unreal4 module to unrealircd.
|
||||
Replaced uplink:ipv6 with uplink:protocol.
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ Anope DefCon
|
||||
|
||||
1) Introduction
|
||||
|
||||
Anope 1.6 onwards supports a unique protection mechanism based on the
|
||||
Anope supports a unique protection mechanism based on the
|
||||
military "Defense Readiness Condition" (DefCon) system. It is based on
|
||||
5 levels of defense readiness defined as:
|
||||
|
||||
@@ -23,7 +23,7 @@ Anope DefCon
|
||||
These are configurable levels that mandates what actions Anope should
|
||||
take in case of emergency and change in readiness status.
|
||||
|
||||
It is used to prevent abuse to both Services, and the ircd on which they
|
||||
It is used to prevent abuse to both Anope, and the IRCd on which they
|
||||
are running. Also to protect the users, primarily in the event of Clones
|
||||
and/or FloodBOT attacks.
|
||||
|
||||
@@ -50,8 +50,8 @@ Anope DefCon
|
||||
Force Chan Mode
|
||||
Use Reduced Session Limit
|
||||
KILL any new clients trying to connect
|
||||
Services will ignore everyone but opers
|
||||
Services will silently ignore everyone but opers
|
||||
Ignore everyone but opers
|
||||
Silently ignore everyone but opers
|
||||
AKILL all new clients trying to connect
|
||||
No new memos sent to block MemoServ attacks
|
||||
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
Anope Internal Events
|
||||
---------------------
|
||||
|
||||
1) Intro
|
||||
2) Using Events
|
||||
|
||||
1) Introduction to Internal Events
|
||||
|
||||
Internal Events are setup to give module developers more information
|
||||
about what the core is doing at different times. This information can
|
||||
be as complex as data we are feeding to the uplink, to simple triggered
|
||||
events such as the databases being saved.
|
||||
|
||||
Additionally there is a module included with the core
|
||||
which can provide some clue as to how to use the code in your modules.
|
||||
The rest of this document assumes that you are used to writing modules.
|
||||
|
||||
2) Using Events
|
||||
|
||||
Each Event in Anope calls a function.
|
||||
You must override these functions in your main modules class.
|
||||
The full list of functions and parameters are in modules.h. In this
|
||||
case, you would be overriding OnJoinChannel() and OnPartChannel() like so:
|
||||
|
||||
void OnJoinChannel(User *u, Channel *c) anope_override { }
|
||||
void OnPartChannel(User *u, Channel *c) anope_override { }
|
||||
|
||||
Some of these event overrides can be used to prevent or allow things to
|
||||
happen that would normally not be allowed or denied. You can also use
|
||||
ModuleManager (not explained here) to set control which order the modules
|
||||
are queried (when multiple modules hook to the same event).
|
||||
|
||||
The "anope_override" identifier is for compatibility with C++11.
|
||||
Its usage is highly recommended.
|
||||
+12
-12
@@ -37,7 +37,7 @@ Note: You should also read the README and FAQ files!
|
||||
Next, unpack the package in your home directory, and go into the created
|
||||
directory.
|
||||
|
||||
If there are any extra modules you want to enable, such as m_mysql, run
|
||||
If there are any extra modules you want to enable, such as mysql, run
|
||||
the 'extras' script to enable them. If you do not know you can come back
|
||||
later and enable them.
|
||||
|
||||
@@ -52,8 +52,8 @@ Note: You should also read the README and FAQ files!
|
||||
cause trouble on your network if passwords are not encrypted, or read
|
||||
the memos of any user.
|
||||
|
||||
Now go into the conf directory (by default, ~/services/conf). Copy the example
|
||||
configuration file (example.conf) to services.conf, and open the latter
|
||||
Now go into the conf directory (by default, ~/anope/conf). Copy the example
|
||||
configuration file (anope.example.conf) to anope.conf, and open the latter
|
||||
with your favorite text editor. It contains all the configuration
|
||||
directives Anope will use at startup. Read the instructions contained in
|
||||
the file carefully. Using the default values is NOT a good idea, and will
|
||||
@@ -71,11 +71,11 @@ Note: You should also read the README and FAQ files!
|
||||
|
||||
* IMPORTANT: Back up your old databases!
|
||||
* If you are upgrading to a new major release, ALWAYS restart a
|
||||
fresh configuration file from example.conf.
|
||||
fresh configuration file from anope.example.conf.
|
||||
|
||||
3) Setting up the IRCd
|
||||
|
||||
Services acts as an IRC server with pseudo-clients on it. To link them to
|
||||
Anope acts as an IRC server with pseudo-clients on it. To link them to
|
||||
your network, you'll need to configure your IRCd to allow services to link.
|
||||
|
||||
The configuration varies depending on the IRCd, but you will probably need
|
||||
@@ -83,7 +83,7 @@ Note: You should also read the README and FAQ files!
|
||||
a shared block), and be sure that the IRCd is listening on the given port
|
||||
in the link block.
|
||||
|
||||
Example link configurations can be found in example.conf for some of the
|
||||
Example link configurations can be found in anope.example.conf for some of the
|
||||
popular IRCds.
|
||||
|
||||
Don't forget to /rehash your IRCd to apply changes.
|
||||
@@ -91,16 +91,16 @@ Note: You should also read the README and FAQ files!
|
||||
4) Starting Anope
|
||||
|
||||
Go into the directory where binaries were installed (by default, this is
|
||||
~/services/bin). Type ./services to launch Anope.
|
||||
~/anope/bin). Type ./anope to launch Anope.
|
||||
|
||||
If there are syntax errors in the configuration file they will be
|
||||
displayed on the screen. Correct them until there are no errors anymore.
|
||||
A successful startup won't generate any message.
|
||||
|
||||
Give Services at least one minute to link to your network, as certain
|
||||
Give Anope at least one minute to link to your network, as certain
|
||||
IRCds on some OSes may be really slow for the link process. If nothing
|
||||
happens after about a minute, it is probably a configuration problem. Try
|
||||
to launch Anope with ./services -debug -nofork to see any errors that it
|
||||
to launch Anope with ./anope -debug -nofork to see any errors that it
|
||||
encounters, and try to correct them.
|
||||
|
||||
If you need help to solve errors, feel free to subscribe to the Anope
|
||||
@@ -112,16 +112,16 @@ Note: You should also read the README and FAQ files!
|
||||
still running, and restart it if not.
|
||||
|
||||
First rename the example.chk script that is in Anope path (by default,
|
||||
this is ~/services/conf) to services.chk and edit it. You'll need to
|
||||
this is ~/anope/conf) to anope.chk and edit it. You'll need to
|
||||
modify the CONFIGURATION part of the file. Then ensure that the file is
|
||||
marked as executable by typing chmod +x services.chk, and try to launch the
|
||||
marked as executable by typing chmod +x anope.chk, and try to launch the
|
||||
script to see if it works (Anope must not be running when you do this ;))
|
||||
|
||||
When this is done, you'll have to add the crontab entry. Type crontab -e.
|
||||
This will open the default text editor with the crontab file. Enter the
|
||||
following (with correct path):
|
||||
|
||||
*/5 * * * * /home/ircd/services/conf/services.chk >/dev/null 2>&1
|
||||
*/5 * * * * /home/ircd/anope/conf/anope.chk >/dev/null 2>&1
|
||||
|
||||
The */5 at the beginning means "check every 5 minutes". You may replace
|
||||
the 5 with other another number if you want (but less than 60). Consult
|
||||
|
||||
+13
-13
@@ -37,7 +37,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
Ensuite, décompressez le package dans votre répertoire home, et allez
|
||||
dans le répértoire qui vient d'être créé.
|
||||
|
||||
Si il y a des modules facultatifs que vous voulez activer comme m_mysql,
|
||||
Si il y a des modules facultatifs que vous voulez activer comme mysql,
|
||||
exécuter le script 'extras' pour les activer. Si vous ne savez pas, vous
|
||||
pouvez les activer plus tard.
|
||||
|
||||
@@ -49,15 +49,15 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
Allez dans le dossier build (cd build) et tapez make et make install.
|
||||
Ceci va installer tous les fichiers nécessaires dans les dossiers que
|
||||
vous avez indiqués avec le script Config et régler les permissions des
|
||||
fichiers. Vous devez vous assurer que le répertoire data n'est pas
|
||||
fichiers. Vous devez vous assurer que le répertoire data n'est pas
|
||||
accessible par les autres utilisateurs, car des utilisateurs
|
||||
malveillants pourraient causer des problèmes sur votre réseau, si les
|
||||
mots de passe ne sont pas chiffrés, ou lire les mémos de tous les
|
||||
utilisateurs.
|
||||
|
||||
Allez maintenant dans le répertoire conf (par défaut, ~/services/conf).
|
||||
Copiez l'exemple de fichier de configuration (example.conf) en
|
||||
services.conf et ouvrez ce dernier avec votre éditeur de texte favori.
|
||||
Allez maintenant dans le répertoire conf (par défaut, ~/anope/conf).
|
||||
Copiez l'exemple de fichier de configuration (anope.example.conf) en
|
||||
anope.conf et ouvrez ce dernier avec votre éditeur de texte favori.
|
||||
Il contient toutes les directives de configuration qu'Anope va utiliser
|
||||
en démarrant. Lisez attentivement les instructions contenues dans le
|
||||
fichier. L'utilisation des valeurs par défaut n'est pas toujours
|
||||
@@ -78,11 +78,11 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
* IMPORTANT : Sauvegardez vos anciennes bases de données !
|
||||
* Si vous mettez Ă jour vers une nouvelle version majeure,
|
||||
recommencez *toujours* toute votre configuration Ă partir du
|
||||
fichier example.conf.
|
||||
fichier anope.example.conf.
|
||||
|
||||
3) Configuration de l'IRCd
|
||||
|
||||
Les Services agissent comme un serveur IRC avec des pseudo-clients.
|
||||
Anope agit comme un serveur IRC avec des pseudo-clients.
|
||||
Pour les relier à votre réseau, vous aurez besoin de configurer votre
|
||||
IRCd pour permettre aux services de se connecter.
|
||||
|
||||
@@ -92,14 +92,14 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
sur le port donné dans le bloc link.
|
||||
|
||||
Des exemples de configurations de bloc link peuvent être trouvés dans
|
||||
le fichier example.conf pour certains des IRCd les plus populaires.
|
||||
le fichier anope.example.conf pour certains des IRCd les plus populaires.
|
||||
|
||||
Souvenez-vous de /rehash votre IRCd pour appliquer les changements.
|
||||
|
||||
4) Mettre en route Anope
|
||||
|
||||
Allez dans le répertoire où les fichiers binaires ont été installés
|
||||
(par défaut, ~/services/bin). Tapez ./services pour lancer Anope.
|
||||
(par défaut, ~/anope/bin). Tapez ./anope pour lancer Anope.
|
||||
|
||||
S'il y a des erreurs de syntaxe dans le fichier de configuration, elles
|
||||
seront affichées à l'écran. Corrigez-les jusqu'à ce qu'il n'y en ait
|
||||
@@ -109,7 +109,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
réseau, car certains IRCds sur certains systèmes peuvent être très
|
||||
lents pour le processus de liaison. Si rien ne se passe après environ
|
||||
une minute, il y a probablement un problème de configuration. Essayez
|
||||
de lancer Anope en mode debug avec ./services -debug -nofork pour voir
|
||||
de lancer Anope en mode debug avec ./anope -debug -nofork pour voir
|
||||
toutes les erreurs rencontrées et essayez de les corriger.
|
||||
|
||||
Si vous avez besoin d'aide pour rĂ©soudre des erreurs, n'hĂ©sitez pas Ă
|
||||
@@ -122,10 +122,10 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
est toujours en cours d'exécution et de le redémarrer s'il n'est pas.
|
||||
|
||||
D'abord renommez le script example.chk qui est dans les dossiers
|
||||
d'Anope (par défaut, ~/services/conf) en services.chk et modifiez-le.
|
||||
d'Anope (par défaut, ~/anope/conf) en anope.chk et modifiez-le.
|
||||
Vous aurez besoin de modifier la partie CONFIGURATION du fichier.
|
||||
Assurez-vous ensuite que le fichier est marqué comme exécutable en
|
||||
tapant chmod +x services.chk et essayez de lancer le script pour voir
|
||||
tapant chmod +x anope.chk et essayez de lancer le script pour voir
|
||||
si cela fonctionne (Anope ne doit pas ĂŞtre en marche lorsque vous
|
||||
testez cela ;))
|
||||
|
||||
@@ -133,7 +133,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
|
||||
crontab -e. Cela va ouvrir l'éditeur de texte par défaut avec le
|
||||
fichier crontab. Entrez la ligne suivante (avec le chemin correct) :
|
||||
|
||||
*/5 * * * * /home/ircd/services/conf/services.chk > /dev/null 2>&1
|
||||
*/5 * * * * /home/ircd/anope/conf/anope.chk > /dev/null 2>&1
|
||||
|
||||
Le */5 au début signifie "vérifier toutes les 5 minutes". Vous pouvez
|
||||
remplacer le 5 par un autre numéro si vous voulez (mais moins de 60).
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ Anope Multi Language Support
|
||||
Anope uses gettext (https://www.gnu.org/software/gettext/) to translate messages for users. To add a new language
|
||||
install gettext and run `msginit -l language -o anope.language.po -i anope.pot`. For example if I was translating to
|
||||
Spanish I could run `msginit -l es_ES -o anope.es_ES.po -i anope.pot`. Open the newly generating .po file and start
|
||||
translating. Once you are done simply rerun ./Config; make && make install and add the language to your services.conf.
|
||||
translating. Once you are done simply rerun ./Config; make && make install and add the language to your anope.conf.
|
||||
Note that on Windows it is not quite this simple, windows.cpp must be edited and Anope recompiled and restarted.
|
||||
|
||||
Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ Anope Modules
|
||||
|
||||
1) Introduction
|
||||
|
||||
Anope 1.6 onwards supports external modules. External modules are pieces
|
||||
Anope supports external modules. External modules are pieces
|
||||
of code that can be attached to a running Anope process dynamically. These
|
||||
modules can serve several purposes, and perform all kind of operations to
|
||||
enhance your network.
|
||||
@@ -22,7 +22,7 @@ Anope Modules
|
||||
1. If modules are supported by your system, they will be configured
|
||||
automatically when you run ./Config. The modules will be installed
|
||||
to the modules directory in your data path (by default this will
|
||||
be ~/services/data/modules).
|
||||
be ~/anope/data/modules).
|
||||
|
||||
2. Compile Anope as usual using ./Config. The "make" process will now
|
||||
compile module support into Anope, and compile the default sample
|
||||
@@ -98,7 +98,7 @@ Anope Modules
|
||||
1. Make sure you're in the main source directory. (usually anope-1.X.XX/)
|
||||
2. Run ./Config to find and configure modules, then `cd build`.
|
||||
3. Run `make` to compile Anope, and any modules.
|
||||
4. Run `make install` to copy the compiled binaries to the ~/services/
|
||||
4. Run `make install` to copy the compiled binaries to the ~/anope/
|
||||
directory.
|
||||
|
||||
You can now use /msg OperServ MODLOAD to load the new modules.
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
Highlighted News in Anope 1.9
|
||||
=============================
|
||||
|
||||
* Added in live updating SQL and the ability to execute commands through SQL
|
||||
* Re-designed configuration file
|
||||
* Code refresh / rewrite into C++
|
||||
+5
-5
@@ -120,7 +120,7 @@ Table of Contents
|
||||
|
||||
2) Presentation
|
||||
|
||||
Anope is a set of Services for IRC networks that allows users to manage
|
||||
Anope is a set of services for IRC networks that allows users to manage
|
||||
their nicks and channels in a secure and efficient way, and administrators
|
||||
to manage their network with powerful tools.
|
||||
|
||||
@@ -167,13 +167,13 @@ Table of Contents
|
||||
Anope currently works with:
|
||||
|
||||
* Bahamut 1.4.27 or later (including 1.8)
|
||||
* Charybdis 3.4 or later
|
||||
* ircd-hybrid 8.2.23 or later
|
||||
* InspIRCd 1.2 or later
|
||||
* InspIRCd 3 or later
|
||||
* ngIRCd 19.2 or later
|
||||
* Plexus 3 or later
|
||||
* Ratbox 2.0.6 or later
|
||||
* UnrealIRCd 3.2 or later
|
||||
* Solanum (all versions)
|
||||
* UnrealIRCd 4 or later
|
||||
|
||||
Anope could also work with some of the daemons derived by the ones listed
|
||||
above, but there's no support for them if they work or don't work.
|
||||
@@ -225,7 +225,7 @@ Table of Contents
|
||||
the log file; if you send a bug report, PLEASE include an excerpt from
|
||||
the log file WITH DEBUGGING ACTIVE; we cannot emphasize enough how
|
||||
important this is to tracking down problems. (You can also enable
|
||||
debugging while Services is running using OperServ's SET DEBUG command.)
|
||||
debugging while Anope is running using OperServ's SET DEBUG command.)
|
||||
If you repeat use --debug=<level>, the debugging level will be increased,
|
||||
which provides more detailed information but may also slow Anope down
|
||||
considerably and make the log file grow dramatically faster. In general,
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
Starting in Anope 1.9.9, Anope has Redis database support (https://redis.io/).
|
||||
Anope has Redis database support (https://redis.io/).
|
||||
This document explains the data structure used by Anope, and explains how
|
||||
keyspace notification works.
|
||||
|
||||
@@ -149,12 +149,12 @@ Table of Contents
|
||||
Which returns a new object ID for me, in this example it will be "8".
|
||||
Now I can create the object:
|
||||
|
||||
HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "Services for IRC Networks"
|
||||
HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "Anope IRC Services"
|
||||
|
||||
Note if you are using HSET instead of HMSET you will need to use a transaction, as shown in the above example.
|
||||
If you are watching your services logs you will immediately see:
|
||||
|
||||
USERS: redis!redis@services.anope.org (Services for IRC Networks) connected to the network (services.anope.org)
|
||||
USERS: redis!redis@services.anope.org (Anope IRC Services) connected to the network (services.anope.org)
|
||||
|
||||
And the bot redis will be in BotServ's bot list.
|
||||
Notice how ids:BotInfo and the value keys are updated automatically.
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
Anope Bundled Tools
|
||||
-------------------
|
||||
|
||||
1) Anope SMTP Client
|
||||
|
||||
Provided with Anope is a simple SMTP client which can be used instead of
|
||||
programs like SendMail in some cases.
|
||||
|
||||
The SMTP client can be used instead of sendmail for use with Anope's mail
|
||||
options. To use the SMTP client instead of sendmail, find the line in your
|
||||
services configuration file (services.conf) that defines sendmailpath. On
|
||||
that line, change the path to your services installation directory, then
|
||||
followed by "bin/anopesmtp" and the IP address of a valid SMTP server. It
|
||||
should look like this:
|
||||
|
||||
sendmailpath = "/home/anope/services/bin/anopesmtp 127.0.0.1"
|
||||
|
||||
If the SMTP client doesn't send mail, or if there's an other problem with
|
||||
it, you can enable debug mode by passing the --debug flag after the server
|
||||
address. This should generate a log file of what happened when it tried
|
||||
to connect to the SMTP server.
|
||||
|
||||
Credits:
|
||||
Originally written by Dominick Meglio <codemastr@unrealircd.com>
|
||||
Ported to *nix by Trystan Scott Lee <trystan@nomadirc.net>
|
||||
+3
-3
@@ -70,7 +70,7 @@ Anope for Windows
|
||||
If you cannot find whats causing the error, please visit our forums or
|
||||
our IRC Support channel for assistance.
|
||||
|
||||
Some Anope modules require third party libraries, such as m_mysql and
|
||||
Some Anope modules require third party libraries, such as mysql and
|
||||
the SSL modules. If these libraries are installed in nonstandard
|
||||
locations, cmake will probably not find them and should be told where
|
||||
they are by passing their location to Config.
|
||||
@@ -103,7 +103,7 @@ Anope for Windows
|
||||
INSTALL within the Solution Explorer. Right-click on INSTALL and choose Build.
|
||||
|
||||
When you have done this, all the files will be installed to where they belong.
|
||||
The only thing you need to do is rename "data/example.conf" to be "data/services.conf",
|
||||
The only thing you need to do is rename "data/anope.example.conf" to be "data/anope.conf",
|
||||
and then follow the steps to set up Anope.
|
||||
|
||||
You have now completed the building phase of Anope for Windows. You can
|
||||
@@ -120,7 +120,7 @@ Anope for Windows
|
||||
Notepad will cause strange characters to appear, and you may not be able to
|
||||
edit the file correctly.
|
||||
|
||||
Open services.conf, and read through it carefully and adjust the settings
|
||||
Open anope.conf, and read through it carefully and adjust the settings
|
||||
you think you need to adjust.
|
||||
|
||||
If you are unsure of the settings, you can go to the dos command prompt
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
Starting with Anope 1.9.4 XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported.
|
||||
XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported.
|
||||
This allows external applications, such as websites, to execute remote procedure calls to Anope in real time.
|
||||
|
||||
Currently there are 5 supported XMLRPC calls, provided by m_xmlrpc_main:
|
||||
Currently there are 5 supported XMLRPC calls, provided by xmlrpc_main:
|
||||
|
||||
checkAuthentication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password
|
||||
is correct for the account name, useful for making login pages on websites.
|
||||
|
||||
+3
-45
@@ -3,7 +3,7 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$
|
||||
# Generate version-bin executable to modify version.h, setting it's linker flags as well
|
||||
add_executable(version-bin version.cpp)
|
||||
set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
|
||||
get_target_property(version_BINARY version-bin LOCATION)
|
||||
set(version_BINARY "$<TARGET_FILE:version-bin>")
|
||||
# Modify version.h from the above executable, with dependencies to version.cpp
|
||||
# and all of the source files in the main build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
|
||||
@@ -16,49 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("version.h$" TRUE)
|
||||
add_to_cpack_ignored_files("build.h$" TRUE)
|
||||
endif(NOT WIN32)
|
||||
|
||||
set(PCH_SOURCES_GCH "")
|
||||
if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
|
||||
sort_list(PCH_SOURCES)
|
||||
|
||||
foreach(PCH_SOURCE ${PCH_SOURCES})
|
||||
find_includes(${PCH_SOURCE} INCLUDES)
|
||||
set(INCLUDES_LIST)
|
||||
append_to_list(INCLUDES_LIST ${PCH_SOURCE})
|
||||
foreach(INCLUDE ${INCLUDES})
|
||||
# Extract the filename from the #include line
|
||||
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
|
||||
if(QUOTE_TYPE STREQUAL "quotes")
|
||||
find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
|
||||
if(NOT FOUND EQUAL -1)
|
||||
append_to_list(INCLUDES_LIST ${FILENAME})
|
||||
endif(NOT FOUND EQUAL -1)
|
||||
endif(QUOTE_TYPE STREQUAL "quotes")
|
||||
endforeach(INCLUDE)
|
||||
|
||||
set(PCH_EXTRAFLAGS "")
|
||||
if(DEBUG_BUILD)
|
||||
set(PCH_EXTRAFLAGS "-g")
|
||||
endif(DEBUG_BUILD)
|
||||
if(PCH_SOURCE STREQUAL "module.h")
|
||||
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
|
||||
endif(PCH_SOURCE STREQUAL "module.h")
|
||||
if(GETTEXT_INCLUDE)
|
||||
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
|
||||
endif(GETTEXT_INCLUDE)
|
||||
|
||||
set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
|
||||
COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS}
|
||||
${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
|
||||
DEPENDS ${INCLUDES_LIST} VERBATIM
|
||||
)
|
||||
endforeach(PCH_SOURCE ${PCH_SOURCES})
|
||||
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
|
||||
# Add a custom target to the above file
|
||||
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h ${PCH_SOURCES_GCH})
|
||||
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h)
|
||||
|
||||
+18
-18
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef ACCESS_H
|
||||
#define ACCESS_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
@@ -28,7 +27,7 @@ enum
|
||||
* backing each ChanAccess determines whether that ChanAccess has a given
|
||||
* privilege.
|
||||
*/
|
||||
struct CoreExport Privilege
|
||||
struct CoreExport Privilege final
|
||||
{
|
||||
Anope::string name;
|
||||
Anope::string desc;
|
||||
@@ -39,10 +38,10 @@ struct CoreExport Privilege
|
||||
bool operator==(const Privilege &other) const;
|
||||
};
|
||||
|
||||
class CoreExport PrivilegeManager
|
||||
class CoreExport PrivilegeManager final
|
||||
{
|
||||
static std::vector<Privilege> Privileges;
|
||||
public:
|
||||
public:
|
||||
static void AddPrivilege(Privilege p);
|
||||
static void RemovePrivilege(Privilege &p);
|
||||
static Privilege *FindPrivilege(const Anope::string &name);
|
||||
@@ -53,9 +52,10 @@ class CoreExport PrivilegeManager
|
||||
/* A provider of access. Only used for creating ChanAccesses, as
|
||||
* they contain pure virtual functions.
|
||||
*/
|
||||
class CoreExport AccessProvider : public Service
|
||||
class CoreExport AccessProvider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
AccessProvider(Module *owner, const Anope::string &name);
|
||||
virtual ~AccessProvider();
|
||||
|
||||
@@ -64,20 +64,21 @@ class CoreExport AccessProvider : public Service
|
||||
*/
|
||||
virtual ChanAccess *Create() = 0;
|
||||
|
||||
private:
|
||||
private:
|
||||
static std::list<AccessProvider *> Providers;
|
||||
public:
|
||||
public:
|
||||
static const std::list<AccessProvider *>& GetProviders();
|
||||
};
|
||||
|
||||
/* Represents one entry of an access list on a channel. */
|
||||
class CoreExport ChanAccess : public Serializable
|
||||
class CoreExport ChanAccess
|
||||
: public Serializable
|
||||
{
|
||||
Anope::string mask;
|
||||
/* account this access entry is for, if any */
|
||||
Serialize::Reference<NickCore> nc;
|
||||
|
||||
public:
|
||||
public:
|
||||
typedef std::vector<ChanAccess *> Path;
|
||||
|
||||
/* The provider that created this access entry */
|
||||
@@ -85,6 +86,7 @@ class CoreExport ChanAccess : public Serializable
|
||||
/* Channel this access entry is on */
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
Anope::string creator;
|
||||
Anope::string description;
|
||||
time_t last_seen;
|
||||
time_t created;
|
||||
|
||||
@@ -95,8 +97,8 @@ class CoreExport ChanAccess : public Serializable
|
||||
const Anope::string &Mask() const;
|
||||
NickCore *GetAccount() const;
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
static const unsigned int MAX_DEPTH = 4;
|
||||
|
||||
@@ -105,7 +107,7 @@ class CoreExport ChanAccess : public Serializable
|
||||
* @param nc The account
|
||||
* @param next Next channel to check if any
|
||||
*/
|
||||
virtual bool Matches(const User *u, const NickCore *nc, ChannelInfo* &next) const;
|
||||
virtual bool Matches(const User *u, const NickCore *nc, ChannelInfo *&next) const;
|
||||
|
||||
/** Check if this access entry has the given privilege.
|
||||
* @param name The privilege name
|
||||
@@ -133,9 +135,9 @@ class CoreExport ChanAccess : public Serializable
|
||||
/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor,
|
||||
* to show what access a user has on a channel because users can match multiple access entries.
|
||||
*/
|
||||
class CoreExport AccessGroup
|
||||
class CoreExport AccessGroup final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* access entries + paths */
|
||||
std::vector<ChanAccess::Path> paths;
|
||||
/* Channel these access entries are on */
|
||||
@@ -170,5 +172,3 @@ class CoreExport AccessGroup
|
||||
|
||||
inline bool empty() const { return paths.empty(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+24
-73
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef ACCOUNT_H
|
||||
#define ACCOUNT_H
|
||||
#pragma once
|
||||
|
||||
#include "extensible.h"
|
||||
#include "serialize.h"
|
||||
@@ -20,7 +19,7 @@
|
||||
|
||||
typedef Anope::hash_map<NickAlias *> nickalias_map;
|
||||
typedef Anope::hash_map<NickCore *> nickcore_map;
|
||||
typedef TR1NS::unordered_map<uint64_t, NickCore *> nickcoreid_map;
|
||||
typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map;
|
||||
|
||||
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
|
||||
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
|
||||
@@ -29,12 +28,14 @@ extern CoreExport nickcoreid_map NickCoreIdList;
|
||||
/* A registered nickname.
|
||||
* It matters that Base is here before Extensible (it is inherited by Serializable)
|
||||
*/
|
||||
class CoreExport NickAlias : public Serializable, public Extensible
|
||||
class CoreExport NickAlias final
|
||||
: public Serializable
|
||||
, public Extensible
|
||||
{
|
||||
Anope::string vhost_ident, vhost_host, vhost_creator;
|
||||
time_t vhost_created;
|
||||
|
||||
public:
|
||||
public:
|
||||
Anope::string nick;
|
||||
Anope::string last_quit;
|
||||
Anope::string last_realname;
|
||||
@@ -54,8 +55,8 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
NickAlias(const Anope::string &nickname, NickCore *nickcore);
|
||||
~NickAlias();
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
/** Set a vhost for the user
|
||||
* @param ident The ident
|
||||
@@ -84,6 +85,11 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
*/
|
||||
const Anope::string &GetVhostHost() const;
|
||||
|
||||
/** Retrieve the vhost mask
|
||||
* @param the mask
|
||||
*/
|
||||
Anope::string GetVhostMask() const;
|
||||
|
||||
/** Retrieve the vhost creator
|
||||
* @return the creator
|
||||
*/
|
||||
@@ -105,13 +111,15 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
* account's display.
|
||||
* It matters that Base is here before Extensible (it is inherited by Serializable)
|
||||
*/
|
||||
class CoreExport NickCore : public Serializable, public Extensible
|
||||
class CoreExport NickCore final
|
||||
: public Serializable
|
||||
, public Extensible
|
||||
{
|
||||
/* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
|
||||
Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
|
||||
/* Unique identifier for the account. */
|
||||
uint64_t id;
|
||||
public:
|
||||
public:
|
||||
/* Name of the account. Find(display)->nc == this. */
|
||||
Anope::string display;
|
||||
/* User password in form of hashm:data */
|
||||
@@ -119,9 +127,6 @@ class CoreExport NickCore : public Serializable, public Extensible
|
||||
Anope::string email;
|
||||
/* Locale name of the language of the user. Empty means default language */
|
||||
Anope::string language;
|
||||
/* Access list, contains user@host masks of users who get certain privileges based
|
||||
* on if NI_SECURE is set and what (if any) kill protection is enabled. */
|
||||
std::vector<Anope::string> access;
|
||||
MemoInfo memos;
|
||||
std::map<Anope::string, Anope::string> last_modes;
|
||||
|
||||
@@ -149,8 +154,8 @@ class CoreExport NickCore : public Serializable, public Extensible
|
||||
NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0);
|
||||
~NickCore();
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
/** Changes the display for this account
|
||||
* @param na The new display, must be grouped to this account.
|
||||
@@ -162,66 +167,14 @@ class CoreExport NickCore : public Serializable, public Extensible
|
||||
*/
|
||||
virtual bool IsServicesOper() const;
|
||||
|
||||
/** Add an entry to the nick's access list
|
||||
*
|
||||
* @param entry The nick!ident@host entry to add to the access list
|
||||
*
|
||||
* Adds a new entry into the access list.
|
||||
*/
|
||||
void AddAccess(const Anope::string &entry);
|
||||
|
||||
/** Get an entry from the nick's access list by index
|
||||
*
|
||||
* @param entry Index in the access list vector to retrieve
|
||||
* @return The access list entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
|
||||
*
|
||||
* Retrieves an entry from the access list corresponding to the given index.
|
||||
*/
|
||||
Anope::string GetAccess(unsigned entry) const;
|
||||
|
||||
/** Get the number of entries on the access list for this account.
|
||||
*/
|
||||
unsigned GetAccessCount() const;
|
||||
|
||||
/** Retrieves the account id for this user */
|
||||
uint64_t GetId();
|
||||
|
||||
/** Find an entry in the nick's access list
|
||||
*
|
||||
* @param entry The nick!ident@host entry to search for
|
||||
* @return True if the entry is found in the access list, false otherwise
|
||||
*
|
||||
* Search for an entry within the access list.
|
||||
*/
|
||||
bool FindAccess(const Anope::string &entry);
|
||||
|
||||
/** Erase an entry from the nick's access list
|
||||
*
|
||||
* @param entry The nick!ident@host entry to remove
|
||||
*
|
||||
* Removes the specified access list entry from the access list.
|
||||
*/
|
||||
void EraseAccess(const Anope::string &entry);
|
||||
|
||||
/** Clears the entire nick's access list
|
||||
*
|
||||
* Deletes all the memory allocated in the access list vector and then clears the vector.
|
||||
*/
|
||||
void ClearAccess();
|
||||
|
||||
/** Is the given user on this accounts access list?
|
||||
*
|
||||
* @param u The user
|
||||
*
|
||||
* @return true if the user is on the access list
|
||||
*/
|
||||
bool IsOnAccess(const User *u) const;
|
||||
|
||||
/** Finds an account
|
||||
* @param nick The account name to find
|
||||
* @return The account, if it exists
|
||||
*/
|
||||
static NickCore* Find(const Anope::string &nick);
|
||||
static NickCore *Find(const Anope::string &nick);
|
||||
|
||||
void AddChannelReference(ChannelInfo *ci);
|
||||
void RemoveChannelReference(ChannelInfo *ci);
|
||||
@@ -240,16 +193,16 @@ class CoreExport IdentifyRequest
|
||||
Anope::string password;
|
||||
|
||||
std::set<Module *> holds;
|
||||
bool dispatched;
|
||||
bool success;
|
||||
bool dispatched = false;
|
||||
bool success = false;
|
||||
|
||||
static std::set<IdentifyRequest *> Requests;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass);
|
||||
virtual ~IdentifyRequest();
|
||||
|
||||
public:
|
||||
public:
|
||||
/* One of these is called when the request goes through */
|
||||
virtual void OnSuccess() = 0;
|
||||
virtual void OnFail() = 0;
|
||||
@@ -286,5 +239,3 @@ class CoreExport IdentifyRequest
|
||||
|
||||
static void ModuleUnload(Module *m);
|
||||
};
|
||||
|
||||
#endif // ACCOUNT_H
|
||||
|
||||
+71
-59
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef ANOPE_H
|
||||
#define ANOPE_H
|
||||
#pragma once
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
@@ -23,15 +22,15 @@ namespace Anope
|
||||
* allow us to only require one type of string everywhere that can be converted
|
||||
* at any time to a specific type of string.
|
||||
*/
|
||||
class CoreExport string
|
||||
class CoreExport string final
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/**
|
||||
* The actual string is stored in an std::string as it can be converted to
|
||||
* ci::string, or a C-style string at any time.
|
||||
*/
|
||||
std::string _string;
|
||||
public:
|
||||
public:
|
||||
/**
|
||||
* Extras.
|
||||
*/
|
||||
@@ -54,9 +53,7 @@ namespace Anope
|
||||
string(const ci::string &_str) : _string(_str.c_str()) { }
|
||||
string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { }
|
||||
template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { }
|
||||
#if __cplusplus >= 201103L
|
||||
string(const string &) = default;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Assignment operators, so any type of string can be assigned to this class.
|
||||
@@ -143,8 +140,8 @@ namespace Anope
|
||||
*/
|
||||
inline void push_back(char c) { return this->_string.push_back(c); }
|
||||
|
||||
inline string& append(const string &s) { this->_string.append(s.str()); return *this; }
|
||||
inline string& append(const char *s, size_t n) { this->_string.append(s, n); return *this; }
|
||||
inline string &append(const string &s) { this->_string.append(s.str()); return *this; }
|
||||
inline string &append(const char *s, size_t n) { this->_string.append(s, n); return *this; }
|
||||
|
||||
/**
|
||||
* Resizes the string content to n characters.
|
||||
@@ -162,21 +159,21 @@ namespace Anope
|
||||
* Trim leading and trailing white spaces from the string.
|
||||
*/
|
||||
|
||||
inline string& ltrim(const Anope::string &what = " \t\r\n")
|
||||
inline string <rim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
while (!this->_string.empty() && what.find(this->_string[0]) != Anope::string::npos)
|
||||
this->_string.erase(this->_string.begin());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline string& rtrim(const Anope::string &what = " \t\r\n")
|
||||
inline string &rtrim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
while (!this->_string.empty() && what.find(this->_string[this->_string.length() - 1]) != Anope::string::npos)
|
||||
this->_string.erase(this->_string.length() - 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline string& trim(const Anope::string &what = " \t\r\n")
|
||||
inline string &trim(const Anope::string &what = " \t\r\n")
|
||||
{
|
||||
this->ltrim(what);
|
||||
this->rtrim(what);
|
||||
@@ -213,6 +210,10 @@ namespace Anope
|
||||
inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); }
|
||||
inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); }
|
||||
|
||||
inline int compare(size_t pos, size_t len, const string &str) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str())); }
|
||||
inline int compare(size_t pos, size_t len, const string &str, size_t subpos, size_type sublen = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str()), subpos, sublen); }
|
||||
inline int compare(size_t pos, size_t len, const char *s, size_type n = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, s, n); }
|
||||
|
||||
/**
|
||||
* Determine if string consists of only numbers.
|
||||
*/
|
||||
@@ -257,8 +258,8 @@ namespace Anope
|
||||
inline string lower() const
|
||||
{
|
||||
Anope::string new_string = *this;
|
||||
for (size_type i = 0; i < new_string.length(); ++i)
|
||||
new_string[i] = Anope::tolower(new_string[i]);
|
||||
for (auto &chr : new_string)
|
||||
chr = Anope::tolower(chr);
|
||||
return new_string;
|
||||
}
|
||||
|
||||
@@ -268,8 +269,8 @@ namespace Anope
|
||||
inline string upper() const
|
||||
{
|
||||
Anope::string new_string = *this;
|
||||
for (size_type i = 0; i < new_string.length(); ++i)
|
||||
new_string[i] = Anope::toupper(new_string[i]);
|
||||
for (auto &chr : new_string)
|
||||
chr = Anope::toupper(chr);
|
||||
return new_string;
|
||||
}
|
||||
|
||||
@@ -311,23 +312,23 @@ namespace Anope
|
||||
inline const string operator+(const char *_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
|
||||
inline const string operator+(const std::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
|
||||
|
||||
struct hash_ci
|
||||
struct hash_ci final
|
||||
{
|
||||
inline size_t operator()(const string &s) const
|
||||
{
|
||||
return TR1NS::hash<std::string>()(s.lower().str());
|
||||
return std::hash<std::string>()(s.lower().str());
|
||||
}
|
||||
};
|
||||
|
||||
struct hash_cs
|
||||
struct hash_cs final
|
||||
{
|
||||
inline size_t operator()(const string &s) const
|
||||
{
|
||||
return TR1NS::hash<std::string>()(s.str());
|
||||
return std::hash<std::string>()(s.str());
|
||||
}
|
||||
};
|
||||
|
||||
struct compare
|
||||
struct compare final
|
||||
{
|
||||
inline bool operator()(const string &s1, const string &s2) const
|
||||
{
|
||||
@@ -335,9 +336,14 @@ namespace Anope
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> class map : public std::map<string, T, ci::less> { };
|
||||
template<typename T> class multimap : public std::multimap<string, T, ci::less> { };
|
||||
template<typename T> class hash_map : public TR1NS::unordered_map<string, T, hash_ci, compare> { };
|
||||
template<typename T>
|
||||
using map = std::map<string, T, ci::less>;
|
||||
|
||||
template<typename T>
|
||||
using multimap = std::multimap<string, T, ci::less>;
|
||||
|
||||
template<typename T>
|
||||
using hash_map = std::unordered_map<string, T, hash_ci, compare>;
|
||||
|
||||
#ifndef REPRODUCIBLE_BUILD
|
||||
static const char *const compiled = __TIME__ " " __DATE__;
|
||||
@@ -369,11 +375,11 @@ namespace Anope
|
||||
*/
|
||||
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
|
||||
|
||||
/** The root of the services installation. Usually ~/services
|
||||
/** The root of the Anope installation. Usually ~/anope
|
||||
*/
|
||||
extern CoreExport Anope::string ServicesDir;
|
||||
|
||||
/** Services binary name (eg services)
|
||||
/** Anope binary name (eg anope)
|
||||
*/
|
||||
extern CoreExport Anope::string ServicesBin;
|
||||
|
||||
@@ -387,7 +393,7 @@ namespace Anope
|
||||
|
||||
/** The uplink we are currently connected to
|
||||
*/
|
||||
extern CoreExport int CurrentUplink;
|
||||
extern CoreExport size_t CurrentUplink;
|
||||
|
||||
/** Various methods to determine the Anope version running
|
||||
*/
|
||||
@@ -419,7 +425,7 @@ namespace Anope
|
||||
* initializing language support, loading modules, and loading databases.
|
||||
* @throws CoreException if something bad went wrong
|
||||
*/
|
||||
extern void Init(int ac, char **av);
|
||||
extern bool Init(int ac, char **av);
|
||||
|
||||
/** Calls the save database event
|
||||
*/
|
||||
@@ -465,14 +471,6 @@ namespace Anope
|
||||
*/
|
||||
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
|
||||
|
||||
/** Decrypts what is in 'src' to 'dest'.
|
||||
* @param src The source string to decrypt
|
||||
* @param dest The destination where the decrypted string is placed
|
||||
* @return true if decryption was successful. This is usually not the case
|
||||
* as most encryption methods we use are one way.
|
||||
*/
|
||||
extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest);
|
||||
|
||||
/** Hashes a buffer with SipHash-2-4
|
||||
* @param src The start of the buffer to hash
|
||||
* @param src_sz The total number of bytes in the buffer
|
||||
@@ -487,7 +485,7 @@ namespace Anope
|
||||
* @param ... any number of parameters
|
||||
* @return a Anope::string
|
||||
*/
|
||||
extern CoreExport string printf(const char *fmt, ...);
|
||||
extern CoreExport string printf(const char *fmt, ...) ATTR_FORMAT(1, 2);
|
||||
|
||||
/** Return the last error code
|
||||
* @return The error code
|
||||
@@ -497,7 +495,7 @@ namespace Anope
|
||||
/** Return the last error, uses errno/GetLastError() to determine this
|
||||
* @return An error message
|
||||
*/
|
||||
extern CoreExport const string LastError();
|
||||
extern CoreExport string LastError();
|
||||
|
||||
/** Determines if a path is a file
|
||||
*/
|
||||
@@ -559,6 +557,12 @@ namespace Anope
|
||||
* @param len The length of the string returned
|
||||
*/
|
||||
extern CoreExport Anope::string Random(size_t len);
|
||||
|
||||
/** Calculates the levenshtein distance between two strings.
|
||||
* @param s1 The first string.
|
||||
* @param s2 The second string.
|
||||
*/
|
||||
extern CoreExport size_t Distance(const Anope::string &s1, const Anope::string &s2);
|
||||
}
|
||||
|
||||
/** sepstream allows for splitting token separated lists.
|
||||
@@ -568,7 +572,7 @@ namespace Anope
|
||||
*/
|
||||
class CoreExport sepstream
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/** Original string.
|
||||
*/
|
||||
Anope::string tokens;
|
||||
@@ -577,11 +581,11 @@ class CoreExport sepstream
|
||||
char sep;
|
||||
/** Current string position
|
||||
*/
|
||||
size_t pos;
|
||||
size_t pos = 0;
|
||||
/** If set then GetToken() can return an empty string
|
||||
*/
|
||||
bool allow_empty;
|
||||
public:
|
||||
public:
|
||||
/** Create a sepstream and fill it with the provided data
|
||||
*/
|
||||
sepstream(const Anope::string &source, char separator, bool allowempty = false);
|
||||
@@ -602,7 +606,7 @@ class CoreExport sepstream
|
||||
/** Gets every token from this stream
|
||||
* @param token Tokens are pushed back here
|
||||
*/
|
||||
template<typename T> void GetTokens(T& token)
|
||||
template<typename T> void GetTokens(T &token)
|
||||
{
|
||||
token.clear();
|
||||
Anope::string t;
|
||||
@@ -625,7 +629,7 @@ class CoreExport sepstream
|
||||
/** Fetch the entire remaining stream, without tokenizing
|
||||
* @return The remaining part of the stream
|
||||
*/
|
||||
const Anope::string GetRemaining();
|
||||
Anope::string GetRemaining();
|
||||
|
||||
/** Returns true if the end of the stream has been reached
|
||||
* @return True if the end of the stream has been reached, otherwise false
|
||||
@@ -635,9 +639,10 @@ class CoreExport sepstream
|
||||
|
||||
/** A derived form of sepstream, which separates on commas
|
||||
*/
|
||||
class commasepstream : public sepstream
|
||||
class commasepstream final
|
||||
: public sepstream
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Initialize with comma separator
|
||||
*/
|
||||
commasepstream(const Anope::string &source, bool allowempty = false) : sepstream(source, ',', allowempty) { }
|
||||
@@ -645,9 +650,10 @@ class commasepstream : public sepstream
|
||||
|
||||
/** A derived form of sepstream, which separates on spaces
|
||||
*/
|
||||
class spacesepstream : public sepstream
|
||||
class spacesepstream final
|
||||
: public sepstream
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Initialize with space separator
|
||||
*/
|
||||
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
|
||||
@@ -659,16 +665,17 @@ class spacesepstream : public sepstream
|
||||
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
|
||||
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
|
||||
*/
|
||||
class CoreException : public std::exception
|
||||
class CoreExport CoreException
|
||||
: public std::exception
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/** Holds the error message to be displayed
|
||||
*/
|
||||
Anope::string err;
|
||||
/** Source of the exception
|
||||
*/
|
||||
Anope::string source;
|
||||
public:
|
||||
public:
|
||||
/** Default constructor, just uses the error message 'Core threw an exception'.
|
||||
*/
|
||||
CoreException() : err("Core threw an exception"), source("The core") { }
|
||||
@@ -683,7 +690,7 @@ class CoreException : public std::exception
|
||||
* Actually no, it does nothing. Never mind.
|
||||
* @throws Nothing!
|
||||
*/
|
||||
virtual ~CoreException() throw() { }
|
||||
virtual ~CoreException() noexcept = default;
|
||||
/** Returns the reason for the exception.
|
||||
* The module should probably put something informative here as the user will see this upon failure.
|
||||
*/
|
||||
@@ -698,9 +705,10 @@ class CoreException : public std::exception
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleException : public CoreException
|
||||
class CoreExport ModuleException
|
||||
: public CoreException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Default constructor, just uses the error message 'Module threw an exception'.
|
||||
*/
|
||||
ModuleException() : CoreException("Module threw an exception", "A Module") { }
|
||||
@@ -712,19 +720,25 @@ class ModuleException : public CoreException
|
||||
* Actually no, it does nothing. Never mind.
|
||||
* @throws Nothing!
|
||||
*/
|
||||
virtual ~ModuleException() throw() { }
|
||||
virtual ~ModuleException() noexcept = default;
|
||||
};
|
||||
|
||||
class ConvertException : public CoreException
|
||||
class CoreExport ConvertException final
|
||||
: public CoreException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
|
||||
|
||||
virtual ~ConvertException() throw() { }
|
||||
virtual ~ConvertException() noexcept = default;
|
||||
};
|
||||
|
||||
/** Convert something to a string
|
||||
*/
|
||||
inline Anope::string stringify(const Anope::string &x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
template<typename T> inline Anope::string stringify(const T &x)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
@@ -794,5 +808,3 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
|
||||
return static_cast<T>(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ANOPE_H
|
||||
|
||||
+16
-21
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef BASE_H
|
||||
#define BASE_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
|
||||
@@ -16,9 +15,8 @@
|
||||
class CoreExport Base
|
||||
{
|
||||
/* References to this base class */
|
||||
std::set<ReferenceBase *> *references;
|
||||
public:
|
||||
Base();
|
||||
std::set<ReferenceBase *> *references = nullptr;
|
||||
public:
|
||||
virtual ~Base();
|
||||
|
||||
/** Adds a reference to this object. Eg, when a Reference
|
||||
@@ -32,12 +30,12 @@ class CoreExport Base
|
||||
|
||||
class ReferenceBase
|
||||
{
|
||||
protected:
|
||||
bool invalid;
|
||||
public:
|
||||
ReferenceBase() : invalid(false) { }
|
||||
protected:
|
||||
bool invalid = false;
|
||||
public:
|
||||
ReferenceBase() = default;
|
||||
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
|
||||
virtual ~ReferenceBase() { }
|
||||
virtual ~ReferenceBase() = default;
|
||||
inline void Invalidate() { this->invalid = true; }
|
||||
};
|
||||
|
||||
@@ -45,14 +43,13 @@ class ReferenceBase
|
||||
* no longer be valid once the object it refers is destructed.
|
||||
*/
|
||||
template<typename T>
|
||||
class Reference : public ReferenceBase
|
||||
class Reference
|
||||
: public ReferenceBase
|
||||
{
|
||||
protected:
|
||||
T *ref;
|
||||
public:
|
||||
Reference() : ref(NULL)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
T *ref = nullptr;
|
||||
public:
|
||||
Reference() = default;
|
||||
|
||||
Reference(T *obj) : ref(obj)
|
||||
{
|
||||
@@ -106,14 +103,14 @@ class Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator->()
|
||||
inline T *operator->()
|
||||
{
|
||||
if (operator bool())
|
||||
return this->ref;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator*()
|
||||
inline T *operator*()
|
||||
{
|
||||
if (operator bool())
|
||||
return this->ref;
|
||||
@@ -139,5 +136,3 @@ class Reference : public ReferenceBase
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // BASE_H
|
||||
|
||||
+10
-10
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef BOTS_H
|
||||
#define BOTS_H
|
||||
#pragma once
|
||||
|
||||
#include "users.h"
|
||||
#include "anope.h"
|
||||
@@ -20,11 +19,13 @@ typedef Anope::map<BotInfo *> botinfo_map;
|
||||
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
|
||||
|
||||
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
|
||||
class CoreExport BotInfo : public User, public Serializable
|
||||
class CoreExport BotInfo final
|
||||
: public User
|
||||
, public Serializable
|
||||
{
|
||||
/* Channels this bot is assigned to */
|
||||
Serialize::Checker<std::set<ChannelInfo *> > channels;
|
||||
public:
|
||||
public:
|
||||
time_t created;
|
||||
/* Last time this bot said something (via privmsg) */
|
||||
time_t lastmsg;
|
||||
@@ -55,7 +56,7 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
virtual ~BotInfo();
|
||||
|
||||
void Serialize(Serialize::Data &data) const;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
void GenerateUID();
|
||||
|
||||
@@ -107,8 +108,9 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
/** Called when a user messages this bot
|
||||
* @param u The user
|
||||
* @param message The users' message
|
||||
* @params tags Message tags
|
||||
*/
|
||||
virtual void OnMessage(User *u, const Anope::string &message);
|
||||
virtual void OnMessage(User *u, const Anope::string &message, const Anope::map<Anope::string> &tags);
|
||||
|
||||
/** Link a command name to a command in services
|
||||
* @param cname The command name
|
||||
@@ -116,7 +118,7 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
* @param permission Permission required to execute the command, if any
|
||||
* @return The commandinfo for the newly created command
|
||||
*/
|
||||
CommandInfo& SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
|
||||
CommandInfo &SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
|
||||
|
||||
/** Get command info for a command
|
||||
* @param cname The command name
|
||||
@@ -129,7 +131,5 @@ class CoreExport BotInfo : public User, public Serializable
|
||||
* @param nick_only True to only look by nick, and not by UID
|
||||
* @return The bot, if it exists
|
||||
*/
|
||||
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
|
||||
static BotInfo *Find(const Anope::string &nick, bool nick_only = false);
|
||||
};
|
||||
|
||||
#endif // BOTS_H
|
||||
|
||||
+17
-15
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef CHANNELS_H
|
||||
#define CHANNELS_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "extensible.h"
|
||||
@@ -19,7 +18,8 @@ typedef Anope::hash_map<Channel *> channel_map;
|
||||
extern CoreExport channel_map ChannelList;
|
||||
|
||||
/* A user container, there is one of these per user per channel. */
|
||||
struct ChanUserContainer : public Extensible
|
||||
struct ChanUserContainer final
|
||||
: public Extensible
|
||||
{
|
||||
User *user;
|
||||
Channel *chan;
|
||||
@@ -29,18 +29,20 @@ struct ChanUserContainer : public Extensible
|
||||
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
|
||||
};
|
||||
|
||||
class CoreExport Channel : public Base, public Extensible
|
||||
class CoreExport Channel final
|
||||
: public Base
|
||||
, public Extensible
|
||||
{
|
||||
static std::vector<Channel *> deleting;
|
||||
|
||||
public:
|
||||
public:
|
||||
typedef std::multimap<Anope::string, Anope::string> ModeList;
|
||||
private:
|
||||
private:
|
||||
/** A map of channel modes with their parameters set on this channel
|
||||
*/
|
||||
ModeList modes;
|
||||
|
||||
public:
|
||||
public:
|
||||
/* Channel name */
|
||||
Anope::string name;
|
||||
/* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */
|
||||
@@ -74,14 +76,14 @@ class CoreExport Channel : public Base, public Extensible
|
||||
int16_t chanserv_modecount; /* Number of check_mode()'s this sec */
|
||||
int16_t bouncy_modes; /* Did we fail to set modes here? */
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Constructor
|
||||
* @param name The channel name
|
||||
* @param ts The time the channel was created
|
||||
*/
|
||||
Channel(const Anope::string &nname, time_t ts = Anope::CurTime);
|
||||
|
||||
public:
|
||||
public:
|
||||
/** Destructor
|
||||
*/
|
||||
~Channel();
|
||||
@@ -108,7 +110,7 @@ class CoreExport Channel : public Base, public Extensible
|
||||
* @param status The status to give the user, if any
|
||||
* @return The UserContainer for the user
|
||||
*/
|
||||
ChanUserContainer* JoinUser(User *u, const ChannelStatus *status);
|
||||
ChanUserContainer *JoinUser(User *u, const ChannelStatus *status);
|
||||
|
||||
/** Remove a user internally from the channel
|
||||
* @param u The user
|
||||
@@ -205,7 +207,8 @@ class CoreExport Channel : public Base, public Extensible
|
||||
* @param enforce_mlock Should mlock be enforced on this mode change
|
||||
* @param cmodes The modes to set
|
||||
*/
|
||||
void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...);
|
||||
void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...) ATTR_FORMAT(4, 5);
|
||||
void SetModes(BotInfo *bi, bool enforce_mlock, const Anope::string &cmodes);
|
||||
|
||||
/** Set a string of modes internally on a channel
|
||||
* @param source The setter
|
||||
@@ -234,7 +237,8 @@ class CoreExport Channel : public Base, public Extensible
|
||||
* @param reason The reason for the kick
|
||||
* @return true if the kick was successful, false if a module blocked the kick
|
||||
*/
|
||||
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
|
||||
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...) ATTR_FORMAT(4, 5);
|
||||
bool Kick(BotInfo *bi, User *u, const Anope::string &reason);
|
||||
|
||||
/** Get all modes set on this channel, excluding status modes.
|
||||
* @return a map of modes and their optional parameters.
|
||||
@@ -298,7 +302,7 @@ class CoreExport Channel : public Base, public Extensible
|
||||
* @param name The channel to find
|
||||
* @return The channel, if found
|
||||
*/
|
||||
static Channel* Find(const Anope::string &name);
|
||||
static Channel *Find(const Anope::string &name);
|
||||
|
||||
/** Finds or creates a channel
|
||||
* @param name The channel name
|
||||
@@ -311,5 +315,3 @@ class CoreExport Channel : public Base, public Extensible
|
||||
|
||||
static void DeleteChannels();
|
||||
};
|
||||
|
||||
#endif // CHANNELS_H
|
||||
|
||||
+23
-24
@@ -9,25 +9,22 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
#pragma once
|
||||
|
||||
#include "service.h"
|
||||
#include "anope.h"
|
||||
#include "channels.h"
|
||||
|
||||
struct CommandGroup
|
||||
struct CommandGroup final
|
||||
{
|
||||
Anope::string name, description;
|
||||
};
|
||||
|
||||
/* Used in BotInfo::commands */
|
||||
struct CommandInfo
|
||||
struct CommandInfo final
|
||||
{
|
||||
typedef Anope::map<CommandInfo> map;
|
||||
|
||||
CommandInfo() : hide(false), prepend_channel(false) { }
|
||||
|
||||
/* Service name of the command */
|
||||
Anope::string name;
|
||||
/* Permission required to execute the command */
|
||||
@@ -35,9 +32,9 @@ struct CommandInfo
|
||||
/* Group this command is in */
|
||||
Anope::string group;
|
||||
/* whether or not to hide this command in help output */
|
||||
bool hide;
|
||||
bool hide = false;
|
||||
/* Only used with fantasy */
|
||||
bool prepend_channel;
|
||||
bool prepend_channel = false;
|
||||
};
|
||||
|
||||
/* Where the replies from commands go to. User inherits from this and is the normal
|
||||
@@ -45,18 +42,19 @@ struct CommandInfo
|
||||
*/
|
||||
struct CoreExport CommandReply
|
||||
{
|
||||
virtual ~CommandReply() { }
|
||||
virtual ~CommandReply() = default;
|
||||
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
|
||||
virtual void SendMessage(CommandSource &source, const Anope::string &msg);
|
||||
};
|
||||
|
||||
/* The source for a command */
|
||||
class CoreExport CommandSource
|
||||
class CoreExport CommandSource final
|
||||
{
|
||||
/* The nick executing the command */
|
||||
Anope::string nick;
|
||||
/* User executing the command, may be NULL */
|
||||
Reference<User> u;
|
||||
public:
|
||||
public:
|
||||
/* The account executing the command */
|
||||
Reference<NickCore> nc;
|
||||
/* for web clients */
|
||||
@@ -64,15 +62,17 @@ class CoreExport CommandSource
|
||||
/* Where the reply should go */
|
||||
CommandReply *reply;
|
||||
/* Channel the command was executed on (fantasy) */
|
||||
Reference<Channel> c;
|
||||
Reference<Channel> c = nullptr;
|
||||
/* The service this command is on */
|
||||
Reference<BotInfo> service;
|
||||
/* The actual name of the command being executed */
|
||||
Anope::string command;
|
||||
/* The permission of the command being executed */
|
||||
Anope::string permission;
|
||||
/* The unique identifier of the executing message. */
|
||||
Anope::string msgid;
|
||||
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
|
||||
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi, const Anope::string &m = "");
|
||||
|
||||
const Anope::string &GetNick() const;
|
||||
User *GetUser();
|
||||
@@ -80,7 +80,7 @@ class CoreExport CommandSource
|
||||
AccessGroup AccessFor(ChannelInfo *ci);
|
||||
bool IsFounder(ChannelInfo *ci);
|
||||
|
||||
void Reply(const char *message, ...);
|
||||
void Reply(const char *message, ...) ATTR_FORMAT(2, 3);
|
||||
void Reply(const Anope::string &message);
|
||||
|
||||
bool HasCommand(const Anope::string &cmd);
|
||||
@@ -91,7 +91,8 @@ class CoreExport CommandSource
|
||||
|
||||
/** Every services command is a class, inheriting from Command.
|
||||
*/
|
||||
class CoreExport Command : public Service
|
||||
class CoreExport Command
|
||||
: public Service
|
||||
{
|
||||
Anope::string desc;
|
||||
std::vector<Anope::string> syntax;
|
||||
@@ -100,7 +101,7 @@ class CoreExport Command : public Service
|
||||
/* Command requires that a user is executing it */
|
||||
bool require_user;
|
||||
|
||||
public:
|
||||
public:
|
||||
/* Maximum parameters accepted by this command */
|
||||
size_t max_params;
|
||||
/* Minimum parameters required to use this command */
|
||||
@@ -109,7 +110,7 @@ class CoreExport Command : public Service
|
||||
/* Module which owns us */
|
||||
Module *module;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
/** Create a new command.
|
||||
* @param owner The owner of the command
|
||||
* @param sname The command name
|
||||
@@ -119,10 +120,10 @@ class CoreExport Command : public Service
|
||||
*/
|
||||
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
|
||||
|
||||
public:
|
||||
virtual ~Command();
|
||||
public:
|
||||
virtual ~Command() = default;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void SetDesc(const Anope::string &d);
|
||||
|
||||
void ClearSyntax();
|
||||
@@ -132,7 +133,7 @@ class CoreExport Command : public Service
|
||||
void AllowUnregistered(bool b);
|
||||
void RequireUser(bool b);
|
||||
|
||||
public:
|
||||
public:
|
||||
bool AllowUnregistered() const;
|
||||
bool RequireUser() const;
|
||||
|
||||
@@ -181,7 +182,5 @@ class CoreExport Command : public Service
|
||||
* @param name If found, is set to the command name, eg REGISTER
|
||||
* @return true if the given command service exists
|
||||
*/
|
||||
static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name);
|
||||
static bool FindCommandFromService(const Anope::string &command_service, BotInfo *&bi, Anope::string &name);
|
||||
};
|
||||
|
||||
#endif // COMMANDS_H
|
||||
|
||||
+22
-30
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
#pragma once
|
||||
|
||||
#include "account.h"
|
||||
#include "regchannel.h"
|
||||
@@ -26,11 +25,11 @@ namespace Configuration
|
||||
{
|
||||
friend struct Configuration::Conf;
|
||||
|
||||
public:
|
||||
public:
|
||||
typedef Anope::map<Anope::string> item_map;
|
||||
typedef Anope::multimap<Block> block_map;
|
||||
|
||||
private:
|
||||
private:
|
||||
Anope::string name;
|
||||
item_map items;
|
||||
block_map blocks;
|
||||
@@ -39,21 +38,14 @@ namespace Configuration
|
||||
/* Represents a missing tag. */
|
||||
static Block EmptyBlock;
|
||||
|
||||
public:
|
||||
public:
|
||||
Block(const Anope::string &);
|
||||
const Anope::string &GetName() const;
|
||||
int CountBlock(const Anope::string &name) const;
|
||||
const Block* GetBlock(const Anope::string &name, int num = 0) const;
|
||||
Block* GetMutableBlock(const Anope::string &name, int num = 0);
|
||||
const Block *GetBlock(const Anope::string &name, int num = 0) const;
|
||||
Block *GetMutableBlock(const Anope::string &name, int num = 0);
|
||||
|
||||
template<typename T> inline T Get(const Anope::string &tag) const
|
||||
{
|
||||
return this->Get<T>(tag, "");
|
||||
}
|
||||
/* VS 2008 has an issue with having a default argument here (def = ""), which is why the above
|
||||
* function exists.
|
||||
*/
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
|
||||
{
|
||||
const Anope::string &value = this->Get<const Anope::string>(tag, def);
|
||||
if (!value.empty())
|
||||
@@ -66,10 +58,10 @@ namespace Configuration
|
||||
}
|
||||
|
||||
bool Set(const Anope::string &tag, const Anope::string &value);
|
||||
const item_map* GetItems() const;
|
||||
const item_map &GetItems() const;
|
||||
};
|
||||
|
||||
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
|
||||
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
} // namespace Internal
|
||||
@@ -79,12 +71,12 @@ namespace Configuration
|
||||
|
||||
/** Represents a configuration file
|
||||
*/
|
||||
class File
|
||||
class File final
|
||||
{
|
||||
Anope::string name;
|
||||
bool executable;
|
||||
FILE *fp;
|
||||
public:
|
||||
FILE *fp = nullptr;
|
||||
public:
|
||||
File(const Anope::string &, bool);
|
||||
~File();
|
||||
const Anope::string &GetName() const;
|
||||
@@ -99,7 +91,8 @@ namespace Configuration
|
||||
|
||||
struct Uplink;
|
||||
|
||||
struct CoreExport Conf : Block
|
||||
struct CoreExport Conf final
|
||||
: Block
|
||||
{
|
||||
/* options:readtimeout */
|
||||
time_t ReadTimeout;
|
||||
@@ -153,15 +146,15 @@ namespace Configuration
|
||||
const Block *GetCommand(CommandSource &);
|
||||
};
|
||||
|
||||
struct Uplink
|
||||
struct Uplink final
|
||||
{
|
||||
Anope::string host;
|
||||
unsigned port;
|
||||
Anope::string password;
|
||||
bool ipv6;
|
||||
int protocol;
|
||||
|
||||
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
|
||||
inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && ipv6 == other.ipv6; }
|
||||
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, int _protocol) : host(_host), port(_port), password(_password), protocol(_protocol) { }
|
||||
inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && protocol == other.protocol; }
|
||||
inline bool operator!=(const Uplink &other) const { return !(*this == other); }
|
||||
};
|
||||
}
|
||||
@@ -172,9 +165,10 @@ namespace Configuration
|
||||
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
|
||||
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
|
||||
*/
|
||||
class ConfigException : public CoreException
|
||||
class CoreExport ConfigException final
|
||||
: public CoreException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Default constructor, just uses the error message 'Config threw an exception'.
|
||||
*/
|
||||
ConfigException() : CoreException("Config threw an exception", "Config Parser") { }
|
||||
@@ -185,10 +179,8 @@ class ConfigException : public CoreException
|
||||
* Actually no, it does nothing. Never mind.
|
||||
* @throws Nothing!
|
||||
*/
|
||||
virtual ~ConfigException() throw() { }
|
||||
virtual ~ConfigException() noexcept = default;
|
||||
};
|
||||
|
||||
extern Configuration::File ServicesConf;
|
||||
extern CoreExport Configuration::Conf *Config;
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class AccessGroup;
|
||||
class AutoKick;
|
||||
class BotInfo;
|
||||
|
||||
+51
-48
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef EXTENSIBLE_H
|
||||
#define EXTENSIBLE_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "serialize.h"
|
||||
@@ -16,15 +15,16 @@
|
||||
|
||||
class Extensible;
|
||||
|
||||
class CoreExport ExtensibleBase : public Service
|
||||
class CoreExport ExtensibleBase
|
||||
: public Service
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
std::map<Extensible *, void *> items;
|
||||
|
||||
ExtensibleBase(Module *m, const Anope::string &n);
|
||||
~ExtensibleBase();
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual void Unset(Extensible *obj) = 0;
|
||||
|
||||
/* called when an object we are keep track of is serializing */
|
||||
@@ -34,19 +34,19 @@ class CoreExport ExtensibleBase : public Service
|
||||
|
||||
class CoreExport Extensible
|
||||
{
|
||||
public:
|
||||
public:
|
||||
std::set<ExtensibleBase *> extension_items;
|
||||
|
||||
virtual ~Extensible();
|
||||
|
||||
void UnsetExtensibles();
|
||||
|
||||
template<typename T> T* GetExt(const Anope::string &name) const;
|
||||
template<typename T> T *GetExt(const Anope::string &name) const;
|
||||
bool HasExt(const Anope::string &name) const;
|
||||
|
||||
template<typename T> T* Extend(const Anope::string &name, const T &what);
|
||||
template<typename T> T* Extend(const Anope::string &name);
|
||||
template<typename T> T* Require(const Anope::string &name);
|
||||
template<typename T> T *Extend(const Anope::string &name, const T &what);
|
||||
template<typename T> T *Extend(const Anope::string &name);
|
||||
template<typename T> T *Require(const Anope::string &name);
|
||||
template<typename T> void Shrink(const Anope::string &name);
|
||||
|
||||
static void ExtensibleSerialize(const Extensible *, const Serializable *, Serialize::Data &data);
|
||||
@@ -54,12 +54,13 @@ class CoreExport Extensible
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class BaseExtensibleItem : public ExtensibleBase
|
||||
class BaseExtensibleItem
|
||||
: public ExtensibleBase
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
virtual T *Create(Extensible *) = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
BaseExtensibleItem(Module *m, const Anope::string &n) : ExtensibleBase(m, n) { }
|
||||
|
||||
~BaseExtensibleItem()
|
||||
@@ -76,24 +77,24 @@ class BaseExtensibleItem : public ExtensibleBase
|
||||
}
|
||||
}
|
||||
|
||||
T* Set(Extensible *obj, const T &value)
|
||||
T *Set(Extensible *obj, const T &value)
|
||||
{
|
||||
T* t = Set(obj);
|
||||
T *t = Set(obj);
|
||||
if (t)
|
||||
*t = value;
|
||||
return t;
|
||||
}
|
||||
|
||||
T* Set(Extensible *obj)
|
||||
T *Set(Extensible *obj)
|
||||
{
|
||||
T* t = Create(obj);
|
||||
T *t = Create(obj);
|
||||
Unset(obj);
|
||||
items[obj] = t;
|
||||
obj->extension_items.insert(this);
|
||||
return t;
|
||||
}
|
||||
|
||||
void Unset(Extensible *obj) anope_override
|
||||
void Unset(Extensible *obj) override
|
||||
{
|
||||
T *value = Get(obj);
|
||||
items.erase(obj);
|
||||
@@ -101,7 +102,7 @@ class BaseExtensibleItem : public ExtensibleBase
|
||||
delete value;
|
||||
}
|
||||
|
||||
T* Get(const Extensible *obj) const
|
||||
T *Get(const Extensible *obj) const
|
||||
{
|
||||
std::map<Extensible *, void *>::const_iterator it = items.find(const_cast<Extensible *>(obj));
|
||||
if (it != items.end())
|
||||
@@ -114,9 +115,9 @@ class BaseExtensibleItem : public ExtensibleBase
|
||||
return items.find(const_cast<Extensible *>(obj)) != items.end();
|
||||
}
|
||||
|
||||
T* Require(Extensible *obj)
|
||||
T *Require(Extensible *obj)
|
||||
{
|
||||
T* t = Get(obj);
|
||||
T *t = Get(obj);
|
||||
if (t)
|
||||
return t;
|
||||
|
||||
@@ -125,54 +126,57 @@ class BaseExtensibleItem : public ExtensibleBase
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ExtensibleItem : public BaseExtensibleItem<T>
|
||||
class ExtensibleItem
|
||||
: public BaseExtensibleItem<T>
|
||||
{
|
||||
protected:
|
||||
T* Create(Extensible *obj) anope_override
|
||||
protected:
|
||||
T *Create(Extensible *obj) override
|
||||
{
|
||||
return new T(obj);
|
||||
}
|
||||
public:
|
||||
public:
|
||||
ExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class PrimitiveExtensibleItem : public BaseExtensibleItem<T>
|
||||
class PrimitiveExtensibleItem
|
||||
: public BaseExtensibleItem<T>
|
||||
{
|
||||
protected:
|
||||
T* Create(Extensible *obj) anope_override
|
||||
protected:
|
||||
T *Create(Extensible *obj) override
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
public:
|
||||
public:
|
||||
PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { }
|
||||
};
|
||||
|
||||
template<>
|
||||
class PrimitiveExtensibleItem<bool> : public BaseExtensibleItem<bool>
|
||||
{
|
||||
protected:
|
||||
bool* Create(Extensible *) anope_override
|
||||
protected:
|
||||
bool *Create(Extensible *) override
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
public:
|
||||
public:
|
||||
PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<bool>(m, n) { }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
|
||||
class SerializableExtensibleItem
|
||||
: public PrimitiveExtensibleItem<T>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<T>(m, n) { }
|
||||
|
||||
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
|
||||
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
|
||||
{
|
||||
T* t = this->Get(e);
|
||||
T *t = this->Get(e);
|
||||
data[this->name] << *t;
|
||||
}
|
||||
|
||||
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
|
||||
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
|
||||
{
|
||||
T t;
|
||||
if (data[this->name] >> t)
|
||||
@@ -185,15 +189,15 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
|
||||
template<>
|
||||
class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<bool>(m, n) { }
|
||||
|
||||
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
|
||||
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
|
||||
{
|
||||
data[this->name] << true;
|
||||
}
|
||||
|
||||
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
|
||||
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
|
||||
{
|
||||
bool b = false;
|
||||
data[this->name] >> b;
|
||||
@@ -205,13 +209,14 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ExtensibleRef : ServiceReference<BaseExtensibleItem<T> >
|
||||
struct ExtensibleRef final
|
||||
: ServiceReference<BaseExtensibleItem<T> >
|
||||
{
|
||||
ExtensibleRef(const Anope::string &n) : ServiceReference<BaseExtensibleItem<T> >("Extensible", n) { }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T* Extensible::GetExt(const Anope::string &name) const
|
||||
T *Extensible::GetExt(const Anope::string &name) const
|
||||
{
|
||||
ExtensibleRef<T> ref(name);
|
||||
if (ref)
|
||||
@@ -222,16 +227,16 @@ T* Extensible::GetExt(const Anope::string &name) const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Extensible::Extend(const Anope::string &name, const T &what)
|
||||
T *Extensible::Extend(const Anope::string &name, const T &what)
|
||||
{
|
||||
T* t = Extend<T>(name);
|
||||
T *t = Extend<T>(name);
|
||||
if (t)
|
||||
*t = what;
|
||||
return t;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Extensible::Extend(const Anope::string &name)
|
||||
T *Extensible::Extend(const Anope::string &name)
|
||||
{
|
||||
ExtensibleRef<T> ref(name);
|
||||
if (ref)
|
||||
@@ -242,7 +247,7 @@ T* Extensible::Extend(const Anope::string &name)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* Extensible::Require(const Anope::string &name)
|
||||
T *Extensible::Require(const Anope::string &name)
|
||||
{
|
||||
if (HasExt(name))
|
||||
return GetExt<T>(name);
|
||||
@@ -259,5 +264,3 @@ void Extensible::Shrink(const Anope::string &name)
|
||||
else
|
||||
Log(LOG_DEBUG) << "Shrink for nonexistent type " << name << " on " << static_cast<void *>(this);
|
||||
}
|
||||
|
||||
#endif // EXTENSIBLE_H
|
||||
|
||||
+17
-24
@@ -6,19 +6,11 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef HASHCOMP_H
|
||||
#define HASHCOMP_H
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <locale>
|
||||
|
||||
#if defined _LIBCPP_VERSION || defined _WIN32
|
||||
#include <unordered_map>
|
||||
#define TR1NS std
|
||||
#else
|
||||
#include <tr1/unordered_map>
|
||||
#define TR1NS std::tr1
|
||||
#endif
|
||||
|
||||
#include "services.h"
|
||||
|
||||
@@ -29,16 +21,17 @@ namespace Anope
|
||||
/* Casemap in use by Anope. ci::string's comparison functions use this (and thus Anope::string) */
|
||||
extern std::locale casemap;
|
||||
|
||||
extern void CaseMapRebuild();
|
||||
extern unsigned char tolower(unsigned char);
|
||||
extern unsigned char toupper(unsigned char);
|
||||
extern CoreExport void CaseMapRebuild();
|
||||
extern CoreExport unsigned char tolower(unsigned char);
|
||||
extern CoreExport unsigned char toupper(unsigned char);
|
||||
|
||||
/* ASCII case insensitive ctype. */
|
||||
template<typename char_type>
|
||||
class ascii_ctype : public std::ctype<char_type>
|
||||
class ascii_ctype
|
||||
: public std::ctype<char_type>
|
||||
{
|
||||
public:
|
||||
char_type do_toupper(char_type c) const anope_override
|
||||
public:
|
||||
char_type do_toupper(char_type c) const override
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return c - 32;
|
||||
@@ -46,7 +39,7 @@ namespace Anope
|
||||
return c;
|
||||
}
|
||||
|
||||
char_type do_tolower(char_type c) const anope_override
|
||||
char_type do_tolower(char_type c) const override
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c + 32;
|
||||
@@ -57,10 +50,11 @@ namespace Anope
|
||||
|
||||
/* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */
|
||||
template<typename char_type>
|
||||
class rfc1459_ctype : public ascii_ctype<char_type>
|
||||
class rfc1459_ctype final
|
||||
: public ascii_ctype<char_type>
|
||||
{
|
||||
public:
|
||||
char_type do_toupper(char_type c) const anope_override
|
||||
public:
|
||||
char_type do_toupper(char_type c) const override
|
||||
{
|
||||
if (c == '{' || c == '}' || c == '|')
|
||||
return c - 32;
|
||||
@@ -68,7 +62,7 @@ namespace Anope
|
||||
return ascii_ctype<char_type>::do_toupper(c);
|
||||
}
|
||||
|
||||
char_type do_tolower(char_type c) const anope_override
|
||||
char_type do_tolower(char_type c) const override
|
||||
{
|
||||
if (c == '[' || c == ']' || c == '\\')
|
||||
return c + 32;
|
||||
@@ -86,7 +80,8 @@ namespace ci
|
||||
* This class is used to implement ci::string, a case-insensitive, ASCII-
|
||||
* comparing string class.
|
||||
*/
|
||||
struct CoreExport ci_char_traits : std::char_traits<char>
|
||||
struct CoreExport ci_char_traits final
|
||||
: std::char_traits<char>
|
||||
{
|
||||
/** Check if two chars match.
|
||||
* @param c1st First character
|
||||
@@ -131,7 +126,7 @@ namespace ci
|
||||
*/
|
||||
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
|
||||
|
||||
struct CoreExport less
|
||||
struct CoreExport less final
|
||||
{
|
||||
/** Compare two Anope::strings as ci::strings and find which one is less
|
||||
* @param s1 The first string
|
||||
@@ -195,5 +190,3 @@ inline bool operator!=(const std::string &leftval, const ci::string &rightval)
|
||||
{
|
||||
return !(leftval.c_str() == rightval);
|
||||
}
|
||||
|
||||
#endif // HASHCOMP_H
|
||||
|
||||
+12
-11
@@ -6,12 +6,14 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
namespace Language
|
||||
{
|
||||
|
||||
/* Languages we support as configured in services.conf. They are
|
||||
/* Languages we support as configured in anope.conf. They are
|
||||
* added to this list if we detect a language exists in the correct
|
||||
* location for each language.
|
||||
*/
|
||||
@@ -70,10 +72,11 @@ namespace Language
|
||||
#define READ_ONLY_MODE _("Services are in read-only mode!")
|
||||
#define PASSWORD_INCORRECT _("Password incorrect.")
|
||||
#define ACCESS_DENIED _("Access denied.")
|
||||
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \
|
||||
"five characters long, should not be something easily guessed\n" \
|
||||
"(e.g. your real name or your nick), and cannot contain the space or tab characters.")
|
||||
#define PASSWORD_TOO_LONG _("Your password is too long. It must not exceed %u characters.")
|
||||
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should not be\n" \
|
||||
"something that could be easily guessed (e.g. your real name or your nick) and\n" \
|
||||
"cannot contain the space or tab characters.\n")
|
||||
#define PASSWORD_TOO_SHORT _("Your password is too short. It must be longer than %u characters.")
|
||||
#define PASSWORD_TOO_LONG _("Your password is too long. It must be shorter than %u characters.")
|
||||
#define NICK_NOT_REGISTERED _("Your nick isn't registered.")
|
||||
#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.")
|
||||
#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.")
|
||||
@@ -87,8 +90,6 @@ namespace Language
|
||||
#define UNKNOWN _("<unknown>")
|
||||
#define NO_EXPIRE _("does not expire")
|
||||
#define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")
|
||||
#define NICK_IS_REGISTERED _("This nick is owned by someone else. Please choose another.\n" \
|
||||
"(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)")
|
||||
#define NICK_IS_SECURE _("This nickname is registered and protected. If it is your\n" \
|
||||
"nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \
|
||||
"please choose a different nick.")
|
||||
@@ -108,9 +109,9 @@ namespace Language
|
||||
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
|
||||
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
|
||||
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
|
||||
"Type \002%s%s READ %s %d\002 to read it.")
|
||||
"Type \002%s%s READ %s %zu\002 to read it.")
|
||||
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
|
||||
"Type \002%s%s READ %d\002 to read it.")
|
||||
"Type \002%s%s READ %zu\002 to read it.")
|
||||
#define MEMO_HAVE_NO_MEMOS _("You have no memos.")
|
||||
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
|
||||
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
|
||||
@@ -121,7 +122,7 @@ namespace Language
|
||||
#define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.")
|
||||
#define HOST_SET_ERROR _("A vHost must be in the format of a valid hostname.")
|
||||
#define HOST_SET_IDENT_ERROR _("A vHost ident must be in the format of a valid ident.")
|
||||
#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %d characters.")
|
||||
#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %d characters.")
|
||||
#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %zu characters.")
|
||||
#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %zu characters.")
|
||||
#define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vHost assigned to this nick.")
|
||||
#define HOST_NO_VIDENT _("Your IRCd does not support vIdent's, if this is incorrect, please report this as a possible bug")
|
||||
|
||||
+12
-15
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef LISTS_H
|
||||
#define LISTS_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
@@ -24,13 +23,13 @@
|
||||
*/
|
||||
class CoreExport NumberList
|
||||
{
|
||||
private:
|
||||
bool is_valid;
|
||||
private:
|
||||
bool is_valid = true;
|
||||
|
||||
std::set<unsigned> numbers;
|
||||
|
||||
bool desc;
|
||||
public:
|
||||
public:
|
||||
/** Processes a numbered list
|
||||
* @param list The list
|
||||
* @param descending True to make HandleNumber get called with numbers in descending order
|
||||
@@ -39,7 +38,7 @@ class CoreExport NumberList
|
||||
|
||||
/** Destructor, does nothing
|
||||
*/
|
||||
virtual ~NumberList();
|
||||
virtual ~NumberList() = default;
|
||||
|
||||
/** Should be called after the constructors are done running. This calls the callbacks.
|
||||
*/
|
||||
@@ -61,15 +60,15 @@ class CoreExport NumberList
|
||||
|
||||
/** This class handles formatting LIST/VIEW replies.
|
||||
*/
|
||||
class CoreExport ListFormatter
|
||||
class CoreExport ListFormatter final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef std::map<Anope::string, Anope::string> ListEntry;
|
||||
private:
|
||||
private:
|
||||
NickCore *nc;
|
||||
std::vector<Anope::string> columns;
|
||||
std::vector<ListEntry> entries;
|
||||
public:
|
||||
public:
|
||||
ListFormatter(NickCore *nc);
|
||||
ListFormatter &AddColumn(const Anope::string &name);
|
||||
void AddEntry(const ListEntry &entry);
|
||||
@@ -79,16 +78,14 @@ class CoreExport ListFormatter
|
||||
|
||||
/** This class handles formatting INFO replies
|
||||
*/
|
||||
class CoreExport InfoFormatter
|
||||
class CoreExport InfoFormatter final
|
||||
{
|
||||
NickCore *nc;
|
||||
std::vector<std::pair<Anope::string, Anope::string> > replies;
|
||||
unsigned longest;
|
||||
public:
|
||||
unsigned longest = 0;
|
||||
public:
|
||||
InfoFormatter(NickCore *nc);
|
||||
void Process(std::vector<Anope::string> &);
|
||||
Anope::string &operator[](const Anope::string &key);
|
||||
void AddOption(const Anope::string &opt);
|
||||
};
|
||||
|
||||
#endif // LISTS_H
|
||||
|
||||
+19
-22
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "defs.h"
|
||||
@@ -38,7 +37,7 @@ enum LogType
|
||||
LOG_DEBUG_4
|
||||
};
|
||||
|
||||
struct LogFile
|
||||
struct LogFile final
|
||||
{
|
||||
Anope::string filename;
|
||||
std::ofstream stream;
|
||||
@@ -49,27 +48,27 @@ struct LogFile
|
||||
};
|
||||
|
||||
/* Represents a single log message */
|
||||
class CoreExport Log
|
||||
class CoreExport Log final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Bot that should log this message */
|
||||
BotInfo *bi;
|
||||
BotInfo *bi = nullptr;
|
||||
/* For commands, the user executing the command, but might not always exist */
|
||||
User *u;
|
||||
User *u = nullptr;
|
||||
/* For commands, the account executing the command, but will not always exist */
|
||||
NickCore *nc;
|
||||
NickCore *nc = nullptr;
|
||||
/* For commands, the command being executed */
|
||||
Command *c;
|
||||
Command *c = nullptr;
|
||||
/* For commands, the command source */
|
||||
CommandSource *source;
|
||||
CommandSource *source = nullptr;
|
||||
/* Used for LOG_CHANNEL */
|
||||
Channel *chan;
|
||||
Channel *chan = nullptr;
|
||||
/* For commands, the channel the command was executed on, will not always exist */
|
||||
const ChannelInfo *ci;
|
||||
const ChannelInfo *ci = nullptr;
|
||||
/* For LOG_SERVER */
|
||||
Server *s;
|
||||
Server *s = nullptr;
|
||||
/* For LOG_MODULE */
|
||||
Module *m;
|
||||
Module *m = nullptr;
|
||||
LogType type;
|
||||
Anope::string category;
|
||||
|
||||
@@ -95,11 +94,11 @@ class CoreExport Log
|
||||
|
||||
~Log();
|
||||
|
||||
private:
|
||||
private:
|
||||
Anope::string FormatSource() const;
|
||||
Anope::string FormatCommand() const;
|
||||
|
||||
public:
|
||||
public:
|
||||
Anope::string BuildPrefix() const;
|
||||
|
||||
template<typename T> Log &operator<<(T val)
|
||||
@@ -110,13 +109,13 @@ class CoreExport Log
|
||||
};
|
||||
|
||||
/* Configured in the configuration file, actually does the message logging */
|
||||
class CoreExport LogInfo
|
||||
class CoreExport LogInfo final
|
||||
{
|
||||
public:
|
||||
BotInfo *bot;
|
||||
public:
|
||||
BotInfo *bot = nullptr;
|
||||
std::vector<Anope::string> targets;
|
||||
std::vector<LogFile *> logfiles;
|
||||
int last_day;
|
||||
int last_day = 0;
|
||||
std::vector<Anope::string> sources;
|
||||
int log_age;
|
||||
std::vector<Anope::string> admin;
|
||||
@@ -140,5 +139,3 @@ class CoreExport LogInfo
|
||||
/* Logs the message l if configured to */
|
||||
void ProcessMessage(const Log *l);
|
||||
};
|
||||
|
||||
#endif // LOGGER_H
|
||||
|
||||
+7
-9
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef MAIL_H
|
||||
#define MAIL_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "threadengine.h"
|
||||
@@ -23,9 +22,10 @@ namespace Mail
|
||||
extern CoreExport bool Validate(const Anope::string &email);
|
||||
|
||||
/* A email message being sent */
|
||||
class Message : public Thread
|
||||
class Message final
|
||||
: public Thread
|
||||
{
|
||||
private:
|
||||
private:
|
||||
Anope::string sendmail_path;
|
||||
Anope::string send_from;
|
||||
Anope::string mail_to;
|
||||
@@ -35,8 +35,8 @@ namespace Mail
|
||||
Anope::string content_type;
|
||||
bool dont_quote_addresses;
|
||||
|
||||
bool success;
|
||||
public:
|
||||
bool success = false;
|
||||
public:
|
||||
/** Construct this message. Once constructed call Thread::Start to launch the mail sending.
|
||||
* @param sf Config->SendFrom
|
||||
* @param mailto Name of person being mailed (u->nick, nc->display, etc)
|
||||
@@ -49,9 +49,7 @@ namespace Mail
|
||||
~Message();
|
||||
|
||||
/* Called from within the thread to actually send the mail */
|
||||
void Run() anope_override;
|
||||
void Run() override;
|
||||
};
|
||||
|
||||
} // namespace Mail
|
||||
|
||||
#endif // MAIL_H
|
||||
|
||||
+8
-10
@@ -9,23 +9,23 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef MEMO_H
|
||||
#define MEMO_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "serialize.h"
|
||||
|
||||
class CoreExport Memo : public Serializable
|
||||
class CoreExport Memo final
|
||||
: public Serializable
|
||||
{
|
||||
public:
|
||||
public:
|
||||
MemoInfo *mi;
|
||||
bool unread;
|
||||
bool receipt;
|
||||
Memo();
|
||||
~Memo();
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
Anope::string owner;
|
||||
/* When it was sent */
|
||||
@@ -37,9 +37,9 @@ class CoreExport Memo : public Serializable
|
||||
/* Memo info structures. Since both nicknames and channels can have memos,
|
||||
* we encapsulate memo data in a MemoInfo to make it easier to handle.
|
||||
*/
|
||||
struct CoreExport MemoInfo
|
||||
struct CoreExport MemoInfo final
|
||||
{
|
||||
int16_t memomax;
|
||||
int16_t memomax = 0;
|
||||
Serialize::Checker<std::vector<Memo *> > memos;
|
||||
std::vector<Anope::string> ignores;
|
||||
|
||||
@@ -51,5 +51,3 @@ struct CoreExport MemoInfo
|
||||
|
||||
static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
|
||||
};
|
||||
|
||||
#endif // MEMO_H
|
||||
|
||||
+78
-56
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
/* Common IRCD messages.
|
||||
@@ -19,39 +21,44 @@
|
||||
namespace Message
|
||||
{
|
||||
|
||||
struct CoreExport Away : IRCDMessage
|
||||
struct CoreExport Away
|
||||
: IRCDMessage
|
||||
{
|
||||
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Capab : IRCDMessage
|
||||
struct CoreExport Capab
|
||||
: IRCDMessage
|
||||
{
|
||||
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Error : IRCDMessage
|
||||
struct CoreExport Error
|
||||
: IRCDMessage
|
||||
{
|
||||
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Invite : IRCDMessage
|
||||
struct CoreExport Invite
|
||||
: IRCDMessage
|
||||
{
|
||||
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Join : IRCDMessage
|
||||
struct CoreExport Join
|
||||
: IRCDMessage
|
||||
{
|
||||
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
|
||||
typedef std::pair<ChannelStatus, User *> SJoinUser;
|
||||
|
||||
@@ -65,109 +72,124 @@ namespace Message
|
||||
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
|
||||
};
|
||||
|
||||
struct CoreExport Kick : IRCDMessage
|
||||
struct CoreExport Kick
|
||||
: IRCDMessage
|
||||
{
|
||||
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Kill : IRCDMessage
|
||||
struct CoreExport Kill
|
||||
: IRCDMessage
|
||||
{
|
||||
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Mode : IRCDMessage
|
||||
struct CoreExport Mode
|
||||
: IRCDMessage
|
||||
{
|
||||
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport MOTD : IRCDMessage
|
||||
struct CoreExport MOTD
|
||||
: IRCDMessage
|
||||
{
|
||||
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Notice : IRCDMessage
|
||||
struct CoreExport Notice
|
||||
: IRCDMessage
|
||||
{
|
||||
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Part : IRCDMessage
|
||||
struct CoreExport Part
|
||||
: IRCDMessage
|
||||
{
|
||||
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Ping : IRCDMessage
|
||||
struct CoreExport Ping
|
||||
: IRCDMessage
|
||||
{
|
||||
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Privmsg : IRCDMessage
|
||||
struct CoreExport Privmsg
|
||||
: IRCDMessage
|
||||
{
|
||||
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Quit : IRCDMessage
|
||||
struct CoreExport Quit
|
||||
: IRCDMessage
|
||||
{
|
||||
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport SQuit : IRCDMessage
|
||||
struct CoreExport SQuit
|
||||
: IRCDMessage
|
||||
{
|
||||
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Stats : IRCDMessage
|
||||
struct CoreExport Stats
|
||||
: IRCDMessage
|
||||
{
|
||||
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Time : IRCDMessage
|
||||
struct CoreExport Time
|
||||
: IRCDMessage
|
||||
{
|
||||
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Topic : IRCDMessage
|
||||
struct CoreExport Topic
|
||||
: IRCDMessage
|
||||
{
|
||||
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Version : IRCDMessage
|
||||
struct CoreExport Version
|
||||
: IRCDMessage
|
||||
{
|
||||
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
struct CoreExport Whois : IRCDMessage
|
||||
struct CoreExport Whois
|
||||
: IRCDMessage
|
||||
{
|
||||
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
|
||||
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
} // namespace Message
|
||||
|
||||
+61
-51
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef MODES_H
|
||||
#define MODES_H
|
||||
#pragma once
|
||||
|
||||
#include "anope.h"
|
||||
#include "base.h"
|
||||
@@ -36,9 +35,10 @@ enum ModeClass
|
||||
|
||||
/** This class is the basis of all modes in Anope
|
||||
*/
|
||||
class CoreExport Mode : public Base
|
||||
class CoreExport Mode
|
||||
: public Base
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Mode name */
|
||||
Anope::string name;
|
||||
/* Class of mode this is (user/channel) */
|
||||
@@ -55,7 +55,7 @@ class CoreExport Mode : public Base
|
||||
* @param type The mode type
|
||||
*/
|
||||
Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
|
||||
virtual ~Mode();
|
||||
virtual ~Mode() = default;
|
||||
|
||||
/** Can a user set this mode, used for mlock
|
||||
* @param u The user
|
||||
@@ -65,9 +65,10 @@ class CoreExport Mode : public Base
|
||||
|
||||
/** This class is a user mode, all user modes use this/inherit from this
|
||||
*/
|
||||
class CoreExport UserMode : public Mode
|
||||
class CoreExport UserMode
|
||||
: public Mode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** constructor
|
||||
* @param name The mode name
|
||||
* @param mc The mode char
|
||||
@@ -75,9 +76,10 @@ class CoreExport UserMode : public Mode
|
||||
UserMode(const Anope::string &name, char mc);
|
||||
};
|
||||
|
||||
class CoreExport UserModeParam : public UserMode
|
||||
class CoreExport UserModeParam
|
||||
: public UserMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** constructor
|
||||
* @param name The mode name
|
||||
* @param mc The mode char
|
||||
@@ -93,9 +95,10 @@ class CoreExport UserModeParam : public UserMode
|
||||
|
||||
/** This class is a channel mode, all channel modes use this/inherit from this
|
||||
*/
|
||||
class CoreExport ChannelMode : public Mode
|
||||
class CoreExport ChannelMode
|
||||
: public Mode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* channel modes that can possibly unwrap this mode */
|
||||
std::vector<ChannelMode *> listeners;
|
||||
|
||||
@@ -105,7 +108,7 @@ class CoreExport ChannelMode : public Mode
|
||||
*/
|
||||
ChannelMode(const Anope::string &name, char mc);
|
||||
|
||||
bool CanSet(User *u) const anope_override;
|
||||
bool CanSet(User *u) const override;
|
||||
|
||||
virtual void Check() { }
|
||||
|
||||
@@ -124,9 +127,10 @@ class CoreExport ChannelMode : public Mode
|
||||
|
||||
/** This is a mode for lists, eg b/e/I. These modes should inherit from this
|
||||
*/
|
||||
class CoreExport ChannelModeList : public ChannelMode
|
||||
class CoreExport ChannelModeList
|
||||
: public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** constructor
|
||||
* @param name The mode name
|
||||
* @param mc The mode char
|
||||
@@ -162,9 +166,10 @@ class CoreExport ChannelModeList : public ChannelMode
|
||||
|
||||
/** This is a mode with a parameter, eg +k/l. These modes should use/inherit from this
|
||||
*/
|
||||
class CoreExport ChannelModeParam : public ChannelMode
|
||||
class CoreExport ChannelModeParam
|
||||
: public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** constructor
|
||||
* @param name The mode name
|
||||
* @param mc The mode char
|
||||
@@ -184,9 +189,10 @@ class CoreExport ChannelModeParam : public ChannelMode
|
||||
|
||||
/** This is a mode that is a channel status, eg +v/h/o/a/q.
|
||||
*/
|
||||
class CoreExport ChannelModeStatus : public ChannelMode
|
||||
class CoreExport ChannelModeStatus
|
||||
: public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* The symbol, eg @ % + */
|
||||
char symbol;
|
||||
/* The "level" of the mode, used to compare with other modes.
|
||||
@@ -207,29 +213,30 @@ class CoreExport ChannelModeStatus : public ChannelMode
|
||||
* but we still have a representation for it.
|
||||
*/
|
||||
template<typename T>
|
||||
class CoreExport ChannelModeVirtual : public T
|
||||
class CoreExport ChannelModeVirtual
|
||||
: public T
|
||||
{
|
||||
Anope::string base;
|
||||
ChannelMode *basech;
|
||||
|
||||
public:
|
||||
public:
|
||||
ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename);
|
||||
|
||||
~ChannelModeVirtual();
|
||||
|
||||
void Check() anope_override;
|
||||
void Check() override;
|
||||
|
||||
ChannelMode *Wrap(Anope::string ¶m) anope_override;
|
||||
ChannelMode *Wrap(Anope::string ¶m) override;
|
||||
|
||||
ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) anope_override = 0;
|
||||
ChannelMode *Unwrap(ChannelMode *cm, Anope::string ¶m) override = 0;
|
||||
};
|
||||
|
||||
/* The status a user has on a channel (+v, +h, +o) etc */
|
||||
class CoreExport ChannelStatus
|
||||
class CoreExport ChannelStatus final
|
||||
{
|
||||
Anope::string modes;
|
||||
public:
|
||||
ChannelStatus();
|
||||
public:
|
||||
ChannelStatus() = default;
|
||||
ChannelStatus(const Anope::string &modes);
|
||||
void AddMode(char c);
|
||||
void DelMode(char c);
|
||||
@@ -240,51 +247,56 @@ class CoreExport ChannelStatus
|
||||
Anope::string BuildModePrefixList() const;
|
||||
};
|
||||
|
||||
class CoreExport UserModeOperOnly : public UserMode
|
||||
class CoreExport UserModeOperOnly
|
||||
: public UserMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { }
|
||||
|
||||
bool CanSet(User *u) const anope_override;
|
||||
bool CanSet(User *u) const override;
|
||||
};
|
||||
|
||||
class CoreExport UserModeNoone : public UserMode
|
||||
class CoreExport UserModeNoone
|
||||
: public UserMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { }
|
||||
|
||||
bool CanSet(User *u) const anope_override;
|
||||
bool CanSet(User *u) const override;
|
||||
};
|
||||
|
||||
/** Channel mode +k (key)
|
||||
*/
|
||||
class CoreExport ChannelModeKey : public ChannelModeParam
|
||||
class CoreExport ChannelModeKey
|
||||
: public ChannelModeParam
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
|
||||
|
||||
bool IsValid(Anope::string &value) const anope_override;
|
||||
bool IsValid(Anope::string &value) const override;
|
||||
};
|
||||
|
||||
/** This class is used for oper only channel modes
|
||||
*/
|
||||
class CoreExport ChannelModeOperOnly : public ChannelMode
|
||||
class CoreExport ChannelModeOperOnly
|
||||
: public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
|
||||
|
||||
/* Opers only */
|
||||
bool CanSet(User *u) const anope_override;
|
||||
bool CanSet(User *u) const override;
|
||||
};
|
||||
|
||||
/** This class is used for channel modes only servers may set
|
||||
*/
|
||||
class CoreExport ChannelModeNoone : public ChannelMode
|
||||
class CoreExport ChannelModeNoone
|
||||
: public ChannelMode
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
|
||||
|
||||
bool CanSet(User *u) const anope_override;
|
||||
bool CanSet(User *u) const override;
|
||||
};
|
||||
|
||||
/** This is the mode manager
|
||||
@@ -293,9 +305,9 @@ class CoreExport ChannelModeNoone : public ChannelMode
|
||||
* This also contains a mode stacker that will combine multiple modes and set
|
||||
* them on a channel or user at once
|
||||
*/
|
||||
class CoreExport ModeManager
|
||||
class CoreExport ModeManager final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
/* Number of generic channel and user modes we are tracking */
|
||||
static unsigned GenericChannelModes;
|
||||
@@ -389,13 +401,13 @@ class CoreExport ModeManager
|
||||
|
||||
/** Represents a mask set on a channel (b/e/I)
|
||||
*/
|
||||
class CoreExport Entry
|
||||
class CoreExport Entry final
|
||||
{
|
||||
Anope::string name;
|
||||
Anope::string mask;
|
||||
public:
|
||||
unsigned short cidr_len;
|
||||
int family;
|
||||
public:
|
||||
unsigned short cidr_len = 0;
|
||||
int family = 0;
|
||||
Anope::string nick, user, host, real;
|
||||
|
||||
/** Constructor
|
||||
@@ -407,9 +419,9 @@ class CoreExport Entry
|
||||
/** Get the banned mask for this entry
|
||||
* @return The mask
|
||||
*/
|
||||
const Anope::string GetMask() const;
|
||||
Anope::string GetMask() const;
|
||||
|
||||
const Anope::string GetNUHMask() const;
|
||||
Anope::string GetNUHMask() const;
|
||||
|
||||
/** Check if this entry matches a user
|
||||
* @param u The user
|
||||
@@ -418,5 +430,3 @@ class CoreExport Entry
|
||||
*/
|
||||
bool Matches(User *u, bool full = false) const;
|
||||
};
|
||||
|
||||
#endif // MODES_H
|
||||
|
||||
+1
-4
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef MODULE_H
|
||||
#define MODULE_H
|
||||
#pragma once
|
||||
|
||||
#include "access.h"
|
||||
#include "account.h"
|
||||
@@ -50,5 +49,3 @@
|
||||
#include "modules/pseudoclients/global.h"
|
||||
#include "modules/pseudoclients/memoserv.h"
|
||||
#include "modules/pseudoclients/nickserv.h"
|
||||
|
||||
#endif // MODULE_H
|
||||
|
||||
+30
-76
@@ -9,11 +9,10 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "serialize.h"
|
||||
|
||||
#ifndef MODULES_H
|
||||
#define MODULES_H
|
||||
|
||||
#include "base.h"
|
||||
#include "modes.h"
|
||||
#include "timers.h"
|
||||
@@ -25,32 +24,7 @@
|
||||
* and functions needed to make a module loadable by the OS.
|
||||
* It defines the class factory and external AnopeInit and AnopeFini functions.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
# define MODULE_INIT(x) \
|
||||
extern "C" DllExport Module *AnopeInit(const Anope::string &, const Anope::string &); \
|
||||
extern "C" Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
|
||||
{ \
|
||||
return new x(modname, creator); \
|
||||
} \
|
||||
BOOLEAN WINAPI DllMain(HINSTANCE, DWORD, LPVOID) \
|
||||
{ \
|
||||
return TRUE; \
|
||||
} \
|
||||
extern "C" DllExport void AnopeFini(x *); \
|
||||
extern "C" void AnopeFini(x *m) \
|
||||
{ \
|
||||
delete m; \
|
||||
} \
|
||||
extern "C" DllExport ModuleVersionC AnopeVersion() \
|
||||
{ \
|
||||
ModuleVersionC ver; \
|
||||
ver.version_major = VERSION_MAJOR; \
|
||||
ver.version_minor = VERSION_MINOR; \
|
||||
ver.version_patch = VERSION_PATCH; \
|
||||
return ver; \
|
||||
}
|
||||
#else
|
||||
# define MODULE_INIT(x) \
|
||||
#define MODULE_INIT(x) \
|
||||
extern "C" DllExport Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
|
||||
{ \
|
||||
return new x(modname, creator); \
|
||||
@@ -67,7 +41,6 @@
|
||||
ver.version_patch = VERSION_PATCH; \
|
||||
return ver; \
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This #define allows us to call a method in all
|
||||
@@ -189,7 +162,7 @@ enum
|
||||
};
|
||||
typedef unsigned short ModType;
|
||||
|
||||
struct ModuleVersionC
|
||||
struct ModuleVersionC final
|
||||
{
|
||||
int version_major, version_minor, version_patch;
|
||||
};
|
||||
@@ -197,14 +170,14 @@ struct ModuleVersionC
|
||||
/** Returned by Module::GetVersion, used to see what version of Anope
|
||||
* a module is compiled against.
|
||||
*/
|
||||
class ModuleVersion
|
||||
class ModuleVersion final
|
||||
{
|
||||
private:
|
||||
private:
|
||||
int version_major;
|
||||
int version_minor;
|
||||
int version_patch;
|
||||
|
||||
public:
|
||||
public:
|
||||
ModuleVersion(const ModuleVersionC &);
|
||||
|
||||
/** Get the major version of Anope this was built against
|
||||
@@ -223,15 +196,19 @@ class ModuleVersion
|
||||
int GetPatch() const;
|
||||
};
|
||||
|
||||
class NotImplementedException : public CoreException { };
|
||||
class CoreExport NotImplementedException final
|
||||
: public CoreException
|
||||
{
|
||||
};
|
||||
|
||||
/** Every module in Anope is actually a class.
|
||||
*/
|
||||
class CoreExport Module : public Extensible
|
||||
class CoreExport Module
|
||||
: public Extensible
|
||||
{
|
||||
private:
|
||||
private:
|
||||
bool permanent;
|
||||
public:
|
||||
public:
|
||||
/** The module name (e.g. os_modload)
|
||||
*/
|
||||
Anope::string name;
|
||||
@@ -322,7 +299,7 @@ class CoreExport Module : public Extensible
|
||||
*/
|
||||
virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when Services' configuration is being (re)loaded.
|
||||
/** Called when the configuration is being (re)loaded.
|
||||
* @param conf The config that is being built now and will replace the global Config object
|
||||
* @throws A ConfigException to abort the config (re)loading process.
|
||||
*/
|
||||
@@ -404,7 +381,6 @@ class CoreExport Module : public Extensible
|
||||
/** Called when anope needs to check passwords against encryption
|
||||
*/
|
||||
virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); }
|
||||
virtual EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); }
|
||||
|
||||
/** Called on fantasy command
|
||||
* @param source The source of the command
|
||||
@@ -801,23 +777,6 @@ class CoreExport Module : public Extensible
|
||||
*/
|
||||
virtual void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) { throw NotImplementedException(); }
|
||||
|
||||
/** called from NickCore::ClearAccess()
|
||||
* @param nc pointer to the NickCore
|
||||
*/
|
||||
virtual void OnNickClearAccess(NickCore *nc) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a user adds an entry to their access list
|
||||
* @param nc The nick
|
||||
* @param entry The entry
|
||||
*/
|
||||
virtual void OnNickAddAccess(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
|
||||
|
||||
/** Called from NickCore::EraseAccess()
|
||||
* @param nc pointer to the NickCore
|
||||
* @param entry The access mask
|
||||
*/
|
||||
virtual void OnNickEraseAccess(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
|
||||
|
||||
/** called from NickCore::ClearCert()
|
||||
* @param nc pointer to the NickCore
|
||||
*/
|
||||
@@ -988,23 +947,26 @@ class CoreExport Module : public Extensible
|
||||
* @param u The user sending the PRIVMSG
|
||||
* @param bi The target of the PRIVMSG
|
||||
* @param message The message
|
||||
* @param tags Message tags
|
||||
* @return EVENT_STOP to halt processing
|
||||
*/
|
||||
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
|
||||
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when we receive a NOTICE for one of our clients
|
||||
* @param u The user sending the NOTICE
|
||||
* @param bi The target of the NOTICE
|
||||
* @param tags Message tags
|
||||
* @param message The message
|
||||
*/
|
||||
virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
|
||||
virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when we receive a PRIVMSG for a registered channel we are in
|
||||
* @param u The source of the message
|
||||
* @param c The channel
|
||||
* @param msg The message
|
||||
* @param tags Message tags
|
||||
*/
|
||||
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { throw NotImplementedException(); }
|
||||
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a message is logged
|
||||
* @param l The log message
|
||||
@@ -1075,9 +1037,10 @@ class CoreExport Module : public Extensible
|
||||
* @param source The source of the message
|
||||
* @param command The command being executed
|
||||
* @param params Parameters
|
||||
* @param tags Tags
|
||||
* @return EVENT_STOP to prevent the protocol module from processing this message
|
||||
*/
|
||||
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> ¶m) { throw NotImplementedException(); }
|
||||
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> ¶ms, Anope::map<Anope::string> &tagss) { throw NotImplementedException(); }
|
||||
|
||||
/** Called to determine if a channel mode can be set by a user
|
||||
* @param u The user
|
||||
@@ -1099,13 +1062,6 @@ class CoreExport Module : public Extensible
|
||||
* @return EVENT_STOP to force the user off of the nick
|
||||
*/
|
||||
virtual EventReturn OnNickValidate(User *u, NickAlias *na) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a certain user has to be unbanned on a certain channel.
|
||||
* May be used to send protocol-specific messages.
|
||||
* @param u The user to be unbanned
|
||||
* @param c The channel that user has to be unbanned on
|
||||
*/
|
||||
virtual void OnChannelUnban(User *u, ChannelInfo *ci) { throw NotImplementedException(); }
|
||||
};
|
||||
|
||||
enum Implementation
|
||||
@@ -1123,7 +1079,7 @@ enum Implementation
|
||||
I_OnCreateChan, I_OnDelChan, I_OnChannelCreate, I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
|
||||
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickGroup, I_OnNickIdentify,
|
||||
I_OnUserLogin, I_OnNickLogout, I_OnNickRegister, I_OnNickConfirm, I_OnNickSuspend, I_OnNickUnsuspended, I_OnDelNick, I_OnNickCoreCreate,
|
||||
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert,
|
||||
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearCert,
|
||||
I_OnNickAddCert, I_OnNickEraseCert, I_OnNickInfo, I_OnBotInfo, I_OnCheckAuthentication, I_OnNickUpdate,
|
||||
I_OnFingerprint, I_OnUserAway, I_OnInvite, I_OnDeleteVhost, I_OnSetVhost, I_OnSetDisplayedHost, I_OnMemoSend, I_OnMemoDel,
|
||||
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
|
||||
@@ -1131,15 +1087,15 @@ enum Implementation
|
||||
I_OnPrivmsg, I_OnLog, I_OnLogMessage, I_OnDnsRequest, I_OnCheckModes, I_OnChannelSync, I_OnSetCorrectModes,
|
||||
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate,
|
||||
I_OnSerializeTypeCreate, I_OnSetChannelOption, I_OnSetNickOption, I_OnMessage, I_OnCanSet, I_OnCheckDelete,
|
||||
I_OnExpireTick, I_OnNickValidate, I_OnChannelUnban,
|
||||
I_OnExpireTick, I_OnNickValidate,
|
||||
I_SIZE
|
||||
};
|
||||
|
||||
/** Used to manage modules.
|
||||
*/
|
||||
class CoreExport ModuleManager
|
||||
class CoreExport ModuleManager final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Event handler hooks.
|
||||
*/
|
||||
static std::vector<Module *> EventHandlers[I_SIZE];
|
||||
@@ -1222,7 +1178,7 @@ class CoreExport ModuleManager
|
||||
*/
|
||||
static void UnloadAll();
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Call the module_delete function to safely delete the module
|
||||
* @param m the module to delete
|
||||
* @return MOD_ERR_OK on success, anything else on fail
|
||||
@@ -1234,5 +1190,3 @@ class CoreExport ModuleManager
|
||||
*/
|
||||
static ModuleVersion GetVersion(void *handle);
|
||||
};
|
||||
|
||||
#endif // MODULES_H
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/** Flags for badwords
|
||||
*/
|
||||
enum BadWordType
|
||||
@@ -30,27 +32,27 @@ struct BadWord
|
||||
Anope::string word;
|
||||
BadWordType type;
|
||||
|
||||
virtual ~BadWord() { }
|
||||
protected:
|
||||
BadWord() { }
|
||||
virtual ~BadWord() = default;
|
||||
protected:
|
||||
BadWord() = default;
|
||||
};
|
||||
|
||||
struct BadWords
|
||||
{
|
||||
virtual ~BadWords() { }
|
||||
virtual ~BadWords() = default;
|
||||
|
||||
/** Add a badword to the badword list
|
||||
* @param word The badword
|
||||
* @param type The type (SINGLE START END)
|
||||
* @return The badword
|
||||
*/
|
||||
virtual BadWord* AddBadWord(const Anope::string &word, BadWordType type) = 0;
|
||||
virtual BadWord *AddBadWord(const Anope::string &word, BadWordType type) = 0;
|
||||
|
||||
/** Get a badword structure by index
|
||||
* @param index The index
|
||||
* @return The badword
|
||||
*/
|
||||
virtual BadWord* GetBadWord(unsigned index) const = 0;
|
||||
virtual BadWord *GetBadWord(unsigned index) const = 0;
|
||||
|
||||
/** Get how many badwords are on this channel
|
||||
* @return The number of badwords in the vector
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Indices for TTB (Times To Ban) */
|
||||
enum
|
||||
{
|
||||
@@ -35,10 +37,10 @@ struct KickerData
|
||||
|
||||
bool dontkickops, dontkickvoices;
|
||||
|
||||
protected:
|
||||
KickerData() { }
|
||||
protected:
|
||||
KickerData() = default;
|
||||
|
||||
public:
|
||||
virtual ~KickerData() { }
|
||||
public:
|
||||
virtual ~KickerData() = default;
|
||||
virtual void Check(ChannelInfo *ci) = 0;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct EntryMsg
|
||||
{
|
||||
Anope::string chan;
|
||||
@@ -13,22 +15,23 @@ struct EntryMsg
|
||||
Anope::string message;
|
||||
time_t when;
|
||||
|
||||
virtual ~EntryMsg() { }
|
||||
protected:
|
||||
EntryMsg() { }
|
||||
virtual ~EntryMsg() = default;
|
||||
protected:
|
||||
EntryMsg() = default;
|
||||
};
|
||||
|
||||
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
|
||||
struct EntryMessageList
|
||||
: Serialize::Checker<std::vector<EntryMsg *> >
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~EntryMessageList()
|
||||
{
|
||||
for (unsigned i = (*this)->size(); i > 0; --i)
|
||||
delete (*this)->at(i - 1);
|
||||
}
|
||||
|
||||
virtual EntryMsg* Create() = 0;
|
||||
virtual EntryMsg *Create() = 0;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct LogSetting
|
||||
{
|
||||
Anope::string chan;
|
||||
@@ -22,21 +24,22 @@ struct LogSetting
|
||||
Anope::string creator;
|
||||
time_t created;
|
||||
|
||||
virtual ~LogSetting() { }
|
||||
protected:
|
||||
LogSetting() { }
|
||||
virtual ~LogSetting() = default;
|
||||
protected:
|
||||
LogSetting() = default;
|
||||
};
|
||||
|
||||
struct LogSettings : Serialize::Checker<std::vector<LogSetting *> >
|
||||
struct LogSettings
|
||||
: Serialize::Checker<std::vector<LogSetting *> >
|
||||
{
|
||||
typedef std::vector<LogSetting *>::iterator iterator;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
LogSettings() : Serialize::Checker<std::vector<LogSetting *> >("LogSetting")
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~LogSettings() { }
|
||||
public:
|
||||
virtual ~LogSettings() = default;
|
||||
virtual LogSetting *Create() = 0;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct ModeLock
|
||||
{
|
||||
Anope::string ci;
|
||||
@@ -18,16 +20,16 @@ struct ModeLock
|
||||
Anope::string setter;
|
||||
time_t created;
|
||||
|
||||
virtual ~ModeLock() { }
|
||||
protected:
|
||||
ModeLock() { }
|
||||
virtual ~ModeLock() = default;
|
||||
protected:
|
||||
ModeLock() = default;
|
||||
};
|
||||
|
||||
struct ModeLocks
|
||||
{
|
||||
typedef std::vector<ModeLock *> ModeList;
|
||||
|
||||
virtual ~ModeLocks() { }
|
||||
virtual ~ModeLocks() = default;
|
||||
|
||||
/** Check if a mode is mlocked
|
||||
* @param mode The mode
|
||||
|
||||
+28
-21
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef DNS_H
|
||||
#define DNS_H
|
||||
#pragma once
|
||||
|
||||
namespace DNS
|
||||
{
|
||||
@@ -73,14 +72,14 @@ namespace DNS
|
||||
struct Question
|
||||
{
|
||||
Anope::string name;
|
||||
QueryType type;
|
||||
unsigned short qclass;
|
||||
QueryType type = QUERY_NONE;
|
||||
unsigned short qclass = 0;
|
||||
|
||||
Question() : type(QUERY_NONE), qclass(0) { }
|
||||
Question() = default;
|
||||
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { }
|
||||
inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
|
||||
|
||||
struct hash
|
||||
struct hash final
|
||||
{
|
||||
size_t operator()(const Question &q) const
|
||||
{
|
||||
@@ -89,14 +88,15 @@ namespace DNS
|
||||
};
|
||||
};
|
||||
|
||||
struct ResourceRecord : Question
|
||||
struct ResourceRecord final
|
||||
: Question
|
||||
{
|
||||
unsigned int ttl;
|
||||
unsigned int ttl = 0;
|
||||
Anope::string rdata;
|
||||
time_t created;
|
||||
|
||||
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
|
||||
ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
|
||||
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { }
|
||||
ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { }
|
||||
};
|
||||
|
||||
struct Query
|
||||
@@ -114,11 +114,12 @@ namespace DNS
|
||||
|
||||
/** DNS manager
|
||||
*/
|
||||
class Manager : public Service
|
||||
class Manager
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { }
|
||||
virtual ~Manager() { }
|
||||
virtual ~Manager() = default;
|
||||
|
||||
virtual void Process(Request *req) = 0;
|
||||
virtual void RemoveRequest(Request *req) = 0;
|
||||
@@ -132,19 +133,27 @@ namespace DNS
|
||||
|
||||
/** A DNS query.
|
||||
*/
|
||||
class Request : public Timer, public Question
|
||||
class Request
|
||||
: public Timer
|
||||
, public Question
|
||||
{
|
||||
Manager *manager;
|
||||
public:
|
||||
public:
|
||||
/* Use result cache if available */
|
||||
bool use_cache;
|
||||
/* Request id */
|
||||
unsigned short id;
|
||||
unsigned short id = 0;
|
||||
/* Creator of this request */
|
||||
Module *creator;
|
||||
|
||||
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
|
||||
use_cache(cache), id(0), creator(c) { }
|
||||
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false)
|
||||
: Timer(0)
|
||||
, Question(addr, qt)
|
||||
, manager(mgr)
|
||||
, use_cache(cache)
|
||||
, creator(c)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Request()
|
||||
{
|
||||
@@ -164,7 +173,7 @@ namespace DNS
|
||||
/** Used to time out the query, xalls OnError and lets the TimerManager
|
||||
* delete this request.
|
||||
*/
|
||||
void Tick(time_t) anope_override
|
||||
void Tick() override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name;
|
||||
Query rr(*this);
|
||||
@@ -174,5 +183,3 @@ namespace DNS
|
||||
};
|
||||
|
||||
} // namespace DNS
|
||||
|
||||
#endif // DNS_H
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Encryption
|
||||
{
|
||||
typedef std::pair<const unsigned char *, size_t> Hash;
|
||||
@@ -16,18 +18,19 @@ namespace Encryption
|
||||
|
||||
class Context
|
||||
{
|
||||
public:
|
||||
virtual ~Context() { }
|
||||
public:
|
||||
virtual ~Context() = default;
|
||||
virtual void Update(const unsigned char *data, size_t len) = 0;
|
||||
virtual void Finalize() = 0;
|
||||
virtual Hash GetFinalizedHash() = 0;
|
||||
};
|
||||
|
||||
class Provider : public Service
|
||||
class Provider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
|
||||
virtual ~Provider() { }
|
||||
virtual ~Provider() = default;
|
||||
|
||||
virtual Context *CreateContext(IV * = NULL) = 0;
|
||||
virtual IV GetDefaultIV() = 0;
|
||||
|
||||
+32
-30
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef ANOPE_HTTPD_H
|
||||
#define ANOPE_HTTPD_H
|
||||
#pragma once
|
||||
|
||||
enum HTTPError
|
||||
{
|
||||
@@ -19,34 +18,35 @@ enum HTTPError
|
||||
};
|
||||
|
||||
/* A message to someone */
|
||||
struct HTTPReply
|
||||
struct HTTPReply final
|
||||
{
|
||||
HTTPError error;
|
||||
HTTPError error = HTTP_ERROR_OK;
|
||||
Anope::string content_type;
|
||||
std::map<Anope::string, Anope::string, ci::less> headers;
|
||||
typedef std::list<std::pair<Anope::string, Anope::string> > cookie;
|
||||
std::vector<cookie> cookies;
|
||||
|
||||
HTTPReply() : error(HTTP_ERROR_OK), length(0) { }
|
||||
HTTPReply() = default;
|
||||
HTTPReply &operator=(const HTTPReply &) = default;
|
||||
|
||||
HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
|
||||
HTTPReply(const HTTPReply &other) : error(other.error), length(other.length)
|
||||
{
|
||||
content_type = other.content_type;
|
||||
headers = other.headers;
|
||||
cookies = other.cookies;
|
||||
|
||||
for (unsigned i = 0; i < other.out.size(); ++i)
|
||||
out.push_back(new Data(other.out[i]->buf, other.out[i]->len));
|
||||
for (const auto &datum : other.out)
|
||||
out.push_back(new Data(datum->buf, datum->len));
|
||||
}
|
||||
|
||||
~HTTPReply()
|
||||
{
|
||||
for (unsigned i = 0; i < out.size(); ++i)
|
||||
delete out[i];
|
||||
for (const auto *datum : out)
|
||||
delete datum;
|
||||
out.clear();
|
||||
}
|
||||
|
||||
struct Data
|
||||
struct Data final
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
@@ -65,7 +65,7 @@ struct HTTPReply
|
||||
};
|
||||
|
||||
std::deque<Data *> out;
|
||||
size_t length;
|
||||
size_t length = 0;
|
||||
|
||||
void Write(const Anope::string &message)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ struct HTTPReply
|
||||
};
|
||||
|
||||
/* A message from someone */
|
||||
struct HTTPMessage
|
||||
struct HTTPMessage final
|
||||
{
|
||||
std::map<Anope::string, Anope::string> headers;
|
||||
std::map<Anope::string, Anope::string> cookies;
|
||||
@@ -93,12 +93,13 @@ struct HTTPMessage
|
||||
class HTTPClient;
|
||||
class HTTPProvider;
|
||||
|
||||
class HTTPPage : public Base
|
||||
class HTTPPage
|
||||
: public virtual Base
|
||||
{
|
||||
Anope::string url;
|
||||
Anope::string content_type;
|
||||
|
||||
public:
|
||||
public:
|
||||
HTTPPage(const Anope::string &u, const Anope::string &ct = "text/html") : url(u), content_type(ct) { }
|
||||
|
||||
const Anope::string &GetURL() const { return this->url; }
|
||||
@@ -115,15 +116,18 @@ class HTTPPage : public Base
|
||||
virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
|
||||
};
|
||||
|
||||
class HTTPClient : public ClientSocket, public BinarySocket, public Base
|
||||
class HTTPClient
|
||||
: public ClientSocket
|
||||
, public BinarySocket
|
||||
, public Base
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
void WriteClient(const Anope::string &message)
|
||||
{
|
||||
BinarySocket::Write(message + "\r\n");
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
HTTPClient(ListenSocket *l, int f, const sockaddrs &a) : ClientSocket(l, a), BinarySocket() { }
|
||||
|
||||
virtual const Anope::string GetIP()
|
||||
@@ -135,12 +139,14 @@ class HTTPClient : public ClientSocket, public BinarySocket, public Base
|
||||
virtual void SendReply(HTTPReply *) = 0;
|
||||
};
|
||||
|
||||
class HTTPProvider : public ListenSocket, public Service
|
||||
class HTTPProvider
|
||||
: public ListenSocket
|
||||
, public Service
|
||||
{
|
||||
Anope::string ip;
|
||||
unsigned short port;
|
||||
bool ssl;
|
||||
public:
|
||||
public:
|
||||
std::vector<Anope::string> ext_ips;
|
||||
std::vector<Anope::string> ext_headers;
|
||||
|
||||
@@ -163,7 +169,7 @@ class HTTPProvider : public ListenSocket, public Service
|
||||
|
||||
virtual bool RegisterPage(HTTPPage *page) = 0;
|
||||
virtual void UnregisterPage(HTTPPage *page) = 0;
|
||||
virtual HTTPPage* FindPage(const Anope::string &name) = 0;
|
||||
virtual HTTPPage *FindPage(const Anope::string &name) = 0;
|
||||
};
|
||||
|
||||
namespace HTTPUtils
|
||||
@@ -174,7 +180,7 @@ namespace HTTPUtils
|
||||
|
||||
for (unsigned i = 0; i < url.length(); ++i)
|
||||
{
|
||||
const char& c = url[i];
|
||||
const char &c = url[i];
|
||||
|
||||
if (c == '%' && i + 2 < url.length())
|
||||
{
|
||||
@@ -196,10 +202,8 @@ namespace HTTPUtils
|
||||
{
|
||||
Anope::string encoded;
|
||||
|
||||
for (unsigned i = 0; i < url.length(); ++i)
|
||||
for (const auto c : url)
|
||||
{
|
||||
const char& c = url[i];
|
||||
|
||||
if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_')
|
||||
encoded += c;
|
||||
else if (c == ' ')
|
||||
@@ -215,9 +219,9 @@ namespace HTTPUtils
|
||||
{
|
||||
Anope::string dst;
|
||||
|
||||
for (unsigned i = 0; i < src.length(); ++i)
|
||||
for (const auto c : src)
|
||||
{
|
||||
switch (src[i])
|
||||
switch (c)
|
||||
{
|
||||
case '<':
|
||||
dst += "<";
|
||||
@@ -232,12 +236,10 @@ namespace HTTPUtils
|
||||
dst += "&";
|
||||
break;
|
||||
default:
|
||||
dst += src[i];
|
||||
dst += c;
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ANOPE_HTTPD_H
|
||||
|
||||
+15
-16
@@ -6,18 +6,17 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef ANOPE_LDAP_H
|
||||
#define ANOPE_LDAP_H
|
||||
#pragma once
|
||||
|
||||
class LDAPException : public ModuleException
|
||||
class DllExport LDAPException : public ModuleException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
LDAPException(const Anope::string &reason) : ModuleException(reason) { }
|
||||
|
||||
virtual ~LDAPException() throw() { }
|
||||
virtual ~LDAPException() noexcept = default;
|
||||
};
|
||||
|
||||
struct LDAPModification
|
||||
struct LDAPModification final
|
||||
{
|
||||
enum LDAPOperation
|
||||
{
|
||||
@@ -32,7 +31,8 @@ struct LDAPModification
|
||||
};
|
||||
typedef std::vector<LDAPModification> LDAPMods;
|
||||
|
||||
struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string> >
|
||||
struct LDAPAttributes final
|
||||
: public std::map<Anope::string, std::vector<Anope::string>>
|
||||
{
|
||||
size_t size(const Anope::string &attr) const
|
||||
{
|
||||
@@ -43,8 +43,8 @@ struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string
|
||||
const std::vector<Anope::string> keys() const
|
||||
{
|
||||
std::vector<Anope::string> k;
|
||||
for (const_iterator it = this->begin(), it_end = this->end(); it != it_end; ++it)
|
||||
k.push_back(it->first);
|
||||
for (const auto &[key, _] : *this)
|
||||
k.push_back(key);
|
||||
return k;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ enum QueryType
|
||||
QUERY_MODIFY
|
||||
};
|
||||
|
||||
struct LDAPResult
|
||||
struct LDAPResult final
|
||||
{
|
||||
std::vector<LDAPAttributes> messages;
|
||||
Anope::string error;
|
||||
@@ -112,20 +112,21 @@ struct LDAPResult
|
||||
|
||||
class LDAPInterface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
LDAPInterface(Module *m) : owner(m) { }
|
||||
virtual ~LDAPInterface() { }
|
||||
virtual ~LDAPInterface() = default;
|
||||
|
||||
virtual void OnResult(const LDAPResult &r) = 0;
|
||||
virtual void OnError(const LDAPResult &err) = 0;
|
||||
virtual void OnDelete() { }
|
||||
};
|
||||
|
||||
class LDAPProvider : public Service
|
||||
class LDAPProvider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
LDAPProvider(Module *c, const Anope::string &n) : Service(c, "LDAPProvider", n) { }
|
||||
|
||||
/** Attempt to bind to the LDAP server as an admin
|
||||
@@ -167,5 +168,3 @@ class LDAPProvider : public Service
|
||||
*/
|
||||
virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0;
|
||||
};
|
||||
|
||||
#endif // ANOPE_LDAP_H
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct NSCertList
|
||||
{
|
||||
protected:
|
||||
NSCertList() { }
|
||||
public:
|
||||
virtual ~NSCertList() { }
|
||||
protected:
|
||||
NSCertList() = default;
|
||||
public:
|
||||
virtual ~NSCertList() = default;
|
||||
|
||||
/** Add an entry to the nick's certificate list
|
||||
*
|
||||
@@ -52,6 +54,15 @@ struct NSCertList
|
||||
*/
|
||||
virtual void EraseCert(const Anope::string &entry) = 0;
|
||||
|
||||
/** Replaces a fingerprint in the nick's certificate list
|
||||
*
|
||||
* @param oldentry The old fingerprint to remove
|
||||
* @param newentry The new fingerprint to add
|
||||
*
|
||||
* Replaces the specified fingerprint in the cert list.
|
||||
*/
|
||||
virtual void ReplaceCert(const Anope::string &oldentry, const Anope::string &newentry) = 0;
|
||||
|
||||
/** Clears the entire nick's cert list
|
||||
*
|
||||
* Deletes all the memory allocated in the certificate list vector and then clears the vector.
|
||||
@@ -61,10 +72,11 @@ struct NSCertList
|
||||
virtual void Check() = 0;
|
||||
};
|
||||
|
||||
class CertService : public Service
|
||||
class CertService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
CertService(Module *c) : Service(c, "CertService", "certs") { }
|
||||
|
||||
virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
|
||||
virtual NickCore *FindAccountFromCert(const Anope::string &cert) = 0;
|
||||
};
|
||||
|
||||
+10
-12
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef OS_FORBID_H
|
||||
#define OS_FORBID_H
|
||||
#pragma once
|
||||
|
||||
enum ForbidType
|
||||
{
|
||||
@@ -23,25 +22,26 @@ struct ForbidData
|
||||
Anope::string mask;
|
||||
Anope::string creator;
|
||||
Anope::string reason;
|
||||
time_t created;
|
||||
time_t expires;
|
||||
time_t created = 0;
|
||||
time_t expires = 0;
|
||||
ForbidType type;
|
||||
|
||||
virtual ~ForbidData() { }
|
||||
protected:
|
||||
ForbidData() : created(0), expires(0) { }
|
||||
virtual ~ForbidData() = default;
|
||||
protected:
|
||||
ForbidData() = default;
|
||||
};
|
||||
|
||||
class ForbidService : public Service
|
||||
class ForbidService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { }
|
||||
|
||||
virtual void AddForbid(ForbidData *d) = 0;
|
||||
|
||||
virtual void RemoveForbid(ForbidData *d) = 0;
|
||||
|
||||
virtual ForbidData* CreateForbid() = 0;
|
||||
virtual ForbidData *CreateForbid() = 0;
|
||||
|
||||
virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
|
||||
|
||||
@@ -51,5 +51,3 @@ class ForbidService : public Service
|
||||
};
|
||||
|
||||
static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,24 +9,27 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct IgnoreData
|
||||
{
|
||||
Anope::string mask;
|
||||
Anope::string creator;
|
||||
Anope::string reason;
|
||||
time_t time; /* When do we stop ignoring them? */
|
||||
time_t time = 0; /* When do we stop ignoring them? */
|
||||
|
||||
virtual ~IgnoreData() { }
|
||||
protected:
|
||||
IgnoreData() : time(0) { }
|
||||
virtual ~IgnoreData() = default;
|
||||
protected:
|
||||
IgnoreData() = default;
|
||||
};
|
||||
|
||||
class IgnoreService : public Service
|
||||
class IgnoreService
|
||||
: public Service
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual void AddIgnore(IgnoreData *) = 0;
|
||||
|
||||
virtual void DelIgnore(IgnoreData *) = 0;
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef OS_NEWS
|
||||
#define OS_NEWS
|
||||
#pragma once
|
||||
|
||||
enum NewsType
|
||||
{
|
||||
@@ -16,14 +15,15 @@ enum NewsType
|
||||
NEWS_OPER
|
||||
};
|
||||
|
||||
struct NewsMessages
|
||||
struct NewsMessages final
|
||||
{
|
||||
NewsType type;
|
||||
Anope::string name;
|
||||
const char *msgs[10];
|
||||
};
|
||||
|
||||
struct NewsItem : Serializable
|
||||
struct NewsItem
|
||||
: Serializable
|
||||
{
|
||||
NewsType type;
|
||||
Anope::string text;
|
||||
@@ -33,9 +33,10 @@ struct NewsItem : Serializable
|
||||
NewsItem() : Serializable("NewsItem") { }
|
||||
};
|
||||
|
||||
class NewsService : public Service
|
||||
class NewsService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
NewsService(Module *m) : Service(m, "NewsService", "news") { }
|
||||
|
||||
virtual NewsItem *CreateNewsItem() = 0;
|
||||
@@ -48,5 +49,3 @@ class NewsService : public Service
|
||||
};
|
||||
|
||||
static ServiceReference<NewsService> news_service("NewsService", "news");
|
||||
|
||||
#endif // OS_NEWS
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef OS_SESSION_H
|
||||
#define OS_SESSION_H
|
||||
#pragma once
|
||||
|
||||
struct Session
|
||||
struct Session final
|
||||
{
|
||||
cidr addr; /* A cidr (sockaddrs + len) representing this session */
|
||||
unsigned count; /* Number of clients with this host */
|
||||
unsigned hits; /* Number of subsequent kills for a host */
|
||||
unsigned count = 1; /* Number of clients with this host */
|
||||
unsigned hits = 0; /* Number of subsequent kills for a host */
|
||||
|
||||
Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
|
||||
Session(const sockaddrs &ip, int len) : addr(ip, len) { }
|
||||
};
|
||||
|
||||
struct Exception : Serializable
|
||||
struct Exception final
|
||||
: Serializable
|
||||
{
|
||||
Anope::string mask; /* Hosts to which this exception applies */
|
||||
unsigned limit; /* Session limit for exception */
|
||||
@@ -28,14 +28,15 @@ struct Exception : Serializable
|
||||
time_t expires; /* Time when it expires. 0 == no expiry */
|
||||
|
||||
Exception() : Serializable("Exception") { }
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
class SessionService : public Service
|
||||
class SessionService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap;
|
||||
public:
|
||||
typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap;
|
||||
typedef std::vector<Exception *> ExceptionVector;
|
||||
|
||||
SessionService(Module *m) : Service(m, "SessionService", "session") { }
|
||||
@@ -69,7 +70,7 @@ void Exception::Serialize(Serialize::Data &data) const
|
||||
data["expires"] << this->expires;
|
||||
}
|
||||
|
||||
Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
Serializable *Exception::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
{
|
||||
if (!session_service)
|
||||
return NULL;
|
||||
@@ -90,5 +91,3 @@ Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
session_service->AddException(ex);
|
||||
return ex;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef CHANSERV_H
|
||||
#define CHANSERV_H
|
||||
#pragma once
|
||||
|
||||
class ChanServService : public Service
|
||||
class ChanServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ")
|
||||
{
|
||||
}
|
||||
@@ -21,5 +21,3 @@ class ChanServService : public Service
|
||||
*/
|
||||
virtual void Hold(Channel *c) = 0;
|
||||
};
|
||||
|
||||
#endif // CHANSERV_H
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
#pragma once
|
||||
|
||||
class GlobalService : public Service
|
||||
class GlobalService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
GlobalService(Module *m) : Service(m, "GlobalService", "Global")
|
||||
{
|
||||
}
|
||||
@@ -26,5 +26,3 @@ class GlobalService : public Service
|
||||
*/
|
||||
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
|
||||
};
|
||||
|
||||
#endif // GLOBAL_H
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef MEMOSERV_H
|
||||
#define MEMOSERV_H
|
||||
#pragma once
|
||||
|
||||
class MemoServService : public Service
|
||||
class MemoServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum MemoResult
|
||||
{
|
||||
MEMO_SUCCESS,
|
||||
@@ -37,5 +37,3 @@ class MemoServService : public Service
|
||||
*/
|
||||
virtual void Check(User *u) = 0;
|
||||
};
|
||||
|
||||
#endif // MEMOSERV_H
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef NICKSERV_H
|
||||
#define NICKSERV_H
|
||||
#pragma once
|
||||
|
||||
class NickServService : public Service
|
||||
class NickServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
NickServService(Module *m) : Service(m, "NickServService", "NickServ")
|
||||
{
|
||||
}
|
||||
@@ -20,5 +20,3 @@ class NickServService : public Service
|
||||
virtual void Collide(User *u, NickAlias *na) = 0;
|
||||
virtual void Release(NickAlias *na) = 0;
|
||||
};
|
||||
|
||||
#endif // NICKSERV_H
|
||||
|
||||
+10
-7
@@ -6,9 +6,11 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Redis
|
||||
{
|
||||
struct Reply
|
||||
struct Reply final
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
@@ -30,8 +32,8 @@ namespace Redis
|
||||
i = 0;
|
||||
bulk.clear();
|
||||
multi_bulk_size = 0;
|
||||
for (unsigned j = 0; j < multi_bulk.size(); ++j)
|
||||
delete multi_bulk[j];
|
||||
for (const auto *reply : multi_bulk)
|
||||
delete reply;
|
||||
multi_bulk.clear();
|
||||
}
|
||||
|
||||
@@ -43,19 +45,20 @@ namespace Redis
|
||||
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
Interface(Module *m) : owner(m) { }
|
||||
virtual ~Interface() { }
|
||||
virtual ~Interface() = default;
|
||||
|
||||
virtual void OnResult(const Reply &r) = 0;
|
||||
virtual void OnError(const Anope::string &error) { Log(owner) << error; }
|
||||
};
|
||||
|
||||
class Provider : public Service
|
||||
class Provider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Provider(Module *c, const Anope::string &n) : Service(c, "Redis::Provider", n) { }
|
||||
|
||||
virtual bool IsSocketDead() = 0;
|
||||
|
||||
+16
-11
@@ -6,9 +6,11 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace SASL
|
||||
{
|
||||
struct Message
|
||||
struct Message final
|
||||
{
|
||||
Anope::string source;
|
||||
Anope::string target;
|
||||
@@ -20,16 +22,17 @@ namespace SASL
|
||||
class Mechanism;
|
||||
struct Session;
|
||||
|
||||
class Service : public ::Service
|
||||
class Service
|
||||
: public ::Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Service(Module *o) : ::Service(o, "SASL::Service", "sasl") { }
|
||||
|
||||
virtual void ProcessMessage(const Message &) = 0;
|
||||
|
||||
virtual Anope::string GetAgent() = 0;
|
||||
|
||||
virtual Session* GetSession(const Anope::string &uid) = 0;
|
||||
virtual Session *GetSession(const Anope::string &uid) = 0;
|
||||
|
||||
virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) = 0;
|
||||
|
||||
@@ -58,12 +61,13 @@ namespace SASL
|
||||
};
|
||||
|
||||
/* PLAIN, EXTERNAL, etc */
|
||||
class Mechanism : public ::Service
|
||||
class Mechanism
|
||||
: public ::Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { }
|
||||
|
||||
virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); }
|
||||
virtual Session *CreateSession(const Anope::string &uid) { return new Session(this, uid); }
|
||||
|
||||
virtual void ProcessMessage(Session *session, const Message &) = 0;
|
||||
|
||||
@@ -74,15 +78,16 @@ namespace SASL
|
||||
}
|
||||
};
|
||||
|
||||
class IdentifyRequest : public ::IdentifyRequest
|
||||
class IdentifyRequest
|
||||
: public ::IdentifyRequest
|
||||
{
|
||||
Anope::string uid;
|
||||
Anope::string hostname, ip;
|
||||
|
||||
public:
|
||||
public:
|
||||
IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { }
|
||||
|
||||
void OnSuccess() anope_override
|
||||
void OnSuccess() override
|
||||
{
|
||||
if (!sasl)
|
||||
return;
|
||||
@@ -108,7 +113,7 @@ namespace SASL
|
||||
}
|
||||
}
|
||||
|
||||
void OnFail() anope_override
|
||||
void OnFail() override
|
||||
{
|
||||
if (!sasl)
|
||||
return;
|
||||
|
||||
@@ -6,12 +6,15 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct MiscData
|
||||
{
|
||||
Anope::string object;
|
||||
Anope::string name;
|
||||
Anope::string data;
|
||||
|
||||
MiscData() { }
|
||||
virtual ~MiscData() { }
|
||||
virtual ~MiscData() = default;
|
||||
protected:
|
||||
MiscData() = default;
|
||||
};
|
||||
|
||||
+37
-31
@@ -6,12 +6,15 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace SQL
|
||||
{
|
||||
|
||||
class Data : public Serialize::Data
|
||||
class Data final
|
||||
: public Serialize::Data
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef std::map<Anope::string, std::stringstream *> Map;
|
||||
Map data;
|
||||
std::map<Anope::string, Type> types;
|
||||
@@ -21,7 +24,7 @@ namespace SQL
|
||||
Clear();
|
||||
}
|
||||
|
||||
std::iostream& operator[](const Anope::string &key) anope_override
|
||||
std::iostream &operator[](const Anope::string &key) override
|
||||
{
|
||||
std::stringstream *&ss = data[key];
|
||||
if (!ss)
|
||||
@@ -29,44 +32,46 @@ namespace SQL
|
||||
return *ss;
|
||||
}
|
||||
|
||||
std::set<Anope::string> KeySet() const anope_override
|
||||
std::set<Anope::string> KeySet() const override
|
||||
{
|
||||
std::set<Anope::string> keys;
|
||||
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
|
||||
keys.insert(it->first);
|
||||
for (const auto &[key, _] : this->data)
|
||||
keys.insert(key);
|
||||
return keys;
|
||||
}
|
||||
|
||||
size_t Hash() const anope_override
|
||||
size_t Hash() const override
|
||||
{
|
||||
size_t hash = 0;
|
||||
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
|
||||
if (!it->second->str().empty())
|
||||
hash ^= Anope::hash_cs()(it->second->str());
|
||||
for (const auto &[_, value] : this->data)
|
||||
{
|
||||
if (!value->str().empty())
|
||||
hash ^= Anope::hash_cs()(value->str());
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
std::map<Anope::string, std::iostream *> GetData() const
|
||||
{
|
||||
std::map<Anope::string, std::iostream *> d;
|
||||
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
|
||||
d[it->first] = it->second;
|
||||
for (const auto &[key, value] : this->data)
|
||||
d[key] = value;
|
||||
return d;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
|
||||
delete it->second;
|
||||
for (const auto &[_, value] : this->data)
|
||||
delete value;
|
||||
this->data.clear();
|
||||
}
|
||||
|
||||
void SetType(const Anope::string &key, Type t) anope_override
|
||||
void SetType(const Anope::string &key, Type t) override
|
||||
{
|
||||
this->types[key] = t;
|
||||
}
|
||||
|
||||
Type GetType(const Anope::string &key) const anope_override
|
||||
Type GetType(const Anope::string &key) const override
|
||||
{
|
||||
std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
|
||||
if (it != this->types.end())
|
||||
@@ -77,24 +82,24 @@ namespace SQL
|
||||
|
||||
/** A SQL exception, can be thrown at various points
|
||||
*/
|
||||
class Exception : public ModuleException
|
||||
class DllExport Exception : public ModuleException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Exception(const Anope::string &reason) : ModuleException(reason) { }
|
||||
|
||||
virtual ~Exception() throw() { }
|
||||
virtual ~Exception() noexcept = default;
|
||||
};
|
||||
|
||||
/** A SQL query
|
||||
*/
|
||||
|
||||
struct QueryData
|
||||
struct QueryData final
|
||||
{
|
||||
Anope::string data;
|
||||
bool escape;
|
||||
};
|
||||
|
||||
struct Query
|
||||
struct Query final
|
||||
{
|
||||
Anope::string query;
|
||||
std::map<Anope::string, QueryData> parameters;
|
||||
@@ -102,7 +107,7 @@ namespace SQL
|
||||
Query() { }
|
||||
Query(const Anope::string &q) : query(q) { }
|
||||
|
||||
Query& operator=(const Anope::string &q)
|
||||
Query &operator=(const Anope::string &q)
|
||||
{
|
||||
this->query = q;
|
||||
this->parameters.clear();
|
||||
@@ -119,7 +124,7 @@ namespace SQL
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
template<typename T> void SetValue(const Anope::string &key, const T& value, bool escape = true)
|
||||
template<typename T> void SetValue(const Anope::string &key, const T &value, bool escape = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -135,16 +140,16 @@ namespace SQL
|
||||
*/
|
||||
class Result
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* Rows, column, item */
|
||||
std::vector<std::map<Anope::string, Anope::string> > entries;
|
||||
Query query;
|
||||
Anope::string error;
|
||||
public:
|
||||
unsigned int id;
|
||||
public:
|
||||
unsigned int id = 0;
|
||||
Anope::string finished_query;
|
||||
|
||||
Result() : id(0) { }
|
||||
Result() = default;
|
||||
Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { }
|
||||
|
||||
inline operator bool() const { return this->error.empty(); }
|
||||
@@ -183,11 +188,11 @@ namespace SQL
|
||||
*/
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
Interface(Module *m) : owner(m) { }
|
||||
virtual ~Interface() { }
|
||||
virtual ~Interface() = default;
|
||||
|
||||
virtual void OnResult(const Result &r) = 0;
|
||||
virtual void OnError(const Result &r) = 0;
|
||||
@@ -195,9 +200,10 @@ namespace SQL
|
||||
|
||||
/** Class providing the SQL service, modules call this to execute queries
|
||||
*/
|
||||
class Provider : public Service
|
||||
class Provider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Provider(Module *c, const Anope::string &n) : Service(c, "SQL::Provider", n) { }
|
||||
|
||||
virtual void Run(Interface *i, const Query &query) = 0;
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
class SSLService : public Service
|
||||
#pragma once
|
||||
|
||||
class SSLService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
|
||||
|
||||
virtual void Init(Socket *s) = 0;
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct SuspendInfo
|
||||
{
|
||||
Anope::string what, by, reason;
|
||||
time_t when, expires;
|
||||
|
||||
SuspendInfo() { }
|
||||
virtual ~SuspendInfo() { }
|
||||
SuspendInfo() = default;
|
||||
virtual ~SuspendInfo() = default;
|
||||
};
|
||||
|
||||
@@ -6,20 +6,22 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "httpd.h"
|
||||
|
||||
class XMLRPCRequest
|
||||
class XMLRPCRequest final
|
||||
{
|
||||
std::map<Anope::string, Anope::string> replies;
|
||||
|
||||
public:
|
||||
public:
|
||||
Anope::string name;
|
||||
Anope::string id;
|
||||
std::deque<Anope::string> data;
|
||||
HTTPReply& r;
|
||||
HTTPReply &r;
|
||||
|
||||
XMLRPCRequest(HTTPReply &_r) : r(_r) { }
|
||||
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.insert(std::make_pair(dname, ddata)); }
|
||||
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
|
||||
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
|
||||
};
|
||||
|
||||
@@ -27,14 +29,15 @@ class XMLRPCServiceInterface;
|
||||
|
||||
class XMLRPCEvent
|
||||
{
|
||||
public:
|
||||
virtual ~XMLRPCEvent() { }
|
||||
public:
|
||||
virtual ~XMLRPCEvent() = default;
|
||||
virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
|
||||
};
|
||||
|
||||
class XMLRPCServiceInterface : public Service
|
||||
class XMLRPCServiceInterface
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }
|
||||
|
||||
virtual void Register(XMLRPCEvent *event) = 0;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
RPL_STATSLINKINFO = 211,
|
||||
RPL_ENDOFSTATS = 219,
|
||||
RPL_STATSUPTIME = 242,
|
||||
RPL_STATSOLINE = 243,
|
||||
RPL_STATSCONN = 250,
|
||||
RPL_WHOISREGNICK = 307,
|
||||
RPL_WHOISUSER = 311,
|
||||
RPL_WHOISSERVER = 312,
|
||||
RPL_WHOISOPERATOR = 313,
|
||||
RPL_WHOISIDLE = 317,
|
||||
RPL_ENDOFWHOIS = 318,
|
||||
RPL_VERSION = 351,
|
||||
RPL_MOTD = 372,
|
||||
RPL_MOTDSTART = 375,
|
||||
RPL_ENDOFMOTD = 376,
|
||||
RPL_YOUREOPER = 381,
|
||||
RPL_TIME = 391,
|
||||
ERR_NOSUCHNICK = 401,
|
||||
ERR_NOMOTD = 422,
|
||||
};
|
||||
+8
-11
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef OPERTYPE_H
|
||||
#define OPERTYPE_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "account.h"
|
||||
@@ -22,9 +21,9 @@ struct CoreExport Oper
|
||||
/* The type of operator this operator is */
|
||||
OperType *ot;
|
||||
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
|
||||
bool require_oper;
|
||||
bool require_oper = true;
|
||||
Anope::string password;
|
||||
Anope::string certfp;
|
||||
std::vector<Anope::string> certfp;
|
||||
/* Hosts allowed to use this operator block */
|
||||
std::vector<Anope::string> hosts;
|
||||
Anope::string vhost;
|
||||
@@ -41,9 +40,9 @@ struct CoreExport Oper
|
||||
static Oper *Find(const Anope::string &name);
|
||||
};
|
||||
|
||||
class CoreExport OperType
|
||||
class CoreExport OperType final
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/** The name of this opertype, e.g. "sra".
|
||||
*/
|
||||
Anope::string name;
|
||||
@@ -66,7 +65,7 @@ class CoreExport OperType
|
||||
/** Set of opertypes we inherit from
|
||||
*/
|
||||
std::set<OperType *> inheritances;
|
||||
public:
|
||||
public:
|
||||
/** Modes to set when someone identifies using this opertype
|
||||
*/
|
||||
Anope::string modes;
|
||||
@@ -116,12 +115,10 @@ class CoreExport OperType
|
||||
/** Gets the icommands for this opertype
|
||||
* @return A list of commands
|
||||
*/
|
||||
const std::list<Anope::string> GetCommands() const;
|
||||
std::list<Anope::string> GetCommands() const;
|
||||
|
||||
/** Gets the privileges for this opertype
|
||||
* @return A list of privileges
|
||||
*/
|
||||
const std::list<Anope::string> GetPrivs() const;
|
||||
std::list<Anope::string> GetPrivs() const;
|
||||
};
|
||||
|
||||
#endif // OPERTYPE_H
|
||||
|
||||
+171
-82
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef PROTOCOL_H
|
||||
#define PROTOCOL_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
@@ -18,61 +17,93 @@
|
||||
#include "modes.h"
|
||||
|
||||
/* Encapsulates the IRCd protocol we are speaking. */
|
||||
class CoreExport IRCDProto : public Service
|
||||
class CoreExport IRCDProto
|
||||
: public Service
|
||||
{
|
||||
Anope::string proto_name;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
IRCDProto(Module *creator, const Anope::string &proto_name);
|
||||
public:
|
||||
public:
|
||||
/** Retrieves the protocol name. */
|
||||
const Anope::string &GetProtocolName() const { return proto_name; }
|
||||
|
||||
virtual ~IRCDProto();
|
||||
|
||||
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &);
|
||||
virtual void SendModeInternal(const MessageSource &, const Channel *, const Anope::string &);
|
||||
virtual void SendModeInternal(const MessageSource &, User *, const Anope::string &);
|
||||
virtual void SendKickInternal(const MessageSource &, const Channel *, User *, const Anope::string &);
|
||||
virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg);
|
||||
virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
|
||||
virtual void SendQuitInternal(User *, const Anope::string &buf);
|
||||
virtual void SendPartInternal(User *, const Channel *chan, const Anope::string &buf);
|
||||
virtual void SendGlobopsInternal(const MessageSource &, const Anope::string &buf);
|
||||
virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
|
||||
virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
|
||||
virtual void SendCTCPInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
|
||||
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
|
||||
|
||||
const Anope::string &GetProtocolName();
|
||||
virtual bool Parse(const Anope::string &, Anope::map<Anope::string> &, Anope::string &, Anope::string &, std::vector<Anope::string> &);
|
||||
virtual Anope::string Format(const Anope::string &source, const Anope::string &message);
|
||||
/** Parses an incoming message from the IRC server.
|
||||
* @param message The message to parse.
|
||||
* @param tags The location to store tags.
|
||||
* @param source The location to store the source.
|
||||
* @param command The location to store the command name.
|
||||
* @param params The location to store the parameters.
|
||||
* @return If the message was well formed then true; otherwise, false.
|
||||
*/
|
||||
virtual bool Parse(const Anope::string &message, Anope::map<Anope::string> &tags, Anope::string &source, Anope::string &command, std::vector<Anope::string> ¶ms);
|
||||
|
||||
/* Formats an outgoing message so it can be sent to the IRC server.
|
||||
* @param message The location to store the formatted message.
|
||||
* @param tags IRCv3 message tags.
|
||||
* @param source Source of the message.
|
||||
* @param command Command name.
|
||||
* @param params Any extra parameters.
|
||||
* @return If the message was formatted then true; otherwise, false.
|
||||
*/
|
||||
virtual bool Format(Anope::string &message, const Anope::map<Anope::string> &tags, const MessageSource &source, const Anope::string &command, const std::vector<Anope::string> ¶ms);
|
||||
|
||||
/* Modes used by default by our clients */
|
||||
Anope::string DefaultPseudoclientModes;
|
||||
Anope::string DefaultPseudoclientModes = "+io";
|
||||
|
||||
/* Can we force change a users's nick? */
|
||||
bool CanSVSNick;
|
||||
bool CanSVSNick = false;
|
||||
|
||||
/* Can we force join or part users? */
|
||||
bool CanSVSJoin;
|
||||
/* Can we set vhosts/vidents on users? */
|
||||
bool CanSetVHost, CanSetVIdent;
|
||||
bool CanSVSJoin = false;
|
||||
|
||||
/* Can we set vhosts on users? */
|
||||
bool CanSetVHost = false;
|
||||
|
||||
/* Can we set vidents on users? */
|
||||
bool CanSetVIdent = false;
|
||||
|
||||
/* Can we ban specific gecos from being used? */
|
||||
bool CanSNLine;
|
||||
bool CanSNLine = false;
|
||||
|
||||
/* Can we ban specific nicknames from being used? */
|
||||
bool CanSQLine;
|
||||
bool CanSQLine = false;
|
||||
|
||||
/* Can we ban specific channel names from being used? */
|
||||
bool CanSQLineChannel;
|
||||
bool CanSQLineChannel = false;
|
||||
|
||||
/* Can we ban by IP? */
|
||||
bool CanSZLine;
|
||||
bool CanSZLine = false;
|
||||
|
||||
/* Can we place temporary holds on specific nicknames? */
|
||||
bool CanSVSHold;
|
||||
/* See os_oline */
|
||||
bool CanSVSO;
|
||||
bool CanSVSHold = false;
|
||||
|
||||
/* See ns_cert */
|
||||
bool CanCertFP;
|
||||
bool CanCertFP = false;
|
||||
|
||||
/* Can users log out before being fully connected? */
|
||||
bool CanSVSLogout = false;
|
||||
|
||||
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
|
||||
bool RequiresID;
|
||||
bool RequiresID = false;
|
||||
|
||||
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
|
||||
bool AmbiguousID;
|
||||
bool AmbiguousID = false;
|
||||
|
||||
/** Can we ask the server to unban a user? */
|
||||
bool CanClearBans = false;
|
||||
|
||||
/* The maximum number of modes we are allowed to set with one MODE command */
|
||||
unsigned MaxModes;
|
||||
unsigned MaxModes = 3;
|
||||
|
||||
/* The maximum number of bytes a line may have */
|
||||
unsigned MaxLine;
|
||||
unsigned MaxLine = 512;
|
||||
|
||||
/* Retrieves the next free UID or SID */
|
||||
virtual Anope::string UID_Retrieve();
|
||||
@@ -125,29 +156,43 @@ class CoreExport IRCDProto : public Service
|
||||
/** Kills a user
|
||||
* @param source Who is doing the kill
|
||||
* @param user The user to be killed
|
||||
* @param fmt Kill reason
|
||||
* @param msg Kill reason
|
||||
*/
|
||||
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...);
|
||||
virtual void SendSVSKill(const MessageSource &source, User *user, const Anope::string &msg);
|
||||
|
||||
virtual void SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...);
|
||||
virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...);
|
||||
virtual void SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values);
|
||||
template <typename... Args>
|
||||
void SendMode(const MessageSource &source, Channel *chan, const Anope::string &modes, Args &&...args)
|
||||
{
|
||||
SendModeInternal(source, chan, modes, { stringify(args)... });
|
||||
}
|
||||
|
||||
virtual void SendModeInternal(const MessageSource &source, User *u, const Anope::string &modes, const std::vector<Anope::string> &values);
|
||||
template <typename... Args>
|
||||
void SendMode(const MessageSource &source, User *u, const Anope::string &modes, Args &&...args)
|
||||
{
|
||||
SendModeInternal(source, u, modes, { stringify(args)... });
|
||||
}
|
||||
|
||||
/** Introduces a client to the rest of the network
|
||||
* @param u The client to introduce
|
||||
*/
|
||||
virtual void SendClientIntroduction(User *u) = 0;
|
||||
|
||||
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...);
|
||||
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const Anope::string &msg);
|
||||
|
||||
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...);
|
||||
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...);
|
||||
virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...);
|
||||
virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...);
|
||||
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
|
||||
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
|
||||
virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
|
||||
virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
|
||||
|
||||
virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
|
||||
virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
|
||||
|
||||
virtual void SendQuit(User *u, const char *fmt, ...);
|
||||
virtual void SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
|
||||
virtual void SendContextPrivmsg(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
|
||||
|
||||
virtual void SendQuit(User *u, const Anope::string &msg);
|
||||
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
|
||||
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
|
||||
|
||||
@@ -159,7 +204,7 @@ class CoreExport IRCDProto : public Service
|
||||
* stacker to be set "soon".
|
||||
*/
|
||||
virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0;
|
||||
virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...);
|
||||
virtual void SendPart(User *u, const Channel *chan, const Anope::string &msg);
|
||||
|
||||
/** Force joins a user that isn't ours to a channel.
|
||||
* @param bi The source of the message
|
||||
@@ -178,11 +223,7 @@ class CoreExport IRCDProto : public Service
|
||||
virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) { }
|
||||
|
||||
virtual void SendInvite(const MessageSource &source, const Channel *c, User *u);
|
||||
virtual void SendGlobops(const MessageSource &source, const char *fmt, ...);
|
||||
|
||||
/** Sets oper flags on a user, currently only supported by Unreal
|
||||
*/
|
||||
virtual void SendSVSO(BotInfo *, const Anope::string &, const Anope::string &) { }
|
||||
virtual void SendGlobops(const MessageSource &source, const Anope::string &msg);
|
||||
|
||||
/** Sends a nick change of one of our clients.
|
||||
*/
|
||||
@@ -213,7 +254,12 @@ class CoreExport IRCDProto : public Service
|
||||
virtual void SendServer(const Server *) = 0;
|
||||
virtual void SendSquit(Server *, const Anope::string &message);
|
||||
|
||||
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...);
|
||||
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const std::vector<Anope::string> ¶ms);
|
||||
template <typename... Args>
|
||||
void SendNumeric(int numeric, const Anope::string &dest, Args &&...args)
|
||||
{
|
||||
SendNumericInternal(numeric, dest, { stringify(args)... });
|
||||
}
|
||||
|
||||
virtual void SendLogin(User *u, NickAlias *na) = 0;
|
||||
virtual void SendLogout(User *u) = 0;
|
||||
@@ -228,33 +274,47 @@ class CoreExport IRCDProto : public Service
|
||||
*/
|
||||
virtual void SendOper(User *u);
|
||||
|
||||
virtual void SendClearBans(const MessageSource &user, Channel *c, User* u) { }
|
||||
|
||||
virtual void SendSASLMechanisms(std::vector<Anope::string> &) { }
|
||||
virtual void SendSASLMessage(const SASL::Message &) { }
|
||||
virtual void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) { }
|
||||
virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { }
|
||||
|
||||
virtual bool IsNickValid(const Anope::string &);
|
||||
virtual bool IsChannelValid(const Anope::string &);
|
||||
virtual bool IsIdentValid(const Anope::string &);
|
||||
virtual bool IsHostValid(const Anope::string &);
|
||||
virtual bool IsExtbanValid(const Anope::string &) { return false; }
|
||||
virtual bool IsTagValid(const Anope::string &, const Anope::string &) { return false; }
|
||||
|
||||
/** Retrieve the maximum number of list modes settable on this channel
|
||||
* Defaults to Config->ListSize
|
||||
*/
|
||||
virtual unsigned GetMaxListFor(Channel *c);
|
||||
virtual unsigned GetMaxListFor(Channel *c, ChannelMode *cm);
|
||||
virtual size_t GetMaxListFor(Channel *c, ChannelMode *cm);
|
||||
|
||||
virtual Anope::string NormalizeMask(const Anope::string &mask);
|
||||
|
||||
/** Retrieves the maximum length of a channel name. */
|
||||
virtual size_t GetMaxChannel();
|
||||
|
||||
/** Retrieves the maximum length of a hostname. */
|
||||
virtual size_t GetMaxHost();
|
||||
|
||||
/** Retrieves the maximum length of a nickname. */
|
||||
virtual size_t GetMaxNick();
|
||||
|
||||
/** Retrieves the maximum length of a username. */
|
||||
virtual size_t GetMaxUser();
|
||||
};
|
||||
|
||||
class CoreExport MessageSource
|
||||
class CoreExport MessageSource final
|
||||
{
|
||||
Anope::string source;
|
||||
User *u;
|
||||
Server *s;
|
||||
User *u = nullptr;
|
||||
Server *s = nullptr;
|
||||
|
||||
public:
|
||||
MessageSource(const Anope::string &);
|
||||
public:
|
||||
explicit MessageSource(const Anope::string &);
|
||||
MessageSource(User *u);
|
||||
MessageSource(Server *s);
|
||||
const Anope::string &GetName() const;
|
||||
@@ -264,39 +324,70 @@ class CoreExport MessageSource
|
||||
Server *GetServer() const;
|
||||
};
|
||||
|
||||
enum IRCDMessageFlag
|
||||
{
|
||||
IRCDMESSAGE_SOFT_LIMIT,
|
||||
IRCDMESSAGE_REQUIRE_SERVER,
|
||||
IRCDMESSAGE_REQUIRE_USER
|
||||
};
|
||||
|
||||
class CoreExport IRCDMessage : public Service
|
||||
/** Base class for protocol module message handlers. */
|
||||
class CoreExport IRCDMessage
|
||||
: public Service
|
||||
{
|
||||
Anope::string name;
|
||||
unsigned param_count;
|
||||
std::set<IRCDMessageFlag> flags;
|
||||
public:
|
||||
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
|
||||
unsigned GetParamCount() const;
|
||||
virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms) = 0;
|
||||
virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags);
|
||||
public:
|
||||
/** An enumeration of potential flags a command can have. */
|
||||
enum Flag
|
||||
: uint8_t
|
||||
{
|
||||
/** The parameter count is a minimum instead of an exact limit. */
|
||||
FLAG_SOFT_LIMIT,
|
||||
|
||||
void SetFlag(IRCDMessageFlag f) { flags.insert(f); }
|
||||
bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); }
|
||||
/** The message must come from a server. */
|
||||
FLAG_REQUIRE_SERVER,
|
||||
|
||||
/** The message must come from a user. */
|
||||
FLAG_REQUIRE_USER,
|
||||
|
||||
/** The highest flag possible. */
|
||||
FLAG_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
/** The name of the message (e.g. PRIVMSG). */
|
||||
const Anope::string name;
|
||||
|
||||
/** The number of parameters this command takes. */
|
||||
const size_t param_count;
|
||||
|
||||
/** The flags that are set on the command. */
|
||||
std::bitset<FLAG_MAX> flags;
|
||||
|
||||
public:
|
||||
IRCDMessage(Module *o, const Anope::string &n, size_t pc = 0);
|
||||
|
||||
/** Retrieves the parameter count. */
|
||||
inline size_t GetParamCount() const { return param_count; }
|
||||
|
||||
/** Runs the handler for this message.
|
||||
* @param source Entity that sent the message.
|
||||
* @param params Message parameters
|
||||
* @param tags Message tags
|
||||
*/
|
||||
virtual void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) = 0;
|
||||
|
||||
/** Sets the flags for this message. */
|
||||
inline void SetFlag(Flag flag, bool value = true) { flags.set(flag, value); }
|
||||
|
||||
/** Determines if a flag is set. */
|
||||
inline bool HasFlag(Flag flag) const { return flags[flag]; }
|
||||
};
|
||||
|
||||
/** MessageTokenizer allows tokens in the IRC wire format to be read from a string */
|
||||
class CoreExport MessageTokenizer
|
||||
class CoreExport MessageTokenizer final
|
||||
{
|
||||
private:
|
||||
/** The message we are parsing tokens from. */
|
||||
Anope::string message;
|
||||
|
||||
/** The current position within the message. */
|
||||
Anope::string::size_type position;
|
||||
Anope::string::size_type position = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
/** Create a tokenstream and fill it with the provided data. */
|
||||
MessageTokenizer(const Anope::string &msg);
|
||||
|
||||
@@ -314,5 +405,3 @@ private:
|
||||
};
|
||||
|
||||
extern CoreExport IRCDProto *IRCD;
|
||||
|
||||
#endif // PROTOCOL_H
|
||||
|
||||
@@ -1,800 +0,0 @@
|
||||
/* A portable stdint.h
|
||||
****************************************************************************
|
||||
* BSD License:
|
||||
****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2005-2011 Paul Hsieh
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* Version 0.1.12
|
||||
*
|
||||
* The ANSI C standard committee, for the C99 standard, specified the
|
||||
* inclusion of a new standard include file called stdint.h. This is
|
||||
* a very useful and long desired include file which contains several
|
||||
* very precise definitions for integer scalar types that is
|
||||
* critically important for making portable several classes of
|
||||
* applications including cryptography, hashing, variable length
|
||||
* integer libraries and so on. But for most developers its likely
|
||||
* useful just for programming sanity.
|
||||
*
|
||||
* The problem is that most compiler vendors have decided not to
|
||||
* implement the C99 standard, and the next C++ language standard
|
||||
* (which has a lot more mindshare these days) will be a long time in
|
||||
* coming and its unknown whether or not it will include stdint.h or
|
||||
* how much adoption it will have. Either way, it will be a long time
|
||||
* before all compilers come with a stdint.h and it also does nothing
|
||||
* for the extremely large number of compilers available today which
|
||||
* do not include this file, or anything comparable to it.
|
||||
*
|
||||
* So that's what this file is all about. Its an attempt to build a
|
||||
* single universal include file that works on as many platforms as
|
||||
* possible to deliver what stdint.h is supposed to. A few things
|
||||
* that should be noted about this file:
|
||||
*
|
||||
* 1) It is not guaranteed to be portable and/or present an identical
|
||||
* interface on all platforms. The extreme variability of the
|
||||
* ANSI C standard makes this an impossibility right from the
|
||||
* very get go. Its really only meant to be useful for the vast
|
||||
* majority of platforms that possess the capability of
|
||||
* implementing usefully and precisely defined, standard sized
|
||||
* integer scalars. Systems which are not intrinsically 2s
|
||||
* complement may produce invalid constants.
|
||||
*
|
||||
* 2) There is an unavoidable use of non-reserved symbols.
|
||||
*
|
||||
* 3) Other standard include files are invoked.
|
||||
*
|
||||
* 4) This file may come in conflict with future platforms that do
|
||||
* include stdint.h. The hope is that one or the other can be
|
||||
* used with no real difference.
|
||||
*
|
||||
* 5) In the current version, if your platform can't represent
|
||||
* int32_t, int16_t and int8_t, it just dumps out with a compiler
|
||||
* error.
|
||||
*
|
||||
* 6) 64 bit integers may or may not be defined. Test for their
|
||||
* presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
|
||||
* Note that this is different from the C99 specification which
|
||||
* requires the existence of 64 bit support in the compiler. If
|
||||
* this is not defined for your platform, yet it is capable of
|
||||
* dealing with 64 bits then it is because this file has not yet
|
||||
* been extended to cover all of your system's capabilities.
|
||||
*
|
||||
* 7) (u)intptr_t may or may not be defined. Test for its presence
|
||||
* with the test: #ifdef PTRDIFF_MAX. If this is not defined
|
||||
* for your platform, then it is because this file has not yet
|
||||
* been extended to cover all of your system's capabilities, not
|
||||
* because its optional.
|
||||
*
|
||||
* 8) The following might not been defined even if your platform is
|
||||
* capable of defining it:
|
||||
*
|
||||
* WCHAR_MIN
|
||||
* WCHAR_MAX
|
||||
* (u)int64_t
|
||||
* PTRDIFF_MIN
|
||||
* PTRDIFF_MAX
|
||||
* (u)intptr_t
|
||||
*
|
||||
* 9) The following have not been defined:
|
||||
*
|
||||
* WINT_MIN
|
||||
* WINT_MAX
|
||||
*
|
||||
* 10) The criteria for defining (u)int_least(*)_t isn't clear,
|
||||
* except for systems which don't have a type that precisely
|
||||
* defined 8, 16, or 32 bit types (which this include file does
|
||||
* not support anyways). Default definitions have been given.
|
||||
*
|
||||
* 11) The criteria for defining (u)int_fast(*)_t isn't something I
|
||||
* would trust to any particular compiler vendor or the ANSI C
|
||||
* committee. It is well known that "compatible systems" are
|
||||
* commonly created that have very different performance
|
||||
* characteristics from the systems they are compatible with,
|
||||
* especially those whose vendors make both the compiler and the
|
||||
* system. Default definitions have been given, but its strongly
|
||||
* recommended that users never use these definitions for any
|
||||
* reason (they do *NOT* deliver any serious guarantee of
|
||||
* improved performance -- not in this file, nor any vendor's
|
||||
* stdint.h).
|
||||
*
|
||||
* 12) The following macros:
|
||||
*
|
||||
* PRINTF_INTMAX_MODIFIER
|
||||
* PRINTF_INT64_MODIFIER
|
||||
* PRINTF_INT32_MODIFIER
|
||||
* PRINTF_INT16_MODIFIER
|
||||
* PRINTF_LEAST64_MODIFIER
|
||||
* PRINTF_LEAST32_MODIFIER
|
||||
* PRINTF_LEAST16_MODIFIER
|
||||
* PRINTF_INTPTR_MODIFIER
|
||||
*
|
||||
* are strings which have been defined as the modifiers required
|
||||
* for the "d", "u" and "x" printf formats to correctly output
|
||||
* (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
|
||||
* (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
|
||||
* PRINTF_INTPTR_MODIFIER is not defined for some systems which
|
||||
* provide their own stdint.h. PRINTF_INT64_MODIFIER is not
|
||||
* defined if INT64_MAX is not defined. These are an extension
|
||||
* beyond what C99 specifies must be in stdint.h.
|
||||
*
|
||||
* In addition, the following macros are defined:
|
||||
*
|
||||
* PRINTF_INTMAX_HEX_WIDTH
|
||||
* PRINTF_INT64_HEX_WIDTH
|
||||
* PRINTF_INT32_HEX_WIDTH
|
||||
* PRINTF_INT16_HEX_WIDTH
|
||||
* PRINTF_INT8_HEX_WIDTH
|
||||
* PRINTF_INTMAX_DEC_WIDTH
|
||||
* PRINTF_INT64_DEC_WIDTH
|
||||
* PRINTF_INT32_DEC_WIDTH
|
||||
* PRINTF_INT16_DEC_WIDTH
|
||||
* PRINTF_INT8_DEC_WIDTH
|
||||
*
|
||||
* Which specifies the maximum number of characters required to
|
||||
* print the number of that type in either hexadecimal or decimal.
|
||||
* These are an extension beyond what C99 specifies must be in
|
||||
* stdint.h.
|
||||
*
|
||||
* Compilers tested (all with 0 warnings at their highest respective
|
||||
* settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
|
||||
* bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
|
||||
* .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
|
||||
*
|
||||
* This file should be considered a work in progress. Suggestions for
|
||||
* improvements, especially those which increase coverage are strongly
|
||||
* encouraged.
|
||||
*
|
||||
* Acknowledgements
|
||||
*
|
||||
* The following people have made significant contributions to the
|
||||
* development and testing of this file:
|
||||
*
|
||||
* Chris Howie
|
||||
* John Steele Scott
|
||||
* Dave Thorup
|
||||
* John Dill
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*
|
||||
* For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
|
||||
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
|
||||
*/
|
||||
|
||||
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
|
||||
#include <stdint.h>
|
||||
#define _PSTDINT_H_INCLUDED
|
||||
# ifndef PRINTF_INT64_MODIFIER
|
||||
# define PRINTF_INT64_MODIFIER "ll"
|
||||
# endif
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER "l"
|
||||
# endif
|
||||
# ifndef PRINTF_INT16_MODIFIER
|
||||
# define PRINTF_INT16_MODIFIER "h"
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_MODIFIER
|
||||
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
|
||||
# endif
|
||||
# ifndef PRINTF_INT64_HEX_WIDTH
|
||||
# define PRINTF_INT64_HEX_WIDTH "16"
|
||||
# endif
|
||||
# ifndef PRINTF_INT32_HEX_WIDTH
|
||||
# define PRINTF_INT32_HEX_WIDTH "8"
|
||||
# endif
|
||||
# ifndef PRINTF_INT16_HEX_WIDTH
|
||||
# define PRINTF_INT16_HEX_WIDTH "4"
|
||||
# endif
|
||||
# ifndef PRINTF_INT8_HEX_WIDTH
|
||||
# define PRINTF_INT8_HEX_WIDTH "2"
|
||||
# endif
|
||||
# ifndef PRINTF_INT64_DEC_WIDTH
|
||||
# define PRINTF_INT64_DEC_WIDTH "20"
|
||||
# endif
|
||||
# ifndef PRINTF_INT32_DEC_WIDTH
|
||||
# define PRINTF_INT32_DEC_WIDTH "10"
|
||||
# endif
|
||||
# ifndef PRINTF_INT16_DEC_WIDTH
|
||||
# define PRINTF_INT16_DEC_WIDTH "5"
|
||||
# endif
|
||||
# ifndef PRINTF_INT8_DEC_WIDTH
|
||||
# define PRINTF_INT8_DEC_WIDTH "3"
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_HEX_WIDTH
|
||||
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_DEC_WIDTH
|
||||
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Something really weird is going on with Open Watcom. Just pull some of
|
||||
* these duplicated definitions from Open Watcom's stdint.h file for now.
|
||||
*/
|
||||
|
||||
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
|
||||
# if !defined (INT64_C)
|
||||
# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
|
||||
# endif
|
||||
# if !defined (UINT64_C)
|
||||
# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
|
||||
# endif
|
||||
# if !defined (INT32_C)
|
||||
# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
|
||||
# endif
|
||||
# if !defined (UINT32_C)
|
||||
# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
|
||||
# endif
|
||||
# if !defined (INT16_C)
|
||||
# define INT16_C(x) (x)
|
||||
# endif
|
||||
# if !defined (UINT16_C)
|
||||
# define UINT16_C(x) (x)
|
||||
# endif
|
||||
# if !defined (INT8_C)
|
||||
# define INT8_C(x) (x)
|
||||
# endif
|
||||
# if !defined (UINT8_C)
|
||||
# define UINT8_C(x) (x)
|
||||
# endif
|
||||
# if !defined (UINT64_MAX)
|
||||
# define UINT64_MAX 18446744073709551615ULL
|
||||
# endif
|
||||
# if !defined (INT64_MAX)
|
||||
# define INT64_MAX 9223372036854775807LL
|
||||
# endif
|
||||
# if !defined (UINT32_MAX)
|
||||
# define UINT32_MAX 4294967295UL
|
||||
# endif
|
||||
# if !defined (INT32_MAX)
|
||||
# define INT32_MAX 2147483647L
|
||||
# endif
|
||||
# if !defined (INTMAX_MAX)
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
# endif
|
||||
# if !defined (INTMAX_MIN)
|
||||
# define INTMAX_MIN INT64_MIN
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _PSTDINT_H_INCLUDED
|
||||
#define _PSTDINT_H_INCLUDED
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# define SIZE_MAX (~(size_t)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Deduce the type assignments from limits.h under the assumption that
|
||||
* integer sizes in bits are powers of 2, and follow the ANSI
|
||||
* definitions.
|
||||
*/
|
||||
|
||||
#ifndef UINT8_MAX
|
||||
# define UINT8_MAX 0xff
|
||||
#endif
|
||||
#ifndef uint8_t
|
||||
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
|
||||
typedef unsigned char uint8_t;
|
||||
# define UINT8_C(v) ((uint8_t) v)
|
||||
# else
|
||||
# error "Platform not supported"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef INT8_MAX
|
||||
# define INT8_MAX 0x7f
|
||||
#endif
|
||||
#ifndef INT8_MIN
|
||||
# define INT8_MIN INT8_C(0x80)
|
||||
#endif
|
||||
#ifndef int8_t
|
||||
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
|
||||
typedef signed char int8_t;
|
||||
# define INT8_C(v) ((int8_t) v)
|
||||
# else
|
||||
# error "Platform not supported"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT16_MAX
|
||||
# define UINT16_MAX 0xffff
|
||||
#endif
|
||||
#ifndef uint16_t
|
||||
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
|
||||
typedef unsigned int uint16_t;
|
||||
# ifndef PRINTF_INT16_MODIFIER
|
||||
# define PRINTF_INT16_MODIFIER ""
|
||||
# endif
|
||||
# define UINT16_C(v) ((uint16_t) (v))
|
||||
#elif (USHRT_MAX == UINT16_MAX)
|
||||
typedef unsigned short uint16_t;
|
||||
# define UINT16_C(v) ((uint16_t) (v))
|
||||
# ifndef PRINTF_INT16_MODIFIER
|
||||
# define PRINTF_INT16_MODIFIER "h"
|
||||
# endif
|
||||
#else
|
||||
#error "Platform not supported"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INT16_MAX
|
||||
# define INT16_MAX 0x7fff
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
# define INT16_MIN INT16_C(0x8000)
|
||||
#endif
|
||||
#ifndef int16_t
|
||||
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
|
||||
typedef signed int int16_t;
|
||||
# define INT16_C(v) ((int16_t) (v))
|
||||
# ifndef PRINTF_INT16_MODIFIER
|
||||
# define PRINTF_INT16_MODIFIER ""
|
||||
# endif
|
||||
#elif (SHRT_MAX == INT16_MAX)
|
||||
typedef signed short int16_t;
|
||||
# define INT16_C(v) ((int16_t) (v))
|
||||
# ifndef PRINTF_INT16_MODIFIER
|
||||
# define PRINTF_INT16_MODIFIER "h"
|
||||
# endif
|
||||
#else
|
||||
#error "Platform not supported"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UINT32_MAX
|
||||
# define UINT32_MAX (0xffffffffUL)
|
||||
#endif
|
||||
#ifndef uint32_t
|
||||
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
|
||||
typedef unsigned long uint32_t;
|
||||
# define UINT32_C(v) v ## UL
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER "l"
|
||||
# endif
|
||||
#elif (UINT_MAX == UINT32_MAX)
|
||||
typedef unsigned int uint32_t;
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER ""
|
||||
# endif
|
||||
# define UINT32_C(v) v ## U
|
||||
#elif (USHRT_MAX == UINT32_MAX)
|
||||
typedef unsigned short uint32_t;
|
||||
# define UINT32_C(v) ((unsigned short) (v))
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER ""
|
||||
# endif
|
||||
#else
|
||||
#error "Platform not supported"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef INT32_MAX
|
||||
# define INT32_MAX (0x7fffffffL)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
# define INT32_MIN INT32_C(0x80000000)
|
||||
#endif
|
||||
#ifndef int32_t
|
||||
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
|
||||
typedef signed long int32_t;
|
||||
# define INT32_C(v) v ## L
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER "l"
|
||||
# endif
|
||||
#elif (INT_MAX == INT32_MAX)
|
||||
typedef signed int int32_t;
|
||||
# define INT32_C(v) v
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER ""
|
||||
# endif
|
||||
#elif (SHRT_MAX == INT32_MAX)
|
||||
typedef signed short int32_t;
|
||||
# define INT32_C(v) ((short) (v))
|
||||
# ifndef PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_INT32_MODIFIER ""
|
||||
# endif
|
||||
#else
|
||||
#error "Platform not supported"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The macro stdint_int64_defined is temporarily used to record
|
||||
* whether or not 64 integer support is available. It must be
|
||||
* defined for any 64 integer extensions for new platforms that are
|
||||
* added.
|
||||
*/
|
||||
|
||||
#undef stdint_int64_defined
|
||||
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
|
||||
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
|
||||
# define stdint_int64_defined
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
# define UINT64_C(v) v ## ULL
|
||||
# define INT64_C(v) v ## LL
|
||||
# ifndef PRINTF_INT64_MODIFIER
|
||||
# define PRINTF_INT64_MODIFIER "ll"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined (stdint_int64_defined)
|
||||
# if defined(__GNUC__)
|
||||
# define stdint_int64_defined
|
||||
__extension__ typedef long long int64_t;
|
||||
__extension__ typedef unsigned long long uint64_t;
|
||||
# define UINT64_C(v) v ## ULL
|
||||
# define INT64_C(v) v ## LL
|
||||
# ifndef PRINTF_INT64_MODIFIER
|
||||
# define PRINTF_INT64_MODIFIER "ll"
|
||||
# endif
|
||||
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
|
||||
# define stdint_int64_defined
|
||||
typedef long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
# define UINT64_C(v) v ## ULL
|
||||
# define INT64_C(v) v ## LL
|
||||
# ifndef PRINTF_INT64_MODIFIER
|
||||
# define PRINTF_INT64_MODIFIER "ll"
|
||||
# endif
|
||||
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
|
||||
# define stdint_int64_defined
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# define UINT64_C(v) v ## UI64
|
||||
# define INT64_C(v) v ## I64
|
||||
# ifndef PRINTF_INT64_MODIFIER
|
||||
# define PRINTF_INT64_MODIFIER "I64"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
|
||||
# define LONG_LONG_MAX INT64_C (9223372036854775807)
|
||||
#endif
|
||||
#ifndef ULONG_LONG_MAX
|
||||
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
|
||||
#endif
|
||||
|
||||
#if !defined (INT64_MAX) && defined (INT64_C)
|
||||
# define INT64_MAX INT64_C (9223372036854775807)
|
||||
#endif
|
||||
#if !defined (INT64_MIN) && defined (INT64_C)
|
||||
# define INT64_MIN INT64_C (-9223372036854775808)
|
||||
#endif
|
||||
#if !defined (UINT64_MAX) && defined (INT64_C)
|
||||
# define UINT64_MAX UINT64_C (18446744073709551615)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Width of hexadecimal for number field.
|
||||
*/
|
||||
|
||||
#ifndef PRINTF_INT64_HEX_WIDTH
|
||||
# define PRINTF_INT64_HEX_WIDTH "16"
|
||||
#endif
|
||||
#ifndef PRINTF_INT32_HEX_WIDTH
|
||||
# define PRINTF_INT32_HEX_WIDTH "8"
|
||||
#endif
|
||||
#ifndef PRINTF_INT16_HEX_WIDTH
|
||||
# define PRINTF_INT16_HEX_WIDTH "4"
|
||||
#endif
|
||||
#ifndef PRINTF_INT8_HEX_WIDTH
|
||||
# define PRINTF_INT8_HEX_WIDTH "2"
|
||||
#endif
|
||||
|
||||
#ifndef PRINTF_INT64_DEC_WIDTH
|
||||
# define PRINTF_INT64_DEC_WIDTH "20"
|
||||
#endif
|
||||
#ifndef PRINTF_INT32_DEC_WIDTH
|
||||
# define PRINTF_INT32_DEC_WIDTH "10"
|
||||
#endif
|
||||
#ifndef PRINTF_INT16_DEC_WIDTH
|
||||
# define PRINTF_INT16_DEC_WIDTH "5"
|
||||
#endif
|
||||
#ifndef PRINTF_INT8_DEC_WIDTH
|
||||
# define PRINTF_INT8_DEC_WIDTH "3"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ok, lets not worry about 128 bit integers for now. Moore's law says
|
||||
* we don't need to worry about that until about 2040 at which point
|
||||
* we'll have bigger things to worry about.
|
||||
*/
|
||||
|
||||
#ifdef stdint_int64_defined
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
# define INTMAX_MAX INT64_MAX
|
||||
# define INTMAX_MIN INT64_MIN
|
||||
# define UINTMAX_MAX UINT64_MAX
|
||||
# define UINTMAX_C(v) UINT64_C(v)
|
||||
# define INTMAX_C(v) INT64_C(v)
|
||||
# ifndef PRINTF_INTMAX_MODIFIER
|
||||
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_HEX_WIDTH
|
||||
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_DEC_WIDTH
|
||||
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
|
||||
# endif
|
||||
#else
|
||||
typedef int32_t intmax_t;
|
||||
typedef uint32_t uintmax_t;
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
# define UINTMAX_C(v) UINT32_C(v)
|
||||
# define INTMAX_C(v) INT32_C(v)
|
||||
# ifndef PRINTF_INTMAX_MODIFIER
|
||||
# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_HEX_WIDTH
|
||||
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
|
||||
# endif
|
||||
# ifndef PRINTF_INTMAX_DEC_WIDTH
|
||||
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Because this file currently only supports platforms which have
|
||||
* precise powers of 2 as bit sizes for the default integers, the
|
||||
* least definitions are all trivial. Its possible that a future
|
||||
* version of this file could have different definitions.
|
||||
*/
|
||||
|
||||
#ifndef stdint_least_defined
|
||||
typedef int8_t int_least8_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
|
||||
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
|
||||
# define UINT_LEAST8_MAX UINT8_MAX
|
||||
# define INT_LEAST8_MAX INT8_MAX
|
||||
# define UINT_LEAST16_MAX UINT16_MAX
|
||||
# define INT_LEAST16_MAX INT16_MAX
|
||||
# define UINT_LEAST32_MAX UINT32_MAX
|
||||
# define INT_LEAST32_MAX INT32_MAX
|
||||
# define INT_LEAST8_MIN INT8_MIN
|
||||
# define INT_LEAST16_MIN INT16_MIN
|
||||
# define INT_LEAST32_MIN INT32_MIN
|
||||
# ifdef stdint_int64_defined
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
|
||||
# define UINT_LEAST64_MAX UINT64_MAX
|
||||
# define INT_LEAST64_MAX INT64_MAX
|
||||
# define INT_LEAST64_MIN INT64_MIN
|
||||
# endif
|
||||
#endif
|
||||
#undef stdint_least_defined
|
||||
|
||||
/*
|
||||
* The ANSI C committee pretending to know or specify anything about
|
||||
* performance is the epitome of misguided arrogance. The mandate of
|
||||
* this file is to *ONLY* ever support that absolute minimum
|
||||
* definition of the fast integer types, for compatibility purposes.
|
||||
* No extensions, and no attempt to suggest what may or may not be a
|
||||
* faster integer type will ever be made in this file. Developers are
|
||||
* warned to stay away from these types when using this or any other
|
||||
* stdint.h.
|
||||
*/
|
||||
|
||||
typedef int_least8_t int_fast8_t;
|
||||
typedef uint_least8_t uint_fast8_t;
|
||||
typedef int_least16_t int_fast16_t;
|
||||
typedef uint_least16_t uint_fast16_t;
|
||||
typedef int_least32_t int_fast32_t;
|
||||
typedef uint_least32_t uint_fast32_t;
|
||||
#define UINT_FAST8_MAX UINT_LEAST8_MAX
|
||||
#define INT_FAST8_MAX INT_LEAST8_MAX
|
||||
#define UINT_FAST16_MAX UINT_LEAST16_MAX
|
||||
#define INT_FAST16_MAX INT_LEAST16_MAX
|
||||
#define UINT_FAST32_MAX UINT_LEAST32_MAX
|
||||
#define INT_FAST32_MAX INT_LEAST32_MAX
|
||||
#define INT_FAST8_MIN INT_LEAST8_MIN
|
||||
#define INT_FAST16_MIN INT_LEAST16_MIN
|
||||
#define INT_FAST32_MIN INT_LEAST32_MIN
|
||||
#ifdef stdint_int64_defined
|
||||
typedef int_least64_t int_fast64_t;
|
||||
typedef uint_least64_t uint_fast64_t;
|
||||
# define UINT_FAST64_MAX UINT_LEAST64_MAX
|
||||
# define INT_FAST64_MAX INT_LEAST64_MAX
|
||||
# define INT_FAST64_MIN INT_LEAST64_MIN
|
||||
#endif
|
||||
|
||||
#undef stdint_int64_defined
|
||||
|
||||
/*
|
||||
* Whatever piecemeal, per compiler thing we can do about the wchar_t
|
||||
* type limits.
|
||||
*/
|
||||
|
||||
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
|
||||
# include <wchar.h>
|
||||
# ifndef WCHAR_MIN
|
||||
# define WCHAR_MIN 0
|
||||
# endif
|
||||
# ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX ((wchar_t)-1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Whatever piecemeal, per compiler/platform thing we can do about the
|
||||
* (u)intptr_t types and limits.
|
||||
*/
|
||||
|
||||
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
|
||||
# define STDINT_H_UINTPTR_T_DEFINED
|
||||
#endif
|
||||
|
||||
#ifndef STDINT_H_UINTPTR_T_DEFINED
|
||||
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
|
||||
# define stdint_intptr_bits 64
|
||||
# elif defined (__WATCOMC__) || defined (__TURBOC__)
|
||||
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
|
||||
# define stdint_intptr_bits 16
|
||||
# else
|
||||
# define stdint_intptr_bits 32
|
||||
# endif
|
||||
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
|
||||
# define stdint_intptr_bits 32
|
||||
# elif defined (__INTEL_COMPILER)
|
||||
/* TODO -- what did Intel do about x86-64? */
|
||||
# endif
|
||||
|
||||
# ifdef stdint_intptr_bits
|
||||
# define stdint_intptr_glue3_i(a,b,c) a##b##c
|
||||
# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
|
||||
# ifndef PRINTF_INTPTR_MODIFIER
|
||||
# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
|
||||
# endif
|
||||
# ifndef PTRDIFF_MAX
|
||||
# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
|
||||
# endif
|
||||
# ifndef PTRDIFF_MIN
|
||||
# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
|
||||
# endif
|
||||
# ifndef UINTPTR_MAX
|
||||
# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
|
||||
# endif
|
||||
# ifndef INTPTR_MAX
|
||||
# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
|
||||
# endif
|
||||
# ifndef INTPTR_MIN
|
||||
# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
|
||||
# endif
|
||||
# ifndef INTPTR_C
|
||||
# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
|
||||
# endif
|
||||
# ifndef UINTPTR_C
|
||||
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
|
||||
# endif
|
||||
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
|
||||
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
|
||||
# else
|
||||
/* TODO -- This following is likely wrong for some platforms, and does
|
||||
nothing for the definition of uintptr_t. */
|
||||
typedef ptrdiff_t intptr_t;
|
||||
# endif
|
||||
# define STDINT_H_UINTPTR_T_DEFINED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assumes sig_atomic_t is signed and we have a 2s complement machine.
|
||||
*/
|
||||
|
||||
#ifndef SIG_ATOMIC_MAX
|
||||
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
|
||||
|
||||
/*
|
||||
* Please compile with the maximum warning settings to make sure macros are not
|
||||
* defined more than once.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define glue3_aux(x,y,z) x ## y ## z
|
||||
#define glue3(x,y,z) glue3_aux(x,y,z)
|
||||
|
||||
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
|
||||
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
|
||||
|
||||
#define DECL(us,bits) glue3(DECL,us,) (bits)
|
||||
|
||||
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
|
||||
|
||||
int main () {
|
||||
DECL(I,8)
|
||||
DECL(U,8)
|
||||
DECL(I,16)
|
||||
DECL(U,16)
|
||||
DECL(I,32)
|
||||
DECL(U,32)
|
||||
#ifdef INT64_MAX
|
||||
DECL(I,64)
|
||||
DECL(U,64)
|
||||
#endif
|
||||
intmax_t imax = INTMAX_C(0);
|
||||
uintmax_t umax = UINTMAX_C(0);
|
||||
char str0[256], str1[256];
|
||||
|
||||
sprintf (str0, "%d %x\n", 0, ~0);
|
||||
|
||||
sprintf (str1, "%d %x\n", i8, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
|
||||
sprintf (str1, "%u %x\n", u8, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
|
||||
sprintf (str1, "%d %x\n", i16, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
|
||||
sprintf (str1, "%u %x\n", u16, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
|
||||
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
|
||||
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
|
||||
#ifdef INT64_MAX
|
||||
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
|
||||
#endif
|
||||
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
|
||||
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
|
||||
if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
|
||||
|
||||
TESTUMAX(8);
|
||||
TESTUMAX(16);
|
||||
TESTUMAX(32);
|
||||
#ifdef INT64_MAX
|
||||
TESTUMAX(64);
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
+18
-17
@@ -6,8 +6,7 @@
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#ifndef REGCHANNEL_H
|
||||
#define REGCHANNEL_H
|
||||
#pragma once
|
||||
|
||||
#include "memo.h"
|
||||
#include "modes.h"
|
||||
@@ -22,9 +21,10 @@ typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
|
||||
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
|
||||
|
||||
/* AutoKick data. */
|
||||
class CoreExport AutoKick : public Serializable
|
||||
class CoreExport AutoKick final
|
||||
: public Serializable
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Channel this autokick is on */
|
||||
Serialize::Reference<ChannelInfo> ci;
|
||||
|
||||
@@ -38,24 +38,26 @@ class CoreExport AutoKick : public Serializable
|
||||
|
||||
AutoKick();
|
||||
~AutoKick();
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
};
|
||||
|
||||
/* It matters that Base is here before Extensible (it is inherited by Serializable)
|
||||
*/
|
||||
class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
class CoreExport ChannelInfo final
|
||||
: public Serializable
|
||||
, public Extensible
|
||||
{
|
||||
/* channels who reference this one */
|
||||
Anope::map<int> references;
|
||||
private:
|
||||
private:
|
||||
Serialize::Reference<NickCore> founder; /* Channel founder */
|
||||
Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
|
||||
Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
|
||||
Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
|
||||
Anope::map<int16_t> levels;
|
||||
|
||||
public:
|
||||
public:
|
||||
friend class ChanAccess;
|
||||
friend class AutoKick;
|
||||
|
||||
@@ -93,9 +95,10 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
ChannelInfo(const ChannelInfo &ci);
|
||||
|
||||
~ChannelInfo();
|
||||
ChannelInfo &operator=(const ChannelInfo &) = default;
|
||||
|
||||
void Serialize(Serialize::Data &data) const anope_override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
/** Change the founder of the channel
|
||||
* @params nc The new founder
|
||||
@@ -166,7 +169,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
* @param t The time the akick was added, defaults to now
|
||||
* @param lu The time the akick was last used, defaults to never
|
||||
*/
|
||||
AutoKick* AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
|
||||
AutoKick *AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
|
||||
|
||||
/** Add an akick entry to the channel by reason
|
||||
* @param user The user who added the akick
|
||||
@@ -175,13 +178,13 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
* @param t The time the akick was added, defaults to now
|
||||
* @param lu The time the akick was last used, defaults to never
|
||||
*/
|
||||
AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
|
||||
AutoKick *AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
|
||||
|
||||
/** Get an entry from the channel akick list
|
||||
* @param index The index in the akick vector
|
||||
* @return The akick structure, or NULL if not found
|
||||
*/
|
||||
AutoKick* GetAkick(unsigned index) const;
|
||||
AutoKick *GetAkick(unsigned index) const;
|
||||
|
||||
/** Get the size of the akick vector for this channel
|
||||
* @return The akick vector size
|
||||
@@ -235,7 +238,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
* @param name channel name to lookup
|
||||
* @return the ChannelInfo associated with the channel
|
||||
*/
|
||||
static ChannelInfo* Find(const Anope::string &name);
|
||||
static ChannelInfo *Find(const Anope::string &name);
|
||||
|
||||
void AddChannelReference(const Anope::string &what);
|
||||
void RemoveChannelReference(const Anope::string &what);
|
||||
@@ -248,5 +251,3 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
* @return true or false
|
||||
*/
|
||||
extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci);
|
||||
|
||||
#endif // REGCHANNEL_H
|
||||
|
||||
+11
-12
@@ -9,37 +9,36 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef REGEXPR_H
|
||||
#define REGEXPR_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
#include "service.h"
|
||||
|
||||
class RegexException : public CoreException
|
||||
class CoreExport RegexException final
|
||||
: public CoreException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
RegexException(const Anope::string &reason = "") : CoreException(reason) { }
|
||||
|
||||
virtual ~RegexException() throw() { }
|
||||
virtual ~RegexException() noexcept = default;
|
||||
};
|
||||
|
||||
class CoreExport Regex
|
||||
{
|
||||
Anope::string expression;
|
||||
protected:
|
||||
protected:
|
||||
Regex(const Anope::string &expr) : expression(expr) { }
|
||||
public:
|
||||
virtual ~Regex() { }
|
||||
public:
|
||||
virtual ~Regex() = default;
|
||||
const Anope::string &GetExpression() { return expression; }
|
||||
virtual bool Matches(const Anope::string &str) = 0;
|
||||
};
|
||||
|
||||
class CoreExport RegexProvider : public Service
|
||||
class CoreExport RegexProvider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
RegexProvider(Module *o, const Anope::string &n) : Service(o, "Regex", n) { }
|
||||
virtual Regex *Compile(const Anope::string &) = 0;
|
||||
};
|
||||
|
||||
#endif // REGEXPR_H
|
||||
|
||||
+35
-37
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SERIALIZE_H
|
||||
#define SERIALIZE_H
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -21,16 +20,16 @@ namespace Serialize
|
||||
{
|
||||
class Data
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
DT_TEXT,
|
||||
DT_INT
|
||||
};
|
||||
|
||||
virtual ~Data() { }
|
||||
virtual ~Data() = default;
|
||||
|
||||
virtual std::iostream& operator[](const Anope::string &key) = 0;
|
||||
virtual std::iostream &operator[](const Anope::string &key) = 0;
|
||||
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
|
||||
virtual size_t Hash() const { throw CoreException("Not supported"); }
|
||||
|
||||
@@ -50,9 +49,10 @@ namespace Serialize
|
||||
* abstract data types (Serialize::Data), and then reconstructed or
|
||||
* updated later at any time.
|
||||
*/
|
||||
class CoreExport Serializable : public virtual Base
|
||||
class CoreExport Serializable
|
||||
: public virtual Base
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/* A list of every serializable item in Anope.
|
||||
* Some of these are static and constructed at runtime,
|
||||
* so this list must be on the heap, as it is not always
|
||||
@@ -65,24 +65,24 @@ class CoreExport Serializable : public virtual Base
|
||||
/* Iterator into serializable_items */
|
||||
std::list<Serializable *>::iterator s_iter;
|
||||
/* The hash of the last serialized form of this object committed to the database */
|
||||
size_t last_commit;
|
||||
size_t last_commit = 0;
|
||||
/* The last time this object was committed to the database */
|
||||
time_t last_commit_time;
|
||||
time_t last_commit_time = 0;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
Serializable(const Anope::string &serialize_type);
|
||||
Serializable(const Serializable &);
|
||||
|
||||
Serializable &operator=(const Serializable &);
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~Serializable();
|
||||
|
||||
/* Unique ID (per type, not globally) for this object */
|
||||
uint64_t id;
|
||||
uint64_t id = 0;
|
||||
|
||||
/* Only used by redis, to ignore updates */
|
||||
unsigned short redis_ignore;
|
||||
unsigned short redis_ignore = 0;
|
||||
|
||||
/** Marks the object as potentially being updated "soon".
|
||||
*/
|
||||
@@ -97,7 +97,7 @@ class CoreExport Serializable : public virtual Base
|
||||
/** Get the type of serializable object this is
|
||||
* @return The serializable object type
|
||||
*/
|
||||
Serialize::Type* GetSerializableType() const { return this->s_type; }
|
||||
Serialize::Type *GetSerializableType() const { return this->s_type; }
|
||||
|
||||
virtual void Serialize(Serialize::Data &data) const = 0;
|
||||
|
||||
@@ -108,9 +108,10 @@ class CoreExport Serializable : public virtual Base
|
||||
* of class that inherits from Serializable. Used for unserializing objects
|
||||
* of this type, as it requires a function pointer to a static member function.
|
||||
*/
|
||||
class CoreExport Serialize::Type : public Base
|
||||
class CoreExport Serialize::Type final
|
||||
: public Base
|
||||
{
|
||||
typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &);
|
||||
typedef Serializable *(*unserialize_func)(Serializable *obj, Serialize::Data &);
|
||||
|
||||
static std::vector<Anope::string> TypeOrder;
|
||||
static std::map<Anope::string, Serialize::Type *> Types;
|
||||
@@ -127,9 +128,9 @@ class CoreExport Serialize::Type : public Base
|
||||
* this timestamp. if curtime == timestamp then we have the most up to date
|
||||
* version of every object of this type.
|
||||
*/
|
||||
time_t timestamp;
|
||||
time_t timestamp = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
/* Map of Serializable::id to Serializable objects */
|
||||
std::map<uint64_t, Serializable *> objects;
|
||||
|
||||
@@ -167,7 +168,7 @@ class CoreExport Serialize::Type : public Base
|
||||
*/
|
||||
void UpdateTimestamp();
|
||||
|
||||
Module* GetOwner() const { return this->owner; }
|
||||
Module *GetOwner() const { return this->owner; }
|
||||
|
||||
static Serialize::Type *Find(const Anope::string &name);
|
||||
|
||||
@@ -187,7 +188,7 @@ class Serialize::Checker
|
||||
{
|
||||
Anope::string name;
|
||||
T obj;
|
||||
mutable ::Reference<Serialize::Type> type;
|
||||
mutable ::Reference<Serialize::Type> type = nullptr;
|
||||
|
||||
inline void Check() const
|
||||
{
|
||||
@@ -197,26 +198,26 @@ class Serialize::Checker
|
||||
type->Check();
|
||||
}
|
||||
|
||||
public:
|
||||
Checker(const Anope::string &n) : name(n), type(NULL) { }
|
||||
public:
|
||||
Checker(const Anope::string &n) : name(n) { }
|
||||
|
||||
inline const T* operator->() const
|
||||
inline const T *operator->() const
|
||||
{
|
||||
this->Check();
|
||||
return &this->obj;
|
||||
}
|
||||
inline T* operator->()
|
||||
inline T *operator->()
|
||||
{
|
||||
this->Check();
|
||||
return &this->obj;
|
||||
}
|
||||
|
||||
inline const T& operator*() const
|
||||
inline const T &operator*() const
|
||||
{
|
||||
this->Check();
|
||||
return this->obj;
|
||||
}
|
||||
inline T& operator*()
|
||||
inline T &operator*()
|
||||
{
|
||||
this->Check();
|
||||
return this->obj;
|
||||
@@ -241,15 +242,14 @@ class Serialize::Checker
|
||||
* destructed.
|
||||
*/
|
||||
template<typename T>
|
||||
class Serialize::Reference : public ReferenceBase
|
||||
class Serialize::Reference final
|
||||
: public ReferenceBase
|
||||
{
|
||||
protected:
|
||||
T *ref;
|
||||
protected:
|
||||
T *ref = nullptr;
|
||||
|
||||
public:
|
||||
Reference() : ref(NULL)
|
||||
{
|
||||
}
|
||||
public:
|
||||
Reference() = default;
|
||||
|
||||
Reference(T *obj) : ref(obj)
|
||||
{
|
||||
@@ -305,7 +305,7 @@ class Serialize::Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator*() const
|
||||
inline T *operator*() const
|
||||
{
|
||||
if (!this->invalid)
|
||||
{
|
||||
@@ -318,7 +318,7 @@ class Serialize::Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator->() const
|
||||
inline T *operator->() const
|
||||
{
|
||||
if (!this->invalid)
|
||||
{
|
||||
@@ -331,5 +331,3 @@ class Serialize::Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SERIALIZE_H
|
||||
|
||||
+9
-11
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SERVERS_H
|
||||
#define SERVERS_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
@@ -26,7 +25,7 @@ namespace Servers
|
||||
* the only server whose uplink *is* Me that is not a juped server.
|
||||
* @return Our uplink, or NULL if not uplinked to anything
|
||||
*/
|
||||
extern CoreExport Server* GetUplink();
|
||||
extern CoreExport Server *GetUplink();
|
||||
|
||||
/* Server maps by name and id */
|
||||
extern CoreExport Anope::map<Server *> ByName;
|
||||
@@ -38,9 +37,10 @@ namespace Servers
|
||||
|
||||
/** Class representing a server
|
||||
*/
|
||||
class CoreExport Server : public Extensible
|
||||
class CoreExport Server final
|
||||
: public Extensible
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/* Server name */
|
||||
Anope::string name;
|
||||
/* Hops between services and server */
|
||||
@@ -62,7 +62,7 @@ class CoreExport Server : public Extensible
|
||||
/* Reason this server was quit */
|
||||
Anope::string quit_reason;
|
||||
|
||||
public:
|
||||
public:
|
||||
/** Constructor
|
||||
* @param uplink The uplink this server is from, is only NULL when creating Me
|
||||
* @param name The server name
|
||||
@@ -73,14 +73,14 @@ class CoreExport Server : public Extensible
|
||||
*/
|
||||
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false);
|
||||
|
||||
private:
|
||||
private:
|
||||
/** Destructor
|
||||
*/
|
||||
~Server();
|
||||
|
||||
public:
|
||||
public:
|
||||
/* Number of users on the server */
|
||||
unsigned users;
|
||||
unsigned users = 0;
|
||||
|
||||
/** Delete this server with a reason
|
||||
* @param reason The reason
|
||||
@@ -183,5 +183,3 @@ class CoreExport Server : public Extensible
|
||||
*/
|
||||
static Server *Find(const Anope::string &name, bool name_only = false);
|
||||
};
|
||||
|
||||
#endif // SERVERS_H
|
||||
|
||||
+12
-13
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SERVICE_H
|
||||
#define SERVICE_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "anope.h"
|
||||
@@ -21,7 +20,8 @@
|
||||
* such as commands, use this. This is also used for modules
|
||||
* that publish a service (m_ssl_openssl, etc).
|
||||
*/
|
||||
class CoreExport Service : public virtual Base
|
||||
class CoreExport Service
|
||||
: public virtual Base
|
||||
{
|
||||
static std::map<Anope::string, std::map<Anope::string, Service *> > Services;
|
||||
static std::map<Anope::string, std::map<Anope::string, Anope::string> > Aliases;
|
||||
@@ -42,7 +42,7 @@ class CoreExport Service : public virtual Base
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
static Service *FindService(const Anope::string &t, const Anope::string &n)
|
||||
{
|
||||
std::map<Anope::string, std::map<Anope::string, Service *> >::const_iterator it = Services.find(t);
|
||||
@@ -113,16 +113,17 @@ class CoreExport Service : public virtual Base
|
||||
}
|
||||
};
|
||||
|
||||
/** Like Reference, but used to refer to Services.
|
||||
/** Like Reference, but used to refer to a Service.
|
||||
*/
|
||||
template<typename T>
|
||||
class ServiceReference : public Reference<T>
|
||||
class ServiceReference
|
||||
: public Reference<T>
|
||||
{
|
||||
Anope::string type;
|
||||
Anope::string name;
|
||||
|
||||
public:
|
||||
ServiceReference() { }
|
||||
public:
|
||||
ServiceReference() = default;
|
||||
|
||||
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
|
||||
{
|
||||
@@ -138,7 +139,7 @@ class ServiceReference : public Reference<T>
|
||||
this->invalid = true;
|
||||
}
|
||||
|
||||
operator bool() anope_override
|
||||
operator bool() override
|
||||
{
|
||||
if (this->invalid)
|
||||
{
|
||||
@@ -159,10 +160,10 @@ class ServiceReference : public Reference<T>
|
||||
}
|
||||
};
|
||||
|
||||
class ServiceAlias
|
||||
class ServiceAlias final
|
||||
{
|
||||
Anope::string t, f;
|
||||
public:
|
||||
public:
|
||||
ServiceAlias(const Anope::string &type, const Anope::string &from, const Anope::string &to) : t(type), f(from)
|
||||
{
|
||||
Service::AddAlias(type, from, to);
|
||||
@@ -173,5 +174,3 @@ class ServiceAlias
|
||||
Service::DelAlias(t, f);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SERVICE_H
|
||||
|
||||
+6
-19
@@ -9,8 +9,7 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SERVICES_H
|
||||
#define SERVICES_H
|
||||
#pragma once
|
||||
|
||||
#include "sysconf.h"
|
||||
|
||||
@@ -21,16 +20,15 @@
|
||||
#include <cstdarg>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <string.h>
|
||||
#if HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <cstring>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Pull in the various bits of STL */
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
@@ -48,21 +46,10 @@
|
||||
|
||||
#define _(x) x
|
||||
|
||||
#if defined __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
|
||||
# define anope_override override
|
||||
# define anope_final final
|
||||
#else
|
||||
# define anope_override
|
||||
# define anope_final
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
# define DllExport
|
||||
# define CoreExport
|
||||
# define MARK_DEPRECATED __attribute((deprecated))
|
||||
# define DllExport __attribute__ ((visibility ("default")))
|
||||
# define CoreExport __attribute__ ((visibility ("default")))
|
||||
# define anope_close close
|
||||
#else
|
||||
# include "anope_windows.h"
|
||||
#endif
|
||||
|
||||
#endif // SERVICES_H
|
||||
|
||||
@@ -9,16 +9,15 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SOCKETENGINE_H
|
||||
#define SOCKETENGINE_H
|
||||
#pragma once
|
||||
|
||||
#include "services.h"
|
||||
#include "sockets.h"
|
||||
|
||||
class CoreExport SocketEngine
|
||||
class CoreExport SocketEngine final
|
||||
{
|
||||
static const int DefaultSize = 2; // Uplink, mode stacker
|
||||
public:
|
||||
public:
|
||||
/* Map of sockets */
|
||||
static std::map<int, Socket *> Sockets;
|
||||
|
||||
@@ -46,5 +45,3 @@ class CoreExport SocketEngine
|
||||
|
||||
static bool IgnoreErrno();
|
||||
};
|
||||
|
||||
#endif // SOCKETENGINE_H
|
||||
|
||||
+72
-57
@@ -9,17 +9,22 @@
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*/
|
||||
|
||||
#ifndef SOCKETS_H
|
||||
#define SOCKETS_H
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include "anope.h"
|
||||
|
||||
// This has to be after anope.h
|
||||
#ifdef _WIN32
|
||||
# include <afunix.h>
|
||||
#endif
|
||||
|
||||
#define NET_BUFSIZE 65535
|
||||
|
||||
/** A sockaddr union used to combine IPv4 and IPv6 sockaddrs
|
||||
@@ -29,6 +34,7 @@ union CoreExport sockaddrs
|
||||
sockaddr sa;
|
||||
sockaddr_in sa4;
|
||||
sockaddr_in6 sa6;
|
||||
sockaddr_un saun;
|
||||
|
||||
/** Construct the object, sets everything to 0
|
||||
*/
|
||||
@@ -57,6 +63,11 @@ union CoreExport sockaddrs
|
||||
*/
|
||||
Anope::string addr() const;
|
||||
|
||||
/** Gets the endpoint represented by this addr.
|
||||
* @return The endpoint.
|
||||
*/
|
||||
Anope::string str() const;
|
||||
|
||||
/** Get the reverse address represented by this addr
|
||||
* @return The reverse address
|
||||
*/
|
||||
@@ -92,12 +103,12 @@ union CoreExport sockaddrs
|
||||
void ntop(int type, const void *src);
|
||||
};
|
||||
|
||||
class CoreExport cidr
|
||||
class CoreExport cidr final
|
||||
{
|
||||
sockaddrs addr;
|
||||
Anope::string cidr_ip;
|
||||
unsigned short cidr_len;
|
||||
public:
|
||||
public:
|
||||
cidr(const Anope::string &ip);
|
||||
cidr(const Anope::string &ip, unsigned char len);
|
||||
cidr(const sockaddrs &ip, unsigned char len);
|
||||
@@ -109,15 +120,16 @@ class CoreExport cidr
|
||||
bool operator==(const cidr &other) const;
|
||||
bool operator!=(const cidr &other) const;
|
||||
|
||||
struct CoreExport hash
|
||||
struct CoreExport hash final
|
||||
{
|
||||
size_t operator()(const cidr &s) const;
|
||||
};
|
||||
};
|
||||
|
||||
class SocketException : public CoreException
|
||||
class CoreExport SocketException final
|
||||
: public CoreException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Constructor for socket exceptions
|
||||
* @param message Error message
|
||||
*/
|
||||
@@ -126,7 +138,7 @@ class SocketException : public CoreException
|
||||
/** Destructor
|
||||
* @throws Nothing
|
||||
*/
|
||||
virtual ~SocketException() throw() { }
|
||||
virtual ~SocketException() noexcept = default;
|
||||
};
|
||||
|
||||
enum SocketFlag
|
||||
@@ -143,8 +155,8 @@ enum SocketFlag
|
||||
|
||||
class CoreExport SocketIO
|
||||
{
|
||||
public:
|
||||
virtual ~SocketIO() { }
|
||||
public:
|
||||
virtual ~SocketIO() = default;
|
||||
|
||||
/** Receive something from the buffer
|
||||
* @param s The socket
|
||||
@@ -201,13 +213,14 @@ class CoreExport SocketIO
|
||||
|
||||
class CoreExport Socket
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* Socket FD */
|
||||
int sock;
|
||||
/* Is this an IPv6 socket? */
|
||||
bool ipv6;
|
||||
|
||||
public:
|
||||
/* The family of this socket FD */
|
||||
int family;
|
||||
|
||||
public:
|
||||
std::bitset<SF_SIZE> flags;
|
||||
|
||||
/* Sockaddrs for bind() (if it's bound) */
|
||||
@@ -222,25 +235,25 @@ class CoreExport Socket
|
||||
|
||||
/** Constructor, possibly creates the socket and adds it to the engine
|
||||
* @param sock The socket to use, -1 if we need to create our own
|
||||
* @param ipv6 true if using ipv6
|
||||
* @param family The family of the socket
|
||||
* @param type The socket type, defaults to SOCK_STREAM
|
||||
*/
|
||||
Socket(int sock, bool ipv6 = false, int type = SOCK_STREAM);
|
||||
Socket(int sock, int family = AF_INET, int type = SOCK_STREAM);
|
||||
|
||||
/** Destructor, closes the socket and removes it from the engine
|
||||
*/
|
||||
virtual ~Socket();
|
||||
|
||||
/** Get the socket family for this socket
|
||||
* @return the family
|
||||
*/
|
||||
int GetFamily() const;
|
||||
|
||||
/** Get the socket FD for this socket
|
||||
* @return the fd
|
||||
*/
|
||||
int GetFD() const;
|
||||
|
||||
/** Check if this socket is IPv6
|
||||
* @return true or false
|
||||
*/
|
||||
bool IsIPv6() const;
|
||||
|
||||
/** Mark a socket as (non)blocking
|
||||
* @param state true to enable blocking, false to disable blocking
|
||||
* @return true if the socket is now blocking
|
||||
@@ -274,9 +287,10 @@ class CoreExport Socket
|
||||
virtual void ProcessError();
|
||||
};
|
||||
|
||||
class CoreExport BufferedSocket : public virtual Socket
|
||||
class CoreExport BufferedSocket
|
||||
: public virtual Socket
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* Things read from the socket */
|
||||
Anope::string read_buffer;
|
||||
/* Things to be written to the socket */
|
||||
@@ -284,31 +298,30 @@ class CoreExport BufferedSocket : public virtual Socket
|
||||
/* How much data was received from this socket on this recv() */
|
||||
int recv_len;
|
||||
|
||||
public:
|
||||
BufferedSocket();
|
||||
virtual ~BufferedSocket();
|
||||
public:
|
||||
virtual ~BufferedSocket() = default;
|
||||
|
||||
/** Called when there is something to be received for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
bool ProcessRead() anope_override;
|
||||
bool ProcessRead() override;
|
||||
|
||||
/** Called when the socket is ready to be written to
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
bool ProcessWrite() anope_override;
|
||||
bool ProcessWrite() override;
|
||||
|
||||
/** Gets the new line from the input buffer, if any
|
||||
*/
|
||||
const Anope::string GetLine();
|
||||
Anope::string GetLine();
|
||||
|
||||
/** Write to the socket
|
||||
* @param message The message
|
||||
*/
|
||||
protected:
|
||||
protected:
|
||||
virtual void Write(const char *buffer, size_t l);
|
||||
public:
|
||||
void Write(const char *message, ...);
|
||||
public:
|
||||
void Write(const char *message, ...) ATTR_FORMAT(2, 3);
|
||||
void Write(const Anope::string &message);
|
||||
|
||||
/** Get the length of the read buffer
|
||||
@@ -322,10 +335,11 @@ class CoreExport BufferedSocket : public virtual Socket
|
||||
int WriteBufferLen() const;
|
||||
};
|
||||
|
||||
class CoreExport BinarySocket : public virtual Socket
|
||||
class CoreExport BinarySocket
|
||||
: public virtual Socket
|
||||
{
|
||||
protected:
|
||||
struct DataBlock
|
||||
protected:
|
||||
struct DataBlock final
|
||||
{
|
||||
char *orig;
|
||||
char *buf;
|
||||
@@ -338,26 +352,25 @@ class CoreExport BinarySocket : public virtual Socket
|
||||
/* Data to be written out */
|
||||
std::deque<DataBlock *> write_buffer;
|
||||
|
||||
public:
|
||||
BinarySocket();
|
||||
virtual ~BinarySocket();
|
||||
public:
|
||||
virtual ~BinarySocket() = default;
|
||||
|
||||
/** Called when there is something to be received for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
bool ProcessRead() anope_override;
|
||||
bool ProcessRead() override;
|
||||
|
||||
/** Called when the socket is ready to be written to
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
bool ProcessWrite() anope_override;
|
||||
bool ProcessWrite() override;
|
||||
|
||||
/** Write data to the socket
|
||||
* @param buffer The data to write
|
||||
* @param l The length of the data; if 0 then this function returns without doing anything
|
||||
*/
|
||||
virtual void Write(const char *buffer, size_t l);
|
||||
void Write(const char *message, ...);
|
||||
void Write(const char *message, ...) ATTR_FORMAT(2, 3);
|
||||
void Write(const Anope::string &message);
|
||||
|
||||
/** Called with data from the socket
|
||||
@@ -368,16 +381,17 @@ class CoreExport BinarySocket : public virtual Socket
|
||||
virtual bool Read(const char *buffer, size_t l);
|
||||
};
|
||||
|
||||
class CoreExport ListenSocket : public virtual Socket
|
||||
class CoreExport ListenSocket
|
||||
: public virtual Socket
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** Constructor
|
||||
* @param bindip The IP to bind to
|
||||
* @param port The port to listen on
|
||||
* @param ipv6 true for ipv6
|
||||
*/
|
||||
ListenSocket(const Anope::string &bindip, int port, bool ipv6);
|
||||
virtual ~ListenSocket();
|
||||
virtual ~ListenSocket() = default;
|
||||
|
||||
/** Process what has come in from the connection
|
||||
* @return false to destroy this socket
|
||||
@@ -392,9 +406,10 @@ class CoreExport ListenSocket : public virtual Socket
|
||||
virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) = 0;
|
||||
};
|
||||
|
||||
class CoreExport ConnectionSocket : public virtual Socket
|
||||
class CoreExport ConnectionSocket
|
||||
: public virtual Socket
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Sockaddrs for connection ip/port */
|
||||
sockaddrs conaddr;
|
||||
|
||||
@@ -408,12 +423,12 @@ class CoreExport ConnectionSocket : public virtual Socket
|
||||
* Used to determine whether or not this socket is connected yet.
|
||||
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue
|
||||
*/
|
||||
bool Process() anope_override;
|
||||
bool Process() override;
|
||||
|
||||
/** Called when there is an error for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
void ProcessError() anope_override;
|
||||
void ProcessError() override;
|
||||
|
||||
/** Called on a successful connect
|
||||
*/
|
||||
@@ -425,9 +440,10 @@ class CoreExport ConnectionSocket : public virtual Socket
|
||||
virtual void OnError(const Anope::string &error);
|
||||
};
|
||||
|
||||
class CoreExport ClientSocket : public virtual Socket
|
||||
class CoreExport ClientSocket
|
||||
: public virtual Socket
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Listen socket this connection came from */
|
||||
ListenSocket *ls;
|
||||
/* Clients address */
|
||||
@@ -443,12 +459,12 @@ class CoreExport ClientSocket : public virtual Socket
|
||||
* Used to determine whether or not this socket is connected yet.
|
||||
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue
|
||||
*/
|
||||
bool Process() anope_override;
|
||||
bool Process() override;
|
||||
|
||||
/** Called when there is an error for this socket
|
||||
* @return true on success, false to drop this socket
|
||||
*/
|
||||
void ProcessError() anope_override;
|
||||
void ProcessError() override;
|
||||
|
||||
/** Called when a client has been accepted() successfully.
|
||||
*/
|
||||
@@ -459,9 +475,10 @@ class CoreExport ClientSocket : public virtual Socket
|
||||
virtual void OnError(const Anope::string &error);
|
||||
};
|
||||
|
||||
class CoreExport Pipe : public Socket
|
||||
class CoreExport Pipe
|
||||
: public Socket
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/** The FD of the write pipe
|
||||
* this->sock is the readfd
|
||||
*/
|
||||
@@ -472,7 +489,7 @@ class CoreExport Pipe : public Socket
|
||||
|
||||
/** Called when data is to be read, reads the data then calls OnNotify
|
||||
*/
|
||||
bool ProcessRead() anope_override;
|
||||
bool ProcessRead() override;
|
||||
|
||||
/** Write data to this pipe
|
||||
* @param data The data to write
|
||||
@@ -507,5 +524,3 @@ class CoreExport Pipe : public Socket
|
||||
extern CoreExport uint32_t TotalRead;
|
||||
extern CoreExport uint32_t TotalWritten;
|
||||
extern CoreExport SocketIO NormalSocketIO;
|
||||
|
||||
#endif // SOCKET_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user