mirror of
https://github.com/anope/anope.git
synced 2026-06-15 19:04:46 +02:00
Compare commits
279 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 507eefc820 | |||
| 72af764861 | |||
| 1b631e96bd | |||
| 3b4a4da52d | |||
| 2e59aac025 | |||
| 3de6da80c6 | |||
| 2829c83118 | |||
| f58012ea0e | |||
| f8605ec188 | |||
| 5a12beff15 | |||
| 6b1f8de885 | |||
| 33be5de66e | |||
| 4399eeaa58 | |||
| 38cfb0603a | |||
| 1a3844e74e | |||
| bfed2e1bf5 | |||
| e488f294a1 | |||
| fde3438ef2 | |||
| 1575dea5b9 | |||
| a1972ba9b6 | |||
| 5a72d8783e | |||
| e6770bc2fd | |||
| 413fed474e | |||
| 60083834f8 | |||
| 9ac4da0489 | |||
| cb3848b7db | |||
| 753119c4a1 | |||
| d996c3aa8f | |||
| ac6e8c617d | |||
| 3b09f4aa54 | |||
| 10f4724b6b | |||
| ad86535024 | |||
| 628f4d2a7e | |||
| 8d5be77c93 | |||
| 13a556df89 | |||
| 4e9d183523 | |||
| 074dfb63a7 | |||
| beaf09de7b | |||
| c8d8978cd0 | |||
| 11edba04fe | |||
| 22ba54b00d | |||
| 6fd7ca39e2 | |||
| b8cd00b412 | |||
| f4bd43e898 | |||
| 7d7664444a | |||
| 1a8bbd6004 | |||
| e725c880a9 | |||
| f5abcd1c4c | |||
| 1986aa6581 | |||
| b52e1b2b02 | |||
| 54719fbfc6 | |||
| 06add0e5fc | |||
| 63d682314b | |||
| 1a6060ac5b | |||
| a302f8f1be | |||
| 04e1a4f5c8 | |||
| 1538909ac0 | |||
| a15f165a1d | |||
| 77435dd0d9 | |||
| 6f57907416 | |||
| 7c1cfd2849 | |||
| 259b10b83a | |||
| 02355546ff | |||
| 6ad3430ac4 | |||
| 29e7674e56 | |||
| b09632d1c3 | |||
| e2df7d4d01 | |||
| 9a984a8148 | |||
| fb9c8950ed | |||
| a849a81ac3 | |||
| f919bb0748 | |||
| 3b85a8071f | |||
| 9a8cac060d | |||
| 0353338436 | |||
| defb8348a7 | |||
| 1b86665d81 | |||
| 2f52fa723c | |||
| 6e0f0b8896 | |||
| 2c5b2c649e | |||
| a6bc4cab9d | |||
| ef37daf44a | |||
| 39d288f99f | |||
| 9ead3f15c3 | |||
| 272104af95 | |||
| 51e95d72e3 | |||
| 12486f6cee | |||
| 891375baca | |||
| 41a295202e | |||
| 722c5b7d61 | |||
| 52216b56a1 | |||
| cd614831de | |||
| 1d0a836a2e | |||
| 46b7064834 | |||
| bb8df01e25 | |||
| 16700b0e30 | |||
| 4e04a11995 | |||
| 76e5480be9 | |||
| 464e6b8010 | |||
| 3272c1bbc6 | |||
| 307ffea951 | |||
| bb94f286f5 | |||
| 86e3556438 | |||
| 12214bee72 | |||
| 08a35231ef | |||
| 9649dc78a1 | |||
| 9970b4e37b | |||
| a5a615d5c7 | |||
| ce97fdd1c6 | |||
| 1a8ae513b4 | |||
| d15ac93a8f | |||
| 4e0f94bcce | |||
| 1c1645096f | |||
| e0ac5509b4 | |||
| 190c37a68b | |||
| a67bef2dee | |||
| 893bbf9251 | |||
| 5441093211 | |||
| ee7455daa8 | |||
| 579af3c442 | |||
| 25bdcfcbc4 | |||
| 26919f41d2 | |||
| 5f735b2570 | |||
| 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 | |||
| 4ea2bc5e46 | |||
| eabc8b641e | |||
| 2f1ed186d1 | |||
| 4cc68397dc | |||
| 2b7872139c | |||
| e47ad6ed3f | |||
| f3b14694c6 | |||
| e9424b529c | |||
| a60c796cf6 | |||
| fcf16ab20a | |||
| 8e3be20387 | |||
| 689dd44d3b | |||
| a25d0aa60e | |||
| c50d1dc2b5 | |||
| 274bb19d03 | |||
| 2c5b84bd1d | |||
| 5c50bcb9c7 | |||
| cef56abea4 | |||
| 30b9f12711 | |||
| c9e0245f23 | |||
| 5337326cc9 | |||
| 73d8c85879 | |||
| 6237245ab7 | |||
| 7ae20c2a6d | |||
| ae1829e5a8 | |||
| 026661c9a2 | |||
| ec7223ace2 | |||
| 1f31621bbf | |||
| dfd41b9b94 | |||
| fdd4aade3b | |||
| 0a53f4c26e | |||
| d6a826a09c | |||
| 484160eb4e | |||
| 7ac1fe5847 | |||
| 72acef4e15 | |||
| a6a0f6c447 | |||
| 398d674cf4 | |||
| 1467de1c7e | |||
| c5023fdfa0 | |||
| 97782248af | |||
| 016761776b | |||
| c2450eabab | |||
| 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 | |||
| 6e6e053384 | |||
| 5edf19d230 | |||
| 4573e1925d | |||
| a40f8e0b9d | |||
| 9db49ec790 | |||
| e8cd2909a5 | |||
| e7a57aa754 | |||
| 1c30f69bd0 | |||
| eb2aaf22ed | |||
| 36c43683e5 | |||
| 0b63a4244d | |||
| 4a62259695 | |||
| 87e3d5a045 | |||
| 2b8384bb39 | |||
| 6d981960da | |||
| aca9d30064 | |||
| b84b1d8166 | |||
| 6acbd326f3 | |||
| cb533b63ac | |||
| 6538641e87 | |||
| eb0e5c89b2 | |||
| 8e2fa4acdb | |||
| 84c2f8d3fc | |||
| 8d99b3e2d7 | |||
| b3ec2a5463 | |||
| 4c67f4393f | |||
| 4e9a2df827 | |||
| 2d2d1972e9 | |||
| cc9e2c1260 | |||
| 2b21264fb0 |
@@ -4,7 +4,7 @@ about: Report a non-security issue with Anope.
|
||||
---
|
||||
|
||||
<!--
|
||||
Please fill in the template below. It will help us process your bug report a lot faster.
|
||||
Please fill in the template below. It will help us process your bug report a lot faster. If you have multiple bugs to report then please open one issue for each bug.
|
||||
-->
|
||||
|
||||
**Description**
|
||||
|
||||
@@ -4,7 +4,7 @@ about: Request that a new feature is added to Anope.
|
||||
---
|
||||
|
||||
<!--
|
||||
Please fill in the template below. It will help us process your feature request a lot faster.
|
||||
Please fill in the template below. It will help us process your feature request a lot faster. If you have multiple features to request then please open one issue for each feature.
|
||||
-->
|
||||
|
||||
**Description**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Currently the 2.0 (stable) branch is actively receiving security fixes.
|
||||
|
||||
The 2.1 (development) branch is still early in development and currently only receives security fixes when they are synced from the 2.0 branch.
|
||||
|
||||
Version | Supported
|
||||
------- | ---------
|
||||
2.1.x | :warning:
|
||||
2.0.x | :white_check_mark:
|
||||
1.8.x | :x:
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please do not report security vulnerabilities on GitHub. Instead, email the details to team@anope.org or get the attention of a developer in our development IRC channel at irc.anope.org #anope-devel and PM them the details.
|
||||
|
||||
We will triage your issue as soon as possible and try to release a fixed version within a week of receiving your report.
|
||||
@@ -4,3 +4,4 @@ updates:
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
target-branch: "2.1"
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
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 \
|
||||
argon2-dev \
|
||||
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 enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre 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++
|
||||
@@ -1,44 +1,51 @@
|
||||
name: Linux CI
|
||||
name: Ubuntu CI
|
||||
on:
|
||||
- pull_request
|
||||
- push
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip ubuntu ci]')"
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
CXXFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update --assume-yes
|
||||
sudo apt-get install --assume-yes --no-install-recommends \
|
||||
clang \
|
||||
g++ \
|
||||
gettext \
|
||||
git \
|
||||
libargon2-dev \
|
||||
libgnutls28-dev \
|
||||
libldap2-dev \
|
||||
libmysqlclient-dev \
|
||||
libpcre2-dev \
|
||||
libpcre3-dev \
|
||||
libsqlite3-dev \
|
||||
libssl-dev \
|
||||
libtre-dev \
|
||||
ninja-build
|
||||
|
||||
- name: Enable extras
|
||||
run: |
|
||||
for MODULE in m_ldap.cpp m_ldap_authentication.cpp m_ldap_oper.cpp m_mysql.cpp m_regex_pcre.cpp m_regex_pcre2.cpp m_regex_posix.cpp m_regex_tre.cpp m_sql_authentication.cpp m_sql_log.cpp m_sql_oper.cpp m_sqlite.cpp m_ssl_gnutls.cpp m_ssl_openssl.cpp stats
|
||||
for MODULE in enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre 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
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=${{ github.workspace }}/run ..
|
||||
|
||||
- name: Build Anope
|
||||
run: |
|
||||
ninja -C ${{ github.workspace }}/build install
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
||||
@@ -6,9 +6,10 @@ on:
|
||||
- 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
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.3
|
||||
|
||||
+11
-14
@@ -1,19 +1,16 @@
|
||||
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/enc_argon2.cpp
|
||||
modules/enc_posix.cpp
|
||||
modules/ldap.cpp
|
||||
modules/mysql.cpp
|
||||
modules/regex_pcre2.cpp
|
||||
modules/regex_posix.cpp
|
||||
modules/regex_tre.cpp
|
||||
modules/sqlite.cpp
|
||||
modules/ssl_gnutls.cpp
|
||||
modules/ssl_openssl.cpp
|
||||
modules/stats
|
||||
run/
|
||||
*.mo
|
||||
|
||||
+16
-27
@@ -22,6 +22,9 @@ 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$")
|
||||
# First look for the compiler's default library directories
|
||||
@@ -167,12 +170,12 @@ 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")
|
||||
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()
|
||||
# Set the compile flags to have all warnings on (including shadowed variables)
|
||||
set(CXXFLAGS "${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wpedantic -Wno-unused-parameter ${CMAKE_CXX_FLAGS}")
|
||||
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
|
||||
@@ -180,6 +183,12 @@ if(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}")
|
||||
@@ -197,29 +206,6 @@ if(NOT MSVC)
|
||||
if(HAVE_PIPE_FLAG)
|
||||
set(CXXFLAGS "${CXXFLAGS} -pipe")
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
list(APPEND LINK_LIBS socket)
|
||||
endif()
|
||||
# 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)
|
||||
list(APPEND LINK_LIBS nsl)
|
||||
endif()
|
||||
# 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()
|
||||
else()
|
||||
message(FATAL_ERROR "The pthread library is required to build Anope")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
|
||||
@@ -238,6 +224,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINF
|
||||
endif()
|
||||
|
||||
# Check for the existence of the following functions
|
||||
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
check_function_exists(umask HAVE_UMASK)
|
||||
check_function_exists(epoll_wait HAVE_EPOLL)
|
||||
check_function_exists(poll HAVE_POLL)
|
||||
@@ -253,8 +240,10 @@ if(LDFLAGS)
|
||||
endif()
|
||||
|
||||
# Search for the following programs
|
||||
find_program(CHGRP "chgrp" REQUIRED)
|
||||
find_program(CHMOD "chmod" REQUIRED)
|
||||
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 anope directory under the user's home directory
|
||||
if(INSTDIR)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Configuration script for Anope.
|
||||
#
|
||||
# Anope (C) 2003-2023 Anope Team
|
||||
# Anope (C) 2003-2024 Anope Team
|
||||
# Contact us at team@anope.org
|
||||
#
|
||||
# This program is free but copyrighted software; see the file COPYING for
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ endmacro()
|
||||
# of TRUE is given, periods will be converted to \\. for CPack.
|
||||
###############################################################################
|
||||
macro(add_to_cpack_ignored_files ITEM)
|
||||
# Temporary copy of the orignal item
|
||||
# Temporary copy of the original item
|
||||
set(REAL_ITEM "${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)
|
||||
|
||||
+162
-81
@@ -238,15 +238,15 @@ serverinfo
|
||||
|
||||
/*
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
* data directory.
|
||||
*/
|
||||
pid = "data/anope.pid"
|
||||
pid = "anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
* config directory.
|
||||
*/
|
||||
motd = "conf/motd.txt"
|
||||
motd = "motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -302,30 +302,31 @@ networkinfo
|
||||
/*
|
||||
* Set this to the maximum allowed nick length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Anope 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
|
||||
* Anope 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
|
||||
* Anope 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
|
||||
@@ -394,19 +395,6 @@ options
|
||||
*/
|
||||
casemap = "ascii"
|
||||
|
||||
/*
|
||||
* This key is used to initiate the random number generator. This number
|
||||
* MUST be random as you want your passcodes to be random. Don't give this
|
||||
* key to anyone! Keep it private!
|
||||
*
|
||||
* NOTE: If you don't uncomment this or keep the default values, any talented
|
||||
* programmer would be able to easily "guess" random strings used to mask
|
||||
* information. Be safe, and come up with a 7-digit number.
|
||||
*
|
||||
* This directive is optional, but highly recommended.
|
||||
*/
|
||||
#seed = 9866235
|
||||
|
||||
/*
|
||||
* 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
|
||||
@@ -522,12 +510,18 @@ options
|
||||
*/
|
||||
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,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
|
||||
@@ -766,9 +759,9 @@ 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
|
||||
@@ -789,14 +782,14 @@ log
|
||||
*
|
||||
* 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/neverop
|
||||
* 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
|
||||
*
|
||||
* global/global
|
||||
* global/global global/queue global/server
|
||||
*
|
||||
* operserv/news operserv/stats operserv/kick operserv/exception operserv/seen
|
||||
* operserv/mode operserv/session operserv/modinfo operserv/ignore operserv/chanlist
|
||||
@@ -925,7 +918,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 email from services.
|
||||
* If the usemail directive is set to yes, unless specified otherwise, all other
|
||||
* directives are required.
|
||||
*
|
||||
@@ -945,7 +938,7 @@ mail
|
||||
|
||||
/*
|
||||
* This is the command-line that will be used to call the mailer to send an
|
||||
* e-mail. It must be called with all the parameters needed to make it
|
||||
* email. It must be called with all the parameters needed to make it
|
||||
* scan the mail input to find the mail recipient; consult your mailer
|
||||
* documentation.
|
||||
*
|
||||
@@ -957,18 +950,18 @@ mail
|
||||
* 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"
|
||||
#sendmailpath = "/usr/sbin/sendmail -it"
|
||||
|
||||
/*
|
||||
* This is the e-mail address from which all the e-mails are to be sent from.
|
||||
* This is the email address from which all the emails are to be sent from.
|
||||
* It should really exist.
|
||||
*/
|
||||
sendfrom = "services@example.com"
|
||||
|
||||
/*
|
||||
* This controls the minimum amount of time a user must wait before sending
|
||||
* 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.
|
||||
* another email after they have sent one. It also controls the minimum time
|
||||
* a user must wait before they can receive another email.
|
||||
*
|
||||
* This feature prevents users from being mail bombed using services and
|
||||
* it is highly recommended that it be used.
|
||||
@@ -979,10 +972,10 @@ mail
|
||||
|
||||
/*
|
||||
* If set, Anope will not put quotes around the TO: fields
|
||||
* in e-mails.
|
||||
* in emails.
|
||||
*
|
||||
* This directive is optional, and as far as we know, it's only needed
|
||||
* if you are using ESMTP or QMail to send out e-mails.
|
||||
* if you are using ESMTP or QMail to send out emails.
|
||||
*/
|
||||
#dontquoteaddresses = yes
|
||||
|
||||
@@ -1099,6 +1092,22 @@ mail
|
||||
#hash = "md5"
|
||||
}
|
||||
|
||||
/*
|
||||
* db_atheme
|
||||
*
|
||||
* This allows importing databases from Atheme. You should load another database module as
|
||||
* well as this as it can only read Atheme databases not write them.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "db_atheme"
|
||||
|
||||
/*
|
||||
* The database name db_atheme should use.
|
||||
*/
|
||||
database = "atheme.db"
|
||||
}
|
||||
|
||||
/*
|
||||
* [RECOMMENDED] db_flatfile
|
||||
*
|
||||
@@ -1199,7 +1208,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
|
||||
@@ -1211,7 +1220,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"
|
||||
}
|
||||
@@ -1219,49 +1228,121 @@ module
|
||||
/*
|
||||
* [RECOMMENDED] Encryption modules.
|
||||
*
|
||||
* The encryption modules are used when dealing with passwords. This determines how
|
||||
* the passwords are stored in the databases, and does not add any security as
|
||||
* far as transmitting passwords over the network goes.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The other encryption modules use one-way encryption, so the passwords can not
|
||||
* be recovered later if those are used.
|
||||
*
|
||||
* The first encryption module loaded is the primary encryption module. All new passwords are
|
||||
* encrypted by this module. Old passwords stored in another encryption method are
|
||||
* automatically re-encrypted by the primary encryption module on next identify.
|
||||
*
|
||||
* enc_md5, enc_sha1, and enc_old are deprecated, and are provided for users
|
||||
* to upgrade to a newer encryption module. Do not use them as the primary
|
||||
* encryption module. They will be removed in a future release.
|
||||
* The encryption modules are used when dealing with passwords. This determines
|
||||
* how the passwords are stored in the databases.
|
||||
*
|
||||
* The first encryption module loaded is the primary encryption module. All new
|
||||
* passwords are encrypted by this module. Old passwords encrypted with another
|
||||
* encryption method are automatically re-encrypted with the primary encryption
|
||||
* module the next time the user identifies.
|
||||
*/
|
||||
|
||||
#module { name = "enc_bcrypt" }
|
||||
module { name = "enc_sha256" }
|
||||
|
||||
/*
|
||||
* [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" }
|
||||
|
||||
/*
|
||||
* enc_old is Anope's previous (broken) MD5 implementation used from 1.4.x to 1.7.16.
|
||||
* If your databases were made using that module, load it here to allow conversion to the primary
|
||||
* encryption method.
|
||||
* enc_sha2
|
||||
*
|
||||
* Provides support for encrypting passwords using the HMAC-SHA-2 algorithm. See
|
||||
* https://en.wikipedia.org/wiki/SHA-2 and https://en.wikipedia.org/wiki/HMAC
|
||||
* for more information.
|
||||
*/
|
||||
#module { name = "enc_old" }
|
||||
module
|
||||
{
|
||||
name = "enc_sha2"
|
||||
|
||||
/** The sub-algorithm to use. Can be set to sha224 for SHA-224, sha256 for
|
||||
* SHA-256, sha284 for SHA-384 or sha512 to SHA-512. Defaults to sha256.
|
||||
*/
|
||||
#algorithm = "sha256"
|
||||
}
|
||||
|
||||
/*
|
||||
* [EXTRA] enc_argon2
|
||||
*
|
||||
* Provides support for encrypting passwords using the Argon2 algorithm. See
|
||||
* https://en.wikipedia.org/wiki/Argon2 for more information.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "enc_argon2"
|
||||
|
||||
/** The sub-algorithm to use. Can be set to argon2d for Argon2d, argon2i for
|
||||
* Argon2i, or argon2id for Argon2id. Defaults to argon2id.
|
||||
*/
|
||||
#algorithm = "argon2id"
|
||||
|
||||
/** The memory hardness in kibibytes of the Argon2 algorithm. Defaults to
|
||||
* 128 mebibytes.
|
||||
*/
|
||||
#memory_cost = 121072
|
||||
|
||||
/** The time hardness (iterations) of the Argon2 algorithm. Defaults to 3.
|
||||
*/
|
||||
#time_cost = 3
|
||||
|
||||
/** The amount of parallel threads to use when encrypting passwords.
|
||||
* Defaults to 1.
|
||||
*/
|
||||
#parallelism = 1
|
||||
|
||||
/** The length in bytes of an Argon2 hash. Defaults to 32. */
|
||||
#hash_length = 32
|
||||
|
||||
/** The length in bytes of an Argon2 salt. Defaults to 32. */
|
||||
#salt_length = 32
|
||||
}
|
||||
|
||||
/*
|
||||
* enc_bcrypt
|
||||
*
|
||||
* Provides support for encrypting passwords using the Bcrypt algorithm. See
|
||||
* https://en.wikipedia.org/wiki/Bcrypt for more information.
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "enc_bcrypt"
|
||||
|
||||
/** The number of Bcrypt rounds to perform on passwords. Can be set to any
|
||||
* number between 10 and 32 but higher numbers are more CPU intensive and
|
||||
* may impact performance.
|
||||
*/
|
||||
#rounds = 10
|
||||
}
|
||||
|
||||
/*
|
||||
* [EXTRA] enc_posix
|
||||
*
|
||||
* Provides verify-only support for passwords encrypted using the POSIX crypt()
|
||||
* function. Load this if you are migratign from another services packages such
|
||||
* as Atheme. See https://en.wikipedia.org/wiki/Crypt_(C) for more information.
|
||||
*
|
||||
* You must load another encryption method before this to re-encrypt passwords
|
||||
* with when a user logs in.
|
||||
*/
|
||||
#module { name = "enc_posix" }
|
||||
|
||||
/*
|
||||
* [DEPRECATED] enc_md5, enc_none, enc_old, enc_sha1, enc_sha256
|
||||
*
|
||||
* Provides verify-only support for passwords encrypted using encryption methods
|
||||
* from older versions of Anope. These methods are no longer considered secure
|
||||
* and will be removed in a future version of Anope. Only load them if you are
|
||||
* upgrading from a previous version of Anope that used them.
|
||||
*
|
||||
* enc_md5: Verifies passwords encrypted with the MD5 algorithm
|
||||
* enc_none: Verifies passwords that are not encrypted
|
||||
* enc_sha1: Verifies passwords encrypted with the SHA1 algorithm
|
||||
* enc_old: Verifies passwords encrypted with the broken MD5 algorithm used
|
||||
* before 1.7.17.
|
||||
* enc_sha256: Verifies passwords encrypted with the SHA256 algorithm using a
|
||||
* custom initialisation vector as a salt.
|
||||
*
|
||||
* You must load another encryption method before this to re-encrypt passwords
|
||||
* with when a user logs in.
|
||||
*/
|
||||
#module { name = "enc_md5" }
|
||||
#module { name = "enc_none" }
|
||||
#module { name = "enc_old" }
|
||||
#module { name = "enc_sha1" }
|
||||
#module { name = "enc_sha256" }
|
||||
|
||||
/* Extra (optional) modules. */
|
||||
include
|
||||
|
||||
@@ -183,7 +183,7 @@ module
|
||||
/*
|
||||
* The maximum number of entries a single bad words list can have.
|
||||
*/
|
||||
badwordsmax = 32
|
||||
badwordsmax = 50
|
||||
|
||||
/*
|
||||
* If set, BotServ will use case sensitive checking for badwords.
|
||||
@@ -249,7 +249,7 @@ command { service = "BotServ"; name = "INFO"; command = "botserv/info"; }
|
||||
* botserv/kick/italics - Configures BotServ's italics kicker.
|
||||
* botserv/kick/repeat - Configures BotServ's repeat kicker.
|
||||
* botserv/kick/reverses - Configures BotServ's reverse kicker.
|
||||
* botserv/kick/underlines - Configures BotServ's reverse kicker.
|
||||
* botserv/kick/underlines - Configures BotServ's underline kicker.
|
||||
* botserv/set/dontkickops - Used for preventing BotServ from kicking channel operators.
|
||||
* botserv/set/dontkickvoices - Used for preventing BotServ from kicking voices.
|
||||
*
|
||||
@@ -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"
|
||||
|
||||
+62
-11
@@ -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, cs_secure, securefounder,
|
||||
* and signkick. If you really want no defaults, use "none" by itself as the option.
|
||||
* 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.
|
||||
@@ -116,15 +114,15 @@ module
|
||||
|
||||
/*
|
||||
* The maximum number of entries on a channel's access list.
|
||||
* If not set, the default is 1024. This can be set to 0 for unlimited.
|
||||
* If not set, the default is 1000. This can be set to 0 for unlimited.
|
||||
*/
|
||||
accessmax = 1024
|
||||
accessmax = 1000
|
||||
|
||||
/*
|
||||
* The length of time ChanServ stays in a channel after kicking a user from a channel they are not
|
||||
* permitted to be in. This only occurs when the user is the only one in the channel.
|
||||
*/
|
||||
inhabit = 15s
|
||||
inhabit = 1m
|
||||
|
||||
/*
|
||||
* Allow only IRC Operators to use ChanServ.
|
||||
@@ -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"
|
||||
@@ -863,7 +913,7 @@ module
|
||||
/*
|
||||
* The maximum number of entries on a channel's autokick list.
|
||||
*/
|
||||
autokickmax = 32
|
||||
autokickmax = 50
|
||||
|
||||
/*
|
||||
* The default reason for an autokick if none is given.
|
||||
@@ -1076,7 +1126,7 @@ module
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
max = 32
|
||||
max = 50
|
||||
}
|
||||
command { service = "ChanServ"; name = "MODE"; command = "chanserv/mode"; group = "chanserv/management"; }
|
||||
|
||||
@@ -1197,7 +1247,7 @@ command { service = "ChanServ"; name = "SET NOEXPIRE"; command = "chanserv/saset
|
||||
*/
|
||||
module { name = "cs_set_misc" }
|
||||
command { service = "ChanServ"; name = "SET URL"; command = "chanserv/set/misc"; misc_description = _("Associate a URL with the channel"); }
|
||||
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; misc_description = _("Associate an E-mail address with the channel"); }
|
||||
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; misc_description = _("Associate an email address with the channel"); }
|
||||
|
||||
/*
|
||||
* cs_status
|
||||
@@ -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.
|
||||
|
||||
@@ -113,3 +113,29 @@ command { service = "Global"; name = "HELP"; command = "generic/help"; }
|
||||
*/
|
||||
module { name = "gl_global" }
|
||||
command { service = "Global"; name = "GLOBAL"; command = "global/global"; permission = "global/global"; }
|
||||
|
||||
/*
|
||||
* gl_queue
|
||||
*
|
||||
* Provides the command global/queue.
|
||||
*
|
||||
* Used for queuing messages to send to every online user.
|
||||
*/
|
||||
module
|
||||
{
|
||||
name = "gl_queue"
|
||||
|
||||
/* The maximum number of messages in a message queue. Defaults to 10. */
|
||||
maxqueue = 10
|
||||
}
|
||||
command { service = "Global"; name = "QUEUE"; command = "global/queue"; permission = "global/queue"; }
|
||||
|
||||
/*
|
||||
* gl_server
|
||||
*
|
||||
* Provides the command global/server.
|
||||
*
|
||||
* Used for sending a message to every online user on a server.
|
||||
*/
|
||||
module { name = "gl_server" }
|
||||
command { service = "Global"; name = "SERVER"; command = "global/server"; permission = "global/server"; }
|
||||
|
||||
@@ -83,7 +83,7 @@ module
|
||||
*
|
||||
* This directive is optional, but recommended.
|
||||
*/
|
||||
senddelay = 3s
|
||||
senddelay = 30s
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -146,7 +146,7 @@ module
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
max = 32
|
||||
max = 50
|
||||
}
|
||||
command { service = "MemoServ"; name = "IGNORE"; command = "memoserv/ignore"; }
|
||||
|
||||
|
||||
+108
-87
@@ -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.
|
||||
@@ -59,7 +59,7 @@ module { name = "help" }
|
||||
* SOA record information.
|
||||
*/
|
||||
|
||||
/* E-mail address of the DNS administrator. */
|
||||
/* Email address of the DNS administrator. */
|
||||
admin = "admin@example.com"
|
||||
|
||||
/* This should be the names of the public facing nameservers serving the records. */
|
||||
@@ -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,7 +88,7 @@ module { name = "help" }
|
||||
*/
|
||||
#module
|
||||
{
|
||||
name = "m_dnsbl"
|
||||
name = "dnsbl"
|
||||
|
||||
/*
|
||||
* If set, Anope will check clients against the DNSBLs when services connect to its uplink.
|
||||
@@ -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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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 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,46 +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.
|
||||
#module { name = "m_regex_pcre2" }
|
||||
* Expressions library.
|
||||
*/
|
||||
#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. */
|
||||
@@ -461,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.
|
||||
@@ -475,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
|
||||
@@ -543,38 +558,39 @@ 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, 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. All
|
||||
* paths are relative to the config directory.
|
||||
*
|
||||
* 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 = "fullchain.pem"
|
||||
key = "privkey.pem"
|
||||
|
||||
/*
|
||||
* Diffie-Hellman parameters to use when acting as a server. This is only
|
||||
@@ -587,53 +603,55 @@ module { name = "m_sasl" }
|
||||
* certtool --generate-dh-params --bits 2048 --outfile dhparams.pem
|
||||
*
|
||||
*/
|
||||
# dhparams = "data/dhparams.pem"
|
||||
#dhparams = "dhparams.pem"
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* All paths are relative to the config directory.
|
||||
*
|
||||
* 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 = "fullchain.pem"
|
||||
key = "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
|
||||
*
|
||||
* 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,
|
||||
@@ -675,7 +693,7 @@ module { name = "m_sasl" }
|
||||
}
|
||||
|
||||
/*
|
||||
* m_sql_log [EXTRA]
|
||||
* sql_log
|
||||
*
|
||||
* This module adds an additional target option to log{} blocks
|
||||
* that allows logging Service's logs to SQL. To log to SQL, add
|
||||
@@ -692,19 +710,19 @@ 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
|
||||
*
|
||||
* 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.
|
||||
@@ -721,13 +739,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
|
||||
@@ -747,7 +765,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
|
||||
{
|
||||
@@ -756,31 +774,34 @@ module { name = "m_sasl" }
|
||||
/* Web server to use. */
|
||||
server = "httpd/main";
|
||||
|
||||
/* Template to use. */
|
||||
template = "default";
|
||||
/*
|
||||
* The directory containing the webcpanel templates. This is relative to the
|
||||
* data directory.
|
||||
*/
|
||||
template_dir = "webcpanel/templates/default";
|
||||
|
||||
/* Page title. */
|
||||
title = "Anope IRC Services";
|
||||
}
|
||||
|
||||
/*
|
||||
* 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" }
|
||||
|
||||
+15
-59
@@ -66,9 +66,9 @@ module
|
||||
client = "NickServ"
|
||||
|
||||
/*
|
||||
* Force users to give an e-mail address when they register a nick.
|
||||
* Requires users to give an email address when they register a nick.
|
||||
*
|
||||
* This directive defaults to "yes" and is recommended to be enabled. This is required if e-mail registration is enabled.
|
||||
* This directive defaults to "yes" and is recommended to be enabled.
|
||||
*/
|
||||
forceemail = yes
|
||||
|
||||
@@ -96,10 +96,8 @@ 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_email: Hide the nick's email address from NickServ's INFO command
|
||||
* - hide_mask: Hide the nick's last or current user@host from NickServ's INFO command
|
||||
* - hide_status: Hide the nick's services operator access status from NickServ's INFO command
|
||||
* - hide_quit: Hide the nick's last quit message from NickServ's INFO command
|
||||
@@ -111,18 +109,17 @@ module
|
||||
* - 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
|
||||
* - ns_no_expire: Enables no expire. Unconfirmed expire overrules this.
|
||||
*
|
||||
* 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
|
||||
* directive is optional, but recommended. If not set, this restriction will be disabled.
|
||||
*/
|
||||
regdelay = 30s
|
||||
regdelay = 5m
|
||||
|
||||
/*
|
||||
* The length of time before a nick's registration expires.
|
||||
@@ -212,16 +209,16 @@ module
|
||||
/*
|
||||
* The minimum length of passwords
|
||||
*
|
||||
* This directive is optional. If not set it defaults to 8.
|
||||
* This directive is optional. If not set it defaults to 10.
|
||||
*/
|
||||
minpasslen = 8
|
||||
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.
|
||||
*/
|
||||
maxpasslen = 32
|
||||
maxpasslen = 50
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -249,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, Anope 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
|
||||
*
|
||||
@@ -303,6 +273,7 @@ command { service = "NickServ"; name = "AJOIN"; command = "nickserv/ajoin"; }
|
||||
*/
|
||||
module { name = "ns_alist" }
|
||||
command { service = "NickServ"; name = "ALIST"; command = "nickserv/alist"; }
|
||||
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/alist"; hide = true; }
|
||||
|
||||
/*
|
||||
* ns_cert
|
||||
@@ -359,7 +330,7 @@ module
|
||||
*
|
||||
* This directive is optional, but recommended. If not set or set to 0, no limits will be applied.
|
||||
*/
|
||||
maxaliases = 16
|
||||
maxaliases = 10
|
||||
|
||||
/*
|
||||
* If set, the NickServ GROUP command won't allow any group changes. This is recommended to
|
||||
@@ -497,7 +468,7 @@ module
|
||||
*
|
||||
* This directive is optional.
|
||||
*/
|
||||
#nickregdelay = 30s
|
||||
nickregdelay = 15s
|
||||
|
||||
/*
|
||||
* The length of time a user using an unconfirmed account has
|
||||
@@ -531,10 +502,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
|
||||
{
|
||||
@@ -575,9 +545,6 @@ 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"; }
|
||||
|
||||
@@ -602,17 +569,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
|
||||
*
|
||||
@@ -667,7 +623,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
|
||||
name = "ns_maxemail"
|
||||
|
||||
/*
|
||||
* The limit to how many registered nicks can use the same e-mail address. If set to 0 or left
|
||||
* The limit to how many registered nicks can use the same email address. If set to 0 or left
|
||||
* commented, there will be no limit enforced when registering new accounts or using
|
||||
* /msg NickServ SET EMAIL.
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -235,15 +235,15 @@ serverinfo
|
||||
|
||||
/*
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
* data directory.
|
||||
*/
|
||||
pid = "data/anope.pid"
|
||||
pid = "anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
* config directory.
|
||||
*/
|
||||
motd = "conf/motd.txt"
|
||||
motd = "motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -283,25 +283,26 @@ networkinfo
|
||||
/*
|
||||
* Set this to the maximum allowed nick length on your network.
|
||||
* Be sure to set this correctly, as setting this wrong can result in
|
||||
* Anope 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
|
||||
* Anope 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
|
||||
* Anope 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.
|
||||
@@ -483,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
|
||||
+1
-1
@@ -7,7 +7,7 @@ if(WIN32)
|
||||
# Add README.txt to list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("README.txt$" TRUE)
|
||||
endif()
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
|
||||
install(FILES ${DOCS}
|
||||
DESTINATION ${DOC_DIR}
|
||||
)
|
||||
|
||||
-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.
|
||||
@@ -1,3 +1,75 @@
|
||||
Anope Version 2.1.4
|
||||
-------------------
|
||||
Added a check for a non-deprecated encryption module on start.
|
||||
Added a way for protocol modules to report an error to the uplink.
|
||||
Added more account settings to the webcpanel.
|
||||
Added self-test functionality for all encryption modules.
|
||||
Added support for challenge authentication on InspIRCd.
|
||||
Added support for importing databases from Atheme.
|
||||
Added support for sending client tags on UnrealIRCd.
|
||||
Added support for the InspIRCd 1206 (v4) protocol.
|
||||
Added the --nopid option to disable writing a pid file.
|
||||
Added the enc_argon2 module to encrypt passwords with Argon2.
|
||||
Added the enc_sha2 module to encrypt passwords with HMAC-SHA-2.
|
||||
Added the global/queue command for queueing multi-line messages.
|
||||
Added the global/server command for sending messages to an individual server.
|
||||
Added the PASSWORD category to operserv/stats to view password encryption methods.
|
||||
Added the verify-only enc_posix module to validate passwords from Atheme that were encrypted with Argon2.
|
||||
Changed nickserv/drop to use confirmation codes to confirm a nickname drop.
|
||||
Changed various paths to be relative to the data and config directories.
|
||||
Converted some IRCDProto member functions to variables.
|
||||
Converted the enc_md5, enc_none, enc_old, enc_sha1, and enc_sha256 modules to be verify-only.
|
||||
Deduplicated page headers and footers in the webcpanel templates.
|
||||
Deprecated the enc_sha256 module.
|
||||
Fixed inconsistent spelling/casing of email, vhost, and vident.
|
||||
Fixed various bugs in the inspircd module.
|
||||
Improved portability of email sending.
|
||||
Improved protocol debug messages.
|
||||
Improved the performance and reliability of internal conversion logic.
|
||||
Improved the randomness of randomly generated numbers.
|
||||
Refactored the enc_bcrypt module and exposed it as an encryption context.
|
||||
Removed several duplicate translation strings.
|
||||
Replaced the custom MD5 implementation in enc_md5 with a vendored one.
|
||||
Replaced the custom SHA256 implementation in enc_sha256 with a vendored one.
|
||||
The ldap_authentication, ldap_oper, sql_authentication, sql_log, and sql_oper modules are now always enabled.
|
||||
|
||||
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.1.2
|
||||
-------------------
|
||||
Bumped the minimum OpenSSL version to 1.1.0.
|
||||
Bumped the minimum 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.
|
||||
|
||||
Anope Version 2.1.1
|
||||
-------------------
|
||||
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.1.0
|
||||
-------------------
|
||||
Added support for access list entry descriptions.
|
||||
|
||||
+56
-2
@@ -1,11 +1,65 @@
|
||||
Anope Version 2.1.4
|
||||
-------------------
|
||||
Added the db_atheme module.
|
||||
Added the enc_argon2 module.
|
||||
Added the enc_posix module.
|
||||
Added the enc_sha2 module.
|
||||
Added the gl_queue module.
|
||||
Added the gl_server module.
|
||||
Added the global/queue operator privilege.
|
||||
Added the global/server operator privilege.
|
||||
Changed serverinfo:motd to be relative to the config directory.
|
||||
Changed serverinfo:pid to be relative to the data directory.
|
||||
Changed the default value of mail:sendmailpath to "/usr/sbin/sendmail -it".
|
||||
Changed the default value of module:accessmax for the chanserv module to 1000.
|
||||
Changed the default value of module:inhabit for the chanserv module to 1 minute.
|
||||
Changed the default value of module:max for the cs_mode module to 50.
|
||||
Changed the default value of module:max for the ms_ignore module to 50.
|
||||
Removed options:seed.
|
||||
Replaced module:template for the webcpanel module with module:template_dir.
|
||||
|
||||
|
||||
Anope Version 2.1.3
|
||||
-------------------
|
||||
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.1.2
|
||||
-------------------
|
||||
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.1.1
|
||||
-------------------
|
||||
Added the m_regex_stdlib module.
|
||||
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
|
||||
|
||||
Anope Version 2.1.0
|
||||
-------------------
|
||||
Added nickserv:minpasslen for configuring the minimum password length.
|
||||
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)
|
||||
Removed the unreal module (use unrealircd instead).
|
||||
Renamed nickserv:passlen to nickserv:maxpasslen.
|
||||
Renamed the charybdis module to solanum.
|
||||
Renamed the inspircd3 module to inspircd.
|
||||
|
||||
+1
-1
@@ -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:
|
||||
|
||||
|
||||
-31
@@ -1,31 +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) override { }
|
||||
void OnPartChannel(User *u, Channel *c) 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).
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ Anope Multi Language Support
|
||||
po files (especially on Windows).
|
||||
|
||||
If you have finished a language file translation and you want others to use it, please send it to team@anope.org
|
||||
(don't forget to mention clearly your (nick)name, your e-mail and the language name). You'll of course get full credit for it.
|
||||
(don't forget to mention clearly your (nick)name, your email and the language name). You'll of course get full credit for it.
|
||||
|
||||
NOTE: There is no guarantee we will use your work so please do not be offended if we say no thanks.
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -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++
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
Anope -- a set of IRC services for IRC networks
|
||||
-----------------------------------------------
|
||||
|
||||
Anope is 2003-2023 Anope Team <team@anope.org>.
|
||||
Anope is 2003-2024 Anope Team <team@anope.org>.
|
||||
Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>.
|
||||
Based on Services 1996-1999 Andrew Church <achurch@achurch.org>.
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+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,7 +3,7 @@
|
||||
/**
|
||||
* XMLRPC Functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*/
|
||||
|
||||
|
||||
+16
-14
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -27,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;
|
||||
@@ -38,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);
|
||||
@@ -52,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();
|
||||
|
||||
@@ -63,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 */
|
||||
@@ -96,7 +98,7 @@ class CoreExport ChanAccess : public Serializable
|
||||
NickCore *GetAccount() const;
|
||||
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
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 */
|
||||
|
||||
+36
-81
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -17,8 +17,8 @@
|
||||
#include "memo.h"
|
||||
#include "base.h"
|
||||
|
||||
typedef Anope::hash_map<NickAlias *> nickalias_map;
|
||||
typedef Anope::hash_map<NickCore *> nickcore_map;
|
||||
typedef Anope::unordered_map<NickAlias *> nickalias_map;
|
||||
typedef Anope::unordered_map<NickCore *> nickcore_map;
|
||||
typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map;
|
||||
|
||||
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
|
||||
@@ -28,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;
|
||||
time_t vhost_created = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
Anope::string nick;
|
||||
Anope::string last_quit;
|
||||
Anope::string last_realname;
|
||||
@@ -41,8 +43,9 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
Anope::string last_usermask;
|
||||
/* Last uncloaked usermask, requires nickserv/auspex to see */
|
||||
Anope::string last_realhost;
|
||||
time_t time_registered;
|
||||
time_t last_seen;
|
||||
time_t time_registered = Anope::CurTime;
|
||||
time_t last_seen = Anope::CurTime;
|
||||
|
||||
/* Account this nick is tied to. Multiple nicks can be tied to a single account. */
|
||||
Serialize::Reference<NickCore> nc;
|
||||
|
||||
@@ -54,7 +57,7 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
~NickAlias();
|
||||
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
/** Set a vhost for the user
|
||||
* @param ident The ident
|
||||
@@ -62,36 +65,41 @@ class CoreExport NickAlias : public Serializable, public Extensible
|
||||
* @param creator Who created the vhost
|
||||
* @param time When the vhost was created
|
||||
*/
|
||||
void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
|
||||
void SetVHost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
|
||||
|
||||
/** Remove a users vhost
|
||||
**/
|
||||
void RemoveVhost();
|
||||
void RemoveVHost();
|
||||
|
||||
/** Check if the user has a vhost
|
||||
* @return true or false
|
||||
*/
|
||||
bool HasVhost() const;
|
||||
bool HasVHost() const;
|
||||
|
||||
/** Retrieve the vhost ident
|
||||
* @return the ident
|
||||
*/
|
||||
const Anope::string &GetVhostIdent() const;
|
||||
const Anope::string &GetVHostIdent() const;
|
||||
|
||||
/** Retrieve the vhost host
|
||||
* @return the host
|
||||
*/
|
||||
const Anope::string &GetVhostHost() const;
|
||||
const Anope::string &GetVHostHost() const;
|
||||
|
||||
/** Retrieve the vhost mask
|
||||
* @param the mask
|
||||
*/
|
||||
Anope::string GetVHostMask() const;
|
||||
|
||||
/** Retrieve the vhost creator
|
||||
* @return the creator
|
||||
*/
|
||||
const Anope::string &GetVhostCreator() const;
|
||||
const Anope::string &GetVHostCreator() const;
|
||||
|
||||
/** Retrieve when the vhost was created
|
||||
* @return the time it was created
|
||||
*/
|
||||
time_t GetVhostCreated() const;
|
||||
time_t GetVHostCreated() const;
|
||||
|
||||
/** Finds a registered nick
|
||||
* @param nick The nick to lookup
|
||||
@@ -104,13 +112,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 */
|
||||
@@ -118,9 +128,8 @@ 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;
|
||||
/* Last time an email was sent to this user */
|
||||
time_t lastmail = 0;
|
||||
MemoInfo memos;
|
||||
std::map<Anope::string, Anope::string> last_modes;
|
||||
|
||||
@@ -130,14 +139,12 @@ class CoreExport NickCore : public Serializable, public Extensible
|
||||
Serialize::Checker<std::vector<NickAlias *> > aliases;
|
||||
|
||||
/* Set if this user is a services operator. o->ot must exist. */
|
||||
Oper *o;
|
||||
Oper *o = nullptr;
|
||||
|
||||
/* Unsaved data */
|
||||
|
||||
/* Number of channels registered by this account */
|
||||
uint16_t channelcount;
|
||||
/* Last time an email was sent to this user */
|
||||
time_t lastmail;
|
||||
uint16_t channelcount = 0;
|
||||
/* Users online now logged into this account */
|
||||
std::list<User *> users;
|
||||
|
||||
@@ -149,7 +156,7 @@ class CoreExport NickCore : public Serializable, public Extensible
|
||||
~NickCore();
|
||||
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
/** Changes the display for this account
|
||||
* @param na The new display, must be grouped to this account.
|
||||
@@ -161,66 +168,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);
|
||||
@@ -244,11 +199,11 @@ class CoreExport IdentifyRequest
|
||||
|
||||
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;
|
||||
|
||||
+99
-97
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -22,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.
|
||||
*/
|
||||
@@ -39,6 +39,7 @@ namespace Anope
|
||||
typedef std::string::reverse_iterator reverse_iterator;
|
||||
typedef std::string::const_reverse_iterator const_reverse_iterator;
|
||||
typedef std::string::size_type size_type;
|
||||
typedef std::string::value_type value_type;
|
||||
static const size_type npos = static_cast<size_type>(-1);
|
||||
|
||||
/**
|
||||
@@ -140,8 +141,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.
|
||||
@@ -159,21 +160,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);
|
||||
@@ -210,6 +211,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.
|
||||
*/
|
||||
@@ -308,7 +313,7 @@ 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
|
||||
{
|
||||
@@ -316,7 +321,7 @@ namespace Anope
|
||||
}
|
||||
};
|
||||
|
||||
struct hash_cs
|
||||
struct hash_cs final
|
||||
{
|
||||
inline size_t operator()(const string &s) const
|
||||
{
|
||||
@@ -324,7 +329,7 @@ namespace Anope
|
||||
}
|
||||
};
|
||||
|
||||
struct compare
|
||||
struct compare final
|
||||
{
|
||||
inline bool operator()(const string &s1, const string &s2) const
|
||||
{
|
||||
@@ -332,9 +337,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 std::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 unordered_map = std::unordered_map<string, T, hash_ci, compare>;
|
||||
|
||||
#ifndef REPRODUCIBLE_BUILD
|
||||
static const char *const compiled = __TIME__ " " __DATE__;
|
||||
@@ -357,6 +367,7 @@ namespace Anope
|
||||
* Use this unless you need very specific time checks
|
||||
*/
|
||||
extern CoreExport time_t CurTime;
|
||||
extern CoreExport long long CurTimeNs;
|
||||
|
||||
/** The debug level we are running at.
|
||||
*/
|
||||
@@ -364,7 +375,7 @@ namespace Anope
|
||||
|
||||
/** Other command line options.
|
||||
*/
|
||||
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
|
||||
extern CoreExport bool ReadOnly, NoFork, NoThird, NoPID, NoExpire, ProtocolDebug;
|
||||
|
||||
/** The root of the Anope installation. Usually ~/anope
|
||||
*/
|
||||
@@ -416,7 +427,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
|
||||
*/
|
||||
@@ -460,7 +471,7 @@ namespace Anope
|
||||
* @param src The source string to encrypt
|
||||
* @param dest The destination where the encrypted string is placed
|
||||
*/
|
||||
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
|
||||
extern CoreExport bool Encrypt(const Anope::string &src, Anope::string &dest);
|
||||
|
||||
/** Hashes a buffer with SipHash-2-4
|
||||
* @param src The start of the buffer to hash
|
||||
@@ -476,7 +487,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
|
||||
@@ -486,7 +497,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
|
||||
*/
|
||||
@@ -525,10 +536,18 @@ namespace Anope
|
||||
*/
|
||||
extern CoreExport Anope::string NormalizeBuffer(const Anope::string &);
|
||||
|
||||
/** Main processing routine. Parses the message and takes the appropriate action.
|
||||
* @param Raw message from the uplink
|
||||
/** Parses a raw message from the uplink and calls its command handler.
|
||||
* @param message Raw message from the uplink
|
||||
*/
|
||||
extern void Process(const Anope::string &);
|
||||
extern void Process(const Anope::string &message);
|
||||
|
||||
/** Calls the command handler for an already parsed message.
|
||||
* @param source Source of the message.
|
||||
* @param command Command name.
|
||||
* @param params Any extra parameters.
|
||||
* @param tags IRCv3 message tags.
|
||||
*/
|
||||
extern CoreExport void ProcessInternal(MessageSource &src, const Anope::string &command, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> & tags);
|
||||
|
||||
/** Does a blocking dns query and returns the first IP.
|
||||
* @param host host to look up
|
||||
@@ -548,6 +567,40 @@ namespace Anope
|
||||
* @param len The length of the string returned
|
||||
*/
|
||||
extern CoreExport Anope::string Random(size_t len);
|
||||
|
||||
/** Generate a random number. */
|
||||
extern CoreExport int RandomNumber();
|
||||
|
||||
/** 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);
|
||||
|
||||
/** Update the current time. */
|
||||
extern CoreExport void UpdateTime();
|
||||
|
||||
/** Expands a path fragment that is relative to the base directory.
|
||||
* @param base The base directory that it is relative to.
|
||||
* @param fragment The fragment to expand.
|
||||
*/
|
||||
extern CoreExport Anope::string Expand(const Anope::string &base, const Anope::string &fragment);
|
||||
|
||||
/** Expands a config path. */
|
||||
inline auto ExpandConfig(const Anope::string &path) { return Expand(ConfigDir, path); }
|
||||
|
||||
/** Expands a data path. */
|
||||
inline auto ExpandData(const Anope::string &path) { return Expand(DataDir, path); }
|
||||
|
||||
/** Expands a locale path. */
|
||||
inline auto ExpandLocale(const Anope::string &path) { return Expand(LocaleDir, path); }
|
||||
|
||||
/** Expands a log path. */
|
||||
inline auto ExpandLog(const Anope::string &path) { return Expand(LogDir, path); }
|
||||
|
||||
/** Expands a module path. */
|
||||
inline auto ExpandModule(const Anope::string &path) { return Expand(ModuleDir, path); }
|
||||
|
||||
}
|
||||
|
||||
/** sepstream allows for splitting token separated lists.
|
||||
@@ -557,11 +610,11 @@ namespace Anope
|
||||
*/
|
||||
class CoreExport sepstream
|
||||
{
|
||||
private:
|
||||
private:
|
||||
/** Original string.
|
||||
*/
|
||||
Anope::string tokens;
|
||||
/** Seperator value
|
||||
/** Separator value
|
||||
*/
|
||||
char sep;
|
||||
/** Current string position
|
||||
@@ -570,11 +623,14 @@ class CoreExport sepstream
|
||||
/** 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);
|
||||
|
||||
/** Retrieves the underlying string. */
|
||||
const auto &GetString() const { return tokens; }
|
||||
|
||||
/** Fetch the next token from the stream
|
||||
* @param token The next token from the stream is placed here
|
||||
* @return True if tokens still remain, false if there are none left
|
||||
@@ -591,7 +647,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;
|
||||
@@ -614,7 +670,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
|
||||
@@ -624,9 +680,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) { }
|
||||
@@ -634,9 +691,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, ' ') { }
|
||||
@@ -648,16 +706,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") { }
|
||||
@@ -687,9 +746,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") { }
|
||||
@@ -704,66 +764,6 @@ class ModuleException : public CoreException
|
||||
virtual ~ModuleException() noexcept = default;
|
||||
};
|
||||
|
||||
class ConvertException : public CoreException
|
||||
{
|
||||
public:
|
||||
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
|
||||
|
||||
virtual ~ConvertException() noexcept = default;
|
||||
};
|
||||
|
||||
/** Convert something to a string
|
||||
*/
|
||||
template<typename T> inline Anope::string stringify(const T &x)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
if (!(stream << x))
|
||||
throw ConvertException("Stringify fail");
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
template<typename T> inline void convert(const Anope::string &s, T &x, Anope::string &leftover, bool failIfLeftoverChars = true)
|
||||
{
|
||||
leftover.clear();
|
||||
std::istringstream i(s.str());
|
||||
char c;
|
||||
if (!(i >> x))
|
||||
throw ConvertException("Convert fail");
|
||||
if (failIfLeftoverChars)
|
||||
{
|
||||
if (i.get(c))
|
||||
throw ConvertException("Convert fail");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string left;
|
||||
getline(i, left);
|
||||
leftover = left;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> inline void convert(const Anope::string &s, T &x, bool failIfLeftoverChars = true)
|
||||
{
|
||||
Anope::string Unused;
|
||||
convert(s, x, Unused, failIfLeftoverChars);
|
||||
}
|
||||
|
||||
template<typename T> inline T convertTo(const Anope::string &s, Anope::string &leftover, bool failIfLeftoverChars = true)
|
||||
{
|
||||
T x;
|
||||
convert(s, x, leftover, failIfLeftoverChars);
|
||||
return x;
|
||||
}
|
||||
|
||||
template<typename T> inline T convertTo(const Anope::string &s, bool failIfLeftoverChars = true)
|
||||
{
|
||||
T x;
|
||||
convert(s, x, failIfLeftoverChars);
|
||||
return x;
|
||||
}
|
||||
|
||||
/** Casts to be used instead of dynamic_cast, this uses dynamic_cast
|
||||
* for debug builds and static_cast on release builds
|
||||
* to speed up the program because dynamic_cast relies on RTTI.
|
||||
@@ -783,3 +783,5 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
|
||||
return static_cast<T>(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
+10
-9
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2011 Adam <Adam@anope.org>
|
||||
* (C) 2008-2023 Anope Team <team@anope.org>
|
||||
* (C) 2008-2024 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ class CoreExport Base
|
||||
{
|
||||
/* References to this base class */
|
||||
std::set<ReferenceBase *> *references = nullptr;
|
||||
public:
|
||||
public:
|
||||
virtual ~Base();
|
||||
|
||||
/** Adds a reference to this object. Eg, when a Reference
|
||||
@@ -30,9 +30,9 @@ class CoreExport Base
|
||||
|
||||
class ReferenceBase
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
bool invalid = false;
|
||||
public:
|
||||
public:
|
||||
ReferenceBase() = default;
|
||||
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
|
||||
virtual ~ReferenceBase() = default;
|
||||
@@ -43,11 +43,12 @@ 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:
|
||||
protected:
|
||||
T *ref = nullptr;
|
||||
public:
|
||||
public:
|
||||
Reference() = default;
|
||||
|
||||
Reference(T *obj) : ref(obj)
|
||||
@@ -102,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;
|
||||
|
||||
+10
-7
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* (C) 2008-2023 Anope Team <team@anope.org>
|
||||
* (C) 2008-2024 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
@@ -19,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;
|
||||
@@ -54,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();
|
||||
|
||||
@@ -106,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
|
||||
@@ -115,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
|
||||
@@ -128,5 +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);
|
||||
};
|
||||
|
||||
+18
-13
@@ -1,6 +1,6 @@
|
||||
/* Channel support
|
||||
*
|
||||
* (C) 2008-2023 Anope Team
|
||||
* (C) 2008-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -13,12 +13,13 @@
|
||||
#include "modes.h"
|
||||
#include "serialize.h"
|
||||
|
||||
typedef Anope::hash_map<Channel *> channel_map;
|
||||
typedef Anope::unordered_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;
|
||||
@@ -28,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 */
|
||||
@@ -73,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();
|
||||
@@ -107,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
|
||||
@@ -204,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
|
||||
@@ -233,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.
|
||||
@@ -297,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
|
||||
|
||||
+19
-15
@@ -1,6 +1,6 @@
|
||||
/* Declarations for command data.
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,13 +15,13 @@
|
||||
#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;
|
||||
|
||||
@@ -44,16 +44,17 @@ struct CoreExport 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 */
|
||||
@@ -61,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();
|
||||
@@ -77,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);
|
||||
@@ -88,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;
|
||||
@@ -97,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 */
|
||||
@@ -106,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
|
||||
@@ -116,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:
|
||||
public:
|
||||
virtual ~Command() = default;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void SetDesc(const Anope::string &d);
|
||||
|
||||
void ClearSyntax();
|
||||
@@ -129,7 +133,7 @@ class CoreExport Command : public Service
|
||||
void AllowUnregistered(bool b);
|
||||
void RequireUser(bool b);
|
||||
|
||||
public:
|
||||
public:
|
||||
bool AllowUnregistered() const;
|
||||
bool RequireUser() const;
|
||||
|
||||
@@ -178,5 +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);
|
||||
};
|
||||
|
||||
+17
-30
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "regchannel.h"
|
||||
#include "users.h"
|
||||
#include "opertype.h"
|
||||
#include <stack>
|
||||
|
||||
namespace Configuration
|
||||
{
|
||||
@@ -25,11 +24,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;
|
||||
@@ -38,37 +37,23 @@ 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
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") 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
|
||||
{
|
||||
const Anope::string &value = this->Get<const Anope::string>(tag, def);
|
||||
if (!value.empty())
|
||||
try
|
||||
{
|
||||
return convertTo<T>(value);
|
||||
}
|
||||
catch (const ConvertException &) { }
|
||||
return T();
|
||||
return Anope::TryConvert<T>(this->Get<const Anope::string>(tag, def)).value_or(T());
|
||||
}
|
||||
|
||||
bool Set(const Anope::string &tag, const Anope::string &value);
|
||||
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
|
||||
@@ -78,12 +63,12 @@ namespace Configuration
|
||||
|
||||
/** Represents a configuration file
|
||||
*/
|
||||
class File
|
||||
class File final
|
||||
{
|
||||
Anope::string name;
|
||||
bool executable;
|
||||
FILE *fp = nullptr;
|
||||
public:
|
||||
public:
|
||||
File(const Anope::string &, bool);
|
||||
~File();
|
||||
const Anope::string &GetName() const;
|
||||
@@ -98,7 +83,8 @@ namespace Configuration
|
||||
|
||||
struct Uplink;
|
||||
|
||||
struct CoreExport Conf : Block
|
||||
struct CoreExport Conf final
|
||||
: Block
|
||||
{
|
||||
/* options:readtimeout */
|
||||
time_t ReadTimeout;
|
||||
@@ -152,7 +138,7 @@ namespace Configuration
|
||||
const Block *GetCommand(CommandSource &);
|
||||
};
|
||||
|
||||
struct Uplink
|
||||
struct Uplink final
|
||||
{
|
||||
Anope::string host;
|
||||
unsigned port;
|
||||
@@ -171,9 +157,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") { }
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
*
|
||||
* (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
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace Anope
|
||||
{
|
||||
/** Attempts to convert a string to any type.
|
||||
* @param in The value to convert.
|
||||
* @param leftover If non-nullptr then the location to store leftover data.
|
||||
*/
|
||||
template<typename T>
|
||||
inline std::optional<T> TryConvert(const Anope::string &in, Anope::string *leftover = nullptr)
|
||||
{
|
||||
std::istringstream tmp(in.str());
|
||||
T out;
|
||||
if (!(tmp >> out))
|
||||
return std::nullopt;
|
||||
|
||||
if (leftover)
|
||||
{
|
||||
leftover->clear();
|
||||
std::getline(tmp, leftover->str());
|
||||
}
|
||||
else
|
||||
{
|
||||
char extra;
|
||||
if (tmp >> extra)
|
||||
return std::nullopt;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Converts a string to any type.
|
||||
* @param in The value to convert.
|
||||
* @param def The default to use if the conversion failed.
|
||||
* @param leftover If non-nullptr then the location to store leftover data.
|
||||
*/
|
||||
template<typename T>
|
||||
inline T Convert(const Anope::string &in, T def, Anope::string *leftover = nullptr)
|
||||
{
|
||||
return TryConvert<T>(in, leftover).value_or(def);
|
||||
}
|
||||
|
||||
/** Attempts to convert any type to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
template <class T>
|
||||
inline std::optional<Anope::string> TryString(const T &in)
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
if (!(tmp << in))
|
||||
return std::nullopt;
|
||||
return tmp.str();
|
||||
}
|
||||
|
||||
/** No-op function that returns the string that was passed to it.
|
||||
* @param in The string to return.
|
||||
*/
|
||||
inline const string &ToString(const string &in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
/** Converts a std::string to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
inline string ToString(const std::string &in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
|
||||
/** Converts a char array to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
inline string ToString(const char *in)
|
||||
{
|
||||
return string(in);
|
||||
}
|
||||
|
||||
/** Converts a char to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
inline string ToString(char in)
|
||||
{
|
||||
return string(1, static_cast<string::value_type>(in));
|
||||
}
|
||||
|
||||
/** Converts an unsigned char to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
inline string ToString(unsigned char in)
|
||||
{
|
||||
return string(1, static_cast<string::value_type>(in));
|
||||
}
|
||||
|
||||
/** Converts a bool to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
inline string ToString(bool in)
|
||||
{
|
||||
return (in ? "1" : "0");
|
||||
}
|
||||
|
||||
/** Converts a type that std::to_string is implemented for to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
template<typename Stringable>
|
||||
inline std::enable_if_t<std::is_arithmetic_v<Stringable>, string> ToString(const Stringable &in)
|
||||
{
|
||||
return std::to_string(in);
|
||||
}
|
||||
|
||||
/** Converts any type to a string.
|
||||
* @param in The value to convert.
|
||||
*/
|
||||
template <class T>
|
||||
inline std::enable_if_t<!std::is_arithmetic_v<T>, string> ToString(const T &in)
|
||||
{
|
||||
return TryString(in).value_or(Anope::string());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
|
||||
+46
-40
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,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 */
|
||||
@@ -33,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);
|
||||
@@ -53,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()
|
||||
@@ -75,17 +77,17 @@ 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);
|
||||
@@ -100,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())
|
||||
@@ -113,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;
|
||||
|
||||
@@ -124,50 +126,53 @@ class BaseExtensibleItem : public ExtensibleBase
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ExtensibleItem : public BaseExtensibleItem<T>
|
||||
class ExtensibleItem
|
||||
: public BaseExtensibleItem<T>
|
||||
{
|
||||
protected:
|
||||
T* Create(Extensible *obj) 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) 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 *) 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 override
|
||||
{
|
||||
T* t = this->Get(e);
|
||||
T *t = this->Get(e);
|
||||
data[this->name] << *t;
|
||||
}
|
||||
|
||||
@@ -184,7 +189,7 @@ 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 override
|
||||
@@ -204,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)
|
||||
@@ -221,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)
|
||||
@@ -241,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);
|
||||
|
||||
+10
-7
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2002-2011 InspIRCd Development Team
|
||||
* (C) 2009-2023 Anope Team <team@anope.org>
|
||||
* (C) 2009-2024 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
@@ -27,9 +27,10 @@ namespace Anope
|
||||
|
||||
/* 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:
|
||||
public:
|
||||
char_type do_toupper(char_type c) const override
|
||||
{
|
||||
if (c >= 'a' && c <= 'z')
|
||||
@@ -49,9 +50,10 @@ 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:
|
||||
public:
|
||||
char_type do_toupper(char_type c) const override
|
||||
{
|
||||
if (c == '{' || c == '}' || c == '|')
|
||||
@@ -78,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
|
||||
@@ -123,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
|
||||
|
||||
+15
-16
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2023 Anope Team
|
||||
* (C) 2008-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -65,17 +65,19 @@ namespace Language
|
||||
} // namespace Language
|
||||
|
||||
/* Commonly used language strings */
|
||||
#define CONFIRM_DROP _("Please confirm that you want to drop \002%s\002 with \002%s%s DROP %s %s\002")
|
||||
#define SERVICE_UNAVAILABLE _("Sorry, %s is temporarily unavailable.")
|
||||
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
|
||||
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
|
||||
#define BAD_EXPIRY_TIME _("Invalid expiry time.")
|
||||
#define USERHOST_MASK_TOO_WIDE _("%s coverage is too wide; Please use a more specific mask.")
|
||||
#define READ_ONLY_MODE _("Services are in read-only mode!")
|
||||
#define READ_ONLY_MODE _("Services are temporarily 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 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 must be longer than %u characters.")
|
||||
#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.")
|
||||
@@ -86,12 +88,10 @@ namespace Language
|
||||
#define CHAN_X_NOT_REGISTERED _("Channel \002%s\002 isn't registered.")
|
||||
#define CHAN_X_NOT_IN_USE _("Channel \002%s\002 doesn't exist.")
|
||||
#define NICK_IDENTIFY_REQUIRED _("You must be logged into an account to use that command.")
|
||||
#define MAIL_X_INVALID _("\002%s\002 is not a valid e-mail address.")
|
||||
#define MAIL_X_INVALID _("\002%s\002 is not a valid email address.")
|
||||
#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.")
|
||||
@@ -99,7 +99,7 @@ namespace Language
|
||||
#define NICK_CANNOT_BE_REGISTERED _("Nickname \002%s\002 may not be registered.")
|
||||
#define NICK_ALREADY_REGISTERED _("Nickname \002%s\002 is already registered!")
|
||||
#define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.")
|
||||
#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the e-mail again, and retry.")
|
||||
#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the email again, and retry.")
|
||||
#define CHAN_NOT_ALLOWED_TO_JOIN _("You are not permitted to be on this channel.")
|
||||
#define CHAN_X_INVALID _("Channel %s is not a valid channel.")
|
||||
#define CHAN_REACHED_CHANNEL_LIMIT _("Sorry, you have already reached your limit of \002%d\002 channels.")
|
||||
@@ -111,20 +111,19 @@ 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.")
|
||||
#define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.")
|
||||
#define MEMO_X_HAS_NO_NEW_MEMOS _("%s has no new memos.")
|
||||
#define BOT_DOES_NOT_EXIST _("Bot \002%s\002 does not exist.")
|
||||
#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.")
|
||||
#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_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")
|
||||
#define HOST_SET_ERROR _("A vhost must be in the format of a valid hostname.")
|
||||
#define HOST_SET_IDENT_ERROR _("A vident 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 %zu characters.")
|
||||
#define HOST_SET_IDENTTOOLONG _("Error! The vident 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 vidents. If this is incorrect please report this as a possible bug.")
|
||||
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -23,13 +23,13 @@
|
||||
*/
|
||||
class CoreExport NumberList
|
||||
{
|
||||
private:
|
||||
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
|
||||
@@ -60,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);
|
||||
@@ -78,12 +78,12 @@ 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 = 0;
|
||||
public:
|
||||
public:
|
||||
InfoFormatter(NickCore *nc);
|
||||
void Process(std::vector<Anope::string> &);
|
||||
Anope::string &operator[](const Anope::string &key);
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -37,7 +37,7 @@ enum LogType
|
||||
LOG_DEBUG_4
|
||||
};
|
||||
|
||||
struct LogFile
|
||||
struct LogFile final
|
||||
{
|
||||
Anope::string filename;
|
||||
std::ofstream stream;
|
||||
@@ -48,9 +48,9 @@ struct LogFile
|
||||
};
|
||||
|
||||
/* Represents a single log message */
|
||||
class CoreExport Log
|
||||
class CoreExport Log final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
/* Bot that should log this message */
|
||||
BotInfo *bi = nullptr;
|
||||
/* For commands, the user executing the command, but might not always exist */
|
||||
@@ -94,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)
|
||||
@@ -109,9 +109,9 @@ class CoreExport Log
|
||||
};
|
||||
|
||||
/* Configured in the configuration file, actually does the message logging */
|
||||
class CoreExport LogInfo
|
||||
class CoreExport LogInfo final
|
||||
{
|
||||
public:
|
||||
public:
|
||||
BotInfo *bot = nullptr;
|
||||
std::vector<Anope::string> targets;
|
||||
std::vector<LogFile *> logfiles;
|
||||
|
||||
+6
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -22,9 +22,11 @@ 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 error;
|
||||
Anope::string sendmail_path;
|
||||
Anope::string send_from;
|
||||
Anope::string mail_to;
|
||||
@@ -34,8 +36,7 @@ namespace Mail
|
||||
Anope::string content_type;
|
||||
bool dont_quote_addresses;
|
||||
|
||||
bool success = false;
|
||||
public:
|
||||
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)
|
||||
|
||||
+6
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -14,9 +14,10 @@
|
||||
#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;
|
||||
@@ -24,7 +25,7 @@ class CoreExport Memo : public Serializable
|
||||
~Memo();
|
||||
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
|
||||
|
||||
Anope::string owner;
|
||||
/* When it was sent */
|
||||
@@ -36,7 +37,7 @@ 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 = 0;
|
||||
Serialize::Checker<std::vector<Memo *> > memos;
|
||||
|
||||
+57
-37
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -21,37 +21,42 @@
|
||||
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, 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, 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, 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, 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, const Anope::map<Anope::string> &tags) override;
|
||||
|
||||
@@ -67,107 +72,122 @@ 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, const Anope::map<Anope::string> &tags) override;
|
||||
};
|
||||
|
||||
+49
-36
@@ -1,7 +1,7 @@
|
||||
/* Mode support
|
||||
*
|
||||
* (C) 2008-2011 Adam <Adam@anope.org>
|
||||
* (C) 2008-2023 Anope Team <team@anope.org>
|
||||
* (C) 2008-2024 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
@@ -35,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) */
|
||||
@@ -64,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
|
||||
@@ -74,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
|
||||
@@ -92,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;
|
||||
|
||||
@@ -123,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
|
||||
@@ -159,11 +164,12 @@ class CoreExport ChannelModeList : public ChannelMode
|
||||
virtual void OnDel(Channel *chan, const Anope::string &mask) { }
|
||||
};
|
||||
|
||||
/** This is a mode with a paramater, eg +k/l. These modes should use/inherit from this
|
||||
/** 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
|
||||
@@ -183,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.
|
||||
@@ -206,12 +213,13 @@ 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();
|
||||
@@ -224,10 +232,10 @@ class CoreExport ChannelModeVirtual : public T
|
||||
};
|
||||
|
||||
/* The status a user has on a channel (+v, +h, +o) etc */
|
||||
class CoreExport ChannelStatus
|
||||
class CoreExport ChannelStatus final
|
||||
{
|
||||
Anope::string modes;
|
||||
public:
|
||||
public:
|
||||
ChannelStatus() = default;
|
||||
ChannelStatus(const Anope::string &modes);
|
||||
void AddMode(char c);
|
||||
@@ -239,17 +247,19 @@ 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 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 override;
|
||||
@@ -257,9 +267,10 @@ class CoreExport UserModeNoone : public UserMode
|
||||
|
||||
/** 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 override;
|
||||
@@ -267,9 +278,10 @@ class CoreExport ChannelModeKey : public ChannelModeParam
|
||||
|
||||
/** 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 */
|
||||
@@ -278,9 +290,10 @@ class CoreExport ChannelModeOperOnly : public ChannelMode
|
||||
|
||||
/** 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 override;
|
||||
@@ -292,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;
|
||||
@@ -388,11 +401,11 @@ 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:
|
||||
public:
|
||||
unsigned short cidr_len = 0;
|
||||
int family = 0;
|
||||
Anope::string nick, user, host, real;
|
||||
@@ -406,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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
|
||||
+30
-47
@@ -1,6 +1,6 @@
|
||||
/* Modular support
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -162,7 +162,7 @@ enum
|
||||
};
|
||||
typedef unsigned short ModType;
|
||||
|
||||
struct ModuleVersionC
|
||||
struct ModuleVersionC final
|
||||
{
|
||||
int version_major, version_minor, version_patch;
|
||||
};
|
||||
@@ -170,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
|
||||
@@ -196,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;
|
||||
@@ -375,7 +379,6 @@ class CoreExport Module : public Extensible
|
||||
virtual EventReturn OnLoadDatabase() { throw NotImplementedException(); }
|
||||
|
||||
/** Called when anope needs to check passwords against encryption
|
||||
* see src/encrypt.c for detailed informations
|
||||
*/
|
||||
virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); }
|
||||
|
||||
@@ -774,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
|
||||
*/
|
||||
@@ -852,12 +838,12 @@ class CoreExport Module : public Extensible
|
||||
/** Called when a vhost is deleted
|
||||
* @param na The nickalias of the vhost
|
||||
*/
|
||||
virtual void OnDeleteVhost(NickAlias *na) { throw NotImplementedException(); }
|
||||
virtual void OnDeleteVHost(NickAlias *na) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a vhost is set
|
||||
* @param na The nickalias of the vhost
|
||||
*/
|
||||
virtual void OnSetVhost(NickAlias *na) { throw NotImplementedException(); }
|
||||
virtual void OnSetVHost(NickAlias *na) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a users host changes
|
||||
* @param u The user
|
||||
@@ -961,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
|
||||
@@ -1038,7 +1027,7 @@ class CoreExport Module : public Extensible
|
||||
/** Called when a nickserv/set command is used.
|
||||
* @param source The source of the command
|
||||
* @param cmd The command
|
||||
* @param nc The nickcore being modifed
|
||||
* @param nc The nickcore being modified
|
||||
* @param setting The setting passed to the command. Probably ON/OFF.
|
||||
* @return EVENT_STOP to halt immediately
|
||||
*/
|
||||
@@ -1048,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
|
||||
@@ -1072,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
|
||||
@@ -1096,23 +1079,23 @@ 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_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,
|
||||
I_OnMLock, I_OnUnMLock, I_OnModuleLoad, I_OnModuleUnload, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnBotNotice,
|
||||
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];
|
||||
@@ -1195,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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* BotServ core functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -33,7 +33,7 @@ struct BadWord
|
||||
BadWordType type;
|
||||
|
||||
virtual ~BadWord() = default;
|
||||
protected:
|
||||
protected:
|
||||
BadWord() = default;
|
||||
};
|
||||
|
||||
@@ -46,13 +46,13 @@ struct BadWords
|
||||
* @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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* BotServ core functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -37,10 +37,10 @@ struct KickerData
|
||||
|
||||
bool dontkickops, dontkickvoices;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
KickerData() = default;
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~KickerData() = default;
|
||||
virtual void Check(ChannelInfo *ci) = 0;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -16,21 +16,22 @@ struct EntryMsg
|
||||
time_t when;
|
||||
|
||||
virtual ~EntryMsg() = default;
|
||||
protected:
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ChanServ core functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -25,20 +25,21 @@ struct LogSetting
|
||||
time_t created;
|
||||
|
||||
virtual ~LogSetting() = default;
|
||||
protected:
|
||||
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:
|
||||
public:
|
||||
virtual ~LogSettings() = default;
|
||||
virtual LogSetting *Create() = 0;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ChanServ core functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -21,7 +21,7 @@ struct ModeLock
|
||||
time_t created;
|
||||
|
||||
virtual ~ModeLock() = default;
|
||||
protected:
|
||||
protected:
|
||||
ModeLock() = default;
|
||||
};
|
||||
|
||||
|
||||
+20
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -79,7 +79,7 @@ namespace DNS
|
||||
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
|
||||
{
|
||||
@@ -88,7 +88,8 @@ namespace DNS
|
||||
};
|
||||
};
|
||||
|
||||
struct ResourceRecord : Question
|
||||
struct ResourceRecord final
|
||||
: Question
|
||||
{
|
||||
unsigned int ttl = 0;
|
||||
Anope::string rdata;
|
||||
@@ -113,9 +114,10 @@ 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() = default;
|
||||
|
||||
@@ -131,10 +133,12 @@ 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 */
|
||||
@@ -142,8 +146,14 @@ namespace DNS
|
||||
/* 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), 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()
|
||||
{
|
||||
@@ -163,7 +173,7 @@ namespace DNS
|
||||
/** Used to time out the query, xalls OnError and lets the TimerManager
|
||||
* delete this request.
|
||||
*/
|
||||
void Tick(time_t) override
|
||||
void Tick() override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name;
|
||||
Query rr(*this);
|
||||
|
||||
+122
-12
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -13,25 +13,135 @@
|
||||
|
||||
namespace Encryption
|
||||
{
|
||||
typedef std::pair<const unsigned char *, size_t> Hash;
|
||||
typedef std::pair<const uint32_t *, size_t> IV;
|
||||
|
||||
/** Base class for encryption contexts. */
|
||||
class Context
|
||||
{
|
||||
public:
|
||||
public:
|
||||
virtual ~Context() = default;
|
||||
|
||||
/** Updates the encryption context with the specified data.
|
||||
* @param str The data to update the context with.
|
||||
*/
|
||||
inline void Update(const Anope::string &str)
|
||||
{
|
||||
Update(reinterpret_cast<const unsigned char *>(str.c_str()), str.length());
|
||||
}
|
||||
|
||||
/** Updates the encryption context with the specified data.
|
||||
* @param data The data to update the context with.
|
||||
* @param len The length of the data.
|
||||
*/
|
||||
virtual void Update(const unsigned char *data, size_t len) = 0;
|
||||
virtual void Finalize() = 0;
|
||||
virtual Hash GetFinalizedHash() = 0;
|
||||
|
||||
/** Finalises the encryption context and returns the digest. */
|
||||
virtual Anope::string Finalize() = 0;
|
||||
};
|
||||
|
||||
class Provider : public Service
|
||||
/** Provider of encryption contexts. */
|
||||
class Provider
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
|
||||
public:
|
||||
/** The byte size of the block cipher. */
|
||||
const size_t block_size;
|
||||
|
||||
/** The byte size of the resulting digest. */
|
||||
const size_t digest_size;
|
||||
|
||||
/** Creates a provider of encryption contexts.
|
||||
* @param creator The module that created this provider.
|
||||
* @param algorithm The name of the encryption algorithm.
|
||||
* @param bs The byte size of the block cipher.
|
||||
* @param ds The byte size of the resulting digest.
|
||||
*/
|
||||
Provider(Module *creator, const Anope::string &algorithm, size_t bs, size_t ds)
|
||||
: Service(creator, "Encryption::Provider", algorithm)
|
||||
, block_size(bs)
|
||||
, digest_size(ds)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Provider() = default;
|
||||
|
||||
virtual Context *CreateContext(IV * = NULL) = 0;
|
||||
virtual IV GetDefaultIV() = 0;
|
||||
/** Checks whether a plain text value matches a hash created by this provider. */
|
||||
virtual bool Compare(const Anope::string &hash, const Anope::string &plain)
|
||||
{
|
||||
return !hash.empty() && hash.equals_cs(ToPrintable(Encrypt(plain)));
|
||||
}
|
||||
|
||||
/** Called on initialising a encryption provider to check it works properly. */
|
||||
void Check(const Anope::map<Anope::string> &checks)
|
||||
{
|
||||
for (const auto &[hash, plain] : checks)
|
||||
{
|
||||
if (!Compare(hash, plain))
|
||||
throw ModuleException("BUG: unable to generate " + this->name + " hashes safely! Please report this!");
|
||||
}
|
||||
Log(LOG_DEBUG) << "The " << this->name << " encryption provider appears to be working correctly.";
|
||||
}
|
||||
|
||||
/** Creates a new encryption context. */
|
||||
virtual std::unique_ptr<Context> CreateContext() = 0;
|
||||
|
||||
/** Quickly encrypts the specified values and returns the digest. */
|
||||
template<typename... Args>
|
||||
Anope::string Encrypt(Args &&...args)
|
||||
{
|
||||
auto context = CreateContext();
|
||||
context->Update(std::forward<Args>(args)...);
|
||||
return context->Finalize();
|
||||
}
|
||||
|
||||
/** Calculates the RFC 2104 hash-based message authentication code for the specified data. */
|
||||
inline Anope::string HMAC(const Anope::string &key, const Anope::string &data)
|
||||
{
|
||||
if (!block_size)
|
||||
return {};
|
||||
|
||||
auto keybuf = key.length() > block_size ? Encrypt(key) : key;
|
||||
keybuf.resize(block_size);
|
||||
|
||||
Anope::string hmac1;
|
||||
Anope::string hmac2;
|
||||
for (size_t i = 0; i < block_size; ++i)
|
||||
{
|
||||
hmac1.push_back(static_cast<char>(keybuf[i] ^ 0x5C));
|
||||
hmac2.push_back(static_cast<char>(keybuf[i] ^ 0x36));
|
||||
}
|
||||
hmac2.append(data);
|
||||
hmac1.append(Encrypt(hmac2));
|
||||
|
||||
return Encrypt(hmac1);
|
||||
}
|
||||
|
||||
/** Converts a hash to its printable form. */
|
||||
virtual Anope::string ToPrintable(const Anope::string &hash)
|
||||
{
|
||||
return Anope::Hex(hash);
|
||||
}
|
||||
};
|
||||
|
||||
/** Helper template for creating simple providers of encryption contexts. */
|
||||
template <typename T>
|
||||
class SimpleProvider final
|
||||
: public Provider
|
||||
{
|
||||
public:
|
||||
/** Creates a simple provider of encryption contexts.
|
||||
* @param creator The module that created this provider.
|
||||
* @param algorithm The name of the encryption algorithm.
|
||||
* @param bs The byte size of the block cipher.
|
||||
* @param ds The byte size of the resulting digest.
|
||||
*/
|
||||
SimpleProvider(Module *creator, const Anope::string &algorithm, size_t bs, size_t ds)
|
||||
: Provider(creator, algorithm, bs, ds)
|
||||
{
|
||||
}
|
||||
|
||||
/** @copydoc Encryption::Provider::CreateContext. */
|
||||
std::unique_ptr<Context> CreateContext() override
|
||||
{
|
||||
return std::make_unique<T>();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class HostRequest
|
||||
{
|
||||
protected:
|
||||
HostRequest() = default;
|
||||
|
||||
public:
|
||||
Anope::string nick;
|
||||
Anope::string ident;
|
||||
Anope::string host;
|
||||
time_t time = 0;
|
||||
|
||||
virtual ~HostRequest() = default;
|
||||
};
|
||||
+21
-15
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2012-2023 Anope Team
|
||||
* (C) 2012-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -18,7 +18,7 @@ enum HTTPError
|
||||
};
|
||||
|
||||
/* A message to someone */
|
||||
struct HTTPReply
|
||||
struct HTTPReply final
|
||||
{
|
||||
HTTPError error = HTTP_ERROR_OK;
|
||||
Anope::string content_type;
|
||||
@@ -27,9 +27,9 @@ struct HTTPReply
|
||||
std::vector<cookie> cookies;
|
||||
|
||||
HTTPReply() = default;
|
||||
HTTPReply& operator=(const 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;
|
||||
@@ -46,7 +46,7 @@ struct HTTPReply
|
||||
out.clear();
|
||||
}
|
||||
|
||||
struct Data
|
||||
struct Data final
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
@@ -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 virtual 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 virtual 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())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class OperInfo
|
||||
{
|
||||
protected:
|
||||
OperInfo() = default;
|
||||
|
||||
OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c)
|
||||
: target(t)
|
||||
, info(i)
|
||||
, adder(a)
|
||||
, created(c)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
Anope::string target;
|
||||
Anope::string info;
|
||||
Anope::string adder;
|
||||
time_t created = 0;
|
||||
|
||||
virtual ~OperInfo() = default;
|
||||
};
|
||||
|
||||
class OperInfoList
|
||||
: public Serialize::Checker<std::vector<OperInfo *>>
|
||||
{
|
||||
public:
|
||||
OperInfoList()
|
||||
: Serialize::Checker<std::vector<OperInfo *>>("OperInfo")
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~OperInfoList()
|
||||
{
|
||||
for (auto *info : *(*this))
|
||||
delete info;
|
||||
}
|
||||
|
||||
virtual OperInfo *Create() = 0;
|
||||
};
|
||||
+11
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,15 +8,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class LDAPException : public ModuleException
|
||||
class DllExport LDAPException : public ModuleException
|
||||
{
|
||||
public:
|
||||
public:
|
||||
LDAPException(const Anope::string &reason) : ModuleException(reason) { }
|
||||
|
||||
virtual ~LDAPException() noexcept = default;
|
||||
};
|
||||
|
||||
struct LDAPModification
|
||||
struct LDAPModification final
|
||||
{
|
||||
enum LDAPOperation
|
||||
{
|
||||
@@ -31,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
|
||||
{
|
||||
@@ -74,7 +75,7 @@ enum QueryType
|
||||
QUERY_MODIFY
|
||||
};
|
||||
|
||||
struct LDAPResult
|
||||
struct LDAPResult final
|
||||
{
|
||||
std::vector<LDAPAttributes> messages;
|
||||
Anope::string error;
|
||||
@@ -111,7 +112,7 @@ struct LDAPResult
|
||||
|
||||
class LDAPInterface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
LDAPInterface(Module *m) : owner(m) { }
|
||||
@@ -122,9 +123,10 @@ class LDAPInterface
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* NickServ core functions
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
struct NSCertList
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
NSCertList() = default;
|
||||
public:
|
||||
public:
|
||||
virtual ~NSCertList() = default;
|
||||
|
||||
/** Add an entry to the nick's certificate list
|
||||
@@ -54,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.
|
||||
@@ -63,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;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -27,20 +27,21 @@ struct ForbidData
|
||||
ForbidType type;
|
||||
|
||||
virtual ~ForbidData() = default;
|
||||
protected:
|
||||
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;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* OperServ ignore interface
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -19,16 +19,17 @@ struct IgnoreData
|
||||
time_t time = 0; /* When do we stop ignoring them? */
|
||||
|
||||
virtual ~IgnoreData() = default;
|
||||
protected:
|
||||
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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,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;
|
||||
@@ -32,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
struct Session
|
||||
struct Session final
|
||||
{
|
||||
cidr addr; /* A cidr (sockaddrs + len) representing this session */
|
||||
unsigned count = 1; /* Number of clients with this host */
|
||||
@@ -17,7 +17,8 @@ struct Session
|
||||
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,12 +29,13 @@ struct Exception : Serializable
|
||||
|
||||
Exception() : Serializable("Exception") { }
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
|
||||
};
|
||||
|
||||
class SessionService : public Service
|
||||
class SessionService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap;
|
||||
typedef std::vector<Exception *> ExceptionVector;
|
||||
|
||||
@@ -68,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class ChanServService : public Service
|
||||
class ChanServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,20 +8,68 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class GlobalService : public Service
|
||||
#define GLOBAL_NO_MESSAGE _("You do not have any messages queued and did not specify a message to send.")
|
||||
#define GLOBAL_QUEUE_CONFLICT _("You can not send a single message while you have messages queued.")
|
||||
|
||||
class GlobalService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
GlobalService(Module *m) : Service(m, "GlobalService", "Global")
|
||||
public:
|
||||
GlobalService(Module *m)
|
||||
: Service(m, "GlobalService", "Global")
|
||||
{
|
||||
}
|
||||
|
||||
/** Retrieves the bot which sends global messages unless otherwise specified. */
|
||||
virtual Reference<BotInfo> GetDefaultSender() = 0;
|
||||
virtual Reference<BotInfo> GetDefaultSender() const = 0;
|
||||
|
||||
/** Send out a global message to all users
|
||||
* @param sender Our client which should send the global
|
||||
* @param source The sender of the global
|
||||
* @param message The message
|
||||
/** Clears any queued messages for the specified account.
|
||||
* @param nc The account to clear queued messages for.
|
||||
*/
|
||||
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
|
||||
virtual void ClearQueue(NickCore *nc) = 0;
|
||||
|
||||
/** Retrieves the size of the messages queue for the specified user.
|
||||
* @param nc The account to count queued messages for.
|
||||
*/
|
||||
inline size_t CountQueue(NickCore* nc) const
|
||||
{
|
||||
auto *q = GetQueue(nc);
|
||||
return q ? q->size() : 0;
|
||||
}
|
||||
|
||||
/** Retrieves the messages queue for the specified user.
|
||||
* @param nc The account to retrieve queued messages for.
|
||||
*/
|
||||
virtual const std::vector<Anope::string> *GetQueue(NickCore* nc) const = 0;
|
||||
|
||||
/** Queues a message to be sent later.
|
||||
* @param nc The account to queue the message for.
|
||||
* @param message The message to queue.
|
||||
* @return The new number of messages in the queue.
|
||||
*/
|
||||
virtual size_t Queue(NickCore *nc, const Anope::string &message) = 0;
|
||||
|
||||
/** Sends a single message to all users on the network.
|
||||
* @param message The message to send.
|
||||
* @param source If non-nullptr then the source of the message.
|
||||
* @param sender If non-nullptr then the bot to send the message from.
|
||||
* @param server If non-nullptr then the server to send messages to.
|
||||
* @return If the message was sent then true; otherwise, false.
|
||||
*/
|
||||
virtual bool SendSingle(const Anope::string &message, CommandSource *source = nullptr, BotInfo *sender = nullptr, Server *server = nullptr) = 0;
|
||||
|
||||
/** Sends a message queue to all users on the network.
|
||||
* @param source The source of the message.
|
||||
* @param sender If non-nullptr then the bot to send the message from.
|
||||
* @param server If non-nullptr then the server to send messages to.
|
||||
* @return If the message queue was sent then true; otherwise, false.
|
||||
*/
|
||||
virtual bool SendQueue(CommandSource &source, BotInfo *sender = nullptr, Server *server = nullptr) = 0;
|
||||
|
||||
/** Unqueues a message from the message queue.
|
||||
* @param nc The account to unqueue the message from.
|
||||
* @param idx The index of the item to remove.
|
||||
* @return Whether the message was removed from the queue.
|
||||
*/
|
||||
virtual bool Unqueue(NickCore *nc, size_t idx) = 0;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class MemoServService : public Service
|
||||
class MemoServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum MemoResult
|
||||
{
|
||||
MEMO_SUCCESS,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2011-2023 Anope Team
|
||||
* (C) 2011-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class NickServService : public Service
|
||||
class NickServService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
NickServService(Module *m) : Service(m, "NickServService", "NickServ")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Redis
|
||||
{
|
||||
struct Reply
|
||||
struct Reply final
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
@@ -45,7 +45,7 @@ namespace Redis
|
||||
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
Interface(Module *m) : owner(m) { }
|
||||
@@ -55,9 +55,10 @@ namespace Redis
|
||||
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;
|
||||
|
||||
+13
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2014-2023 Anope Team
|
||||
* (C) 2014-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace SASL
|
||||
{
|
||||
struct Message
|
||||
struct Message final
|
||||
{
|
||||
Anope::string source;
|
||||
Anope::string target;
|
||||
@@ -22,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;
|
||||
|
||||
@@ -60,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;
|
||||
|
||||
@@ -76,12 +78,13 @@ 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() override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,6 +15,6 @@ struct MiscData
|
||||
Anope::string data;
|
||||
|
||||
virtual ~MiscData() = default;
|
||||
protected:
|
||||
protected:
|
||||
MiscData() = default;
|
||||
};
|
||||
|
||||
+25
-22
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,12 +8,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
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;
|
||||
@@ -23,7 +26,7 @@ namespace SQL
|
||||
Clear();
|
||||
}
|
||||
|
||||
std::iostream& operator[](const Anope::string &key) override
|
||||
std::iostream &operator[](const Anope::string &key) override
|
||||
{
|
||||
std::stringstream *&ss = data[key];
|
||||
if (!ss)
|
||||
@@ -81,9 +84,9 @@ 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() noexcept = default;
|
||||
@@ -92,13 +95,13 @@ namespace SQL
|
||||
/** 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;
|
||||
@@ -106,7 +109,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();
|
||||
@@ -123,15 +126,14 @@ 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
|
||||
{
|
||||
Anope::string string_value = stringify(value);
|
||||
this->parameters[key].data = string_value;
|
||||
this->parameters[key].escape = escape;
|
||||
}
|
||||
catch (const ConvertException &ex) { }
|
||||
auto str = Anope::TryString(value);
|
||||
if (!str.has_value())
|
||||
return;
|
||||
|
||||
this->parameters[key].data = str.value();
|
||||
this->parameters[key].escape = escape;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -139,12 +141,12 @@ namespace SQL
|
||||
*/
|
||||
class Result
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* Rows, column, item */
|
||||
std::vector<std::map<Anope::string, Anope::string> > entries;
|
||||
Query query;
|
||||
Anope::string error;
|
||||
public:
|
||||
public:
|
||||
unsigned int id = 0;
|
||||
Anope::string finished_query;
|
||||
|
||||
@@ -187,7 +189,7 @@ namespace SQL
|
||||
*/
|
||||
class Interface
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Module *owner;
|
||||
|
||||
Interface(Module *m) : owner(m) { }
|
||||
@@ -199,9 +201,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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2010-2023 Anope Team
|
||||
* (C) 2010-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -8,9 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class SSLService : public Service
|
||||
class SSLService
|
||||
: public Service
|
||||
{
|
||||
public:
|
||||
public:
|
||||
SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
|
||||
|
||||
virtual void Init(Socket *s) = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2010-2023 Anope Team
|
||||
* (C) 2010-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -10,15 +10,15 @@
|
||||
|
||||
#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.emplace(dname, ddata); }
|
||||
@@ -29,14 +29,15 @@ class XMLRPCServiceInterface;
|
||||
|
||||
class XMLRPCEvent
|
||||
{
|
||||
public:
|
||||
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,
|
||||
};
|
||||
+7
-7
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
|
||||
* (C) 2008-2023 Anope Team <team@anope.org>
|
||||
* (C) 2008-2024 Anope Team <team@anope.org>
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*/
|
||||
@@ -23,7 +23,7 @@ struct CoreExport Oper
|
||||
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
|
||||
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;
|
||||
@@ -40,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;
|
||||
@@ -65,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;
|
||||
@@ -115,10 +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;
|
||||
};
|
||||
|
||||
+190
-74
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -16,69 +16,131 @@
|
||||
#include "service.h"
|
||||
#include "modes.h"
|
||||
|
||||
/** Thrown when a protocol error happens. */
|
||||
class CoreExport ProtocolException final
|
||||
: public ModuleException
|
||||
{
|
||||
public:
|
||||
ProtocolException(const Anope::string &message)
|
||||
: ModuleException(message)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* 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;
|
||||
bool CanSVSHold = false;
|
||||
|
||||
/* See ns_cert */
|
||||
bool CanCertFP;
|
||||
/* Can we send arbitrary message tags? */
|
||||
bool CanSendTags;
|
||||
bool CanCertFP = false;
|
||||
|
||||
/* Can users log out before being fully connected? */
|
||||
bool CanSVSLogout;
|
||||
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;
|
||||
/* The maximum number of modes we are allowed to set with one MODE command */
|
||||
unsigned MaxModes;
|
||||
bool AmbiguousID = false;
|
||||
|
||||
/** Can we ask the server to unban a user? */
|
||||
bool CanClearBans = false;
|
||||
|
||||
/* The maximum length of a channel name. */
|
||||
size_t MaxChannel = 0;
|
||||
|
||||
/* The maximum length of a hostname. */
|
||||
size_t MaxHost = 0;
|
||||
|
||||
/* The maximum number of bytes a line may have */
|
||||
unsigned MaxLine;
|
||||
size_t MaxLine = 512;
|
||||
|
||||
/* The maximum number of modes we are allowed to set with one MODE command */
|
||||
size_t MaxModes = 3;
|
||||
|
||||
/* The maximum length of a nickname. */
|
||||
size_t MaxNick = 0;
|
||||
|
||||
/* The maximum length of a username. */
|
||||
size_t MaxUser = 0;
|
||||
|
||||
|
||||
/* Retrieves the next free UID or SID */
|
||||
virtual Anope::string UID_Retrieve();
|
||||
virtual Anope::string SID_Retrieve();
|
||||
|
||||
/** Extracts a timestamp from a string. */
|
||||
virtual time_t ExtractTimestamp(const Anope::string &str);
|
||||
|
||||
/** Sends an error to the uplink before disconnecting.
|
||||
* @param reason The error message.
|
||||
*/
|
||||
virtual void SendError(const Anope::string &reason);
|
||||
|
||||
/** Sets the server in NOOP mode. If NOOP mode is enabled, no users
|
||||
* will be able to oper on the server.
|
||||
* @param s The server
|
||||
@@ -97,8 +159,8 @@ class CoreExport IRCDProto : public Service
|
||||
* @param vident The ident to set
|
||||
* @param vhost The vhost to set
|
||||
*/
|
||||
virtual void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
|
||||
virtual void SendVhostDel(User *) { }
|
||||
virtual void SendVHost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
|
||||
virtual void SendVHostDel(User *) { }
|
||||
|
||||
/** Sets an akill. This is a recursive function that can be called multiple times
|
||||
* for the same xline, but for different users, if the xline is not one that can be
|
||||
@@ -126,29 +188,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, { Anope::ToString(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, { Anope::ToString(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);
|
||||
|
||||
@@ -160,7 +236,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
|
||||
@@ -179,7 +255,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, ...);
|
||||
virtual void SendGlobops(const MessageSource &source, const Anope::string &msg);
|
||||
|
||||
/** Sends a nick change of one of our clients.
|
||||
*/
|
||||
@@ -210,7 +286,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, { Anope::ToString(args)... });
|
||||
}
|
||||
|
||||
virtual void SendLogin(User *u, NickAlias *na) = 0;
|
||||
virtual void SendLogout(User *u) = 0;
|
||||
@@ -225,6 +306,8 @@ 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, NickAlias *na) { }
|
||||
@@ -234,24 +317,25 @@ class CoreExport IRCDProto : public Service
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
class CoreExport MessageSource
|
||||
class CoreExport MessageSource final
|
||||
{
|
||||
Anope::string source;
|
||||
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;
|
||||
@@ -261,29 +345,61 @@ 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, const Anope::map<Anope::string> &tags) = 0;
|
||||
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. */
|
||||
@@ -292,7 +408,7 @@ private:
|
||||
/** The current position within the message. */
|
||||
Anope::string::size_type position = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
/** Create a tokenstream and fill it with the provided data. */
|
||||
MessageTokenizer(const Anope::string &msg);
|
||||
|
||||
|
||||
+17
-14
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2008-2023 Anope Team
|
||||
* (C) 2008-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -16,14 +16,15 @@
|
||||
#include "serialize.h"
|
||||
#include "bots.h"
|
||||
|
||||
typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
|
||||
typedef Anope::unordered_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,23 +39,25 @@ class CoreExport AutoKick : public Serializable
|
||||
AutoKick();
|
||||
~AutoKick();
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
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;
|
||||
|
||||
@@ -92,10 +95,10 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
|
||||
ChannelInfo(const ChannelInfo &ci);
|
||||
|
||||
~ChannelInfo();
|
||||
ChannelInfo& operator=(const ChannelInfo &) = default;
|
||||
ChannelInfo &operator=(const ChannelInfo &) = default;
|
||||
|
||||
void Serialize(Serialize::Data &data) const override;
|
||||
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
|
||||
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);
|
||||
|
||||
+9
-7
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -15,9 +15,10 @@
|
||||
#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() noexcept = default;
|
||||
@@ -26,17 +27,18 @@ class RegexException : public CoreException
|
||||
class CoreExport Regex
|
||||
{
|
||||
Anope::string expression;
|
||||
protected:
|
||||
protected:
|
||||
Regex(const Anope::string &expr) : expression(expr) { }
|
||||
public:
|
||||
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;
|
||||
};
|
||||
|
||||
+25
-22
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -20,7 +20,7 @@ namespace Serialize
|
||||
{
|
||||
class Data
|
||||
{
|
||||
public:
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
DT_TEXT,
|
||||
@@ -29,7 +29,7 @@ namespace Serialize
|
||||
|
||||
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"); }
|
||||
|
||||
@@ -49,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
|
||||
@@ -68,13 +69,13 @@ class CoreExport Serializable : public virtual Base
|
||||
/* The last time this object was committed to the database */
|
||||
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 */
|
||||
@@ -96,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;
|
||||
|
||||
@@ -107,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;
|
||||
@@ -128,7 +130,7 @@ class CoreExport Serialize::Type : public Base
|
||||
*/
|
||||
time_t timestamp = 0;
|
||||
|
||||
public:
|
||||
public:
|
||||
/* Map of Serializable::id to Serializable objects */
|
||||
std::map<uint64_t, Serializable *> objects;
|
||||
|
||||
@@ -166,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);
|
||||
|
||||
@@ -196,26 +198,26 @@ class Serialize::Checker
|
||||
type->Check();
|
||||
}
|
||||
|
||||
public:
|
||||
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;
|
||||
@@ -240,12 +242,13 @@ class Serialize::Checker
|
||||
* destructed.
|
||||
*/
|
||||
template<typename T>
|
||||
class Serialize::Reference : public ReferenceBase
|
||||
class Serialize::Reference final
|
||||
: public ReferenceBase
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
T *ref = nullptr;
|
||||
|
||||
public:
|
||||
public:
|
||||
Reference() = default;
|
||||
|
||||
Reference(T *obj) : ref(obj)
|
||||
@@ -302,7 +305,7 @@ class Serialize::Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator*() const
|
||||
inline T *operator*() const
|
||||
{
|
||||
if (!this->invalid)
|
||||
{
|
||||
@@ -315,7 +318,7 @@ class Serialize::Reference : public ReferenceBase
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline T* operator->() const
|
||||
inline T *operator->() const
|
||||
{
|
||||
if (!this->invalid)
|
||||
{
|
||||
|
||||
+8
-7
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -25,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;
|
||||
@@ -37,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 */
|
||||
@@ -61,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
|
||||
@@ -72,12 +73,12 @@ 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 = 0;
|
||||
|
||||
|
||||
+9
-7
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -20,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;
|
||||
@@ -41,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);
|
||||
@@ -115,12 +116,13 @@ class CoreExport Service : public virtual Base
|
||||
/** 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:
|
||||
public:
|
||||
ServiceReference() = default;
|
||||
|
||||
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
|
||||
@@ -158,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);
|
||||
|
||||
+24
-30
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -11,39 +11,33 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <deque>
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "defs.h"
|
||||
#include "sysconf.h"
|
||||
|
||||
#define BUFSIZE 1024
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstdarg>
|
||||
#include <stdexcept>
|
||||
|
||||
#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>
|
||||
#include <map>
|
||||
#include <exception>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <bitset>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
#define _(x) x
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -14,10 +14,10 @@
|
||||
#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;
|
||||
|
||||
|
||||
+36
-29
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -103,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);
|
||||
@@ -120,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
|
||||
*/
|
||||
@@ -154,7 +155,7 @@ enum SocketFlag
|
||||
|
||||
class CoreExport SocketIO
|
||||
{
|
||||
public:
|
||||
public:
|
||||
virtual ~SocketIO() = default;
|
||||
|
||||
/** Receive something from the buffer
|
||||
@@ -212,14 +213,14 @@ class CoreExport SocketIO
|
||||
|
||||
class CoreExport Socket
|
||||
{
|
||||
protected:
|
||||
protected:
|
||||
/* Socket FD */
|
||||
int sock;
|
||||
|
||||
/* The family of this socket FD */
|
||||
int family;
|
||||
|
||||
public:
|
||||
public:
|
||||
std::bitset<SF_SIZE> flags;
|
||||
|
||||
/* Sockaddrs for bind() (if it's bound) */
|
||||
@@ -286,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 */
|
||||
@@ -296,7 +298,7 @@ class CoreExport BufferedSocket : public virtual Socket
|
||||
/* How much data was received from this socket on this recv() */
|
||||
int recv_len;
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~BufferedSocket() = default;
|
||||
|
||||
/** Called when there is something to be received for this socket
|
||||
@@ -311,15 +313,15 @@ class CoreExport BufferedSocket : public virtual Socket
|
||||
|
||||
/** 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
|
||||
@@ -333,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;
|
||||
@@ -349,7 +352,7 @@ class CoreExport BinarySocket : public virtual Socket
|
||||
/* Data to be written out */
|
||||
std::deque<DataBlock *> write_buffer;
|
||||
|
||||
public:
|
||||
public:
|
||||
virtual ~BinarySocket() = default;
|
||||
|
||||
/** Called when there is something to be received for this socket
|
||||
@@ -367,7 +370,7 @@ class CoreExport BinarySocket : public virtual Socket
|
||||
* @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
|
||||
@@ -378,9 +381,10 @@ 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
|
||||
@@ -402,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;
|
||||
|
||||
@@ -435,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 */
|
||||
@@ -469,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
|
||||
*/
|
||||
|
||||
+13
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (C) 2003-2023 Anope Team
|
||||
* (C) 2003-2024 Anope Team
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
@@ -14,9 +14,15 @@
|
||||
// The default umask to use for files.
|
||||
#cmakedefine DEFUMASK @DEFUMASK@
|
||||
|
||||
// The extension used for module file extensions.
|
||||
#define DLL_EXT "@CMAKE_SHARED_LIBRARY_SUFFIX@"
|
||||
|
||||
// Whether Anope was built in debug mode.
|
||||
#cmakedefine01 DEBUG_BUILD
|
||||
|
||||
// Whether the clock_gettime() function is available.
|
||||
#cmakedefine01 HAVE_CLOCK_GETTIME
|
||||
|
||||
// Whether Anope was built with localization support.
|
||||
#cmakedefine01 HAVE_LOCALIZATION
|
||||
|
||||
@@ -26,8 +32,10 @@
|
||||
#ifdef _WIN32
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
# ifdef _MSC_VER
|
||||
# define PATH_MAX MAX_PATH
|
||||
# endif
|
||||
# define sleep(x) Sleep(x * 1000)
|
||||
#endif
|
||||
|
||||
#if defined __GNUC__
|
||||
# define ATTR_FORMAT(STRINGPOS, FIRSTPOS) __attribute__((format(printf, STRINGPOS, FIRSTPOS)))
|
||||
#else
|
||||
# define ATTR_FORMAT(STRINGPOS, FIRSTPOS)
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user