1
0
mirror of https://github.com/anope/anope.git synced 2026-06-15 20:54:46 +02:00

Compare commits

...

95 Commits

Author SHA1 Message Date
Sadie Powell e9424b529c Release 2.1.2. 2024-02-17 18:14:10 +00:00
Sadie Powell a60c796cf6 Update the config changelog. 2024-02-17 18:13:30 +00:00
Sadie Powell fcf16ab20a Merge branch '2.0' into 2.1. 2024-02-11 21:35:31 +00:00
Sadie Powell 8e3be20387 Update the Windows dependencies. 2024-02-11 21:34:00 +00:00
Sadie Powell 689dd44d3b Add a GitHub security policy. 2024-02-11 21:32:23 +00:00
Sadie Powell a25d0aa60e Update the changelog. 2024-02-11 21:14:59 +00:00
Sadie Powell c50d1dc2b5 Remove some outdated development docs. 2024-02-11 21:08:17 +00:00
Sadie Powell 274bb19d03 Switch Thread to use the C++11 equivalent, remove win32/pthread. 2024-02-11 20:35:21 +00:00
Sadie Powell 2c5b84bd1d Replace Condition and Mutex with the C++11 standard equivalents. 2024-02-11 19:53:05 +00:00
Sadie Powell 5c50bcb9c7 Remove the time_t parameter from Tick and TickTimers.
Most uses of Tick do not use the parameter and even when it is used
it is always the same as CurTime.
2024-02-11 18:18:18 +00:00
Sadie Powell cef56abea4 Consistently use time_t for the timer duration. 2024-02-11 18:10:38 +00:00
Sadie Powell 30b9f12711 Remove the now parameter from the Timer class.
This was never actually changed from the default.
2024-02-11 17:56:35 +00:00
Sadie Powell c9e0245f23 Revert "Document ns_no_expire nick default".
This reverts commit 9c9df2ad1f.

Closes #350.
2024-02-11 16:22:01 +00:00
Robby 5337326cc9 Update the dutch language file. 2024-01-31 06:17:01 +01:00
Robby 73d8c85879 Update the dutch language file. 2024-01-31 06:17:00 +01:00
Robby 6237245ab7 Remove an extraneous space in cs_xop, part 2. 2024-01-31 03:20:35 +01:00
Robby 7ae20c2a6d Remove an extraneous space in cs_xop. 2024-01-31 03:08:54 +01:00
Robby ae1829e5a8 Fix a typo in the PASSWORD_TOO_SHORT text string. 2024-01-30 19:15:19 +01:00
Sadie Powell 026661c9a2 Fix irc2sql and webcpanel not being put into the modules folder. 2024-01-30 14:53:08 +00:00
Sadie Powell ec7223ace2 Convert map/multimap/hash_map to an alias template. 2024-01-30 14:29:17 +00:00
Sadie Powell 1f31621bbf Remove various references to old versions. 2024-01-30 14:01:07 +00:00
Sadie Powell dfd41b9b94 Fix Clang and GCC disagreeing about whether a move is needed. 2024-01-24 16:12:29 +00:00
Sadie Powell fdd4aade3b Add a CI workflow for Alpine. 2024-01-24 15:14:21 +00:00
Sadie Powell 0a53f4c26e Merge branch '2.0' into 2.1. 2024-01-24 14:48:53 +00:00
Sadie Powell d6a826a09c Backport CI changes from the 2.1 branch. 2024-01-24 14:45:57 +00:00
Sadie Powell 484160eb4e Shuffle modules around a bit. 2024-01-24 12:34:34 +00:00
Sadie Powell 7ac1fe5847 Rename several modules to remove the m_ prefix. 2024-01-24 12:22:51 +00:00
Sadie Powell 72acef4e15 Mark types that have no inheritors as final. 2024-01-23 16:53:06 +00:00
Sadie Powell a6a0f6c447 Improve the layout of types that inherit from another type. 2024-01-23 15:28:23 +00:00
Sadie Powell 398d674cf4 Fix some CoreExport types that should be DllExport. 2024-01-23 14:06:46 +00:00
Sadie Powell 1467de1c7e Mark all exception types as CoreExport.
From the GCC docs:

>Exception catching of a user defined type in a binary other than
>the one which threw the exception requires a typeinfo lookup.

Closes #335.
2024-01-22 20:06:57 +00:00
Sadie Powell c5023fdfa0 Update the Turkish translation for the changes in 2.1 git.
Co-authored-by: CaPa CuL <capacul@gmail.com>
2024-01-22 19:52:06 +00:00
Sadie Powell 97782248af Merge branch '2.0' into 2.1. 2024-01-22 18:35:12 +00:00
Sadie Powell 016761776b Add a new Turkish translation contributed by CaPa CuL.
Co-authored-by: CaPa CuL <capacul@gmail.com>
2024-01-22 16:29:20 +00:00
Victor Coss c2450eabab Fix typo 2024-01-22 00:38:23 +00:00
Sadie Powell d6ced86021 Fix some module names that were missed in commit 4056af00e3. 2024-01-11 17:13:14 +00:00
Sadie Powell 0d8d1675f7 Fix an oversight in build_subdir. 2024-01-10 17:49:02 +00:00
Sadie Powell 4056af00e3 Parse InspIRCd module names in a way which is 1206 compatible. 2024-01-10 17:47:27 +00:00
Sadie Powell 99b4305573 Add a wrapper for std::string::compare to Anope::string. 2024-01-10 17:07:17 +00:00
Sadie Powell 113301dbba Update the changelogs. 2024-01-09 21:25:44 +00:00
Sadie Powell 349ae043b6 Always build the stats modules.
These have no external dependencies so it makes no sense to not
always build them.
2024-01-09 21:25:44 +00:00
Sadie Powell 710e7dd3a2 Bump the minimum OpenSSL version to 1.1. 2024-01-09 21:25:44 +00:00
Sadie Powell 1e9c6d7931 Always disable SSLv3 support, allow disabling TLSv1.[012]. 2024-01-09 21:25:44 +00:00
Sadie Powell 5772b924cc Drop support for ancient versions of GnuTLS. 2024-01-09 21:25:44 +00:00
Sadie Powell fce5f4cc0f Update the default SSL filenames to use the Certbot names. 2024-01-09 21:25:44 +00:00
Sadie Powell fa7ad6b3df Use native file extensions on macOS and Windows. 2024-01-09 14:35:49 +00:00
Sadie Powell fc2df00cfc Put modules into their own folder on Windows. 2024-01-09 13:57:32 +00:00
Sadie Powell f92c5471c2 Add a string overload of Channel::Kick. 2024-01-08 14:37:50 +00:00
Sadie Powell 0439e3b21b Add a string overload of User::SetModes. 2024-01-08 14:14:57 +00:00
Sadie Powell 5b23fae8bf Add a string overload of Channel::SetModes. 2024-01-08 14:14:37 +00:00
Sadie Powell aac4b0f0a3 Bump the up to date languages for the recent format changes. 2024-01-08 13:47:39 +00:00
Sadie Powell f083795c79 Fix various format string issues. 2024-01-08 13:11:50 +00:00
Sadie Powell 5db79c1e24 Add a non-formatting overload of User::SetModesInternal. 2024-01-08 13:11:50 +00:00
Sadie Powell a4dddfd5f1 Mark format strings with the GNU printf attribute. 2024-01-08 13:11:50 +00:00
Valentin Lorentz 7ddc865cde fr_FR: Generalize gender-neutral grammar
'(e)' and 'le/la' were used in a few places, I generalized them to all
strings referring to people.

I also made role names gender-neutral using contraction (eg. "fondateur"
-> "fondateurice"), and adapted specifiers accordingly.
2024-01-06 23:22:10 +00:00
Sadie Powell 688ecf1c1d Fix an oversight in the mysql module. 2024-01-06 23:19:18 +00:00
Sadie Powell c0453cfec1 Fix a sign conversion issue in the mysql module. 2024-01-06 13:39:03 +00:00
Sadie Powell a9ab0c72a6 Use auto in places where the type is unambiguous. 2024-01-06 13:23:37 +00:00
Robert Scheck de918ef9cf Add missing whitespace in multi-line comment 2024-01-06 12:41:31 +00:00
Sadie Powell 0ee9874112 Update translations for the recent services case fix. 2024-01-05 21:44:08 +00:00
Val Lorentz 388858aee6 Fix inconsistent capitalization of 'services'. 2024-01-05 21:34:26 +00:00
Sadie Powell f22703df59 Fix a translation string and enable translations on CI. 2024-01-05 21:28:54 +00:00
Val Lorentz 4715b76dbe fr_FR: msgmerge + update fuzzy strings. 2024-01-05 21:21:43 +00:00
Sadie Powell 50bd385ccf Add an alias for chanserv/status for the name used by Atheme.
Closes #336.
2024-01-05 21:21:17 +00:00
Sadie Powell e738da9b11 Merge branch '2.0' into 2.1. 2024-01-05 19:52:56 +00:00
Val Lorentz 6e6e053384 fr_FR: Update fuzzy strings 2024-01-05 19:49:56 +00:00
Valentin Lorentz 5edf19d230 fr_FR: Fix trailing spaces 2024-01-05 19:00:19 +00:00
Sadie Powell 4573e1925d Use normal exit codes when exiting the process. 2024-01-05 12:00:28 +00:00
Sadie Powell a40f8e0b9d Update the copyright headers for 2024. 2024-01-04 22:25:48 +00:00
Sadie Powell 9db49ec790 Bump for 2.1.2-git. 2024-01-04 17:55:44 +00:00
Sadie Powell e8cd2909a5 Release 2.1.1. 2024-01-04 17:54:06 +00:00
Sadie Powell e7a57aa754 Update the changelog. 2024-01-04 17:53:05 +00:00
Sadie Powell 1c30f69bd0 Fix a typo in GetCommandLineArgument. 2024-01-04 17:52:30 +00:00
Sadie Powell eb2aaf22ed Fix a copy/paste error in the default channel settings. 2024-01-01 17:32:37 +00:00
k4be 36c43683e5 Remove unused strings from pl_PL 2023-12-27 15:06:30 +00:00
k4be 0b63a4244d Update pl_PL translation for 2.1 2023-12-27 15:06:30 +00:00
Sadie Powell 4a62259695 Move privilege descriptions to the example configs. 2023-12-22 15:58:28 +00:00
Sadie Powell 87e3d5a045 Remove an extraneous space in cs_xop. 2023-12-21 01:27:34 +00:00
Dragone2 2b8384bb39 Updates Italian translations for Anope 2.1 2023-12-21 00:47:47 +00:00
Sadie Powell 6d981960da Merge branch '2.0' into 2.1. 2023-12-20 00:07:51 +00:00
Sadie Powell aca9d30064 Tweak the issue templates slightly. 2023-12-19 21:21:39 +00:00
Sadie Powell b84b1d8166 Misc grammar fixes. 2023-12-17 19:32:45 +00:00
Sadie Powell 6acbd326f3 Add the regex_stdlib regular expression engine.
Unlike other regular expression engines this is available on all
systems.
2023-12-17 15:00:26 +00:00
Sadie Powell cb533b63ac Merge branch '2.0' into 2.1. 2023-12-17 14:33:44 +00:00
Sadie Powell 6538641e87 Remove some unnecessary spaces that break editor indentation. 2023-12-17 13:59:49 +00:00
Sadie Powell eb0e5c89b2 Remove the m_regex_pcre module.
Users should migrate to m_regex_pcre2 instead.
2023-12-17 13:46:34 +00:00
Mingjie Shen 8e2fa4acdb messages: fix incorrect format specifier
Calling a printf-like function with the wrong type of arguments causes
unpredictable behavior.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-12-08 17:16:53 +00:00
Sadie Powell 84c2f8d3fc Skip checking for chgrp/chmod on Windows. 2023-12-07 15:59:19 +00:00
Dragone2 8d99b3e2d7 Clean-ups old strings 2023-12-05 16:52:02 +00:00
Dragone2 b3ec2a5463 Adds new Italian translations 2023-12-05 16:52:02 +00:00
Sadie Powell 4c67f4393f Update the en_US translation. 2023-12-04 18:49:57 +00:00
Sadie Powell 4e9a2df827 Add the UNBANME privilege to allow users to unban themselves.
This is separate from the existing UNBAN privilege which applies
to all users.

Closes #331.
2023-11-30 14:38:20 +00:00
Sadie Powell 2d2d1972e9 Fix some modules that weren't converted to the new socket ctor.
Closes #330.
2023-11-26 13:26:38 +00:00
PeGaSuS cc9e2c1260 Fix missing end of comment 2023-11-24 21:04:05 +00:00
Sadie Powell 2b21264fb0 Bump for 2.1.1-git. 2023-11-24 13:37:11 +00:00
390 changed files with 9825 additions and 11070 deletions
+1 -1
View File
@@ -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**
+1 -1
View File
@@ -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**
+19
View File
@@ -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.
+58
View File
@@ -0,0 +1,58 @@
name: Alpine CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip alpine ci]')"
container: alpine:edge
runs-on: ubuntu-latest
env:
CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
apk update
apk add \
clang \
cmake \
g++ \
gettext \
git \
gnutls-dev \
mariadb-dev \
openldap-dev \
openssl-dev \
pcre2-dev \
samurai \
sqlite-dev \
tre-dev
- name: Enable extras
run: |
for MODULE in ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
do
ln -s $PWD/modules/extra/$MODULE.cpp $PWD/modules
done
- name: Run CMake
run: |
mkdir build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=$(readlink -f ../run) ..
- name: Build Anope
run: |
ninja -C build install
strategy:
fail-fast: false
matrix:
compiler:
- clang++
- g++
+10 -4
View File
@@ -1,44 +1,50 @@
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 \
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 ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
do
ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules
ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules
done
- name: Run CMake
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:
+1
View File
@@ -6,6 +6,7 @@ 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
+14 -14
View File
@@ -1,19 +1,19 @@
build/
config.cache
include/sysconf.h
modules/m_ldap.cpp
modules/m_ldap_authentication.cpp
modules/m_ldap_oper.cpp
modules/m_mysql.cpp
modules/m_regex_pcre.cpp
modules/m_regex_pcre2.cpp
modules/m_regex_posix.cpp
modules/m_regex_tre.cpp
modules/m_sql_authentication.cpp
modules/m_sql_log.cpp
modules/m_sql_oper.cpp
modules/m_sqlite.cpp
modules/m_ssl_gnutls.cpp
modules/m_ssl_openssl.cpp
modules/ldap.cpp
modules/ldap_authentication.cpp
modules/ldap_oper.cpp
modules/mysql.cpp
modules/regex_pcre2.cpp
modules/regex_posix.cpp
modules/regex_tre.cpp
modules/sql_authentication.cpp
modules/sql_log.cpp
modules/sql_oper.cpp
modules/sqlite.cpp
modules/ssl_gnutls.cpp
modules/ssl_openssl.cpp
modules/stats
run/
*.mo
+8 -3
View File
@@ -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
@@ -172,7 +175,7 @@ if(MSVC)
# 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
@@ -253,8 +256,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)
+1 -1
View File
@@ -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
View File
@@ -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)
+4 -4
View File
@@ -527,7 +527,7 @@ options
*
* 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.
@@ -1199,7 +1199,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 +1211,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"
}
@@ -1225,7 +1225,7 @@ module
*
* Without any encryption modules loaded users will not be able to authenticate unless
* there is another module loaded that provides authentication checking, such as
* m_ldap_authentication or m_sql_authentication.
* ldap_authentication or sql_authentication.
*
* With enc_none, passwords will be stored in plain text, allowing for passwords
* to be recovered later but it isn't secure and therefore is not recommended.
+2 -1
View File
@@ -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"
+55 -2
View File
@@ -93,8 +93,8 @@ 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, cs_secure,
* securefounder, and signkick. If you really want no defaults, use "none" by itself as the option.
*/
defaults = "keeptopic peace cs_secure securefounder signkick"
@@ -216,6 +216,7 @@ module
privilege
{
name = "ACCESS_CHANGE"
desc = _("Allowed to modify the access list")
rank = 0
level = 10
flag = "f"
@@ -232,6 +233,7 @@ privilege
privilege
{
name = "ACCESS_LIST"
desc = _("Allowed to view the access list")
rank = 10
level = 3
flag = "f"
@@ -248,6 +250,7 @@ privilege
privilege
{
name = "AKICK"
desc = _("Allowed to use the AKICK command")
rank = 250
level = 10
flag = "K"
@@ -264,6 +267,7 @@ privilege
privilege
{
name = "ASSIGN"
desc = _("Allowed to assign/unassign a bot")
rank = 270
level = "founder"
flag = "s"
@@ -280,6 +284,7 @@ privilege
privilege
{
name = "AUTOHALFOP"
desc = _("Automatic halfop upon join")
rank = 100
level = 4
flag = "H"
@@ -296,6 +301,7 @@ privilege
privilege
{
name = "AUTOOP"
desc = _("Automatic channel operator status upon join")
rank = 210
level = 5
flag = "O"
@@ -312,6 +318,7 @@ privilege
privilege
{
name = "AUTOOWNER"
desc = _("Automatic owner upon join")
rank = 330
level = 9999
flag = "Q"
@@ -328,6 +335,7 @@ privilege
privilege
{
name = "AUTOPROTECT"
desc = _("Automatic protect upon join")
rank = 240
level = 10
flag = "A"
@@ -344,6 +352,7 @@ privilege
privilege
{
name = "AUTOVOICE"
desc = _("Automatic voice on join")
rank = 50
level = 3
flag = "V"
@@ -360,6 +369,7 @@ privilege
privilege
{
name = "BADWORDS"
desc = _("Allowed to modify channel badwords list")
rank = 260
level = 10
flag = "K"
@@ -376,6 +386,7 @@ privilege
privilege
{
name = "BAN"
desc = _("Allowed to ban users")
rank = 150
level = 4
flag = "b"
@@ -392,6 +403,7 @@ privilege
privilege
{
name = "FANTASIA"
desc = _("Allowed to use fantasy commands")
rank = 30
level = 3
flag = "c"
@@ -411,6 +423,7 @@ privilege
privilege
{
name = "FOUNDER"
desc = _("Allowed to issue commands restricted to channel founders")
rank = 360
level = 10000
flag = "F"
@@ -428,6 +441,7 @@ privilege
privilege
{
name = "GETKEY"
desc = _("Allowed to use GETKEY command")
rank = 180
level = 5
flag = "G"
@@ -445,6 +459,7 @@ privilege
privilege
{
name = "HALFOP"
desc = _("Allowed to (de)halfop users")
rank = 120
level = 5
flag = "h"
@@ -462,6 +477,7 @@ privilege
privilege
{
name = "HALFOPME"
desc = _("Allowed to (de)halfop themself")
rank = 110
level = 4
flag = "h"
@@ -479,6 +495,7 @@ privilege
privilege
{
name = "INFO"
desc = _("Allowed to get full INFO output")
rank = 80
level = 9999
flag = "I"
@@ -496,6 +513,7 @@ privilege
privilege
{
name = "INVITE"
desc = _("Allowed to use the INVITE command")
rank = 190
level = 5
flag = "i"
@@ -512,6 +530,7 @@ privilege
privilege
{
name = "KICK"
desc = _("Allowed to use the KICK command")
rank = 130
level = 4
flag = "k"
@@ -529,6 +548,7 @@ privilege
privilege
{
name = "MEMO"
desc = _("Allowed to read channel memos")
rank = 280
level = 10
flag = "m"
@@ -546,6 +566,7 @@ privilege
privilege
{
name = "MODE"
desc = _("Allowed to use the MODE command")
rank = 170
level = 9999
flag = "s"
@@ -562,6 +583,7 @@ privilege
privilege
{
name = "NOKICK"
desc = _("Prevents users being kicked by services")
rank = 20
level = 1
flag = "N"
@@ -579,6 +601,7 @@ privilege
privilege
{
name = "OP"
desc = _("Allowed to (de)op users")
rank = 230
level = 5
flag = "o"
@@ -596,6 +619,7 @@ privilege
privilege
{
name = "OPME"
desc = _("Allowed to (de)op themself")
rank = 220
level = 5
flag = "o"
@@ -613,6 +637,7 @@ privilege
privilege
{
name = "OWNER"
desc = _("Allowed to (de)owner users")
rank = 350
level = "founder"
flag = "q"
@@ -630,6 +655,7 @@ privilege
privilege
{
name = "OWNERME"
desc = _("Allowed to (de)owner themself")
rank = 340
level = 9999
flag = "q"
@@ -647,6 +673,7 @@ privilege
privilege
{
name = "PROTECT"
desc = _("Allowed to (de)protect users")
rank = 310
level = 9999
flag = "a"
@@ -664,6 +691,7 @@ privilege
privilege
{
name = "PROTECTME"
desc = _("Allowed to (de)protect themself")
rank = 300
level = 10
flag = "a"
@@ -681,6 +709,7 @@ privilege
privilege
{
name = "SAY"
desc = _("Allowed to use SAY and ACT commands")
rank = 90
level = 5
flag = "B"
@@ -700,6 +729,7 @@ privilege
privilege
{
name = "SET"
desc = _("Allowed to set channel settings")
rank = 320
level = 9999
flag = "s"
@@ -717,6 +747,7 @@ privilege
privilege
{
name = "SIGNKICK"
desc = _("No signed kick when SIGNKICK LEVEL is used")
rank = 140
level = 9999
flag = "K"
@@ -733,6 +764,7 @@ privilege
privilege
{
name = "TOPIC"
desc = _("Allowed to change channel topics")
rank = 160
level = 5
flag = "t"
@@ -749,12 +781,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 +816,7 @@ privilege
privilege
{
name = "VOICE"
desc = _("Allowed to (de)voice users")
rank = 70
level = 4
flag = "v"
@@ -783,6 +834,7 @@ privilege
privilege
{
name = "VOICEME"
desc = _("Allowed to (de)voice themself")
rank = 60
level = 3
flag = "v"
@@ -1209,6 +1261,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
+1 -1
View File
@@ -5,7 +5,7 @@
module
{
name = "m_chanstats"
name = "chanstats"
/*
* The name of this engine.
+98 -82
View File
@@ -19,14 +19,14 @@
module { name = "help" }
/*
* m_dns
* dns
*
* Adds support for the DNS protocol. By itself this module does nothing useful,
* but other modules such as m_dnsbl and os_dns require this.
* but other modules such as dnsbl and os_dns require this.
*/
#module
{
name = "m_dns"
name = "dns"
/*
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
@@ -80,7 +80,7 @@ module { name = "help" }
}
/*
* m_dnsbl
* dnsbl
*
* Allows configurable DNS blacklists to check connecting users against. If a user
* is found on the blacklist they will be immediately banned. This is a crucial module
@@ -88,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 [EXTRA]
*
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
* LDAP to authenticate users. Requires m_ldap.
* LDAP to authenticate users. Requires ldap.
*/
#module
{
name = "m_ldap_authentication"
name = "ldap_authentication"
/*
* The distinguished name used for searching for users's accounts.
@@ -314,16 +314,16 @@ module { name = "help" }
}
/*
* m_ldap_oper [EXTRA]
* ldap_oper [EXTRA]
*
* This module dynamically ties users to Anope opertypes when they identify
* via LDAP group membership. Requires m_ldap.
* via LDAP group membership. Requires ldap.
*
* Note that this doesn't give the user privileges on the IRCd, only in 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,38 @@ module { name = "help" }
}
/*
* m_sasl
* sasl
*
* Some IRCds allow "SASL" authentication to let users identify to services
* during the IRCd user registration process. If this module is loaded, Anope will allow
* authenticating users through this mechanism. Supported mechanisms are:
* PLAIN, EXTERNAL.
*/
module { name = "m_sasl" }
module { name = "sasl" }
/*
* m_ssl_gnutls [EXTRA]
* ssl_gnutls [EXTRA]
*
* This module provides SSL services to Anope using GnuTLS, for example to
* connect to the uplink server(s) via SSL.
*
* You may only load either m_ssl_gnutls or m_ssl_openssl, but not both.
* You may only load either ssl_gnutls or ssl_openssl, but not both.
*/
#module
{
name = "m_ssl_gnutls"
name = "ssl_gnutls"
/*
* An optional certificate and key for m_ssl_gnutls to give to the uplink.
* An optional certificate and key for ssl_gnutls to give to the uplink.
*
* You can generate your own certificate and key pair by using:
*
* certtool --generate-privkey --bits 2048 --outfile anope.key
* certtool --generate-self-signed --load-privkey anope.key --outfile anope.crt
* certtool --generate-privkey --bits 2048 --outfile privkey.pem
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
*
*/
cert = "data/anope.crt"
key = "data/anope.key"
cert = "data/fullchain.pem"
key = "data/privkey.pem"
/*
* Diffie-Hellman parameters to use when acting as a server. This is only
@@ -591,49 +606,50 @@ module { name = "m_sasl" }
}
/*
* m_ssl_openssl [EXTRA]
* ssl_openssl [EXTRA]
*
* This module provides SSL services to Anope using OpenSSL, for example to
* connect to the uplink server(s) via SSL.
*
* You may only load either m_ssl_openssl or m_ssl_gnutls, but not both.
* You may only load either ssl_openssl or ssl_gnutls, but not both.
*
*/
#module
{
name = "m_ssl_openssl"
name = "ssl_openssl"
/*
* An optional certificate and key for m_ssl_openssl to give to the uplink.
* An optional certificate and key for ssl_openssl to give to the uplink.
*
* You can generate your own certificate and key pair by using:
*
* openssl genrsa -out anope.key 2048
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095
* openssl genrsa -out privkey.pem 2048
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
*/
cert = "data/anope.crt"
key = "data/anope.key"
cert = "data/fullchain.pem"
key = "data/privkey.pem"
/*
* As of 2014 SSL 3.0 is considered insecure, but it might be enabled
* on some systems by default for compatibility reasons.
* You can use the following option to enable or disable it explicitly.
* Leaving this option not set defaults to the default system behavior.
* If you wish to increase security you can disable support for older
* versions of TLS with no known vulnerabilities but that provide less
* security. For your security SSLv2 and SSLv3 are always disabled.
*/
#sslv3 = no
#tlsv10 = no
#tlsv11 = no
#tlsv12 = yes
}
/*
* m_sql_authentication [EXTRA]
* sql_authentication [EXTRA]
*
* This module allows authenticating users against an external SQL database using a custom
* query.
*/
#module
{
name = "m_sql_authentication"
name = "sql_authentication"
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
engine = "mysql/main"
/* Query to execute to authenticate. A non empty result from this query is considered a success,
@@ -675,7 +691,7 @@ module { name = "m_sasl" }
}
/*
* m_sql_log [EXTRA]
* sql_log [EXTRA]
*
* This module adds an additional target option to log{} blocks
* that allows logging Service's logs to SQL. To log to SQL, add
@@ -692,19 +708,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 [EXTRA]
*
* This module allows granting users services operator privileges and possibly IRC Operator
* privileges based on an external SQL database using a custom query.
*/
#module
{
name = "m_sql_oper"
name = "sql_oper"
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
engine = "mysql/main"
/* Query to execute to determine if a user should have operator privileges.
@@ -721,13 +737,13 @@ module { name = "m_sasl" }
}
/*
* m_sqlite [EXTRA]
* sqlite [EXTRA]
*
* This module allows other modules to use SQLite.
*/
#module
{
name = "m_sqlite"
name = "sqlite"
/* A SQLite database */
sqlite
@@ -747,7 +763,7 @@ module { name = "m_sasl" }
* as they could over IRC. If you are using the default configuration you should be able to access
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
*
* This module requires m_httpd.
* This module requires httpd.
*/
#module
{
@@ -764,23 +780,23 @@ module { name = "m_sasl" }
}
/*
* m_xmlrpc
* xmlrpc
*
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
*/
#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" }
-1
View File
@@ -111,7 +111,6 @@ 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
* memo_receive. If you really want no defaults, use "none" by itself as the option.
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -483,13 +483,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
View File
@@ -1 +0,0 @@
astyle --style=java --indent=tab --brackets=break-closing --indent-switches --indent-cases --brackets=break
-1
View File
@@ -1 +0,0 @@
For all bug reports / updates please see https://github.com/anope/anope/issues
-111
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+20
View File
@@ -1,3 +1,23 @@
Anope Version 2.1.2
-------------------
Bumped the minimum OpenSSL version to 1.1.0.
Bumped the minumum GnuTLS version to 3.0.0.
Disabled SSLv3 support in the m_ssl_openssl module.
Modernized mutex and thread code to use Modern C++.
Normalised the program exit codes.
Updated the Dutch translation.
Updated the French translation.
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.
+15 -2
View File
@@ -1,11 +1,24 @@
Anope Version 2.1.2
-------------------
Added module:tlsv10 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to no).
Added module:tlsv11 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to yes).
Added module:tlsv12 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to yes)
Removed module:sslv3 from m_ssl_openssl.
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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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.
-6
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+1 -1
View File
@@ -3,7 +3,7 @@
/**
* XMLRPC Functions
*
* (C) 2003-2023 Anope Team
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*/
+14 -12
View File
@@ -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 */
@@ -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 */
+11 -7
View File
@@ -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.
@@ -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;
public:
public:
Anope::string nick;
Anope::string last_quit;
Anope::string last_realname;
@@ -104,13 +106,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 */
@@ -244,11 +248,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;
+40 -26
View File
@@ -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.
*/
@@ -210,6 +210,10 @@ namespace Anope
inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); }
inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); }
inline int compare(size_t pos, size_t len, const string& str) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str())); }
inline int compare(size_t pos, size_t len, const string& str, size_t subpos, size_type sublen = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str()), subpos, sublen); }
inline int compare(size_t pos, size_t len, const char* s, size_type n = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, s, n); }
/**
* Determine if string consists of only numbers.
*/
@@ -308,7 +312,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 +320,7 @@ namespace Anope
}
};
struct hash_cs
struct hash_cs final
{
inline size_t operator()(const string &s) const
{
@@ -324,7 +328,7 @@ namespace Anope
}
};
struct compare
struct compare final
{
inline bool operator()(const string &s1, const string &s2) const
{
@@ -332,9 +336,14 @@ namespace Anope
}
};
template<typename T> class map : public std::map<string, T, ci::less> { };
template<typename T> class multimap : public std::multimap<string, T, ci::less> { };
template<typename T> class hash_map : public 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 hash_map = std::unordered_map<string, T, hash_ci, compare>;
#ifndef REPRODUCIBLE_BUILD
static const char *const compiled = __TIME__ " " __DATE__;
@@ -416,7 +425,7 @@ namespace Anope
* initializing language support, loading modules, and loading databases.
* @throws CoreException if something bad went wrong
*/
extern void Init(int ac, char **av);
extern bool Init(int ac, char **av);
/** Calls the save database event
*/
@@ -476,7 +485,7 @@ namespace Anope
* @param ... any number of parameters
* @return a Anope::string
*/
extern CoreExport string printf(const char *fmt, ...);
extern CoreExport string printf(const char *fmt, ...) ATTR_FORMAT(1, 2);
/** Return the last error code
* @return The error code
@@ -557,11 +566,11 @@ namespace Anope
*/
class CoreExport sepstream
{
private:
private:
/** Original string.
*/
Anope::string tokens;
/** Seperator value
/** Separator value
*/
char sep;
/** Current string position
@@ -570,7 +579,7 @@ 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);
@@ -624,9 +633,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 +644,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 +659,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 +699,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,9 +717,10 @@ class ModuleException : public CoreException
virtual ~ModuleException() noexcept = default;
};
class ConvertException : public CoreException
class CoreExport ConvertException final
: public CoreException
{
public:
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() noexcept = default;
+8 -7
View File
@@ -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)
+5 -3
View File
@@ -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;
+15 -10
View File
@@ -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.
@@ -18,7 +18,8 @@ typedef Anope::hash_map<Channel *> channel_map;
extern CoreExport channel_map ChannelList;
/* A user container, there is one of these per user per channel. */
struct ChanUserContainer : public Extensible
struct ChanUserContainer final
: public Extensible
{
User *user;
Channel *chan;
@@ -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();
@@ -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.
+13 -12
View File
@@ -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;
@@ -47,13 +47,13 @@ struct CoreExport CommandReply
};
/* 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 */
@@ -77,7 +77,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 +88,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 +98,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 +107,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 +117,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 +130,7 @@ class CoreExport Command : public Service
void AllowUnregistered(bool b);
void RequireUser(bool b);
public:
public:
bool AllowUnregistered() const;
bool RequireUser() const;
+12 -10
View File
@@ -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,11 +25,11 @@ namespace Configuration
{
friend struct Configuration::Conf;
public:
public:
typedef Anope::map<Anope::string> item_map;
typedef Anope::multimap<Block> block_map;
private:
private:
Anope::string name;
item_map items;
block_map blocks;
@@ -38,7 +38,7 @@ 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;
@@ -78,12 +78,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 +98,8 @@ namespace Configuration
struct Uplink;
struct CoreExport Conf : Block
struct CoreExport Conf final
: Block
{
/* options:readtimeout */
time_t ReadTimeout;
@@ -152,7 +153,7 @@ namespace Configuration
const Block *GetCommand(CommandSource &);
};
struct Uplink
struct Uplink final
{
Anope::string host;
unsigned port;
@@ -171,9 +172,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") { }
+1 -1
View File
@@ -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.
+26 -20
View File
@@ -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,7 +34,7 @@ class CoreExport ExtensibleBase : public Service
class CoreExport Extensible
{
public:
public:
std::set<ExtensibleBase *> extension_items;
virtual ~Extensible();
@@ -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()
@@ -124,45 +126,48 @@ class BaseExtensibleItem : public ExtensibleBase
};
template<typename T>
class ExtensibleItem : public BaseExtensibleItem<T>
class ExtensibleItem
: public BaseExtensibleItem<T>
{
protected:
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:
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:
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
@@ -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,7 +209,8 @@ 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) { }
};
+10 -7
View File
@@ -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
+4 -4
View File
@@ -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.
@@ -75,7 +75,7 @@ namespace Language
#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.")
@@ -111,9 +111,9 @@ namespace Language
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %d\002 to read it.")
"Type \002%s%s READ %s %zu\002 to read it.")
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
"Type \002%s%s READ %d\002 to read it.")
"Type \002%s%s READ %zu\002 to read it.")
#define MEMO_HAVE_NO_MEMOS _("You have no memos.")
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
+9 -9
View File
@@ -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
View File
@@ -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;
+5 -4
View File
@@ -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,10 @@ namespace Mail
extern CoreExport bool Validate(const Anope::string &email);
/* A email message being sent */
class Message : public Thread
class Message final
: public Thread
{
private:
private:
Anope::string sendmail_path;
Anope::string send_from;
Anope::string mail_to;
@@ -35,7 +36,7 @@ namespace Mail
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)
+5 -4
View File
@@ -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;
@@ -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;
+41 -21
View File
@@ -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,35 +21,40 @@
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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
@@ -67,105 +72,120 @@ 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, 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); }
+47 -34
View File
@@ -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;
+1 -1
View File
@@ -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 -14
View File
@@ -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(); }
@@ -1038,7 +1041,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
*/
@@ -1110,9 +1113,9 @@ enum Implementation
/** 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 +1198,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
+2 -2
View File
@@ -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;
};
+3 -3
View File
@@ -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;
};
+6 -5
View File
@@ -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,16 +16,17 @@ 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)
+6 -5
View File
@@ -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;
};
+2 -2
View File
@@ -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
View File
@@ -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);
+5 -4
View File
@@ -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.
@@ -18,16 +18,17 @@ namespace Encryption
class Context
{
public:
public:
virtual ~Context() = default;
virtual void Update(const unsigned char *data, size_t len) = 0;
virtual void Finalize() = 0;
virtual Hash GetFinalizedHash() = 0;
};
class Provider : public Service
class Provider
: public Service
{
public:
public:
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
virtual ~Provider() = default;
+17 -11
View File
@@ -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;
@@ -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;
+11 -9
View File
@@ -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
+6 -5
View File
@@ -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
@@ -63,9 +63,10 @@ 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;
+5 -4
View File
@@ -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,13 +27,14 @@ 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;
+6 -5
View File
@@ -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;
+7 -5
View File
@@ -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;
+7 -5
View File
@@ -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 */
@@ -31,9 +32,10 @@ struct Exception : Serializable
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;
+4 -3
View File
@@ -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")
{
}
+4 -3
View File
@@ -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 GlobalService : public Service
class GlobalService
: public Service
{
public:
public:
GlobalService(Module *m) : Service(m, "GlobalService", "Global")
{
}
+4 -3
View File
@@ -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,
+4 -3
View File
@@ -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")
{
}
+6 -5
View File
@@ -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;
+11 -8
View File
@@ -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,9 +22,10 @@ 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;
@@ -60,9 +61,10 @@ 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); }
@@ -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
+2 -2
View File
@@ -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;
};
+14 -12
View File
@@ -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,9 +11,10 @@
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;
@@ -81,9 +82,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 +93,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;
@@ -139,12 +140,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 +188,7 @@ namespace SQL
*/
class Interface
{
public:
public:
Module *owner;
Interface(Module *m) : owner(m) { }
@@ -199,9 +200,10 @@ namespace SQL
/** Class providing the SQL service, modules call this to execute queries
*/
class Provider : public Service
class Provider
: public Service
{
public:
public:
Provider(Module *c, const Anope::string &n) : Service(c, "SQL::Provider", n) { }
virtual void Run(Interface *i, const Query &query) = 0;
+4 -3
View File
@@ -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 -1
View File
@@ -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.
+7 -6
View File
@@ -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,11 +10,11 @@
#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;
@@ -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;
+4 -4
View File
@@ -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.
*/
@@ -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;
+24 -22
View File
@@ -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,13 +17,14 @@
#include "modes.h"
/* Encapsulates the IRCd protocol we are speaking. */
class CoreExport IRCDProto : public Service
class CoreExport IRCDProto
: public Service
{
Anope::string proto_name;
protected:
protected:
IRCDProto(Module *creator, const Anope::string &proto_name);
public:
public:
virtual ~IRCDProto();
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &);
@@ -128,27 +129,27 @@ class CoreExport IRCDProto : public Service
* @param user The user to be killed
* @param fmt Kill reason
*/
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...);
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...) ATTR_FORMAT(4, 5);
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 SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...) ATTR_FORMAT(4, 5);
/** 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 char *fmt, ...) ATTR_FORMAT(5, 6);
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 SendQuit(User *u, const char *fmt, ...) ATTR_FORMAT(3, 4);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
@@ -160,7 +161,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 char *fmt, ...) ATTR_FORMAT(4, 5);
/** Force joins a user that isn't ours to a channel.
* @param bi The source of the message
@@ -179,7 +180,7 @@ class CoreExport IRCDProto : public Service
virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
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 char *fmt, ...) ATTR_FORMAT(3, 4);
/** Sends a nick change of one of our clients.
*/
@@ -210,7 +211,7 @@ 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 SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendLogin(User *u, NickAlias *na) = 0;
virtual void SendLogout(User *u) = 0;
@@ -244,13 +245,13 @@ class CoreExport IRCDProto : public Service
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:
public:
MessageSource(const Anope::string &);
MessageSource(User *u);
MessageSource(Server *s);
@@ -268,12 +269,13 @@ enum IRCDMessageFlag
IRCDMESSAGE_REQUIRE_USER
};
class CoreExport IRCDMessage : public Service
class CoreExport IRCDMessage
: public Service
{
Anope::string name;
unsigned param_count;
std::set<IRCDMessageFlag> flags;
public:
public:
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
unsigned GetParamCount() const;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) = 0;
@@ -283,7 +285,7 @@ class CoreExport IRCDMessage : public Service
};
/** 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 +294,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);
+9 -6
View File
@@ -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.
@@ -21,9 +21,10 @@ typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
/* AutoKick data. */
class CoreExport AutoKick : public Serializable
class CoreExport AutoKick final
: public Serializable
{
public:
public:
/* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci;
@@ -43,18 +44,20 @@ class CoreExport AutoKick : public Serializable
/* 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;
+9 -7
View File
@@ -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;
};
+15 -12
View File
@@ -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,
@@ -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 */
@@ -107,7 +108,8 @@ 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 &);
@@ -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;
@@ -196,7 +198,7 @@ class Serialize::Checker
type->Check();
}
public:
public:
Checker(const Anope::string &n) : name(n) { }
inline const T* operator->() const
@@ -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)
+7 -6
View File
@@ -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,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
View File
@@ -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);
+1 -1
View File
@@ -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.
+3 -3
View File
@@ -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;
+35 -28
View File
@@ -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
@@ -316,10 +318,10 @@ class CoreExport BufferedSocket : public virtual Socket
/** 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
*/
+10 -1
View File
@@ -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,6 +14,9 @@
// 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
@@ -31,3 +34,9 @@
# 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
+9 -59
View File
@@ -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,15 +14,19 @@
#include "sockets.h"
#include "extensible.h"
class CoreExport Thread : public Pipe, public Extensible
#include <thread>
class CoreExport Thread
: public Pipe
, public Extensible
{
private:
private:
/* Set to true to tell the thread to finish and we are waiting for it */
bool exit = false;
public:
public:
/* Handle for this thread */
pthread_t handle;
std::thread *handle = nullptr;
/** Threads destructor
*/
@@ -57,57 +61,3 @@ class CoreExport Thread : public Pipe, public Extensible
*/
virtual void Run() = 0;
};
class CoreExport Mutex
{
protected:
/* A mutex, used to keep threads in sync */
pthread_mutex_t mutex;
public:
/** Constructor
*/
Mutex();
/** Destructor
*/
~Mutex();
/** Attempt to lock the mutex, will hang until a lock can be achieved
*/
void Lock();
/** Unlock the mutex, it must be locked first
*/
void Unlock();
/** Attempt to lock the mutex, will return true on success and false on fail
* Does not block
* @return true or false
*/
bool TryLock();
};
class CoreExport Condition : public Mutex
{
private:
/* A condition */
pthread_cond_t cond;
public:
/** Constructor
*/
Condition();
/** Destructor
*/
~Condition();
/** Called to wakeup the waiter
*/
void Wakeup();
/** Called to wait for a Wakeup() call
*/
void Wait();
};
+11 -22
View File
@@ -1,6 +1,6 @@
/* Timer include stuff.
*
* (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,42 +15,36 @@
class CoreExport Timer
{
private:
private:
/** The owner of the timer, if any
*/
Module *owner;
/** The time this was created
*/
time_t settime;
/** The triggering time
*/
time_t trigger;
/** Numer of seconds between triggers
/** Number of seconds between triggers
*/
long secs;
time_t secs;
/** True if this is a repeating timer
*/
bool repeat;
public:
public:
/** Constructor, initializes the triggering time
* @param time_from_now The number of seconds from now to trigger the timer
* @param now The time now
* @param repeating Repeat this timer every time_from_now if this is true
*/
Timer(long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
Timer(time_t time_from_now, bool repeating = false);
/** Constructor, initializes the triggering time
* @param creator The creator of the timer
* @param time_from_now The number of seconds from now to trigger the timer
* @param now The time now
* @param repeating Repeat this timer every time_from_now if this is true
*/
Timer(Module *creator, long time_from_now, time_t now = Anope::CurTime, bool repeating = false);
Timer(Module *creator, time_t time_from_now, bool repeating = false);
/** Destructor, removes the timer from the list
*/
@@ -81,11 +75,6 @@ class CoreExport Timer
*/
long GetSecs() const;
/** Returns the time this timer was created
* @return The time this timer was created
*/
time_t GetSetTime() const;
/** Returns the owner of this timer, if any
* @return The owner of the timer
*/
@@ -94,19 +83,19 @@ class CoreExport Timer
/** Called when the timer ticks
* This should be overridden with something useful
*/
virtual void Tick(time_t ctime) = 0;
virtual void Tick() = 0;
};
/** This class manages sets of Timers, and triggers them at their defined times.
* This will ensure timers are not missed, as well as removing timers that have
* expired and allowing the addition of new ones.
*/
class CoreExport TimerManager
class CoreExport TimerManager final
{
/** A list of timers
*/
static std::multimap<time_t, Timer *> Timers;
public:
public:
/** Add a timer to the list
* @param t A Timer derived class to add
*/
@@ -120,7 +109,7 @@ class CoreExport TimerManager
/** Tick all pending timers
* @param ctime The current time
*/
static void TickTimers(time_t ctime = Anope::CurTime);
static void TickTimers();
/** Deletes all timers owned by the given module
*/
+7 -5
View File
@@ -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,9 +20,11 @@ namespace Uplink
}
/* This is the socket to our uplink */
class UplinkSocket : public ConnectionSocket, public BufferedSocket
class UplinkSocket final
: public ConnectionSocket
, public BufferedSocket
{
public:
public:
bool error;
UplinkSocket();
~UplinkSocket();
@@ -31,12 +33,12 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
void OnError(const Anope::string &) override;
/* A message sent over the uplink socket */
class CoreExport Message
class CoreExport Message final
{
MessageSource source;
std::stringstream buffer;
public:
public:
Message();
Message(const MessageSource &);
~Message();
+15 -10
View File
@@ -1,7 +1,7 @@
/*
*
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2003-2023 Anope Team <team@anope.org>
* (C) 2003-2024 Anope Team <team@anope.org>
*
* Please read COPYING and README for further details.
*
@@ -28,16 +28,19 @@ extern CoreExport unsigned MaxUserCount;
extern CoreExport time_t MaxUserTime;
/* Online user and channel data. */
class CoreExport User : public virtual Base, public Extensible, public CommandReply
class CoreExport User
: public virtual Base
, public Extensible
, public CommandReply
{
/* true if the user was quit or killed */
bool quit;
/* Users that are in the process of quitting */
static std::list<User *> quitting_users;
public:
public:
typedef std::map<Anope::string, Anope::string> ModeList;
protected:
protected:
Anope::string vident;
Anope::string ident;
Anope::string uid;
@@ -54,7 +57,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
time_t invalid_pw_time;
public: // XXX: exposing a tiny bit too much
public: // XXX: exposing a tiny bit too much
/* User's current nick */
Anope::string nick;
@@ -90,7 +93,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/* Last time this user sent an email */
time_t lastmail;
protected:
protected:
/** Create a new user object, initialising necessary fields and
* adds it to the hash
*
@@ -112,7 +115,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/
virtual ~User();
public:
public:
static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
/** Update the nickname of a user record accordingly, should be
@@ -188,7 +191,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param fmt Format of the Message
* @param ... any number of parameters
*/
void SendMessage(BotInfo *source, const char *fmt, ...);
void SendMessage(BotInfo *source, const char *fmt, ...) ATTR_FORMAT(3, 4);
void SendMessage(BotInfo *source, const Anope::string &msg) override;
/** Identify the user to a nick.
@@ -302,13 +305,15 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param bi The client setting the modes
* @param umodes The modes
*/
void SetModes(BotInfo *bi, const char *umodes, ...);
void SetModes(BotInfo *bi, const char *umodes, ...) ATTR_FORMAT(3, 4);
void SetModes(BotInfo *bi, const Anope::string &umodes);
/** Set a string of modes on a user internally
* @param setter who/what is setting the mode
* @param umodes The modes
*/
void SetModesInternal(const MessageSource &source, const char *umodes, ...);
void SetModesInternal(const MessageSource &source, const char *umodes, ...) ATTR_FORMAT(3, 4);
void SetModesInternal(const MessageSource &source, const Anope::string &umodes);
/** Get modes set for this user.
* @return A string of modes set on the user
+6 -6
View File
@@ -1,6 +1,6 @@
/* Build bumper
*
* (C) 2003-2023 Anope Team
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
@@ -172,19 +172,19 @@ int main(int argc, char *argv[])
std::map<std::string, std::string> versions, old_versions;
if (!read_version_sh(version_sh, versions))
return -1;
return EXIT_FAILURE;
std::string git_version = get_git_hash(git_dir);
if (!write_build_h(buildh, git_version))
return -1;
return EXIT_FAILURE;
read_version_h(versionh, old_versions);
if (versions == old_versions)
return 0;
return EXIT_SUCCESS;
if (!write_version_h(versionh, versions))
return -1;
return EXIT_FAILURE;
return 0;
return EXIT_SUCCESS;
}
+7 -5
View File
@@ -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.
@@ -13,11 +13,12 @@
#include "sockets.h"
/* An Xline, eg, anything added with operserv/akill, or any of the operserv/sxline commands */
class CoreExport XLine : public Serializable
class CoreExport XLine final
: public Serializable
{
void Init();
Anope::string nick, user, host, real;
public:
public:
cidr *c;
Anope::string mask;
Regex *regex;
@@ -48,14 +49,15 @@ class CoreExport XLine : public Serializable
};
/* Managers XLines. There is one XLineManager per type of XLine. */
class CoreExport XLineManager : public Service
class CoreExport XLineManager
: public Service
{
char type;
/* List of XLines in this XLineManager */
Serialize::Checker<std::vector<XLine *> > xlines;
/* Akills can have the same IDs, sometimes */
static Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID;
public:
public:
/* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers;
+1 -1
View File
@@ -2760,7 +2760,7 @@ msgstr ""
msgid ""
"Alternative methods of modifying channel access lists are\n"
"available. "
"available."
msgstr ""
#, fuzzy
+1 -1
View File
@@ -2540,7 +2540,7 @@ msgstr ""
msgid ""
"Alternative methods of modifying channel access lists are\n"
"available. "
"available."
msgstr "Alternative Methoden zum Bearbeiten der Kanalzugangsliste sind verfügbar."
msgid "Approve the requested vHost of a user"

Some files were not shown because too many files have changed in this diff Show More