1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 01:33:12 +02:00

Compare commits

..

108 Commits

Author SHA1 Message Date
Sadie Powell 15f5be76b9 Bump for 2.0.21-git. 2026-05-26 18:00:50 +01:00
Sadie Powell 12f1ebee1c Release 2.0.20. 2026-05-26 17:59:50 +01:00
Sadie Powell 8e691eac80 Update the change log. 2026-05-26 10:44:44 +01:00
Sadie Powell 2327c6ac9a Fix an escaped value that wasn't escaped enough in chanstats. 2026-05-26 10:36:50 +01:00
Sadie Powell e23ea8f8ea Escape user-provided values in ldap_authentication and ldap_oper. 2026-05-26 09:30:15 +01:00
Sadie Powell 449cfa6503 Add EscapeDN and EscapeSF to the LDAP API. 2026-05-26 09:29:57 +01:00
Sadie Powell 01fc7421b6 Backport the pull request checks from 2.0. 2026-05-20 22:13:38 +01:00
Sadie Powell e6d7306202 Backport the mailmap changes from 2.1. 2026-05-12 11:26:06 +01:00
Sadie Powell 2107d18d9e Remove suggestion to email language file updates to team@.
Its 2026 and its way easier for everyone involved to just file a
pull request.
2026-05-11 13:00:55 +01:00
Sadie Powell acb9428635 Backport the locales-all advice from 2.1. 2026-05-11 12:58:47 +01:00
Sadie Powell 27a19dcc52 Update the mailmap. 2026-05-06 11:59:03 +01:00
Sadie Powell ba26d9a15c Add a missing FNAME handler on InspIRCd 3+.
Closes #572.
2026-04-16 11:50:10 +01:00
Sadie Powell 9834040948 Fix checking the wrong config option in os_stats. 2026-03-11 16:41:50 +00:00
Sadie Powell bc9e035038 Extract all public types in Doxygen documentation. 2026-01-30 08:51:21 +00:00
Sadie Powell debfa59be6 Bump for 2.0.20-git. 2026-01-26 13:55:35 +00:00
Sadie Powell e321749d1f Release 2.0.19. 2026-01-26 13:53:05 +00:00
Sadie Powell 8a2d7526cd Update the change log. 2026-01-26 13:52:40 +00:00
Sadie Powell e1f34ee5d6 Add a Doxygen config file. 2026-01-26 13:11:17 +00:00
Sadie Powell 4ac5cf89e3 Update the copyright headers for 2025. 2026-01-01 18:04:37 +00:00
Sadie Powell f526932882 Backport CI changes from the 2.1 branch. 2025-12-03 16:26:32 +00:00
Sadie Powell 5a9f581491 Fix chanserv/enforce enforcing against founders.
Closes #532.
2025-12-03 16:18:50 +00:00
Sadie Powell f6c093ae23 Fix not respecting the mode state when removing a mode lock. 2025-11-13 13:23:05 +00:00
Sadie Powell f4c565aa08 Fix reading the settings in m_dns. 2025-11-09 15:56:30 +00:00
crazycatdevs f03e802f58 Fix creating channel entries in irc2sql.
Related to #526 : MySQL doesn't accept the timestamp in topictime, must use FROM_UNIXTIME() like it's done in OnTopicUpdated
2025-09-05 14:45:57 +01:00
Sadie Powell dbef7a7c64 Don't try to write to a buffered socket if there's no data.
This can cause the SSL modules to act weirdly because the TLS
library will return 0 bytes written (correctly) which is then
interpreted as an error.
2025-08-05 13:10:16 +01:00
Sadie Powell fca421aa2a Fix resetpass confirming accounts when not using email confirmation.
Fixes MantisBT bug 1734.
2025-06-25 17:36:16 +01:00
Sadie Powell 035905d321 Fix example messages using .site which is a real TLD now. 2025-06-25 15:39:35 +01:00
Sadie Powell 9bcf46f8ea Fix using service's instead of services' where appropriate. 2025-06-25 15:29:16 +01:00
Sadie Powell 0b6c7ce5d6 Update some messages for the language used by modern BIND versions. 2025-06-25 15:28:54 +01:00
Sadie Powell 0bb1bc5c67 Backport various minor config changes from 2.1. 2025-06-25 12:00:33 +01:00
Sadie Powell 4b15ca0232 Bump for 2.0.19-git. 2025-05-08 15:03:03 +01:00
Sadie Powell 997302f861 Release 2.0.18. 2025-05-08 15:01:58 +01:00
Sadie Powell b3b6e9f862 Update the change log. 2025-05-08 14:59:37 +01:00
Sadie Powell d23bfb0113 Fix being able to group guest nicknames.
This does not affect 2.1 because grouped nicknames work differently
on that branch.

Reported by @ValwareIRC.
2025-05-08 14:51:56 +01:00
Sadie Powell 151f9c2bcc Backport the Windows CI runner to 2.0.
[skip ubuntu ci]
2025-04-18 18:24:29 +01:00
Sadie Powell b9acaa6d51 Ask people to file PRs on GitHub as well as emailing team@. 2025-04-15 10:05:51 +01:00
Sadie Powell c6065ff0f3 Update the change log. 2025-04-02 23:00:12 +01:00
Sadie Powell a5aae4f41d Fix building in a post-CMP0082 world. 2025-04-02 23:00:12 +01:00
Sadie Powell 0b36ddfaf3 Fix building on old versions of RHEL. 2025-04-02 09:58:49 +01:00
Sadie Powell 947ddc9e1b Fix building on CMake 4.
This is a partial backport from 2.1.
2025-04-02 09:53:10 +01:00
Sadie Powell 43dc6f7509 Fix ns_maxemail miscounting email addresses in some cases. 2025-03-22 20:19:50 +00:00
Sadie Powell 883367c1d2 Fix importing some data from 1.8. 2025-03-12 00:33:41 +00:00
Sadie Powell 7f2c281121 Fix a compiler warning on newer versions of MSVC. 2025-03-03 22:46:12 +00:00
Robby b448a20f40 Update the dutch language file. 2025-02-23 04:22:33 +01:00
Sadie Powell 227caba783 Fix sql_live on recent MariaDB. 2025-02-20 13:05:22 +00:00
Sadie Powell b51dff0b1a Update the CI for the upcoming Ubuntu 20.04 removal. 2025-02-14 21:51:47 +00:00
Sadie Powell fbb8442252 Reset the stats properly.
Closes #465.
2025-02-14 18:15:51 +00:00
Sadie Powell 8110fddfe5 Document the sql_live performance limitations. 2025-02-14 18:09:34 +00:00
Sadie Powell 1f7aa241bb Prioritise operserv/ignore above other modules.
Closes #471.
2025-02-11 13:48:11 +00:00
Sadie Powell a8eda0676d Backport logging the reason sending email failed to the 2.0 branch.
Closes #463.
2025-01-23 19:23:32 +00:00
Sadie Powell da7f47c1c7 Update the copyright headers for 2025. 2025-01-14 13:30:07 +00:00
Sadie Powell a92f09153a Bump for 2.0.18-git. 2024-12-08 12:18:55 +00:00
Sadie Powell 73714420d1 Release 2.0.17. 2024-12-08 12:15:26 +00:00
Sadie Powell ea96f2ad40 Update the change log. 2024-12-08 12:13:28 +00:00
Sadie Powell 7083c424c2 Only process sockets after loading the db when using db_sql{_live}.
This avoids slow startups for the 95% of users who are using the
db_flatfile database backend.
2024-11-19 00:39:00 +00:00
Sadie Powell de16238e01 Process all socket events before connecting to the uplink.
This ensures that the SQL import actually succeeds before we do
something that might terminate the process.
2024-11-16 12:49:45 +00:00
Sadie Powell a668c8b520 Clarify how to import databases from flatfile to SQL.
Closes #456.
2024-11-15 15:57:41 +00:00
Sadie Powell 96ccfe4cbe Fix using User::Account where User::IsIdentified should be used.
The former causes a dereference which cause a database update. This
is not good for performance with db_sql_live on bigger networks.
2024-11-11 16:46:56 +00:00
Sadie Powell ee160842b3 Fix serialising boolean extension items. 2024-11-11 15:24:40 +00:00
Sadie Powell 98c840eb02 Expand the size of some chanstats columns.
Closes #444.
2024-11-07 12:31:47 +00:00
Sadie Powell 7d5ca5c90b Switch the city version of geoipupdate to a non-corrupt database.
Closes #439.
2024-10-27 16:13:51 +00:00
Sadie Powell f40719787f Fix a change that was missing from the previous commit. 2024-10-18 11:45:19 +01:00
Sadie Powell e5602f956d Fix marking channels as persistent on InspIRCd and UnrealIRCd. 2024-10-18 11:26:03 +01:00
Sadie Powell e704fa6266 Update the IRC server to point to Teranova. 2024-10-13 17:15:26 +01:00
Sadie Powell bafcba023c Switch geoipupdate.sh to use a mirror as the original data is gone. 2024-10-12 12:01:00 +01:00
Sadie Powell 6d34054b78 Change the mode lock before removing/adding the PERM mode.
This fixes being unable to unset mlock on the first attempt.
2024-10-11 15:45:02 +01:00
Sadie Powell cc37e6d69a Remove config option for options:warningtimeout.
This hasn't done anything since the early 1.9 releases I'm not sure
why it hasn't been removed already.
2024-09-17 12:27:13 +01:00
TehPeGaSuS 4b48fc98d3 Fix the documentation of mail:usemail.
`nickserv:registration` only has as options: none, admin, mail.

I assume that `mail` is the word that should replace `yes`
2024-09-01 09:41:32 +01:00
Sadie Powell 6da4a148fa Fix translating mail:memo_message. 2024-08-24 12:27:05 +01:00
Sadie Powell 63ad540e55 Add a note to LANGUAGE about rebuilding from scratch. 2024-07-20 19:25:58 +01:00
Sadie Powell a1165eea94 Fix the type of the InspIRCd IJOIN chants when converting. 2024-07-20 19:25:58 +01:00
Sadie Powell bfca74f6b3 Bump for 2.0.17-git. 2024-07-19 13:24:41 +01:00
Sadie Powell 3acf74483c Release 2.0.16. 2024-07-19 12:49:56 +01:00
Sadie Powell a3ec8329f4 Document the previous commit. 2024-07-19 12:48:44 +01:00
Sadie Powell 31bc597c81 Send the vhost/vident before the account name on InspIRCd.
This fixes IRCd-side account cloaks causing CHGHOST spam.
2024-07-19 01:11:32 +01:00
Sadie Powell 2de0dddb1c Fix joining channels with keys on InspIRCd v3. 2024-07-14 16:39:37 +01:00
Sadie Powell 41ea346551 Update the change log. 2024-07-11 01:13:59 +01:00
Sadie Powell 439ad3e736 Make it clear that inspircd3 also works with InspIRCd 4. 2024-07-11 01:13:59 +01:00
Sadie Powell 8105607257 Fix the default config for channel suspensions. 2024-06-23 13:51:53 +01:00
Sadie Powell ccc088d946 Log a user out fully when their nick gets suspended.
Closes #409.
2024-06-04 22:41:32 +01:00
Sadie Powell 8bb83f6b1a Explicitly specify ROW_FORMAT=DYNAMIC when creating tables.
Resolves the issues some people were having with extremely wide rows.
2024-05-16 17:29:25 +01:00
Sadie Powell da99a53dfa Don't specify a width for DT_INT columns.
This isn't actually used by MySQL for the column width.
2024-05-16 17:28:15 +01:00
Sadie Powell a9e9ac32a0 Store boolean extension items as DT_INT. 2024-05-16 17:28:15 +01:00
Sadie Powell 05e6df23a2 Mark boolean columns as DT_INT in bs_kick. 2024-05-16 16:50:41 +01:00
Sadie Powell 3f9fc23270 Remove some unnecessary advice. 2024-05-16 16:44:38 +01:00
Sadie Powell afe87bf693 Ensure we are connected to MySQL before trying to escape data. 2024-05-11 11:36:29 +01:00
Sadie Powell 0c5bf51378 Skip serializing data without a type in db_flatfile. 2024-04-29 08:16:45 +01:00
Sadie Powell d41764bfd6 Fix sending emails to nicks ending with a backslash. 2024-03-15 18:52:12 +00:00
Sadie Powell 10f4724b6b Dependabot requires that the target-branch is a string. 2024-03-15 12:17:15 +00:00
Sadie Powell 8d5be77c93 Send dependabot pull requests to the 2.1 branch. 2024-03-15 11:56:56 +00:00
Sadie Powell f4bd43e898 Add a workaround for users matching expired sqlines.
I'll fix this properly in 2.1 because I don't want to make big
changes to 2.0.

Closes #384.
2024-03-12 16:47:57 +00:00
Sadie Powell 7d7664444a Fix expiring forbids. 2024-03-12 16:26:33 +00:00
Sadie Powell 1a8bbd6004 Respect --noexpire in cs_suspend and ns_suspend. 2024-03-12 14:43:12 +00:00
Sadie Powell e725c880a9 Fix expiring channel suspensions.
Closes #386.
2024-03-12 14:12:37 +00:00
Sadie Powell f5abcd1c4c Fix expiring nick suspensions.
Closes #376.
2024-03-12 14:02:16 +00:00
Sadie Powell 1986aa6581 Fix duplicate messages when synconset/syncongroup is set.
Closes #366.
2024-03-12 13:26:25 +00:00
Sadie Powell 1a6060ac5b Fix sending SVSTOPIC when topiclock is loaded on InspIRCd. 2024-03-12 11:46:41 +00:00
Sadie Powell 6f57907416 Fix the TIME message on InspIRCd. 2024-03-11 22:38:15 +00:00
Bram Matthys b09632d1c3 Fix OS SQLINE expiry with UnrealIRCd 2024-03-11 18:30:55 +00:00
Sadie Powell cd614831de Fix feature detection on InspIRCd. 2024-03-08 16:49:55 +00:00
Sadie Powell 9649dc78a1 When using ldap/sql auth prevent displays expiring before their group.
This prevents zombie accounts from being left around that can't be
authenticated to.

Closes #355.
2024-03-04 12:08:28 +00:00
Sadie Powell ee7455daa8 Fix a copy/paste error in webcpanel. 2024-02-29 16:27:24 +00:00
Sadie Powell 5f735b2570 Fix matching extbans on InspIRCd and implement missing matchers. 2024-02-27 20:33:43 +00:00
Sadie Powell 4ea2bc5e46 Mark as 2.0.16-git. 2024-02-17 20:08:10 +00:00
Sadie Powell eabc8b641e Release 2.0.15. 2024-02-17 20:07:09 +00:00
Sadie Powell 2f1ed186d1 Update the change log. 2024-02-17 20:06:08 +00:00
Sadie Powell 4cc68397dc Update the copyright headers for 2024. 2024-02-17 19:58:17 +00:00
Sadie Powell 2b7872139c Prevent resetting the password of suspended accounts.
Closes #351.
2024-02-17 19:52:39 +00:00
407 changed files with 19218 additions and 11742 deletions
+2 -2
View File
@@ -7,11 +7,11 @@
| | | |
|_| IRC Services |_| IRC Services
CURVER CURVER
This program will help you to compile your services, and ask you This program will help you to compile your Services, and ask you
questions regarding the compile-time settings of it during the questions regarding the compile-time settings of it during the
process. For more options type SOURCE_DIR/Config --help process. For more options type SOURCE_DIR/Config --help
Anope is a set of services for IRC networks that allows users to Anope is a set of Services for IRC networks that allows users to
manage their nicks and channels in a secure and efficient way, manage their nicks and channels in a secure and efficient way,
and administrators to manage their network with powerful tools. and administrators to manage their network with powerful tools.
+14
View File
@@ -24,3 +24,17 @@ I have tested this pull request on:
**Operating system name and version:** <!-- e.g. Linux 3.11 --> **Operating system name and version:** <!-- e.g. Linux 3.11 -->
**Compiler name and version:** <!-- e.g. GCC 4.2.0 --> **Compiler name and version:** <!-- e.g. GCC 4.2.0 -->
## Checks
<!--
Tick the boxes for the checks you have made.
-->
I have ensured that:
- [ ] The code I am submitting is my own work and/or I have permission from the author to share it.
- [ ] Generative AI (Copilot, ChatGPT, etc) was not used to create any part of this pull request.
- [ ] If the pull request contains a security fix I have followed the reporting rules mentioned in [the security policy](https://github.com/anope/anope/security/policy) (delete if not applicable).
- [ ] I have documented any features added by this pull request (delete if not applicable).
- [ ] This pull request does not introduce any incompatible API changes (stable branches only, delete if not applicable).
+1 -1
View File
@@ -14,6 +14,6 @@ Version | Supported
## Reporting a Vulnerability ## 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. 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.teranova.net #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. We will triage your issue as soon as possible and try to release a fixed version within a week of receiving your report.
+1
View File
@@ -4,3 +4,4 @@ updates:
directory: / directory: /
schedule: schedule:
interval: monthly interval: monthly
target-branch: "2.1"
-58
View File
@@ -1,58 +0,0 @@
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 -5
View File
@@ -2,15 +2,16 @@ name: Ubuntu CI
on: on:
- pull_request - pull_request
- push - push
- workflow_dispatch
jobs: jobs:
build: build:
if: "!contains(github.event.head_commit.message, '[skip ubuntu ci]')" if: "!contains(github.event.head_commit.message, '[skip ubuntu ci]')"
runs-on: ubuntu-20.04 runs-on: ubuntu-24.04
env: env:
CXX: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror CXXFLAGS: -std=${{ matrix.standard }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- name: Install dependencies - name: Install dependencies
run: | run: |
@@ -24,6 +25,7 @@ jobs:
libldap2-dev \ libldap2-dev \
libmysqlclient-dev \ libmysqlclient-dev \
libpcre2-dev \ libpcre2-dev \
libpcre3-dev \
libsqlite3-dev \ libsqlite3-dev \
libssl-dev \ libssl-dev \
libtre-dev \ libtre-dev \
@@ -31,9 +33,9 @@ jobs:
- name: Enable extras - name: Enable extras
run: | 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 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
do do
ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules
done done
- name: Run CMake - name: Run CMake
@@ -51,3 +53,6 @@ jobs:
compiler: compiler:
- clang++ - clang++
- g++ - g++
standard:
- c++98
- c++17
+47 -8
View File
@@ -2,34 +2,73 @@ name: Windows CI
on: on:
pull_request: pull_request:
push: push:
schedule: release:
- cron: '0 0 * * 0' types:
- published
workflow_dispatch:
jobs: jobs:
build: build:
if: "!contains(github.event.head_commit.message, '[skip windows ci]')" if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
runs-on: windows-2019 runs-on: windows-2025
env:
BUILD_TYPE: ${{ github.event_name == 'release' && 'Release' || 'Debug' }}
CONAN_USER_HOME: ${{ github.workspace }}/win/build
CONAN_USER_HOME_SHORT: None
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v6
- name: Setup NSIS
run: |-
choco install nsis
- name: Setup MSBuild - name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3 uses: microsoft/setup-msbuild@v2
- name: Setup Conan - name: Setup Conan
uses: turtlebrowser/get-conan@v1.2 uses: turtlebrowser/get-conan@v1.2
with: with:
version: 1.59.0 version: 1.66.0
- name: Try to restore libraries from the cache
uses: actions/cache/restore@v4
id: library-cache
with:
key: conan-${{ hashFiles('src/win32/conanfile.txt') }}
path: ${{ env.CONAN_USER_HOME }}/.conan
- name: Install libraries - name: Install libraries
run: | run: |
conan install ${{ github.workspace }}\src\win32 --build=missing conan install ${{ github.workspace }}\src\win32 --build=missing
- name: Save libraries to the cache
if: ${{ steps.library-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
key: ${{ steps.library-cache.outputs.cache-primary-key }}
path: ${{ env.CONAN_USER_HOME }}/.conan
- name: Run CMake - name: Run CMake
run: | run: |
mkdir ${{ github.workspace }}\build mkdir ${{ github.workspace }}\build
cd ${{ github.workspace }}\build cd ${{ github.workspace }}\build
cmake -A "x64" -G "Visual Studio 16 2019" .. cmake -A x64 -D "CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}" -G "Visual Studio 17 2022" ..
- name: Build Anope - name: Build Anope
working-directory: ${{ github.workspace }}\build working-directory: ${{ github.workspace }}\build
run: | run: |
msbuild PACKAGE.vcxproj /M:3 /P:Configuration=Release /P:Platform=x64 /VERBOSITY:MINIMAL msbuild PACKAGE.vcxproj /M:5 /P:Configuration=${{ env.BUILD_TYPE }} /P:Platform=x64 /VERBOSITY:MINIMAL
- name: Upload installer
if: "${{ github.event_name == 'release' }}"
working-directory: ${{ github.workspace }}\build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} $(Get-ChildItem anope-*.exe)
- name: Upload artifact
if: "${{ github.event_name != 'release' }}"
uses: actions/upload-artifact@v5
with:
name: windows-installer
path: ${{ github.workspace }}\build\\anope-*.exe
+15 -14
View File
@@ -1,19 +1,20 @@
build/ build/
config.cache config.cache
docs/doxygen
include/sysconf.h include/sysconf.h
modules/ldap.cpp modules/m_ldap.cpp
modules/ldap_authentication.cpp modules/m_ldap_authentication.cpp
modules/ldap_oper.cpp modules/m_ldap_oper.cpp
modules/mysql.cpp modules/m_mysql.cpp
modules/regex_pcre2.cpp modules/m_regex_pcre.cpp
modules/regex_posix.cpp modules/m_regex_pcre2.cpp
modules/regex_tre.cpp modules/m_regex_posix.cpp
modules/sql_authentication.cpp modules/m_regex_tre.cpp
modules/sql_log.cpp modules/m_sql_authentication.cpp
modules/sql_oper.cpp modules/m_sql_log.cpp
modules/sqlite.cpp modules/m_sql_oper.cpp
modules/ssl_gnutls.cpp modules/m_sqlite.cpp
modules/ssl_openssl.cpp modules/m_ssl_gnutls.cpp
modules/m_ssl_openssl.cpp
modules/stats modules/stats
run/ run/
*.mo
+13 -3
View File
@@ -12,39 +12,49 @@ Charles Kingsley <chaz@anope.org>
Charles Kingsley <chaz@anope.org> <sjaz@5417fbe8-f217-4b02-8779-1006273d7864> Charles Kingsley <chaz@anope.org> <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>
Cronus <cronus@nite-serv.com> Cronus <cronus@nite-serv.com>
Daniel Engel <dane@zero.org> <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Daniel Engel <dane@zero.org> <dane dane@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
David Robson <rob@anope.org> <robbeh@5417fbe8-f217-4b02-8779-1006273d7864>
David Robson <rob@anope.org> <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> David Robson <rob@anope.org> <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
David Robson <rob@anope.org> <robbeh@5417fbe8-f217-4b02-8779-1006273d7864>
Dennis Friis <peavey@inspircd.org> <peavey peavey@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> Dennis Friis <peavey@inspircd.org> <peavey peavey@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>
Fabio Scotoni <cculex@gmail.com> Fabio Scotoni <cculex@gmail.com>
Filippo Cortigiani <simos@simosnap.org> <devel@devel.crtnet.it>
Filippo Cortigiani <simos@simosnap.org> <simos@H7-25.fritz.box>
Florian Schulze <certus@anope.org> <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Florian Schulze <certus@anope.org> <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Gabriel Acevedo H. <drstein@anope.org> <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Gabriel Acevedo H. <drstein@anope.org> <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Harakiri <harakiri@overstack.fr> Harakiri <harakiri@overstack.fr>
Hendrik Jäger <gitcommit@henk.geekmail.org> <github@henk.geekmail.org>
Jan Milants <viper@anope.org> Jan Milants <viper@anope.org>
Jan Milants <viper@anope.org> <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864> Jan Milants <viper@anope.org> <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864>
Jan Milants <viper@anope.org> <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Jan Milants <viper@anope.org> <viper viper@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Jens Voss <dukepyrolator@anope.org> <anope@s15355730.onlinehome-server.info> Jens Voss <dukepyrolator@anope.org> <anope@s15355730.onlinehome-server.info>
Jens Voss <dukepyrolator@anope.org> <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864> Jens Voss <dukepyrolator@anope.org> <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>
Jens Voss <dukepyrolator@anope.org> <DukePyrolator@anope.org> Jens Voss <dukepyrolator@anope.org> <DukePyrolator@anope.org>
Jens Voss <dukepyrolator@anope.org> Jens VoĂź <jens@pyrobook.(none)> Jens Voss <dukepyrolator@anope.org> <jens@pyrobook.(none)>
k4be <k4be@pirc.pl> <34816207+k4bek4be@users.noreply.github.com>
Lee Holmes <lethality@anope.org> Lee Holmes <lethality@anope.org>
Lee Holmes <lethality@anope.org> <lee@lethality.me.uk> Lee Holmes <lethality@anope.org> <lee@lethality.me.uk>
Mark Summers <mark@goopler.net> <mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Mark Summers <mark@goopler.net> <mark mark@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Matt Schatz <genius3000@g3k.solutions> Matt Schatz <genius3000@g3k.solutions>
Matt Ullman <matt@airraidsirens.com> <blindsight@gamesurge.net> Matt Ullman <matt@airraidsirens.com> <blindsight@gamesurge.net>
Michael Hazell <michaelhazell@hotmail.com> <Techman-@users.noreply.github.com> Michael Hazell <michaelhazell@hotmail.com> <Techman-@users.noreply.github.com>
Michael Stapelberg <michael@robustirc.net> <stapelberg@users.noreply.github.com>
Michael Wobst <wobst.michael@web.de> Michael Wobst <wobst.michael@web.de>
Michael Wobst <wobst.michael@web.de> <michael@static.163.129.251.148.clients.your-server.de> Michael Wobst <wobst.michael@web.de> <michael@static.163.129.251.148.clients.your-server.de>
Michael Wobst <wobst.michael@web.de> <michael@wobst.at> Michael Wobst <wobst.michael@web.de> <michael@wobst.at>
Naram Qashat <cyberbotx@anope.org> <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> Naram Qashat <cyberbotx@anope.org> <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>
Naram Qashat <cyberbotx@anope.org> <cyberbotx@cyberbotx.com> Naram Qashat <cyberbotx@anope.org> <cyberbotx@cyberbotx.com>
Naram Qashat <cyberbotx@anope.org> <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> Naram Qashat <cyberbotx@anope.org> <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>
PeGaSuS <droider.pc@gmail.com>
PeGaSuS <droider.pc@gmail.com> <25697531+TehPeGaSuS@users.noreply.github.com>
Pieter Bootsma <geniusdex@anope.org> <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Pieter Bootsma <geniusdex@anope.org> <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Robby <robby@chatbelgie.be> <robby@anope.org> Robby <robby@chatbelgie.be> <robby@anope.org>
Robby <robby@chatbelgie.be> <robby@chat.be> Robby <robby@chatbelgie.be> <robby@chat.be>
Robert Scheck <robert@fedoraproject.org> <robert-scheck@users.noreply.github.com>
Robin Burchell <w00t@inspircd.org> <rburchell@5417fbe8-f217-4b02-8779-1006273d7864> Robin Burchell <w00t@inspircd.org> <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>
Robin Burchell <w00t@inspircd.org> <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> Robin Burchell <w00t@inspircd.org> <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>
Sadie Powell <sadie@witchery.services> Peter Powell <petpow@saberuk.com> Sadie Powell <sadie@sadiepowell.dev> <petpow@saberuk.com>
Sadie Powell <sadie@sadiepowell.dev> <sadie@witchery.services>
Sebastian Barfurth <github@afreshmelon.com> Sebastian Barfurth <github@afreshmelon.com>
Sebastian V. <hal9000@denorastats.org> Sebastian V. <hal9000@denorastats.org>
Sebastian V. <hal9000@denorastats.org> <pimpmylinux@5417fbe8-f217-4b02-8779-1006273d7864> Sebastian V. <hal9000@denorastats.org> <pimpmylinux@5417fbe8-f217-4b02-8779-1006273d7864>
Trystan S. Lee <trystan@nomadirc.net> <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> Trystan S. Lee <trystan@nomadirc.net> <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>
Val Lorentz <progval+git@progval.net> <progval+git@progval.net>
+231 -114
View File
@@ -1,10 +1,64 @@
# This usage of CMake requires at least version 3.8 # This usage of CMake requires at least version 2.4 (checks are made to determine what to use when certain versions lack functions)
cmake_minimum_required(VERSION 3.8 FATAL_ERROR) cmake_minimum_required(VERSION 2.4...3.20 FATAL_ERROR)
# Set the project as C++ primarily, but have C enabled for the checks required later # Set the project as C++ primarily, but have C enabled for the checks required later
project(Anope CXX) project(Anope CXX)
enable_language(C) enable_language(C)
# Detect the version of CMake for the later conditional checks
execute_process(COMMAND ${CMAKE_COMMAND} --version OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "cmake version 2\\.(.*)" "\\1" ONLY_VERSION "${VERSION}")
string(REGEX MATCH "-patch .*$" HAS_PATCH "${ONLY_VERSION}")
if(HAS_PATCH)
string(REGEX REPLACE "(.*)-patch .*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
string(REGEX REPLACE ".*-patch (.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
else(HAS_PATCH)
string(REGEX MATCH "\\." HAS_DOT "${ONLY_VERSION}")
if(HAS_DOT)
string(REGEX REPLACE "(.*)\\..*" "\\1" MINOR_VERSION "${ONLY_VERSION}")
string(REGEX REPLACE ".*\\.(.*)" "\\1" PATCH_VERSION "${ONLY_VERSION}")
else(HAS_DOT)
string(REGEX REPLACE "(.*)-beta" "\\1" MINOR_VERSION "${ONLY_VERSION}")
if(MINOR_VERSION STREQUAL "4-1\n")
set(PATCH_VERSION 1)
else(MINOR_VERSION STREQUAL "4-1\n")
set(PATCH_VERSION 0)
endif(MINOR_VERSION STREQUAL "4-1\n")
set(MINOR_VERSION 4)
endif(HAS_DOT)
endif(HAS_PATCH)
# Detect is we are using CMake 2.6 or better, these versions include functions that require less work than CMake 2.4 does
if(MINOR_VERSION GREATER 5)
set(CMAKE26_OR_BETTER TRUE)
set(CMAKE248_OR_BETTER TRUE)
set(CMAKE244_OR_BETTER TRUE)
set(CMAKE242_OR_BETTER TRUE)
else(MINOR_VERSION GREATER 5)
set(CMAKE26_OR_BETTER FALSE)
# Also detect if we are using CMake 2.4.8 or better, the FIND sub-command of list() is nonexistent in earlier versions
if(PATCH_VERSION GREATER 7)
set(CMAKE248_OR_BETTER TRUE)
set(CMAKE244_OR_BETTER TRUE)
set(CMAKE242_OR_BETTER TRUE)
else(PATCH_VERSION GREATER 7)
set(CMAKE248_OR_BETTER FALSE)
# Also detect if we are using CMake 2.4.4 or better, the CheckCXXCompilerFlag module and SORT sub-command of list() are nonexistent in earlier versions
if(PATCH_VERSION GREATER 3)
set(CMAKE244_OR_BETTER TRUE)
set(CMAKE242_OR_BETTER TRUE)
else(PATCH_VERSION GREATER 3)
set(CMAKE244_OR_BETTER FALSE)
# ALSO detect if we are using CMake 2.4.2 or better, the APPEND sub-command of list() is nonexistent in earlier versions
if(PATCH_VERSION GREATER 1)
set(CMAKE242_OR_BETTER TRUE)
else(PATCH_VERSION GREATER 1)
set(CMAKE242_OR_BETTER FALSE)
endif(PATCH_VERSION GREATER 1)
endif(PATCH_VERSION GREATER 3)
endif(PATCH_VERSION GREATER 7)
endif(MINOR_VERSION GREATER 5)
# Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template # Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake)
@@ -17,13 +71,14 @@ set(ENV{LC_ALL} C)
set(DEFAULT_LIBRARY_DIRS) set(DEFAULT_LIBRARY_DIRS)
set(DEFAULT_INCLUDE_DIRS) set(DEFAULT_INCLUDE_DIRS)
# We require C++17 to build # Check that we aren't running on an ancient broken GCC
set(CMAKE_CXX_EXTENSIONS OFF) if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_STANDARD 17) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_FULL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_STANDARD_REQUIRED ON) string(REGEX REPLACE "^(\\d+\\.\\d+)" "\\1" GCC_VERSION ${GCC_FULL_VERSION})
if(GCC_VERSION LESS 4.2)
# Put modules in their own folder message(FATAL_ERROR "Your compiler is too old to build Anope. Upgrade to GCC 4.2 or newer!")
set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif(GCC_VERSION LESS 4.2)
endif(CMAKE_COMPILER_IS_GNUCXX)
# 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 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$") if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
@@ -34,9 +89,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line # Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line
if(NOT MINGW) if(NOT MINGW)
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE}) string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
else() else(NOT MINGW)
set(LIBRARIES "${LINE}") set(LIBRARIES "${LINE}")
endif() endif(NOT MINGW)
# Iterate through the libraries # Iterate through the libraries
foreach(LIBRARY ${LIBRARIES}) foreach(LIBRARY ${LIBRARIES})
# Check if the first character is an equal sign, and skip that library directory as it is (I believe) the primary default and shows up later in the list anyways # Check if the first character is an equal sign, and skip that library directory as it is (I believe) the primary default and shows up later in the list anyways
@@ -44,13 +99,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
if(NOT FIRST_CHAR STREQUAL "=") if(NOT FIRST_CHAR STREQUAL "=")
# If the directory had no = in front of it, make sure it's absolute and add it to the list of default library directories # If the directory had no = in front of it, make sure it's absolute and add it to the list of default library directories
get_filename_component(LIBRARY ${LIBRARY} ABSOLUTE) get_filename_component(LIBRARY ${LIBRARY} ABSOLUTE)
list(APPEND DEFAULT_LIBRARY_DIRS ${LIBRARY}) append_to_list(DEFAULT_LIBRARY_DIRS ${LIBRARY})
endif() endif(NOT FIRST_CHAR STREQUAL "=")
endforeach() endforeach(LIBRARY)
# Remove duplicate entries from the list # Remove duplicate entries from the list
if(DEFAULT_LIBRARY_DIRS) if(DEFAULT_LIBRARY_DIRS)
list(REMOVE_DUPLICATES DEFAULT_LIBRARY_DIRS) remove_list_duplicates(DEFAULT_LIBRARY_DIRS)
endif() endif(DEFAULT_LIBRARY_DIRS)
# Create a temporary file to test for the default include directories # Create a temporary file to test for the default include directories
FILE(WRITE empty.cpp "") FILE(WRITE empty.cpp "")
# Next, we look for the compiler's default include directories # Next, we look for the compiler's default include directories
@@ -67,11 +122,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# If the line has the following on it, the next lines will contain directory names # If the line has the following on it, the next lines will contain directory names
if(LINE STREQUAL "#include <...> search starts here:") if(LINE STREQUAL "#include <...> search starts here:")
set(IN_SEARCH TRUE) set(IN_SEARCH TRUE)
else() else(LINE STREQUAL "#include <...> search starts here:")
# If the line has the following on it, we hit the end of the list # If the line has the following on it, we hit the end of the list
if(LINE STREQUAL "End of search list.") if(LINE STREQUAL "End of search list.")
set(IN_SEARCH FALSE) set(IN_SEARCH FALSE)
else() else(LINE STREQUAL "End of search list.")
# If we are within the block between the above two lines... # If we are within the block between the above two lines...
if(IN_SEARCH) if(IN_SEARCH)
# Get everything but the first character of the line # Get everything but the first character of the line
@@ -83,16 +138,47 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Convert the path to an absolute one, just in case it wasn't # Convert the path to an absolute one, just in case it wasn't
get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE) get_filename_component(INCLUDE ${INCLUDE} ABSOLUTE)
# Add that directory to the list of default include directories # Add that directory to the list of default include directories
list(APPEND DEFAULT_INCLUDE_DIRS ${INCLUDE}) append_to_list(DEFAULT_INCLUDE_DIRS ${INCLUDE})
endif() endif(IN_SEARCH)
endif() endif(LINE STREQUAL "End of search list.")
endif() endif(LINE STREQUAL "#include <...> search starts here:")
endforeach() endforeach(LINE)
# Remove duplicate entries from the list # Remove duplicate entries from the list
if(DEFAULT_INCLUDE_DIRS) if(DEFAULT_INCLUDE_DIRS)
list(REMOVE_DUPLICATES DEFAULT_INCLUDE_DIRS) remove_list_duplicates(DEFAULT_INCLUDE_DIRS)
endif() endif(DEFAULT_INCLUDE_DIRS)
endif() endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# If we are using Visual Studio, locate the path of the Windows Server 2008 SDK or Windows Server 2003 Platform SDK, depending on which is installed
if(MSVC)
# If the path comes up as "/registry" from any of these, the path wasn't found, otherwise, we'll set WSDK_PATH to the corresponding path
# Look for the 2008 SDK under HKLM first
get_filename_component(WSDK2008_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
if(WSDK2008_PATH STREQUAL "/registry")
# If not found, look for the 2003 SDK under HKLM
get_filename_component(WSDK2003_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1;Install Dir]" ABSOLUTE CACHE)
if(WSDK2003_PATH STREQUAL "/registry")
# If not found, look for the 2008 SDK under HKCU
get_filename_component(WSDK2008_PATH "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
if(WSDK2008_PATH STREQUAL "/registry")
# If not found, look for the 2003 SDK under HKCU
get_filename_component(WSDK2003_PATH "[HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1;Install Dir]" ABSOLUTE CACHE)
if(WSDK2003_PATH STREQUAL "/registry")
# The SDK was never found, set the path to nothing
set(WSDK_PATH "")
else(WSDK2003_PATH STREQUAL "/registry")
set(WSDK_PATH "${WSDK2003_PATH}")
endif(WSDK2003_PATH STREQUAL "/registry")
else(WSDK2008_PATH STREQUAL "/registry")
set(WSDK_PATH "${WSDK2008_PATH}")
endif(WSDK2008_PATH STREQUAL "/registry")
else(WSDK2003_PATH STREQUAL "/registry")
set(WSDK_PATH "${WSDK2003_PATH}")
endif(WSDK2003_PATH STREQUAL "/registry")
else(WSDK2008_PATH STREQUAL "/registry")
set(WSDK_PATH "${WSDK2008_PATH}")
endif(WSDK2008_PATH STREQUAL "/registry")
endif(MSVC)
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition # If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their definition
# and dump it in the cache along with proper documentation, otherwise set CMAKE_BUILD_TYPE # and dump it in the cache along with proper documentation, otherwise set CMAKE_BUILD_TYPE
@@ -101,33 +187,38 @@ endif()
if(NOT MSVC) if(NOT MSVC)
if(CMAKE_BUILD_TYPE) if(CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
else() else(CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif() endif(CMAKE_BUILD_TYPE)
endif() endif(NOT MSVC)
# If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake) # If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake)
if(MINGW) if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres) set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC) enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>") set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
endif() endif(MINGW)
# Include the checking functions used later in this CMakeLists.txt # Include the checking functions used later in this CMakeLists.txt
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckTypeSize) include(CheckTypeSize)
include(CheckLibraryExists) include(CheckLibraryExists)
include(CheckCXXCompilerFlag) if(CMAKE244_OR_BETTER)
include(CheckCXXCompilerFlag)
else(CMAKE244_OR_BETTER)
include(TestCXXAcceptsFlag)
endif(CMAKE244_OR_BETTER)
# If extra include directories were specified, tell cmake about them. # If extra include directories were specified, tell cmake about them.
if(EXTRA_INCLUDE) if(EXTRA_INCLUDE)
include_directories(${EXTRA_INCLUDE}) include_directories(${EXTRA_INCLUDE})
endif() endif(EXTRA_INCLUDE)
# If extra library directories were specified, tell cmake about them. # If extra library directories were specified, tell cmake about them.
if(EXTRA_LIBS) if(EXTRA_LIBS)
link_directories(${EXTRA_LIBS}) link_directories(${EXTRA_LIBS})
endif() endif(EXTRA_LIBS)
# setup conan # setup conan
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
@@ -137,31 +228,25 @@ endif()
# Find gettext # Find gettext
find_package(Gettext) find_package(Gettext)
find_package(Intl)
if(GETTEXT_FOUND AND Intl_FOUND) option(USE_PCH "Use precompiled headers" OFF)
set(HAVE_LOCALIZATION ON)
include_directories(${Intl_INCLUDE_DIRS})
else()
message("Unable to find gettext and libintl; disabling localization")
set(HAVE_LOCALIZATION OFF)
endif()
# Use the following directories as includes # Use the following directories as includes
include_directories( # Note that it is important the binary include directory comes before the
${Anope_BINARY_DIR}/include # source include directory so the precompiled headers work correctly.
${Anope_SOURCE_DIR}/include include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language ${Anope_SOURCE_DIR}/modules/pseudoclients)
${Anope_SOURCE_DIR}/vendor
)
# Pass on REPRODUCIBLE_BUILD # Pass on REPRODUCIBLE_BUILD
if(REPRODUCIBLE_BUILD) if(REPRODUCIBLE_BUILD)
add_definitions(-DREPRODUCIBLE_BUILD) add_definitions(-DREPRODUCIBLE_BUILD)
endif() endif(REPRODUCIBLE_BUILD)
# If using Windows, always add the _WIN32 define
if(WIN32) if(WIN32)
# If using Windows, include the windows specific folder for anope_windows.h add_definitions(-D_WIN32)
# And include the windows specific folder for our anope_windows.h
include_directories(${Anope_SOURCE_DIR}/src/win32) include_directories(${Anope_SOURCE_DIR}/src/win32)
endif() endif(WIN32)
# If using Visual Studio, set the C++ flags accordingly # If using Visual Studio, set the C++ flags accordingly
if(MSVC) if(MSVC)
@@ -171,76 +256,107 @@ if(MSVC)
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines # Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs") set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio # Otherwise, we're not using Visual Studio
else() else(MSVC)
# Set the compile flags to have all warnings on (including shadowed variables) # Set the compile flags to have all warnings on (including shadowed variables)
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}") set(CXXFLAGS "${CXXFLAGS} -Wall -Wshadow")
endif() # If on a *nix system, also set the compile flags to remove GNU extensions (favor ISO C++) as well as reject non-ISO C++ code, also remove all leading underscores in exported symbols (only on GNU compiler)
if(UNIX)
set(CXXFLAGS "${CXXFLAGS} -ansi -pedantic ${CMAKE_CXX_FLAGS}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXXFLAGS "${CXXFLAGS} -Wno-long-long -fno-leading-underscore")
endif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# If we aren't on a *nix system, we are using MinGW
else(UNIX)
# Also, if we are building under MinGW, add another define for MinGW
if(MINGW)
add_definitions(-DMINGW)
endif(MINGW)
endif(UNIX)
endif(MSVC)
# If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags # If CMake has found that the given system requires a special library for dl* calls, include it with the linker flags
if(CMAKE_DL_LIBS) if(CMAKE_DL_LIBS)
list(APPEND LINK_LIBS ${CMAKE_DL_LIBS}) append_to_list(LINK_LIBS ${CMAKE_DL_LIBS})
endif() endif(CMAKE_DL_LIBS)
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries # Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries
if(MINGW) if(MINGW)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
endif() endif(MINGW)
if(NOT PROGRAM_NAME) if(NOT PROGRAM_NAME)
set(PROGRAM_NAME anope) # Under Windows, we set the executable name for Anope to be anope
endif() if(WIN32)
set(PROGRAM_NAME anope)
# Under *nix, we set the executable name for Anope to be services
else(WIN32)
set(PROGRAM_NAME services)
endif(WIN32)
endif(NOT PROGRAM_NAME)
# If we are not using Visual Studio, we'll run the following checks # If we are not using Visual Studio, we'll run the following checks
if(NOT MSVC) if(NOT MSVC)
# Check if the C++ compiler can accept the -pipe flag, and add it to the compile flags if it works # Check if the C++ compiler can accept the -pipe flag, and add it to the compile flags if it works
check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG) if(CMAKE244_OR_BETTER)
# If using CMake 2.4.4 or better, we can use check_cxx_compiler_flag
check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG)
else(CMAKE244_OR_BETTER)
# If using CMake 2.4.3 or older, we will use check_cxx_accepts_flags instead
check_cxx_accepts_flag(-pipe HAVE_PIPE_FLAG)
endif(CMAKE244_OR_BETTER)
# If the flag was accepted, add it to the list of flags # If the flag was accepted, add it to the list of flags
if(HAVE_PIPE_FLAG) if(HAVE_PIPE_FLAG)
set(CXXFLAGS "${CXXFLAGS} -pipe") set(CXXFLAGS "${CXXFLAGS} -pipe")
endif() endif(HAVE_PIPE_FLAG)
# The following are additional library checks, they are not required for Windows # The following are additional library checks, they are not required for Windows
if(NOT WIN32) if(NOT WIN32)
# Check if socket is within the socket library (if the library exists), and add it to the linker flags if needed # Check if socket is within the socket library (if the library exists), and add it to the linker flags if needed
check_library_exists(socket socket "" HAVE_SOCKET_LIB) check_library_exists(socket socket "" HAVE_SOCKET_LIB)
if(HAVE_SOCKET_LIB) if(HAVE_SOCKET_LIB)
list(APPEND LINK_LIBS socket) append_to_list(LINK_LIBS socket)
endif() endif(HAVE_SOCKET_LIB)
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed # Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB) check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
if(HAVE_NSL_LIB) if(HAVE_NSL_LIB)
list(APPEND LINK_LIBS nsl) append_to_list(LINK_LIBS nsl)
endif() endif(HAVE_NSL_LIB)
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed # Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
check_library_exists(pthread pthread_create "" HAVE_PTHREAD) check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
if(HAVE_PTHREAD) if(HAVE_PTHREAD)
if(NOT APPLE) if(NOT APPLE)
set(LDFLAGS "${LDFLAGS} -pthread") set(LDFLAGS "${LDFLAGS} -pthread")
endif() endif(NOT APPLE)
else() else(HAVE_PTHREAD)
message(FATAL_ERROR "The pthread library is required to build Anope") message(FATAL_ERROR "The pthread library is required to build Anope")
endif() endif(HAVE_PTHREAD)
endif() endif(NOT WIN32)
endif() endif(NOT MSVC)
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not # If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
if(NOT DEFUMASK) if(NOT DEFUMASK)
if(RUNGROUP) if(RUNGROUP)
set(DEFUMASK "007") set(DEFUMASK "007")
else() else(RUNGROUP)
set(DEFUMASK "077") set(DEFUMASK "077")
endif() endif(RUNGROUP)
endif() endif(NOT DEFUMASK)
# Set the DEBUG_BUILD for sysconf.h # Set the DEBUG_BUILD for sysconf.h
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(DEBUG_BUILD TRUE) set(DEBUG_BUILD TRUE)
endif() endif(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
# Check for the existence of the following include files
check_include_file(cstdint HAVE_CSTDINT)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(strings.h HAVE_STRINGS_H)
# Check for the existence of the following functions # Check for the existence of the following functions
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(stricmp HAVE_STRICMP)
check_function_exists(umask HAVE_UMASK) check_function_exists(umask HAVE_UMASK)
check_function_exists(epoll_wait HAVE_EPOLL) check_function_exists(epoll_wait HAVE_EPOLL)
check_function_exists(poll HAVE_POLL) check_function_exists(poll HAVE_POLL)
@@ -248,52 +364,52 @@ check_function_exists(kqueue HAVE_KQUEUE)
# Strip the leading and trailing spaces from the compile flags # Strip the leading and trailing spaces from the compile flags
if(CXXFLAGS) if(CXXFLAGS)
string(STRIP ${CXXFLAGS} CXXFLAGS) strip_string(${CXXFLAGS} CXXFLAGS)
endif() endif(CXXFLAGS)
# Strip the leading and trailing spaces from the linker flags # Strip the leading and trailing spaces from the linker flags
if(LDFLAGS) if(LDFLAGS)
string(STRIP ${LDFLAGS} LDFLAGS) strip_string(${LDFLAGS} LDFLAGS)
endif() endif(LDFLAGS)
# Search for the following programs # Search for the following programs
if(NOT WIN32 AND RUNGROUP) find_program(GREP grep)
find_program(CHGRP "chgrp" REQUIRED) find_program(SH sh)
find_program(CHMOD "chmod" REQUIRED) find_program(CHGRP chgrp)
endif() find_program(CHMOD chmod)
# 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 a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the services directory under the user's home directory
if(INSTDIR) if(INSTDIR)
set(CMAKE_INSTALL_PREFIX "${INSTDIR}") set(CMAKE_INSTALL_PREFIX "${INSTDIR}")
elseif(NOT CMAKE_INSTALL_PREFIX) elseif(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/anope") set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/services")
endif() endif(INSTDIR)
# Set default paths for various directories if not already defined # Set default paths for various directories if not already defined
if(NOT BIN_DIR) if(NOT BIN_DIR)
set(BIN_DIR "bin") set(BIN_DIR "bin")
endif() endif(NOT BIN_DIR)
if(NOT DB_DIR) if(NOT DB_DIR)
set(DB_DIR "data") set(DB_DIR "data")
endif() endif(NOT DB_DIR)
if(NOT DOC_DIR) if(NOT DOC_DIR)
set(DOC_DIR "doc") set(DOC_DIR "doc")
endif() endif(NOT DOC_DIR)
if(NOT CONF_DIR) if(NOT CONF_DIR)
set(CONF_DIR "conf") set(CONF_DIR "conf")
endif() endif(NOT CONF_DIR)
if(NOT LIB_DIR) if(NOT LIB_DIR)
set(LIB_DIR "lib") set(LIB_DIR "lib")
endif() endif(NOT LIB_DIR)
if(NOT LOCALE_DIR) if(NOT LOCALE_DIR)
set(LOCALE_DIR "locale") set(LOCALE_DIR "locale")
endif() endif(NOT LOCALE_DIR)
if(NOT LOGS_DIR) if(NOT LOGS_DIR)
set(LOGS_DIR "logs") set(LOGS_DIR "logs")
endif() endif(NOT LOGS_DIR)
# Version number processing # Version number processing
# Find all lines in src/version.sh that start with VERSION_ # Find all lines in src/version.sh that start with VERSION_
file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^VERSION_") read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS)
# Iterate through the strings found # Iterate through the strings found
foreach(VERSION_STR ${VERSIONS}) foreach(VERSION_STR ${VERSIONS})
string(REGEX REPLACE "^VERSION_([A-Z]+)=\"?([^\"]*)\"?$" "\\1;\\2" VERSION_OUT ${VERSION_STR}) string(REGEX REPLACE "^VERSION_([A-Z]+)=\"?([^\"]*)\"?$" "\\1;\\2" VERSION_OUT ${VERSION_STR})
@@ -302,8 +418,8 @@ foreach(VERSION_STR ${VERSIONS})
if(${VERSION_LEN} GREATER 1) if(${VERSION_LEN} GREATER 1)
list(GET VERSION_OUT 1 VERSION_DATA) list(GET VERSION_OUT 1 VERSION_DATA)
set(VERSION_${VERSION_TYPE} ${VERSION_DATA}) set(VERSION_${VERSION_TYPE} ${VERSION_DATA})
endif() endif(${VERSION_LEN} GREATER 1)
endforeach() endforeach(VERSION_STR ${VERSIONS})
# Default build version to 0 # Default build version to 0
set(VERSION_BUILD 0) set(VERSION_BUILD 0)
@@ -311,7 +427,7 @@ set(VERSION_BUILD 0)
# Only change the build number if version.h exists # Only change the build number if version.h exists
if(EXISTS "${Anope_SOURCE_DIR}/include/version.h") if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
# Attempt to read the build number from include/version.h # Attempt to read the build number from include/version.h
file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^#define VERSION_BUILD") read_from_file(${Anope_SOURCE_DIR}/include/version.h "^#define VERSION_BUILD" VERSIONS)
foreach(VERSION_STR ${VERSIONS}) foreach(VERSION_STR ${VERSIONS})
# Get the length of the string # Get the length of the string
string(LENGTH ${VERSION_STR} VERSION_LEN) string(LENGTH ${VERSION_STR} VERSION_LEN)
@@ -321,8 +437,8 @@ if(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION) string(SUBSTRING ${VERSION_STR} 22 ${VERSION_NUM_LEN} VERSION)
# Set VERSION_BUILD correctly # Set VERSION_BUILD correctly
set(VERSION_BUILD ${VERSION}) set(VERSION_BUILD ${VERSION})
endforeach() endforeach(VERSION_STR ${VERSIONS})
endif() endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h")
# Set the version variables based on what was found above # Set the version variables based on what was found above
set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}") set(VERSION_COMMA "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_BUILD}")
@@ -335,7 +451,7 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
if(WIN32) if(WIN32)
# Generate the win32.rc file using the above variables # Generate the win32.rc file using the above variables
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc) configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
endif() endif(WIN32)
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source # Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE) add_to_cpack_ignored_files(".git\;config.cache\;CMakeFiles\;sysconf.h$\;build" TRUE)
@@ -350,16 +466,8 @@ if(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
# If using Visual Studio, add these files as well # If using Visual Studio, add these files as well
if(MSVC) if(MSVC)
add_to_cpack_ignored_files(".vcproj$\;.sln$\;.ncb$\;.suo$\;.dir$\;.ilk$\;.exp$\;.pdb$\;.lib$\;/debug$;/release$;/relwithdebinfo$;/minsizerel$" TRUE) add_to_cpack_ignored_files(".vcproj$\;.sln$\;.ncb$\;.suo$\;.dir$\;.ilk$\;.exp$\;.pdb$\;.lib$\;/debug$;/release$;/relwithdebinfo$;/minsizerel$" TRUE)
endif() endif(MSVC)
endif() endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR})
# Go into the following directories and run their CMakeLists.txt as well
add_subdirectory(data)
add_subdirectory(docs)
add_subdirectory(language)
add_subdirectory(src)
add_subdirectory(modules)
add_subdirectory(include)
# Get the filename of the Anope binary, to use later # Get the filename of the Anope binary, to use later
set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>") set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
@@ -370,19 +478,19 @@ install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
if(WIN32) if(WIN32)
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")") install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
endif() endif(WIN32)
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory # On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory
if(NOT WIN32 AND RUNGROUP) if(NOT WIN32 AND RUNGROUP)
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")") install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${DB_DIR}/backups\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")") install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\${LOGS_DIR}\")")
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")") install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")")
endif() endif(NOT WIN32 AND RUNGROUP)
# On Windows platforms, install extra files # On Windows platforms, install extra files
if(WIN32) if(WIN32)
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
DESTINATION ${BIN_DIR} DESTINATION ${BIN_DIR}
) )
endif() endif(WIN32)
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")") install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
@@ -423,10 +531,19 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}") set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
set(CPACK_NSIS_URL_INFO_ABOUT "https://www.anope.org/") set(CPACK_NSIS_URL_INFO_ABOUT "https://www.anope.org/")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
endif() endif(WIN32)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "anope-${VERSION_FULL_NOBUILD}-source") set(CPACK_SOURCE_PACKAGE_FILE_NAME "anope-${VERSION_FULL_NOBUILD}-source")
set(CPACK_SOURCE_GENERATOR "TGZ") set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "$ENV{CPACK_IGNORED_FILES}") set(CPACK_SOURCE_IGNORE_FILES "$ENV{CPACK_IGNORED_FILES}")
set(CPACK_MONOLITHIC_INSTALL TRUE) set(CPACK_MONOLITHIC_INSTALL TRUE)
include(CPack) include(CPack)
endif() endif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# Go into the following directories and run their CMakeLists.txt as well
add_subdirectory(data)
add_subdirectory(docs)
add_subdirectory(language)
add_subdirectory(src)
add_subdirectory(modules)
add_subdirectory(include)
+52 -10
View File
@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Configuration script for Anope. # Configuration script for Services.
# #
# Anope (C) 2003-2024 Anope Team # Anope (C) 2003-2024 Anope Team
# Contact us at team@anope.org # Contact us at team@anope.org
@@ -62,6 +62,12 @@ Run_Build_System () {
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE" BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=RELEASE"
fi fi
if [ "$USE_PCH" = "yes" ] ; then
PCH="-DUSE_PCH:BOOLEAN=ON"
else
PCH="-DUSE_PCH:BOOLEAN=OFF"
fi
if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then
EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS" EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS"
fi fi
@@ -70,6 +76,12 @@ Run_Build_System () {
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS" EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
fi fi
case `uname -s` in
MINGW*)
GEN_TYPE="-G\"MSYS Makefiles\""
;;
esac
if [ "$SOURCE_DIR" = "." ] ; then if [ "$SOURCE_DIR" = "." ] ; then
pwdsave=`pwd` pwdsave=`pwd`
test -d build || mkdir build test -d build || mkdir build
@@ -79,9 +91,9 @@ Run_Build_System () {
REAL_SOURCE_DIR="$SOURCE_DIR" REAL_SOURCE_DIR="$SOURCE_DIR"
fi fi
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR" echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "You should fix these issues and then run ./Config -quick to rerun CMake." echo "You should fix these issues and then run ./Config -quick to rerun CMake."
exit 1 exit 1
@@ -113,10 +125,11 @@ export ECHO2 ECHO2SUF
# Init values # Init values
########################################################################### ###########################################################################
INSTDIR=$HOME/anope INSTDIR=$HOME/services
RUNGROUP= RUNGROUP=
UMASK= UMASK=
DEBUG="no" DEBUG="no"
USE_PCH="no"
EXTRA_INCLUDE_DIRS= EXTRA_INCLUDE_DIRS=
EXTRA_LIB_DIRS= EXTRA_LIB_DIRS=
EXTRA_CONFIG_ARGS= EXTRA_CONFIG_ARGS=
@@ -163,7 +176,7 @@ done
cmake --version 2>&1 > /dev/null cmake --version 2>&1 > /dev/null
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
clear clear
echo "Anope requires CMake 3.8 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager." echo "Anope requires CMake 2.4 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager."
echo "If you have installed CMake already, ensure it is in your PATH environment variable." echo "If you have installed CMake already, ensure it is in your PATH environment variable."
exit 0 exit 0
fi fi
@@ -171,15 +184,24 @@ fi
########################################################################### ###########################################################################
if [ ! "$NO_INTRO" ] ; then if [ ! "$NO_INTRO" ] ; then
case `uname -s` in
MINGW*)
PAGER=less
;;
*)
PAGER=more
clear
;;
esac
export MORE='-e' export MORE='-e'
. $SOURCE_DIR/src/version.sh . $SOURCE_DIR/src/version.sh
cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | more cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
echo "" echo ""
else else
echo "" echo ""
fi fi
echo "Beginning Anope configuration." echo "Beginning Services configuration."
echo "" echo ""
########################################################################### ###########################################################################
@@ -218,7 +240,7 @@ while [ $ok -eq 0 ] ; do
fi fi
fi fi
elif exists "$INPUT/include/services.h" ; then elif exists "$INPUT/include/services.h" ; then
echo "You cannot use the Anope source directory as a target directory." echo "You cannot use the Services source directory as a target directory."
else else
ok=1 ok=1
fi fi
@@ -230,11 +252,11 @@ echo ""
OLD_RUNGROUP="$RUNGROUP" OLD_RUNGROUP="$RUNGROUP"
if [ "$RUNGROUP" ] ; then if [ "$RUNGROUP" ] ; then
echo "Which group should all Anope data files be owned by? (If Anope" echo "Which group should all Services data files be owned by? (If Services"
echo "should not force files to be owned by a particular group, type \"none\"" echo "should not force files to be owned by a particular group, type \"none\""
echo "(without the quotes) and press Return.)" echo "(without the quotes) and press Return.)"
else else
echo "Which group should all Anope data files be owned by? (If Anope" echo "Which group should all Services data files be owned by? (If Services"
echo "should not force files to be owned by a particular group, just press" echo "should not force files to be owned by a particular group, just press"
echo "Return.)" echo "Return.)"
fi fi
@@ -300,6 +322,25 @@ echo ""
#### ####
TEMP_YN="n"
if [ "$USE_PCH" = "yes" ] ; then
TEMP_YN="y"
fi
echo "Do you want to build using precompiled headers? This can speed up"
echo "the build, but uses more disk space."
echo2 "[$TEMP_YN] "
read YN
if [ "$YN" ] ; then
if [ "$YN" = "y" ] ; then
USE_PCH="yes"
else
USE_PCH="no"
fi
fi
echo ""
####
echo "Are there any extra include directories you wish to use?" echo "Are there any extra include directories you wish to use?"
echo "You may only need to do this if CMake is unable to locate" echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints." echo "missing dependencies without hints."
@@ -362,6 +403,7 @@ INSTDIR="$INSTDIR"
RUNGROUP="$RUNGROUP" RUNGROUP="$RUNGROUP"
UMASK=$UMASK UMASK=$UMASK
DEBUG="$DEBUG" DEBUG="$DEBUG"
USE_PCH="$USE_PCH"
EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS" EXTRA_INCLUDE_DIRS="$EXTRA_INCLUDE_DIRS"
EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS" EXTRA_LIB_DIRS="$EXTRA_LIB_DIRS"
EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS" EXTRA_CONFIG_ARGS="$EXTRA_CONFIG_ARGS"
+8 -8
View File
@@ -1,10 +1,10 @@
## About ## About
Anope is an open source set of IRC services. It is highly modular, with a vast number of configurable parameters, and is the most used IRC services package. There are also many modules on the [modsite](https://modules.anope.org) to add additional features. It runs on Linux, BSD, and Windows, and supports many modern IRCds, including InspIRCd, UnrealIRCd, and ircd-hybrid. For more details, credits, command line options, and contact information see [docs/README](https://github.com/anope/anope/blob/2.0/docs/README). Anope is an open source set of IRC Services. It is highly modular, with a vast number of configurable parameters, and is the most used IRC services package. There are also many modules on the [modsite](https://modules.anope.org) to add additional features. It runs on Linux, BSD, and Windows, and supports many modern IRCds, including InspIRCd, UnrealIRCd, and ircd-hybrid. For more details, credits, command line options, and contact information see [docs/README](https://github.com/anope/anope/blob/2.0/docs/README).
* [Website](https://anope.org) * [Website](https://anope.org)
* [GitHub](https://github.com/anope) * [GitHub](https://github.com/anope)
* IRC \#anope on irc.anope.org * IRC \#anope on irc.teranova.net
## Installation ## Installation
@@ -19,7 +19,7 @@ $ make
$ make install $ make install
``` ```
Now change to the directory where you installed Anope to, e.g. `$ cd ~/anope/` Now change to the directory where you installed Anope to, e.g. `$ cd ~/services/`
### Windows ### Windows
Download the latest release off of the [releases page](https://github.com/anope/anope/releases) and run the installer. Download the latest release off of the [releases page](https://github.com/anope/anope/releases) and run the installer.
@@ -27,19 +27,19 @@ Download the latest release off of the [releases page](https://github.com/anope/
## Configuration ## Configuration
Copy conf/anope.example.conf to conf/anope.conf Copy conf/example.conf to conf/services.conf
``` ```
$ cp conf/anope.example.conf conf/anope.conf $ cp conf/example.conf conf/services.conf
``` ```
Edit anope.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the anope.example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.anope.org](irc://irc.anope.org/#anope). Edit services.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the the example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.teranova.net](ircs://irc.teranova.net/anope).
Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `anope.conf` to include the new file. Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `services.conf` to include the new file.
## Running ## Running
Run `$ ./bin/anope` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/anope --support` Run `$ ./bin/services` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/services --support`
## Installing extra modules ## Installing extra modules
+481 -32
View File
@@ -1,3 +1,421 @@
###############################################################################
# strip_string(<input string> <output string>)
#
# A macro to handle stripping the leading and trailing spaces from a string,
# uses string(STRIP) if using CMake 2.6.x or better, otherwise uses
# string(REGEX REPLACE).
###############################################################################
macro(strip_string INPUT_STRING OUTPUT_STRING)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, we can just use the STRIP sub-command of string()
string(STRIP ${INPUT_STRING} ${OUTPUT_STRING})
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we will have to use the REGEX REPLACE sub-command of string() instead
# First check if the input string is empty or not
if (${INPUT_STRING} STREQUAL "")
set(${OUTPUT_STRING} "")
else(${INPUT_STRING} STREQUAL "")
# Determine if the string is entirely empty or not
string(REGEX MATCH "^[ \t]*$" EMPTY_STRING "${INPUT_STRING}")
if(EMPTY_STRING)
set(${OUTPUT_STRING} "")
else(EMPTY_STRING)
# We detect if there is any leading whitespace and remove any if there is
string(SUBSTRING "${INPUT_STRING}" 0 1 FIRST_CHAR)
if(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
string(REGEX REPLACE "^[ \t]+" "" TEMP_STRING "${INPUT_STRING}")
else(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
set(TEMP_STRING "${INPUT_STRING}")
endif(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
# Next we detect if there is any trailing whitespace and remove any if there is
string(LENGTH "${TEMP_STRING}" STRING_LEN)
math(EXPR STRING_LEN "${STRING_LEN} - 1")
string(SUBSTRING "${TEMP_STRING}" ${STRING_LEN} 1 LAST_CHAR)
if(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
string(REGEX REPLACE "[ \t]+$" "" ${OUTPUT_STRING} "${TEMP_STRING}")
else(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
set(${OUTPUT_STRING} "${TEMP_STRING}")
endif(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
endif(EMPTY_STRING)
endif(${INPUT_STRING} STREQUAL "")
endif(CMAKE26_OR_BETTER)
endmacro(strip_string)
###############################################################################
# append_to_list(<list> <args>...)
#
# A macro to handle appending to lists, uses list(APPEND) if using CMake 2.4.2
# or better, otherwise uses set() instead.
###############################################################################
macro(append_to_list LIST)
if(CMAKE242_OR_BETTER)
# For CMake 2.4.2 or better, we can just use the APPEND sub-command of list()
list(APPEND ${LIST} ${ARGN})
else(CMAKE242_OR_BETTER)
# For CMake 2.4.x before 2.4.2, we have to do this manually use set() instead
set(${LIST} ${${LIST}} ${ARGN})
endif(CMAKE242_OR_BETTER)
endmacro(append_to_list)
###############################################################################
# find_in_list(<list> <value> <output variable>)
#
# A macro to handle searching within a list, will store the result in the
# given <output variable>, uses list(FIND) if using CMake 2.6.x or better
# (or CMake 2.4.8 or better), otherwise it iterates through the list to find
# the item.
###############################################################################
macro(find_in_list LIST ITEM_TO_FIND FOUND)
if(CMAKE248_OR_BETTER)
# For CMake 2.4.8 or better, we can use the FIND sub-command of list()
list(FIND ${LIST} ${ITEM_TO_FIND} ITEM_FOUND)
else(CMAKE248_OR_BETTER)
# For CMake 2.4.x before 2.4.8, we have to do this ourselves (NOTE: This is very slow due to a lack of break() as well)
# Firstly we set the position to -1 indicating nothing found, we also use a temporary position
set(ITEM_FOUND -1)
set(POS 0)
# Iterate through the list
foreach(ITEM ${${LIST}})
# If the item we are looking at is the item we are trying to find, set that we've found the item
if(${ITEM} STREQUAL ${ITEM_TO_FIND})
set(ITEM_FOUND ${POS})
endif(${ITEM} STREQUAL ${ITEM_TO_FIND})
# Increase the position value by 1
math(EXPR POS "${POS} + 1")
endforeach(ITEM)
endif(CMAKE248_OR_BETTER)
# Set the given FOUND variable to the result
set(${FOUND} ${ITEM_FOUND})
endmacro(find_in_list)
###############################################################################
# remove_list_duplicates(<list>)
#
# A macro to handle removing duplicates from a list, uses
# list(REMOVE_DUPLICATES) if using CMake 2.6.x or better, otherwise it uses
# a slower method of creating a temporary list and only adding to it when
# a duplicate item hasn't been found.
###############################################################################
macro(remove_list_duplicates LIST)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, this can be done automatically
list(REMOVE_DUPLICATES ${LIST})
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we have to do this ourselves, firstly we'll clear a temporary list
set(NEW_LIST)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# Check if the item is in the new list
find_in_list(NEW_LIST ${ITEM} FOUND_ITEM)
if(FOUND_ITEM EQUAL -1)
# If the item was not found, append it to the list
append_to_list(NEW_LIST ${ITEM})
endif(FOUND_ITEM EQUAL -1)
endforeach(ITEM)
# Replace the old list with the new list
set(${LIST} ${NEW_LIST})
endif(CMAKE26_OR_BETTER)
endmacro(remove_list_duplicates)
###############################################################################
# remove_item_from_list(<list> <value>)
#
# A macro to handle removing a value from a list, uses list(REMOVE_ITEM) in
# both cases, but can remove the value itself using CMake 2.4.2 or better,
# while older versions use a slower method of iterating the list to find the
# index of the value to remove.
###############################################################################
macro(remove_item_from_list LIST VALUE)
if(CMAKE242_OR_BETTER)
# For CMake 2.4.2 or better, this can be done automatically
list(REMOVE_ITEM ${LIST} ${VALUE})
else(CMAKE242_OR_BETTER)
# For CMake 2.4.x before 2.4.2, we have to do this ourselves, firstly we set the index and a variable to indicate if the item was found
set(INDEX 0)
set(FOUND FALSE)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# If the item hasn't been found yet, but the current item is the same, remove it
if(NOT FOUND)
if(ITEM STREQUAL ${VALUE})
set(FOUND TRUE)
list(REMOVE_ITEM ${LIST} ${INDEX})
endif(ITEM STREQUAL ${VALUE})
endif(NOT FOUND)
# Increase the index value by 1
math(EXPR INDEX "${INDEX} + 1")
endforeach(ITEM)
endif(CMAKE242_OR_BETTER)
endmacro(remove_item_from_list)
###############################################################################
# sort_list(<list>)
#
# A macro to handle sorting a list, uses list(SORT) if using CMake 2.4.4 or
# better, otherwise it uses a slower method of creating a temporary list and
# adding elements in alphabetical order.
###############################################################################
macro(sort_list LIST)
if(CMAKE244_OR_BETTER)
# For CMake 2.4.4 or better, this can be done automatically
list(SORT ${LIST})
else(CMAKE244_OR_BETTER)
# For CMake 2.4.x before 2.4.4, we have to do this ourselves, firstly we'll create a temporary list
set(NEW_LIST)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# Temporary index position for the new list, as well as temporary value to store if the item was ever found
set(INDEX 0)
set(FOUND FALSE)
# Iterate through the new list
foreach(NEW_ITEM ${NEW_LIST})
# Compare the items, only if nothing was found before
if(NOT FOUND)
if(NEW_ITEM STRGREATER "${ITEM}")
set(FOUND TRUE)
list(INSERT NEW_LIST ${INDEX} ${ITEM})
endif(NEW_ITEM STRGREATER "${ITEM}")
endif(NOT FOUND)
# Increase the index value by 1
math(EXPR INDEX "${INDEX} + 1")
endforeach(NEW_ITEM)
# If the item was never found, just append it to the end
if(NOT FOUND)
append_to_list(NEW_LIST ${ITEM})
endif(NOT FOUND)
endforeach(ITEM)
# Replace the old list with the new list
set(${LIST} ${NEW_LIST})
endif(CMAKE244_OR_BETTER)
endmacro(sort_list)
###############################################################################
# read_from_file(<filename> <regex> <output variable>)
#
# A macro to handle reading specific lines from a file, uses file(STRINGS) if
# using CMake 2.6.x or better, otherwise we read in the entire file and
# perform a string(REGEX MATCH) on each line of the file instead. This
# macro can also be used to read in all the lines of a file if REGEX is set
# to "".
###############################################################################
macro(read_from_file FILE REGEX STRINGS)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, we can just use the STRINGS sub-command to get the lines that match the given regular expression (if one is given, otherwise get all lines)
if(REGEX STREQUAL "")
file(STRINGS ${FILE} RESULT)
else(REGEX STREQUAL "")
file(STRINGS ${FILE} RESULT REGEX ${REGEX})
endif(REGEX STREQUAL "")
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we need to do this manually, firstly we read the file in
execute_process(COMMAND ${CMAKE_COMMAND} -DFILE:STRING=${FILE} -P ${Anope_SOURCE_DIR}/cmake/ReadFile.cmake ERROR_VARIABLE ALL_STRINGS)
# Next we replace all newlines with semicolons
string(REGEX REPLACE "\n" ";" ALL_STRINGS ${ALL_STRINGS})
if(REGEX STREQUAL "")
# For no regular expression, just set the result to all the lines
set(RESULT ${ALL_STRINGS})
else(REGEX STREQUAL "")
# Clear the result list
set(RESULT)
# Iterate through all the lines of the file
foreach(STRING ${ALL_STRINGS})
# Check for a match against the given regular expression
string(REGEX MATCH ${REGEX} STRING_MATCH ${STRING})
# If we had a match, append the match to the list
if(STRING_MATCH)
append_to_list(RESULT ${STRING})
endif(STRING_MATCH)
endforeach(STRING)
endif(REGEX STREQUAL "")
endif(CMAKE26_OR_BETTER)
# Set the given STRINGS variable to the result
set(${STRINGS} ${RESULT})
endmacro(read_from_file)
###############################################################################
# extract_include_filename(<line> <output variable> [<optional output variable of quote type>])
#
# This macro will take a #include line and extract the filename.
###############################################################################
macro(extract_include_filename INCLUDE FILENAME)
# Strip the leading and trailing spaces from the include line
strip_string(${INCLUDE} INCLUDE_STRIPPED)
# Make sure to only do the following if there is a string
if(INCLUDE_STRIPPED STREQUAL "")
set(FILE "")
else(INCLUDE_STRIPPED STREQUAL "")
# Extract the filename including the quotes or angle brackets
string(REGEX REPLACE "^.*([\"<].*[\">]).*$" "\\1" FILE "${INCLUDE_STRIPPED}")
# If an optional 3rd argument is given, we'll store if the quote style was quoted or angle bracketed
if(${ARGC} GREATER 2)
string(SUBSTRING ${FILE} 0 1 QUOTE)
if(QUOTE STREQUAL "<")
set(${ARGV2} "angle brackets")
else(QUOTE STREQUAL "<")
set(${ARGV2} "quotes")
endif(QUOTE STREQUAL "<")
endif(${ARGC} GREATER 2)
# Now remove the quotes or angle brackets
string(REGEX REPLACE "^[\"<](.*)[\">]$" "\\1" FILE "${FILE}")
endif(INCLUDE_STRIPPED STREQUAL "")
# Set the filename to the the given variable
set(${FILENAME} "${FILE}")
endmacro(extract_include_filename)
###############################################################################
# find_includes(<source filename> <output variable>)
#
# This macro will search through a file for #include lines, regardless of
# whitespace, but only returns the lines that are valid for the current
# platform CMake is running on.
###############################################################################
macro(find_includes SRC INCLUDES)
# Read all lines from the file that start with #, regardless of whitespace before the #
read_from_file(${SRC} "^[ \t]*#.*$" LINES)
# Set that any #include lines found are valid, and create temporary variables for the last found #ifdef/#ifndef
set(VALID_LINE TRUE)
set(LAST_DEF)
set(LAST_CHECK)
# Create an empty include list
set(INCLUDES_LIST)
# Iterate through all the # lines
foreach(LINE ${LINES})
# Search for #ifdef, #ifndef, #else, #endif, and #include
string(REGEX MATCH "^[ \t]*#[ \t]*ifdef[ \t]*.*$" FOUND_IFDEF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*ifndef[ \t]*.*$" FOUND_IFNDEF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*else.*$" FOUND_ELSE ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*endif.*$" FOUND_ENDIF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*include[ \t]*[\"<].*[\">][\ t]*.*$" FOUND_INCLUDE ${LINE})
# If we found a #ifdef on the line, extract the data after the #ifdef and set if the lines after it are valid based on the variables in CMake
if(FOUND_IFDEF)
# Extract the define
string(REGEX REPLACE "^[ \t]*#[ \t]*ifdef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
if(DEFINE STREQUAL "_WIN32")
set(DEFINE WIN32)
endif(DEFINE STREQUAL "_WIN32")
# Set the last define to this one, and set the last check to true, so when #else is encountered, we can do an opposing check
set(LAST_DEF ${DEFINE})
set(LAST_CHECK TRUE)
# If the define is true (it either exists or is a non-false result), the lines following will be checked, otherwise they will be skipped
if(${DEFINE})
set(VALID_LINE TRUE)
else(${DEFINE})
set(VALID_LINE FALSE)
endif(${DEFINE})
else(FOUND_IFDEF)
# If we found a #ifndef on the line, the same thing as #ifdef is done, except with the checks in the opposite direction
if(FOUND_IFNDEF)
# Extract the define
string(REGEX REPLACE "^[ \t]*#[ \t]*ifndef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
if(DEFINE STREQUAL "_WIN32")
set(DEFINE WIN32)
endif(DEFINE STREQUAL "_WIN32")
# Set the last define to this one, and set the last check to false, so when #else is encountered, we can do an opposing check
set(LAST_DEF ${DEFINE})
set(LAST_CHECK FALSE)
# If the define is not true (it either doesn't exists or is a false result), the lines following will be checked, otherwise they will be skipped
if(${DEFINE})
set(VALID_LINE FALSE)
else(${DEFINE})
set(VALUE_LINE TRUE)
endif(${DEFINE})
else(FOUND_IFNDEF)
# If we found a #else on the line, we check the last define in the opposite direction
if(FOUND_ELSE)
# When LAST_CHECK is true, we were inside a #ifdef, now act as if we are entering a #ifndef section by doing an opposing check
if(LAST_CHECK)
if(${LAST_DEF})
set(VALID_LINE FALSE)
else(${LAST_DEF})
set(VALID_LINE TRUE)
endif(${LAST_DEF})
# When LAST_CHECK is false, we were inside a #ifndef, now act as if we are entering a #ifdef section by doing an opposing check
else(LAST_CHECK)
if(${LAST_DEF})
set(VALID_LINE TRUE)
else(${LAST_DEF})
set(VALID_LINE FALSE)
endif(${LAST_DEF})
endif(LAST_CHECK)
else(FOUND_ELSE)
# If we found a #endif on the line, we'll assume everything following the line is valid until we meet another one of the above lines
if(FOUND_ENDIF)
set(VALID_LINE TRUE)
else(FOUND_ENDIF)
# If we found a #include on the line, add the entire line to the list of includes unless the line isn't valid
if(FOUND_INCLUDE)
if(VALID_LINE)
append_to_list(INCLUDES_LIST "${LINE}")
endif(VALID_LINE)
endif(FOUND_INCLUDE)
endif(FOUND_ENDIF)
endif(FOUND_ELSE)
endif(FOUND_IFNDEF)
endif(FOUND_IFDEF)
endforeach(LINE)
set(${INCLUDES} ${INCLUDES_LIST})
endmacro(find_includes)
###############################################################################
# calculate_depends(<source filename> [<optional output variable for includes>])
#
# This macro is used in most of the src (sub)directories to calculate the
# header file dependencies for the given source file.
###############################################################################
macro(calculate_depends SRC)
# Temporarily set that we didn't get a 3rd argument before we actually check if we did get one or not
set(CHECK_ANGLE_INCLUDES FALSE)
# Check for a third argument
if(${ARGC} GREATER 1)
set(CHECK_ANGLE_INCLUDES TRUE)
endif(${ARGC} GREATER 1)
# Find all the lines in the given source file that have any form of #include on them, regardless of whitespace, but only if they are valid for the platform we are on
find_includes(${SRC} INCLUDES)
# Reset the list of headers to empty
set(HEADERS)
# Iterate through the strings containing #include (if any)
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
if(QUOTE_TYPE STREQUAL "angle brackets")
# The following checks will only be done if there was a request for angle includes to be checked
if(CHECK_ANGLE_INCLUDES)
# Find the path of the include file
if(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include ${EXTRA_INCLUDE})
else(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} ${EXTRA_INCLUDE})
endif(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the include file was found, add it's path to the list of include paths, but only if it doesn't already exist and isn't in the defaults for the compiler
if(FOUND_${FILENAME}_INCLUDE)
# This used to be find_in_list, but it was changed to this loop to do a find on each default include directory, this fixes Mac OS X trying to get it's framework directories in here
set(FOUND_IN_DEFAULTS -1)
foreach(DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIRS})
string(REGEX REPLACE "\\+" "\\\\+" DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIR})
string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE})
if(FOUND_DEFAULT)
set(FOUND_IN_DEFAULTS 0)
endif(FOUND_DEFAULT)
endforeach(DEFAULT_INCLUDE_DIR)
if(FOUND_IN_DEFAULTS EQUAL -1)
find_in_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
if(FOUND_IN_INCLUDES EQUAL -1)
append_to_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}")
endif(FOUND_IN_INCLUDES EQUAL -1)
endif(FOUND_IN_DEFAULTS EQUAL -1)
else(FOUND_${FILENAME}_INCLUDE)
# XXX
if(NOT ${FILENAME} STREQUAL "libintl.h")
message(WARNING "${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
endif(NOT ${FILENAME} STREQUAL "libintl.h")
endif(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
endif(QUOTE_TYPE STREQUAL "angle brackets")
endforeach(INCLUDE)
endmacro(calculate_depends)
############################################################################### ###############################################################################
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>) # calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
# #
@@ -15,10 +433,10 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
set(LIBRARIES) set(LIBRARIES)
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */ # Check to see if there are any lines matching: /* RequiredLibraries: [something] */
if(WIN32) if(WIN32)
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\*/") read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
else() else(WIN32)
file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\*/") read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
endif() endif(WIN32)
# Iterate through those lines # Iterate through those lines
foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES}) foreach(REQUIRED_LIBRARY ${REQUIRED_LIBRARIES})
# Strip off the /* RequiredLibraries: and */ from the line # Strip off the /* RequiredLibraries: and */ from the line
@@ -32,55 +450,86 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
if (${LIBRARY} MATCHES "^.+\\|.+$") if (${LIBRARY} MATCHES "^.+\\|.+$")
string(REGEX REPLACE ".+\\|(.*)" "\\1" LIBRARY_ALT ${LIBRARY}) string(REGEX REPLACE ".+\\|(.*)" "\\1" LIBRARY_ALT ${LIBRARY})
string(REGEX REPLACE "(.+)\\|.*" "\\1" LIBRARY ${LIBRARY}) string(REGEX REPLACE "(.+)\\|.*" "\\1" LIBRARY ${LIBRARY})
endif() endif(${LIBRARY} MATCHES "^.+\\|.+$")
# Locate the library to see if it exists # Locate the library to see if it exists
if(DEFAULT_LIBRARY_DIRS OR DEFINED $ENV{VCINSTALLDIR}) if(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS}) find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
else() else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} NO_DEFAULT_PATH) find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} NO_DEFAULT_PATH)
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS}) find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS})
endif() endif(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the library was found, we will add it to the linker flags # If the library was found, we will add it to the linker flags
if(FOUND_${LIBRARY}_LIBRARY) if(FOUND_${LIBRARY}_LIBRARY)
if(MSVC) if(MSVC)
# For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies # For Visual Studio, instead of editing the linker flags, we'll add the library to a separate list of extra dependencies
list(APPEND EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}") append_to_list(EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
else() else(MSVC)
# Get the path only of the library, to add it to library paths. # Get the path only of the library, to add it to library paths.
get_filename_component(LIBRARY_PATH ${FOUND_${LIBRARY}_LIBRARY} PATH) get_filename_component(LIBRARY_PATH ${FOUND_${LIBRARY}_LIBRARY} PATH)
list(APPEND LIBRARY_PATHS "${LIBRARY_PATH}") append_to_list(LIBRARY_PATHS "${LIBRARY_PATH}")
# Extract the library short name, add it to the library path # Extract the library short name, add it to the library path
get_filename_component(LIBRARY_NAME ${FOUND_${LIBRARY}_LIBRARY} NAME_WE) get_filename_component(LIBRARY_NAME ${FOUND_${LIBRARY}_LIBRARY} NAME_WE)
string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${LIBRARY_NAME}) string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${LIBRARY_NAME})
list(APPEND LIBRARIES ${LIBRARY_NAME}) append_to_list(LIBRARIES ${LIBRARY_NAME})
endif() endif(MSVC)
else() else(FOUND_${LIBRARY}_LIBRARY)
# In the case of the library not being found, we fatally error so CMake stops trying to generate # In the case of the library not being found, we fatally error so CMake stops trying to generate
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.") message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
endif() endif(FOUND_${LIBRARY}_LIBRARY)
endforeach() endforeach(LIBRARY)
endforeach() endforeach(REQUIRED_LIBRARY)
# Remove duplicates from the library paths # Remove duplicates from the library paths
if(LIBRARY_PATHS) if(LIBRARY_PATHS)
list(REMOVE_DUPLICATES LIBRARY_PATHS) remove_list_duplicates(LIBRARY_PATHS)
endif() endif(LIBRARY_PATHS)
# Remove diplicates from the libraries # Remove diplicates from the libraries
if(LIBRARIES) if(LIBRARIES)
list(REMOVE_DUPLICATES LIBRARIES) remove_list_duplicates(LIBRARIES)
endif() endif(LIBRARIES)
# Iterate through library paths and add them to the linker flags # Iterate through library paths and add them to the linker flags
foreach(LIBRARY_PATH ${LIBRARY_PATHS}) foreach(LIBRARY_PATH ${LIBRARY_PATHS})
if(NOT "${LIBRARY_PATH}" IN_LIST DEFAULT_LIBRARY_DIRS) find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
if(FOUND_IN_DEFAULTS EQUAL -1)
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}") set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
endif() endif(FOUND_IN_DEFAULTS EQUAL -1)
endforeach() endforeach(LIBRARY_PATH)
# Iterate through libraries and add them to the linker flags # Iterate through libraries and add them to the linker flags
foreach(LIBRARY ${LIBRARIES}) foreach(LIBRARY ${LIBRARIES})
list(APPEND EXTRA_DEPENDENCIES "${LIBRARY}") append_to_list(EXTRA_DEPENDENCIES "${LIBRARY}")
endforeach() endforeach(LIBRARY)
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}") set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}") set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
endmacro() endmacro(calculate_libraries)
###############################################################################
# check_functions(<source filename> <output variable set to TRUE on success>)
#
# This macro is used in most of the module (sub)directories to calculate the
# function dependencies for the given source file.
###############################################################################
macro(check_functions SRC SUCCESS)
# Default to true
set(${SUCCESS} TRUE)
# Check to see if there are any lines matching: /* RequiredFunctions: [something] */
read_from_file(${SRC} "/\\\\*[ \t]*RequiredFunctions:[ \t]*.*[ \t]*\\\\*/" REQUIRED_FUNCTIONS)
# Iterate through those lines
foreach(REQUIRED_FUNCTION ${REQUIRED_FUNCTIONS})
# Strip off the /* RequiredFunctions: and */ from the line
string(REGEX REPLACE "/\\*[ \t]*RequiredFunctions:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
# Replace all commas with semicolons
string(REGEX REPLACE "," ";" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
# Iterate through the functions given
foreach(FUNCTION ${REQUIRED_FUNCTION})
# Check if the function exists
check_function_exists(${REQUIRED_FUNCTION} HAVE_${REQUIRED_FUNCTION})
# If we don't have the function warn the user and set SUCCESS to FALSE
if(NOT HAVE_${REQUIRED_FUNCTION})
message("${SRC} needs function ${REQUIRED_FUNCTION} but we were unable to locate that function!")
set(${SUCCESS} FALSE)
endif(NOT HAVE_${REQUIRED_FUNCTION})
endforeach(FUNCTION)
endforeach(REQUIRED_FUNCTION)
endmacro(check_functions)
############################################################################### ###############################################################################
# add_to_cpack_ignored_files(<item> [TRUE]) # add_to_cpack_ignored_files(<item> [TRUE])
@@ -95,12 +544,12 @@ macro(add_to_cpack_ignored_files ITEM)
# If we have 2+ arguments, assume that the second one was something like TRUE (doesn't matter really) and convert periods so they will be \\. for CPack # If 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) if(${ARGC} GREATER 1)
string(REPLACE "." "\\\\." REAL_ITEM ${REAL_ITEM}) string(REPLACE "." "\\\\." REAL_ITEM ${REAL_ITEM})
endif() endif(${ARGC} GREATER 1)
# If the environment variable is already defined, just tack the item to the end # If the environment variable is already defined, just tack the item to the end
if(DEFINED ENV{CPACK_IGNORED_FILES}) if(DEFINED ENV{CPACK_IGNORED_FILES})
set(ENV{CPACK_IGNORED_FILES} "$ENV{CPACK_IGNORED_FILES};${REAL_ITEM}") set(ENV{CPACK_IGNORED_FILES} "$ENV{CPACK_IGNORED_FILES};${REAL_ITEM}")
# Otherwise set the environment variable to the item # Otherwise set the environment variable to the item
else() else(DEFINED ENV{CPACK_IGNORED_FILES})
set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}") set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}")
endif() endif(DEFINED ENV{CPACK_IGNORED_FILES})
endmacro() endmacro(add_to_cpack_ignored_files)
+26
View File
@@ -0,0 +1,26 @@
# Find the header files, libs, and executables for gettext
if(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h /usr/include /usr/local/include ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY intl PATHS /usr/lib /usr/lib64 ${EXTRA_LIBS})
find_program(GETTEXT_MSGFMT msgfmt PATHS /usr/bin/ /usr/local/bin ${EXTRA_INCLUDE})
if(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
if(GETTEXT_LIBRARY)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
endif(GETTEXT_LIBRARY)
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
else(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h)
find_library(GETTEXT_LIBRARY gnuintl)
find_program(GETTEXT_MSGFMT msgfmt)
if(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
endif(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
endif(NOT WIN32)
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
if(GETTEXT_FOUND)
include_directories("${GETTEXT_INCLUDE}")
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
endif(GETTEXT_FOUND)
+5
View File
@@ -0,0 +1,5 @@
# This file is external to the read_from_file macro in Anope.cmake in order to
# get around a possible memory leak in older versions of CMake.
file(READ "${FILE}" RESULT)
message("${RESULT}")
+2 -2
View File
@@ -1,6 +1,6 @@
# Only install example.chk and anope.example.conf from this directory # Only install example.chk and example.conf from this directory
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file) # NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
set(DATA example.chk anope.example.conf botserv.example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf) set(DATA example.chk botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf)
install(FILES ${DATA} install(FILES ${DATA}
DESTINATION ${CONF_DIR} DESTINATION ${CONF_DIR}
) )
+6 -7
View File
@@ -323,7 +323,6 @@ command { service = "NickServ"; name = "SASET GREET"; command = "nickserv/saset/
privilege privilege
{ {
name = "GREET" name = "GREET"
desc = _("Greet message displayed on join")
rank = 40 rank = 40
level = 5 level = 5
flag = "g" flag = "g"
@@ -334,10 +333,10 @@ privilege
/* /*
* fantasy * fantasy
* *
* Allows 'fantasist' commands to be used in channels. * Allows fantasy commands (e.g. !kick) to be used in channels.
* *
* Provides the commands: * Provides the commands:
* botserv/set/fantasy - Used for enabling or disabling BotServ's fantasist commands. * botserv/set/fantasy - Used for enabling or disabling BotServ's fantasy commands.
*/ */
module module
{ {
@@ -376,15 +375,15 @@ fantasy { name = "ENFORCE"; command = "chanserv/enforce"; }
fantasy { name = "ENTRYMSG"; command = "chanserv/entrymsg"; } fantasy { name = "ENTRYMSG"; command = "chanserv/entrymsg"; }
fantasy { name = "FLAGS"; command = "chanserv/flags"; } fantasy { name = "FLAGS"; command = "chanserv/flags"; }
fantasy { name = "HALFOP"; command = "chanserv/modes"; } fantasy { name = "HALFOP"; command = "chanserv/modes"; }
fantasy { name = "HELP"; command = "generic/help"; prepend_channel = false; } fantasy { name = "HELP"; command = "generic/help"; prepend_channel = no; }
fantasy { name = "HOP"; command = "chanserv/xop"; } fantasy { name = "HOP"; command = "chanserv/xop"; }
fantasy { name = "INFO"; command = "chanserv/info"; prepend_channel = false; } fantasy { name = "INFO"; command = "chanserv/info"; prepend_channel = no; }
fantasy { name = "INVITE"; command = "chanserv/invite"; } fantasy { name = "INVITE"; command = "chanserv/invite"; }
fantasy { name = "K"; command = "chanserv/kick"; } fantasy { name = "K"; command = "chanserv/kick"; }
fantasy { name = "KB"; command = "chanserv/ban"; } fantasy { name = "KB"; command = "chanserv/ban"; }
fantasy { name = "KICK"; command = "chanserv/kick"; } fantasy { name = "KICK"; command = "chanserv/kick"; }
fantasy { name = "LEVELS"; command = "chanserv/levels"; } fantasy { name = "LEVELS"; command = "chanserv/levels"; }
fantasy { name = "LIST"; command = "chanserv/list"; prepend_channel = false; } fantasy { name = "LIST"; command = "chanserv/list"; prepend_channel = no; }
fantasy { name = "LOG"; command = "chanserv/log"; } fantasy { name = "LOG"; command = "chanserv/log"; }
fantasy { name = "MODE"; command = "chanserv/mode"; } fantasy { name = "MODE"; command = "chanserv/mode"; }
fantasy { name = "MUTE"; command = "chanserv/ban"; kick = no; mode = "QUIET"; } fantasy { name = "MUTE"; command = "chanserv/ban"; kick = no; mode = "QUIET"; }
@@ -392,7 +391,7 @@ fantasy { name = "OP"; command = "chanserv/modes"; }
fantasy { name = "OWNER"; command = "chanserv/modes"; } fantasy { name = "OWNER"; command = "chanserv/modes"; }
fantasy { name = "PROTECT"; command = "chanserv/modes"; } fantasy { name = "PROTECT"; command = "chanserv/modes"; }
fantasy { name = "QOP"; command = "chanserv/xop"; } fantasy { name = "QOP"; command = "chanserv/xop"; }
fantasy { name = "SEEN"; command = "chanserv/seen"; prepend_channel = false; } fantasy { name = "SEEN"; command = "chanserv/seen"; prepend_channel = no; }
fantasy { name = "SOP"; command = "chanserv/xop"; } fantasy { name = "SOP"; command = "chanserv/xop"; }
fantasy { name = "STATUS"; command = "chanserv/status"; } fantasy { name = "STATUS"; command = "chanserv/status"; }
fantasy { name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; } fantasy { name = "SUSPEND"; command = "chanserv/suspend"; permission = "chanserv/suspend"; }
+7 -61
View File
@@ -109,10 +109,9 @@ module
/* /*
* The length of time before a channel registration expires. * The length of time before a channel registration expires.
* *
* This directive is optional, but recommended. * This directive is optional. If not set, the default is never.
* If not set, the default is 30 days.
*/ */
expire = 30d #expire = 90d
/* /*
* The maximum number of entries on a channel's access list. * The maximum number of entries on a channel's access list.
@@ -163,19 +162,19 @@ module
/* /*
* If set, prevents channel access entries from containing hostmasks. * If set, prevents channel access entries from containing hostmasks.
*/ */
disallow_hostmask_access = false disallow_hostmask_access = no
/* /*
* If set, prevents channels from being on access lists. * If set, prevents channels from being on access lists.
*/ */
disallow_channel_access = false disallow_channel_access = no
/* /*
* If set, ChanServ will always lower the timestamp of registered channels to their registration date. * If set, ChanServ will always lower the timestamp of registered channels to their registration date.
* This prevents several race conditions where unauthorized users can join empty registered channels and set * This prevents several race conditions where unauthorized users can join empty registered channels and set
* modes etc. prior to services deopping them. * modes etc. prior to services deopping them.
*/ */
always_lower_ts = false always_lower_ts = no
} }
/* /*
@@ -216,7 +215,6 @@ module
privilege privilege
{ {
name = "ACCESS_CHANGE" name = "ACCESS_CHANGE"
desc = _("Allowed to modify the access list")
rank = 0 rank = 0
level = 10 level = 10
flag = "f" flag = "f"
@@ -233,7 +231,6 @@ privilege
privilege privilege
{ {
name = "ACCESS_LIST" name = "ACCESS_LIST"
desc = _("Allowed to view the access list")
rank = 10 rank = 10
level = 3 level = 3
flag = "f" flag = "f"
@@ -250,7 +247,6 @@ privilege
privilege privilege
{ {
name = "AKICK" name = "AKICK"
desc = _("Allowed to use the AKICK command")
rank = 250 rank = 250
level = 10 level = 10
flag = "K" flag = "K"
@@ -267,7 +263,6 @@ privilege
privilege privilege
{ {
name = "ASSIGN" name = "ASSIGN"
desc = _("Allowed to assign/unassign a bot")
rank = 270 rank = 270
level = "founder" level = "founder"
flag = "s" flag = "s"
@@ -284,7 +279,6 @@ privilege
privilege privilege
{ {
name = "AUTOHALFOP" name = "AUTOHALFOP"
desc = _("Automatic halfop upon join")
rank = 100 rank = 100
level = 4 level = 4
flag = "H" flag = "H"
@@ -301,7 +295,6 @@ privilege
privilege privilege
{ {
name = "AUTOOP" name = "AUTOOP"
desc = _("Automatic channel operator status upon join")
rank = 210 rank = 210
level = 5 level = 5
flag = "O" flag = "O"
@@ -318,7 +311,6 @@ privilege
privilege privilege
{ {
name = "AUTOOWNER" name = "AUTOOWNER"
desc = _("Automatic owner upon join")
rank = 330 rank = 330
level = 9999 level = 9999
flag = "Q" flag = "Q"
@@ -335,7 +327,6 @@ privilege
privilege privilege
{ {
name = "AUTOPROTECT" name = "AUTOPROTECT"
desc = _("Automatic protect upon join")
rank = 240 rank = 240
level = 10 level = 10
flag = "A" flag = "A"
@@ -352,7 +343,6 @@ privilege
privilege privilege
{ {
name = "AUTOVOICE" name = "AUTOVOICE"
desc = _("Automatic voice on join")
rank = 50 rank = 50
level = 3 level = 3
flag = "V" flag = "V"
@@ -369,7 +359,6 @@ privilege
privilege privilege
{ {
name = "BADWORDS" name = "BADWORDS"
desc = _("Allowed to modify channel badwords list")
rank = 260 rank = 260
level = 10 level = 10
flag = "K" flag = "K"
@@ -386,7 +375,6 @@ privilege
privilege privilege
{ {
name = "BAN" name = "BAN"
desc = _("Allowed to ban users")
rank = 150 rank = 150
level = 4 level = 4
flag = "b" flag = "b"
@@ -403,7 +391,6 @@ privilege
privilege privilege
{ {
name = "FANTASIA" name = "FANTASIA"
desc = _("Allowed to use fantasy commands")
rank = 30 rank = 30
level = 3 level = 3
flag = "c" flag = "c"
@@ -423,7 +410,6 @@ privilege
privilege privilege
{ {
name = "FOUNDER" name = "FOUNDER"
desc = _("Allowed to issue commands restricted to channel founders")
rank = 360 rank = 360
level = 10000 level = 10000
flag = "F" flag = "F"
@@ -441,7 +427,6 @@ privilege
privilege privilege
{ {
name = "GETKEY" name = "GETKEY"
desc = _("Allowed to use GETKEY command")
rank = 180 rank = 180
level = 5 level = 5
flag = "G" flag = "G"
@@ -459,7 +444,6 @@ privilege
privilege privilege
{ {
name = "HALFOP" name = "HALFOP"
desc = _("Allowed to (de)halfop users")
rank = 120 rank = 120
level = 5 level = 5
flag = "h" flag = "h"
@@ -477,7 +461,6 @@ privilege
privilege privilege
{ {
name = "HALFOPME" name = "HALFOPME"
desc = _("Allowed to (de)halfop themself")
rank = 110 rank = 110
level = 4 level = 4
flag = "h" flag = "h"
@@ -495,7 +478,6 @@ privilege
privilege privilege
{ {
name = "INFO" name = "INFO"
desc = _("Allowed to get full INFO output")
rank = 80 rank = 80
level = 9999 level = 9999
flag = "I" flag = "I"
@@ -513,7 +495,6 @@ privilege
privilege privilege
{ {
name = "INVITE" name = "INVITE"
desc = _("Allowed to use the INVITE command")
rank = 190 rank = 190
level = 5 level = 5
flag = "i" flag = "i"
@@ -530,7 +511,6 @@ privilege
privilege privilege
{ {
name = "KICK" name = "KICK"
desc = _("Allowed to use the KICK command")
rank = 130 rank = 130
level = 4 level = 4
flag = "k" flag = "k"
@@ -548,7 +528,6 @@ privilege
privilege privilege
{ {
name = "MEMO" name = "MEMO"
desc = _("Allowed to read channel memos")
rank = 280 rank = 280
level = 10 level = 10
flag = "m" flag = "m"
@@ -566,7 +545,6 @@ privilege
privilege privilege
{ {
name = "MODE" name = "MODE"
desc = _("Allowed to use the MODE command")
rank = 170 rank = 170
level = 9999 level = 9999
flag = "s" flag = "s"
@@ -583,7 +561,6 @@ privilege
privilege privilege
{ {
name = "NOKICK" name = "NOKICK"
desc = _("Prevents users being kicked by services")
rank = 20 rank = 20
level = 1 level = 1
flag = "N" flag = "N"
@@ -601,7 +578,6 @@ privilege
privilege privilege
{ {
name = "OP" name = "OP"
desc = _("Allowed to (de)op users")
rank = 230 rank = 230
level = 5 level = 5
flag = "o" flag = "o"
@@ -619,7 +595,6 @@ privilege
privilege privilege
{ {
name = "OPME" name = "OPME"
desc = _("Allowed to (de)op themself")
rank = 220 rank = 220
level = 5 level = 5
flag = "o" flag = "o"
@@ -637,7 +612,6 @@ privilege
privilege privilege
{ {
name = "OWNER" name = "OWNER"
desc = _("Allowed to (de)owner users")
rank = 350 rank = 350
level = "founder" level = "founder"
flag = "q" flag = "q"
@@ -655,7 +629,6 @@ privilege
privilege privilege
{ {
name = "OWNERME" name = "OWNERME"
desc = _("Allowed to (de)owner themself")
rank = 340 rank = 340
level = 9999 level = 9999
flag = "q" flag = "q"
@@ -673,7 +646,6 @@ privilege
privilege privilege
{ {
name = "PROTECT" name = "PROTECT"
desc = _("Allowed to (de)protect users")
rank = 310 rank = 310
level = 9999 level = 9999
flag = "a" flag = "a"
@@ -691,7 +663,6 @@ privilege
privilege privilege
{ {
name = "PROTECTME" name = "PROTECTME"
desc = _("Allowed to (de)protect themself")
rank = 300 rank = 300
level = 10 level = 10
flag = "a" flag = "a"
@@ -709,7 +680,6 @@ privilege
privilege privilege
{ {
name = "SAY" name = "SAY"
desc = _("Allowed to use SAY and ACT commands")
rank = 90 rank = 90
level = 5 level = 5
flag = "B" flag = "B"
@@ -729,7 +699,6 @@ privilege
privilege privilege
{ {
name = "SET" name = "SET"
desc = _("Allowed to set channel settings")
rank = 320 rank = 320
level = 9999 level = 9999
flag = "s" flag = "s"
@@ -747,7 +716,6 @@ privilege
privilege privilege
{ {
name = "SIGNKICK" name = "SIGNKICK"
desc = _("No signed kick when SIGNKICK LEVEL is used")
rank = 140 rank = 140
level = 9999 level = 9999
flag = "K" flag = "K"
@@ -764,7 +732,6 @@ privilege
privilege privilege
{ {
name = "TOPIC" name = "TOPIC"
desc = _("Allowed to change channel topics")
rank = 160 rank = 160
level = 5 level = 5
flag = "t" flag = "t"
@@ -781,30 +748,12 @@ privilege
privilege privilege
{ {
name = "UNBAN" name = "UNBAN"
desc = _("Allowed to unban users")
rank = 200 rank = 200
level = 4 level = 4
flag = "u" flag = "u"
xop = "HOP" 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. * VOICE privilege.
* *
@@ -816,7 +765,6 @@ privilege
privilege privilege
{ {
name = "VOICE" name = "VOICE"
desc = _("Allowed to (de)voice users")
rank = 70 rank = 70
level = 4 level = 4
flag = "v" flag = "v"
@@ -834,7 +782,6 @@ privilege
privilege privilege
{ {
name = "VOICEME" name = "VOICEME"
desc = _("Allowed to (de)voice themself")
rank = 60 rank = 60
level = 3 level = 3
flag = "v" flag = "v"
@@ -1171,7 +1118,7 @@ module
name = "cs_seen" name = "cs_seen"
/* If set, uses the older 1.8 style seen, which is less resource intensive */ /* If set, uses the older 1.8 style seen, which is less resource intensive */
simple = false simple = no
/* Sets the time to keep seen entries in the seen database. */ /* Sets the time to keep seen entries in the seen database. */
purgetime = "30d" purgetime = "30d"
@@ -1220,7 +1167,7 @@ module
* If set, persistent channels have their creation times lowered to their * If set, persistent channels have their creation times lowered to their
* original registration dates. * original registration dates.
*/ */
persist_lower_ts = true persist_lower_ts = yes
} }
command { service = "ChanServ"; name = "SET"; command = "chanserv/set"; group = "chanserv/management"; } command { service = "ChanServ"; name = "SET"; command = "chanserv/set"; group = "chanserv/management"; }
command { service = "ChanServ"; name = "SET AUTOOP"; command = "chanserv/set/autoop"; } command { service = "ChanServ"; name = "SET AUTOOP"; command = "chanserv/set/autoop"; }
@@ -1261,7 +1208,6 @@ command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc
*/ */
module { name = "cs_status" } module { name = "cs_status" }
command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; } command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; }
command { service = "ChanServ"; name = "WHY"; command = "chanserv/status"; hide = true; }
/* /*
* cs_suspend * cs_suspend
+1 -1
View File
@@ -5,7 +5,7 @@
module module
{ {
name = "chanstats" name = "m_chanstats"
/* /*
* The name of this engine. * The name of this engine.
+4 -4
View File
@@ -9,16 +9,16 @@
############################################################### ###############################################################
# Anope binary directory # Anope binary directory
ANOPATH=/home/ircd/anope/bin ANOPATH=/home/ircd/services/bin
# Anope data directory # Anope data directory
ANODATA=/home/ircd/anope/data ANODATA=/home/ircd/services/data
# Name of the pid file # Name of the pid file
ANOPIDF=anope.pid ANOPIDF=services.pid
# Name of the executable # Name of the executable
ANOPROG=anope ANOPROG=services
# Parameters to pass to the executable # Parameters to pass to the executable
ANOARGS="" ANOARGS=""
+185 -164
View File
@@ -1,8 +1,8 @@
/* /*
* Example configuration file for Anope. After making the appropriate * Example configuration file for Services. After making the appropriate
* changes to this file, place it in the Anope conf directory (as * changes to this file, place it in the Services conf directory (as
* specified in the "Config" script, default /home/username/anope/conf) * specified in the "configure" script, default /home/username/services/conf)
* under the name "anope.conf". * under the name "services.conf".
* *
* The format of this file is fairly simple: three types of comments are supported: * The format of this file is fairly simple: three types of comments are supported:
* - All text after a '#' on a line is ignored, as in shell scripting * - All text after a '#' on a line is ignored, as in shell scripting
@@ -53,7 +53,7 @@
* included to indicate whether an option is required: * included to indicate whether an option is required:
* *
* [REQUIRED] * [REQUIRED]
* Indicates a directive which must be given. Without it, Anope will * Indicates a directive which must be given. Without it, Services will
* not start. * not start.
* *
* [RECOMMENDED] * [RECOMMENDED]
@@ -65,13 +65,9 @@
* will typically be disabled. If this is not the case, more * will typically be disabled. If this is not the case, more
* information will be given in the documentation. * information will be given in the documentation.
* *
* [DISCOURAGED]
* Indicates a directive which may cause undesirable side effects if
* specified.
*
* [DEPRECATED] * [DEPRECATED]
* Indicates a directive which will disappear in a future version of * Indicates a directive which will disappear in a future version of
* Anope, usually because its functionality has been either * Services, usually because its functionality has been either
* superseded by that of other directives or incorporated into the main * superseded by that of other directives or incorporated into the main
* program. * program.
*/ */
@@ -85,7 +81,7 @@
/* /*
* The services.host define is used in multiple different locations throughout the * The services.host define is used in multiple different locations throughout the
* configuration for services clients hostnames. * configuration for the server name and pseudoclient hostnames.
*/ */
define define
{ {
@@ -110,7 +106,7 @@ define
#include #include
{ {
type = "executable" type = "executable"
name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/anope.conf" name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/services.conf"
} }
/* /*
@@ -120,7 +116,7 @@ define
* This section can be included multiple times, and Anope will attempt to * This section can be included multiple times, and Anope will attempt to
* connect to each server until it finally connects. * connect to each server until it finally connects.
* *
* Each uplink IRCd should have a corresponding configuration to allow Anope * Each uplink IRCd should have a corresponding configuration to allow Services
* to link to it. * to link to it.
* *
* An example configuration for InspIRCd that is compatible with the below uplink * An example configuration for InspIRCd that is compatible with the below uplink
@@ -161,22 +157,20 @@ define
uplink uplink
{ {
/* /*
* The IP address, hostname, or UNIX socket path of the IRC server you wish * The IP or hostname of the IRC server you wish to connect Services to.
* to connect Anope to. * Usually, you will want to connect Services over 127.0.0.1 (aka localhost).
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
* *
* NOTE: On some shell providers, this will not be an option. * NOTE: On some shell providers, this will not be an option.
*/ */
host = "127.0.0.1" host = "127.0.0.1"
/* /*
* The protocol that Anope should use when connecting to the uplink. Can * Enable if Services should connect using IPv6.
* be set to "ipv4" (the default), "ipv6", or "unix".
*/ */
protocol = "ipv4" ipv6 = no
/* /*
* Enable if Anope should connect using SSL. * Enable if Services should connect using SSL.
* You must have an SSL module loaded for this to work. * You must have an SSL module loaded for this to work.
*/ */
ssl = no ssl = no
@@ -202,26 +196,26 @@ uplink
/* /*
* [REQUIRED] Server Information * [REQUIRED] Server Information
* *
* This section contains information about the services server. * This section contains information about the Services server.
*/ */
serverinfo serverinfo
{ {
/* /*
* The hostname that Anope will be seen as, it must have no conflicts with any * The hostname that Services will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have * other server names on the rest of your IRC network. Note that it does not have
* to be an existing hostname, just one that isn't on your network already. * to be an existing hostname, just one that isn't on your network already.
*/ */
name = "services.example.com" name = "services.host"
/* /*
* The text which should appear as the server's information in /WHOIS and similar * The text which should appear as the server's information in /WHOIS and similar
* queries. * queries.
*/ */
description = "Anope IRC Services" description = "Services for IRC Networks"
/* /*
* The local address that Anope will bind to before connecting to the remote * The local address that Services will bind to before connecting to the remote
* server. This may be useful for multihomed hosts. If omitted, Anope will let * server. This may be useful for multihomed hosts. If omitted, Services will let
* the Operating System choose the local address. This directive is optional. * the Operating System choose the local address. This directive is optional.
* *
* If you don't know what this means or don't need to use it, just leave this * If you don't know what this means or don't need to use it, just leave this
@@ -237,16 +231,16 @@ serverinfo
#id = "00A" #id = "00A"
/* /*
* The filename containing the Anope process ID. The path is relative to the * The filename containing the Services process ID. The path is relative to the
* services root directory. * services root directory.
*/ */
pid = "data/anope.pid" pid = "data/services.pid"
/* /*
* The filename containing the Message of the Day. The path is relative to the * The filename containing the Message of the Day. The path is relative to the
* services root directory. * services root directory.
*/ */
motd = "conf/motd.txt" motd = "conf/services.motd"
} }
/* /*
@@ -256,18 +250,21 @@ serverinfo
* You MUST modify this to match the IRCd you run. * You MUST modify this to match the IRCd you run.
* *
* Supported: * Supported:
* - bahamut * - [DEPRECATED] bahamut
* - charybdis
* - hybrid * - hybrid
* - inspircd * - [DEPRECATED] inspircd12
* - [DEPRECATED] inspircd20
* - inspircd3 (for 3.x and 4.x)
* - ngircd * - ngircd
* - plexus * - plexus
* - ratbox * - ratbox
* - solanum * - [DEPRECATED] unreal (for 3.2.x)
* - unrealircd * - unreal4 (for 4.x or later)
*/ */
module module
{ {
name = "inspircd" name = "inspircd3"
/* /*
* Some protocol modules can enforce mode locks server-side. This reduces the spam caused by * Some protocol modules can enforce mode locks server-side. This reduces the spam caused by
@@ -289,32 +286,32 @@ module
/* /*
* [REQUIRED] Network Information * [REQUIRED] Network Information
* *
* This section contains information about the IRC network that Anope will be * This section contains information about the IRC network that Services will be
* connecting to. * connecting to.
*/ */
networkinfo networkinfo
{ {
/* /*
* This is the name of the network that Anope will be running on. * This is the name of the network that Services will be running on.
*/ */
networkname = "LocalNet" networkname = "LocalNet"
/* /*
* Set this to the maximum allowed nick length on your network. * Set this to the maximum allowed nick length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
nicklen = 31 nicklen = 31
/* Set this to the maximum allowed ident length on your network. /* Set this to the maximum allowed ident length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
userlen = 10 userlen = 10
/* Set this to the maximum allowed hostname length on your network. /* Set this to the maximum allowed hostname length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
hostlen = 64 hostlen = 64
@@ -330,7 +327,7 @@ networkinfo
/* /*
* Characters allowed in nicknames. This always includes the characters described * Characters allowed in nicknames. This always includes the characters described
* in RFC1459, and so does not need to be set for normal behavior. Changing this to * in RFC1459, and so does not need to be set for normal behavior. Changing this to
* include characters your IRCd doesn't support will cause your IRCd and/or Anope * include characters your IRCd doesn't support will cause your IRCd and/or Services
* to break. Multibyte characters are not supported, nor are escape sequences. * to break. Multibyte characters are not supported, nor are escape sequences.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
@@ -342,20 +339,20 @@ networkinfo
* to services, such as BotServ bot hostnames and user vhosts. Changing this is not * to services, such as BotServ bot hostnames and user vhosts. Changing this is not
* recommended unless you know for sure your IRCd supports whatever characters you are * recommended unless you know for sure your IRCd supports whatever characters you are
* wanting to use. Telling services to set a vHost containing characters your IRCd * wanting to use. Telling services to set a vHost containing characters your IRCd
* disallows could potentially break the IRCd and/or Anope. * disallows could potentially break the IRCd and/or Services.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-" vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-/"
/* /*
* If set to true, allows vHosts to not contain dots (.). * If enabled, allows vHosts to not contain dots (.).
* Newer IRCds generally do not have a problem with this, but the same warning as * Newer IRCds generally do not have a problem with this, but the same warning as
* vhost_chars applies. * vhost_chars applies.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
allow_undotted_vhosts = false allow_undotted_vhosts = no
/* /*
* The characters that are not allowed to be at the very beginning or very ending * The characters that are not allowed to be at the very beginning or very ending
@@ -363,26 +360,26 @@ networkinfo
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
disallow_start_or_end = ".-" disallow_start_or_end = ".-/"
} }
/* /*
* [REQUIRED] Anope Options * [REQUIRED] Services Options
* *
* This section contains various options which determine how Anope will operate. * This section contains various options which determine how Services will operate.
*/ */
options options
{ {
/* /*
* On Linux/UNIX systems Anope can setuid and setgid to this user and group * On Linux/UNIX systems Anope can setuid and setgid to this user and group
* after starting up. This is useful if Anope has to bind to privileged ports. * after starting up. This is useful if Anope has to bind to privileged ports
*/ */
#user = "anope" #user = "anope"
#group = "anope" #group = "anope"
/* /*
* The case mapping used by services. This must be set to a valid locale name * The case mapping used by services. This must be set to a valid locale name
* installed on your machine. Anope uses this case map to compare, with * installed on your machine. Services use this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc. * case insensitivity, things such as nick names, channel names, etc.
* *
* We provide two special casemaps shipped with Anope, ascii and rfc1459. * We provide two special casemaps shipped with Anope, ascii and rfc1459.
@@ -408,11 +405,23 @@ options
#seed = 9866235 #seed = 9866235
/* /*
* Sets the number of invalid password tries before services removes a user * If set, Services will perform more stringent checks on passwords. If this
* isn't set, Services will only disallow a password if it is the same as the
* entity (nickname name) with which it is associated. When set, however,
* Services will also check that the password is at least five
* characters long, and in the future will probably check other things
* as well.
*
* This directive is optional, but recommended.
*/
strictpasswords = yes
/*
* Sets the number of invalid password tries before Services removes a user
* from the network. If a user enters a number of invalid passwords equal to * from the network. If a user enters a number of invalid passwords equal to
* the given amount for any services function or combination of functions * the given amount for any Services function or combination of functions
* during a single IRC session (subject to badpasstimeout, below), services * during a single IRC session (subject to badpasstimeout, below), Services
* will issues a /KILL for the user. If not given, services will ignore * will issues a /KILL for the user. If not given, Services will ignore
* failed password attempts (though they will be logged in any case). * failed password attempts (though they will be logged in any case).
* *
* This directive is optional, but recommended. * This directive is optional, but recommended.
@@ -445,16 +454,10 @@ options
*/ */
readtimeout = 5s readtimeout = 5s
/*
* Sets the interval between sending warning messages for program errors via
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/* /*
* Sets the (maximum) frequency at which the timeout list is checked. This, * Sets the (maximum) frequency at which the timeout list is checked. This,
* combined with readtimeout above, determines how accurately timed events, * combined with readtimeout above, determines how accurately timed events,
* such as nick kills, occur; it also determines how much CPU time services * such as nick kills, occur; it also determines how much CPU time Services
* will use doing this. Higher values will cause less accurate timing but * will use doing this. Higher values will cause less accurate timing but
* less CPU usage. * less CPU usage.
* *
@@ -467,7 +470,7 @@ options
timeoutcheck = 3s timeoutcheck = 3s
/* /*
* If set, this will allow users to let services send PRIVMSGs to them * If set, this will allow users to let Services send PRIVMSGs to them
* instead of NOTICEs. Also see the "msg" option of nickserv:defaults, * instead of NOTICEs. Also see the "msg" option of nickserv:defaults,
* which also toggles the default communication (PRIVMSG or NOTICE) to * which also toggles the default communication (PRIVMSG or NOTICE) to
* use for unregistered users. * use for unregistered users.
@@ -480,7 +483,7 @@ options
#useprivmsg = yes #useprivmsg = yes
/* /*
* If set, will force services to only respond to PRIVMSGs addresses to * If set, will force Services to only respond to PRIVMSGs addresses to
* Nick@ServerName - e.g. NickServ@example.com. This should be used in * Nick@ServerName - e.g. NickServ@example.com. This should be used in
* conjunction with IRCd aliases. This directive is optional. * conjunction with IRCd aliases. This directive is optional.
* *
@@ -489,14 +492,14 @@ options
#usestrictprivmsg = yes #usestrictprivmsg = yes
/* /*
* If set, Anope will only show /stats o to IRC Operators. This directive * If set, Services will only show /stats o to IRC Operators. This directive
* is optional. * is optional.
*/ */
#hidestatso = yes #hidestatso = yes
/* /*
* A space-separated list of U-lined servers on your network, it is assumed that * A space-separated list of U-lined servers on your network, it is assumed that
* the servers in this list are allowed to set channel modes and Anope will * the servers in this list are allowed to set channel modes and Services will
* not attempt to reverse their mode changes. * not attempt to reverse their mode changes.
* *
* WARNING: Do NOT put your normal IRC user servers in this directive. * WARNING: Do NOT put your normal IRC user servers in this directive.
@@ -511,13 +514,13 @@ options
retrywait = 60s retrywait = 60s
/* /*
* If set, services will hide commands that users don't have the privilege to execute * If set, Services will hide commands that users don't have the privilege to execute
* from HELP output. * from HELP output.
*/ */
hideprivilegedcommands = yes hideprivilegedcommands = yes
/* /*
* If set, services will hide commands that users can't execute because they are not * If set, Services will hide commands that users can't execute because they are not
* logged in from HELP output. * logged in from HELP output.
*/ */
hideregisteredcommands = yes hideregisteredcommands = yes
@@ -527,7 +530,7 @@ options
* *
* Note for this to work the regex module providing the regex engine must be loaded. * Note for this to work the regex module providing the regex engine must be loaded.
*/ */
#regexengine = "regex/stdlib" #regexengine = "regex/pcre"
/* /*
* A list of languages to load on startup that will be available in /NICKSERV SET LANGUAGE. * A list of languages to load on startup that will be available in /NICKSERV SET LANGUAGE.
@@ -611,7 +614,7 @@ include
} }
/* /*
* [OPTIONAL] NickServ * [RECOMMENDED] NickServ
* *
* Includes nickserv.example.conf, which is necessary for NickServ functionality. * Includes nickserv.example.conf, which is necessary for NickServ functionality.
* *
@@ -735,7 +738,7 @@ log
{ {
bot = "Global" bot = "Global"
target = "globops" target = "globops"
admin = "global/* operserv/chankill operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop" admin = "global/* operserv/chankill operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/oline operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop"
servers = "squit" servers = "squit"
users = "oper" users = "oper"
other = "expire/* bados akill/*" other = "expire/* bados akill/*"
@@ -748,7 +751,6 @@ log
* You may define groups of commands and privileges, as well as who may use them. * You may define groups of commands and privileges, as well as who may use them.
* *
* This block is recommended, as without it you will be unable to access most oper commands. * This block is recommended, as without it you will be unable to access most oper commands.
* It replaces the old ServicesRoot directive amongst others.
* *
* The command names below are defaults and are configured in the *serv.conf's. If you configure * The command names below are defaults and are configured in the *serv.conf's. If you configure
* additional commands with permissions, such as commands from third party modules, the permissions * additional commands with permissions, such as commands from third party modules, the permissions
@@ -774,7 +776,7 @@ log
* nickserv/recover - Can recover other users nicks * nickserv/recover - Can recover other users nicks
* operserv/config - Can modify services's configuration * operserv/config - Can modify services's configuration
* operserv/oper/modify - Can add and remove operators with at most the same privileges * operserv/oper/modify - Can add and remove operators with at most the same privileges
* protected - Can not be kicked from channels by services * protected - Can not be kicked from channels by Services
* *
* Available commands: * Available commands:
* botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private * botserv/bot/del botserv/bot/add botserv/bot/change botserv/set/private
@@ -787,12 +789,13 @@ log
* *
* memoserv/sendall memoserv/staff * memoserv/sendall memoserv/staff
* *
* nickserv/getemail nickserv/suspend nickserv/ajoin nickserv/list * nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin
* nickserv/list
* *
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password * nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message * nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
* nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire * nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire
* nickserv/saset/keepmodes nickserv/saset/neverop * nickserv/saset/keepmodes
* *
* hostserv/set hostserv/del hostserv/list * hostserv/set hostserv/del hostserv/list
* *
@@ -804,7 +807,7 @@ log
* operserv/oper operserv/config operserv/umode operserv/logsearch * operserv/oper operserv/config operserv/umode operserv/logsearch
* operserv/modload operserv/jupe operserv/set operserv/noop * operserv/modload operserv/jupe operserv/set operserv/noop
* operserv/quit operserv/update operserv/reload operserv/restart * operserv/quit operserv/update operserv/reload operserv/restart
* operserv/shutdown operserv/svs operserv/kill * operserv/shutdown operserv/svs operserv/oline operserv/kill
* *
* Firstly, we define 'opertypes' which are named whatever we want ('Network Administrator', etc). * Firstly, we define 'opertypes' which are named whatever we want ('Network Administrator', etc).
* These can contain commands for oper-only strings (see above) which grants access to that specific command, * These can contain commands for oper-only strings (see above) which grants access to that specific command,
@@ -858,7 +861,7 @@ opertype
inherits = "Services Operator" inherits = "Services Operator"
commands = "botserv/* chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/noop operserv/forbid global/*" commands = "botserv/* chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/oline operserv/noop operserv/forbid global/*"
privs = "*" privs = "*"
} }
@@ -876,10 +879,10 @@ opertype
* After defining different types of operators in the above opertype section, we now define who is in these groups * After defining different types of operators in the above opertype section, we now define who is in these groups
* through 'oper' blocks, similar to ircd access. * through 'oper' blocks, similar to ircd access.
* *
* The default is to comment these out (so NOBODY will have access). * The default is to comment these out (so NOBODY will have Services access).
* You probably want to add yourself and a few other people at minimum. * You probably want to add yourself and a few other people at minimum.
* *
* As with all permissions, make sure to only give trustworthy people access. * As with all permissions, make sure to only give trustworthy people access to Services.
*/ */
#oper #oper
@@ -890,7 +893,7 @@ opertype
/* The opertype this person will have */ /* The opertype this person will have */
type = "Services Root" type = "Services Root"
/* If set, the user must be an oper on the IRCd to gain their /* If set, the user must be an oper on the IRCd to gain their Services
* oper privileges. * oper privileges.
*/ */
require_oper = yes require_oper = yes
@@ -925,7 +928,7 @@ opertype
/* /*
* [OPTIONAL] Mail Config * [OPTIONAL] Mail Config
* *
* This section contains settings related to the use of e-mail from services. * This section contains settings related to the use of e-mail from Services.
* If the usemail directive is set to yes, unless specified otherwise, all other * If the usemail directive is set to yes, unless specified otherwise, all other
* directives are required. * directives are required.
* *
@@ -936,26 +939,28 @@ opertype
mail mail
{ {
/* /*
* If set, this option enables the mail commands in Anope. You may choose * If set, this option enables the mail commands in Services. You may choose
* to disable it if you have no Sendmail-compatible mailer installed. Whilst * to disable it if you have no Sendmail-compatible mailer installed. Whilst
* this directive (and entire block) is optional, it is required if * this directive (and entire block) is optional, it is required if
* nickserv:registration is set to yes. * nickserv:registration is set to mail.
*/ */
usemail = yes usemail = yes
/* /*
* This is the command-line that will be used to call the mailer to send an * The command used for sending emails. It is assumed that this behaves like
* e-mail. It must be called with all the parameters needed to make it * sendmail (i.e. it reads the email from the standard input stream) but you
* scan the mail input to find the mail recipient; consult your mailer * should probably use Postfix or some other sendmail-compatible emailer
* documentation. * instead of sendmail as sendmail is very hard to configure correctly. If
* you are using Windows then https://www.glob.com.au/sendmail/ is probably
* the best option currently.
* *
* Postfix users must use the compatible sendmail utility provided with * If your emailer sends emails directly from the services host you will
* it. This one usually needs no parameters on the command-line. Most * need to configure DKIM, DMARC, and SPF to avoid email hosts from marking
* sendmail applications (or replacements of it) require the -t option * your services emails as spam. It is important that you do this *BEFORE*
* to be used. * sending emails for the first time as some email providers will add your
* * host to a DNSBL like Spamhaus if they consider your emails to be spam. If
* If you are running on Windows you should use a Windows sendmail port * this is too difficult then you may want to consider sending emails via an
* like https://www.glob.com.au/sendmail/ for sending emails. * external email provider using a forwarder like msmtp.
*/ */
sendmailpath = "/usr/sbin/sendmail -t" sendmailpath = "/usr/sbin/sendmail -t"
@@ -970,7 +975,7 @@ mail
* another e-mail after they have sent one. It also controls the minimum time * another e-mail after they have sent one. It also controls the minimum time
* a user must wait before they can receive another e-mail. * a user must wait before they can receive another e-mail.
* *
* This feature prevents users from being mail bombed using services and * This feature prevents users from being mail bombed using Services and
* it is highly recommended that it be used. * it is highly recommended that it be used.
* *
* This directive is optional, but highly recommended. * This directive is optional, but highly recommended.
@@ -978,7 +983,7 @@ mail
delay = 5m delay = 5m
/* /*
* If set, Anope will not put quotes around the TO: fields * If set, Services will not attempt to put quotes around the TO: fields
* in e-mails. * in e-mails.
* *
* This directive is optional, and as far as we know, it's only needed * This directive is optional, and as far as we know, it's only needed
@@ -1102,7 +1107,7 @@ mail
/* /*
* [RECOMMENDED] db_flatfile * [RECOMMENDED] db_flatfile
* *
* This is the default flatfile database format. * Stores your database in a custom flatfile format.
*/ */
module module
{ {
@@ -1115,18 +1120,18 @@ module
/* /*
* Sets the number of days backups of databases are kept. If you don't give it, * Sets the number of days backups of databases are kept. If you don't give it,
* or if you set it to 0, Anope won't backup the databases. * or if you set it to 0, Services won't backup the databases.
* *
* NOTE: Anope must run 24 hours a day for this feature to work. * NOTE: Services must run 24 hours a day for this feature to work.
* *
* This directive is optional, but recommended. * This directive is optional, but recommended.
*/ */
keepbackups = 3 keepbackups = 7
/* /*
* Allows Anope to continue file write operations (i.e. database saving) * Allows Services to continue file write operations (i.e. database saving)
* even if the original file cannot be backed up. Enabling this option may * even if the original file cannot be backed up. Enabling this option may
* allow Anope to continue operation under conditions where it might * allow Services to continue operation under conditions where it might
* otherwise fail, such as a nearly-full disk. * otherwise fail, such as a nearly-full disk.
* *
* NOTE: Enabling this option can cause irrecoverable data loss under some * NOTE: Enabling this option can cause irrecoverable data loss under some
@@ -1142,11 +1147,6 @@ module
* This is only useful with very large databases, with hundreds * This is only useful with very large databases, with hundreds
* of thousands of objects, that have a noticeable delay from * of thousands of objects, that have a noticeable delay from
* writing databases. * writing databases.
*
* If your database is large enough cause a noticeable delay when
* saving you should consider a more powerful alternative such
* as db_sql or db_redis, which incrementally update their
* databases asynchronously in real time.
*/ */
fork = no fork = no
} }
@@ -1154,16 +1154,16 @@ module
/* /*
* db_sql and db_sql_live * db_sql and db_sql_live
* *
* db_sql module allows saving and loading databases using one of the SQL engines. * Allows saving and loading databases to a SQL database.
* This module loads the databases once on startup, then incrementally updates
* objects in the database as they are changed within Anope in real time. Changes
* to the SQL tables not done by Anope will have no effect and will be overwritten.
* *
* db_sql_live module allows saving and loading databases using one of the SQL engines. * db_sql loads the databases once on startup and then incrementally updates in
* This module reads and writes to SQL in real time. Changes to the SQL tables * in the database as they are changed within Anope. Changes to the SQL tables
* will be immediately reflected into Anope. This module should not be loaded * not done by Anope will have no effect and will be overwritten.
* in conjunction with db_sql.
* *
* db_sql_live module reads and writes to SQL in real time. Changes to the SQL
* tables will be immediately reflected in Anope. This module can not be loaded
* at the same time as db_sql. It should also not be used on large networks as
* it executes quite a lot of queries which can cause performance issues.
*/ */
#module #module
{ {
@@ -1171,10 +1171,10 @@ module
#name = "db_sql_live" #name = "db_sql_live"
/* /*
* The SQL service db_sql(_live) should use, these are configured in modules.conf. * The SQL service that db_sql(_live) should use. These are configured in
* For MySQL, this should probably be mysql/main. * modules.example.conf. For MySQL, this should probably be mysql/main.
*/ */
engine = "sqlite/main" engine = "mysql/main"
/* /*
* An optional prefix to prepended to the name of each created table. * An optional prefix to prepended to the name of each created table.
@@ -1182,24 +1182,29 @@ module
*/ */
#prefix = "anope_db_" #prefix = "anope_db_"
/* Whether or not to import data from another database module in to SQL on startup. /*
* If you enable this, be sure that the database services is configured to use is * Whether or not to import data from another database module in to SQL on
* empty and that another database module to import from is loaded before db_sql. * startup.
* After you enable this and do a database import you should disable it for
* subsequent restarts.
* *
* Note that you can not import databases using db_sql_live. If you want to import * If you enable this, be sure that the database Anope is configured to use
* databases and use db_sql_live you should import them using db_sql, then shut down * is empty and that another database module to import from is loaded BEFORE
* and start services with db_sql_live. * db_sql. After you enable this and do a database import you MUST disable
* it for subsequent restarts. If you want to keep writing a file database
* after the SQL import is done you should load db_flatfile AFTER this
* module.
*
* Note that you can not import databases using db_sql_live. If you want to
* import databases and use db_sql_live you should import them using db_sql,
* then shut down and start Anope with db_sql_live.
*/ */
import = false import = no
} }
/* /*
* db_redis. * db_redis.
* *
* This module allows using Redis (https://redis.io/) as a database backend. * This module allows using Redis (https://redis.io/) as a database backend.
* This module requires that redis is loaded and configured properly. * This module requires that m_redis is loaded and configured properly.
* *
* Redis 2.8 supports keyspace notifications which allows Redis to push notifications * 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 * to Anope about outside modifications to the database. This module supports this and
@@ -1211,7 +1216,7 @@ module
name = "db_redis" name = "db_redis"
/* /*
* Redis database to use. This must be configured with redis. * Redis database to use. This must be configured with m_redis.
*/ */
engine = "redis/main" engine = "redis/main"
} }
@@ -1219,49 +1224,65 @@ module
/* /*
* [RECOMMENDED] Encryption modules. * [RECOMMENDED] Encryption modules.
* *
* The encryption modules are used when dealing with passwords. This determines how * The encryption modules are used when dealing with passwords. This determines
* the passwords are stored in the databases, and does not add any security as * how the passwords are stored in the databases.
* far as transmitting passwords over the network goes.
*
* Without any encryption modules loaded users will not be able to authenticate unless
* there is another module loaded that provides authentication checking, such as
* 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.
*
* The other encryption modules use one-way encryption, so the passwords can not
* be recovered later if those are used.
*
* The first encryption module loaded is the primary encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the primary encryption module on next identify.
*
* enc_md5, enc_sha1, and enc_old are deprecated, and are provided for users
* to upgrade to a newer encryption module. Do not use them as the primary
* encryption module. They will be removed in a future release.
* *
* The first encryption module loaded is the primary encryption module. All new
* passwords are encrypted by this module. Old passwords encrypted with another
* encryption method are automatically re-encrypted with the primary encryption
* module the next time the user identifies.
*/ */
#module { name = "enc_bcrypt" }
module { name = "enc_sha256" }
/*
* [DEPRECATED] Deprecated encryption modules. You can only use these for compatibility with
* old databases and will need to load one of the above modules as your primary encryption
* module.
*/
#module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_sha1" }
/* /*
* enc_old is Anope's previous (broken) MD5 implementation used from 1.4.x to 1.7.16. * enc_bcrypt
* If your databases were made using that module, load it here to allow conversion to the primary *
* encryption method. * Provides support for encrypting passwords using the Bcrypt algorithm. See
* https://en.wikipedia.org/wiki/Bcrypt for more information.
*/ */
#module { name = "enc_old" } #module
{
name = "enc_bcrypt"
/** The number of Bcrypt rounds to perform on passwords. Can be set to any
* number between 10 and 32 but higher numbers are more CPU intensive and
* may impact performance.
*/
#rounds = 10
}
/*
* [RECOMMENDED] enc_sha256
*
* Provides support for encrypting passwords using the SHA-2 algorithm with a
* salted initialization vector. See https://en.wikipedia.org/wiki/SHA-2 for
* more information.
*/
module
{
name = "enc_sha256"
}
/*
* [DEPRECATED] enc_md5, enc_none, enc_old, enc_sha1
*
* Provides support for passwords encrypted using encryption methods from older
* versions of Anope. These methods are no longer considered secure and will be
* removed in a future version of Anope. Only load them if you are upgrading
* from a previous version of Anope that used them.
*
* enc_md5: Verifies passwords encrypted with the MD5 algorithm
* enc_none: Verifies passwords that are not encrypted
* enc_sha1: Verifies passwords encrypted with the SHA1 algorithm
* enc_old: Verifies passwords encrypted with the broken MD5 algorithm used
* before 1.7.17.
*
* You must load another encryption method before this to re-encrypt passwords
* with when a user logs in.
*/
#module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_old" }
#module { name = "enc_sha1" }
/* Extra (optional) modules. */ /* Extra (optional) modules. */
include include
+3 -3
View File
@@ -66,7 +66,7 @@ module
client = "Global" client = "Global"
/* /*
* This is the global message that will be sent when Anope is being * This is the global message that will be sent when Services are being
* shutdown/restarted. * shutdown/restarted.
* *
* This directive is optional. * This directive is optional.
@@ -74,7 +74,7 @@ module
#globaloncycledown = "Services are restarting, they will be back shortly - please be good while they're gone" #globaloncycledown = "Services are restarting, they will be back shortly - please be good while they're gone"
/* /*
* This is the global message that will be sent when Anope (re)joins the * This is the global message that will be sent when Services (re)join the
* network. * network.
* *
* This directive is optional. * This directive is optional.
@@ -82,7 +82,7 @@ module
#globaloncycleup = "Services are now back online - have a nice day" #globaloncycleup = "Services are now back online - have a nice day"
/* /*
* If set, Anope will hide the IRC Operator's nick in a global * If set, Services will hide the IRC Operator's nick in a global
* message/notice. * message/notice.
* *
* This directive is optional. * This directive is optional.
+5 -5
View File
@@ -68,7 +68,7 @@ module
/* /*
* If enabled, vhosts are activated on users immediately when they are set. * If enabled, vhosts are activated on users immediately when they are set.
*/ */
activate_on_set = false activate_on_set = no
} }
/* /*
@@ -110,12 +110,12 @@ module
/* /*
* Upon nickserv/group, this option syncs the nick's main vHost to the grouped nick. * Upon nickserv/group, this option syncs the nick's main vHost to the grouped nick.
*/ */
syncongroup = true syncongroup = no
/* /*
* This makes vhosts act as if they are per account. * This makes vhosts act as if they are per account.
*/ */
synconset = true synconset = no
} }
command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; } command { service = "HostServ"; name = "GROUP"; command = "hostserv/group"; }
@@ -161,13 +161,13 @@ module
name = "hs_request" name = "hs_request"
/* /*
* If set, Anope will send a memo to the user requesting a vHost when it's been * If set, Services will send a memo to the user requesting a vHost when it's been
* approved or rejected. * approved or rejected.
*/ */
#memouser = yes #memouser = yes
/* /*
* If set, Anope will send a memo to all services staff when a new vHost is requested. * If set, Services will send a memo to all Services staff when a new vHost is requested.
*/ */
#memooper = yes #memooper = yes
} }
+2 -5
View File
@@ -78,8 +78,7 @@ module
/* /*
* The delay between consecutive uses of the MemoServ SEND command. This can help prevent spam * The delay between consecutive uses of the MemoServ SEND command. This can help prevent spam
* as well as denial-of-service attacks from sending large numbers of memos and filling up disk * as well as denial-of-service attacks from sending large numbers of memos and filling up disk
* space (and memory). The default 3-second wait means a maximum average of 150 bytes of memo * space (and memory).
* per second per user under the current IRC protocol.
* *
* This directive is optional, but recommended. * This directive is optional, but recommended.
*/ */
@@ -186,8 +185,6 @@ command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
* Provides the command memoserv/rsend. * Provides the command memoserv/rsend.
* *
* Used to send a memo requiring a receipt be sent back once it is read. * Used to send a memo requiring a receipt be sent back once it is read.
*
* Requires configuring memoserv:memoreceipt.
*/ */
#module #module
{ {
@@ -198,7 +195,7 @@ command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
* *
* This directive is optional. * This directive is optional.
*/ */
operonly = false operonly = no
} }
#command { service = "MemoServ"; name = "RSEND"; command = "memoserv/rsend"; } #command { service = "MemoServ"; name = "RSEND"; command = "memoserv/rsend"; }
+113 -117
View File
@@ -3,7 +3,7 @@
* *
* The following blocks are used to load all non-core modules, including 3rd-party modules. * The following blocks are used to load all non-core modules, including 3rd-party modules.
* Modules can be prevented from loading by commenting out the line, other modules can be added by * Modules can be prevented from loading by commenting out the line, other modules can be added by
* adding a module block. These modules will be loaded prior to Anope connecting to your network. * adding a module block. These modules will be loaded prior to Services connecting to your network.
* *
* Note that some of these modules are labeled EXTRA, and must be enabled prior to compiling by * Note that some of these modules are labeled EXTRA, and must be enabled prior to compiling by
* running the 'extras' script on Linux and UNIX. * running the 'extras' script on Linux and UNIX.
@@ -19,14 +19,14 @@
module { name = "help" } module { name = "help" }
/* /*
* dns * m_dns
* *
* Adds support for the DNS protocol. By itself this module does nothing useful, * Adds support for the DNS protocol. By itself this module does nothing useful,
* but other modules such as dnsbl and os_dns require this. * but other modules such as m_dnsbl and os_dns require this.
*/ */
#module #module
{ {
name = "dns" name = "m_dns"
/* /*
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file. * The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
@@ -65,7 +65,7 @@ module { name = "help" }
/* This should be the names of the public facing nameservers serving the records. */ /* This should be the names of the public facing nameservers serving the records. */
nameservers = "ns1.example.com ns2.example.com" nameservers = "ns1.example.com ns2.example.com"
/* The time slave servers are allowed to cache. This should be reasonably low /* The time secondary servers are allowed to cache for. This should be reasonably low
* if you want your records to be updated without much delay. * if you want your records to be updated without much delay.
*/ */
refresh = 3600 refresh = 3600
@@ -80,7 +80,7 @@ module { name = "help" }
} }
/* /*
* dnsbl * m_dnsbl
* *
* Allows configurable DNS blacklists to check connecting users against. If a user * 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 * is found on the blacklist they will be immediately banned. This is a crucial module
@@ -88,17 +88,17 @@ module { name = "help" }
*/ */
#module #module
{ {
name = "dnsbl" name = "m_dnsbl"
/* /*
* If set, Anope will check clients against the DNSBLs when services connect to its uplink. * If set, Services will check clients against the DNSBLs when services connect to its uplink.
* This is not recommended, and on large networks will open a very large amount of DNS queries. * This is not recommended, and on large networks will open a very large amount of DNS queries.
* Whilst services are not drastically affected by this, your nameserver/DNSBL might care. * Whilst services are not drastically affected by this, your nameserver/DNSBL might care.
*/ */
check_on_connect = no check_on_connect = no
/* /*
* If set, Anope will check clients when coming back from a netsplit. This can cause a large number * If set, Services will check clients when coming back from a netsplit. This can cause a large number
* of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL * of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL
* might care. * might care.
*/ */
@@ -179,19 +179,19 @@ module { name = "help" }
} }
/* /*
* helpchan * m_helpchan
* *
* Gives users who are op in the specified help channel usermode +h (helpop). * Gives users who are op in the specified help channel usermode +h (helpop).
*/ */
#module #module
{ {
name = "helpchan" name = "m_helpchan"
helpchannel = "#help" helpchannel = "#help"
} }
/* /*
* httpd * m_httpd
* *
* Allows services to serve web pages. By itself, this module does nothing useful. * Allows services to serve web pages. By itself, this module does nothing useful.
* *
@@ -200,7 +200,7 @@ module { name = "help" }
*/ */
#module #module
{ {
name = "httpd" name = "m_httpd"
httpd httpd
{ {
@@ -233,13 +233,13 @@ module { name = "help" }
} }
/* /*
* ldap [EXTRA] * [EXTRA] m_ldap
* *
* This module allows other modules to use LDAP. By itself, this module does nothing useful. * This module allows other modules to use LDAP. By itself, this module does nothing useful.
*/ */
#module #module
{ {
name = "ldap" name = "m_ldap"
ldap ldap
{ {
@@ -254,14 +254,14 @@ module { name = "help" }
} }
/* /*
* ldap_authentication [EXTRA] * [EXTRA] m_ldap_authentication
* *
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use * This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
* LDAP to authenticate users. Requires ldap. * LDAP to authenticate users. Requires m_ldap.
*/ */
#module #module
{ {
name = "ldap_authentication" name = "m_ldap_authentication"
/* /*
* The distinguished name used for searching for users's accounts. * The distinguished name used for searching for users's accounts.
@@ -304,26 +304,26 @@ module { name = "help" }
* *
* If not set, then registration is not blocked. * If not set, then registration is not blocked.
*/ */
#disable_register_reason = "To register on this network visit https://some.misconfigured.site/register" #disable_register_reason = "To register on this network visit https://some.misconfigured.site.example/register"
/* /*
* If set, the reason to give the users who try to "/msg NickServ SET EMAIL". * If set, the reason to give the users who try to "/msg NickServ SET EMAIL".
* If not set, then email changing is not blocked. * If not set, then email changing is not blocked.
*/ */
#disable_email_reason = "To change your email address visit https://some.misconfigured.site" #disable_email_reason = "To change your email address visit https://some.misconfigured.site.example"
} }
/* /*
* ldap_oper [EXTRA] * [EXTRA] m_ldap_oper
* *
* This module dynamically ties users to Anope opertypes when they identify * This module dynamically ties users to Anope opertypes when they identify
* via LDAP group membership. Requires ldap. * via LDAP group membership. Requires m_ldap.
* *
* Note that this doesn't give the user privileges on the IRCd, only in Anope. * Note that this doesn't give the user privileges on the IRCd, only in Services.
*/ */
#module #module
{ {
name = "ldap_oper" name = "m_ldap_oper"
/* /*
* An optional binddn to use when searching for groups. * An optional binddn to use when searching for groups.
@@ -355,13 +355,13 @@ module { name = "help" }
} }
/* /*
* mysql [EXTRA] * [EXTRA] m_mysql
* *
* This module allows other modules to use MySQL. * This module allows other modules to use MySQL.
*/ */
#module #module
{ {
name = "mysql" name = "m_mysql"
mysql mysql
{ {
@@ -376,13 +376,13 @@ module { name = "help" }
} }
/* /*
* redis * m_redis
* *
* This module allows other modules to use Redis. * This module allows other modules to use Redis.
*/ */
#module #module
{ {
name = "redis" name = "m_redis"
/* A redis database */ /* A redis database */
redis redis
@@ -401,62 +401,48 @@ module { name = "help" }
} }
/* /*
* regex_pcre2 [EXTRA] * [DEPRECATED] [EXTRA] m_regex_pcre
*
* 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" }
/*
* [EXTRA] m_regex_pcre2
* *
* Provides the regex engine regex/pcre, which uses version 2 of the Perl Compatible Regular * Provides the regex engine regex/pcre, which uses version 2 of the Perl Compatible Regular
* Expressions library. * Expressions library. This can not be loaded at the same time as the m_regex_pcre module.
*/ */
#module { name = "regex_pcre2" } #module { name = "m_regex_pcre2" }
/* /*
* regex_posix [EXTRA] * [EXTRA] m_regex_posix
* *
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions. * 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 = "regex_posix" } #module { name = "m_regex_posix" }
/* /*
* regex_stdlib * [EXTRA] m_regex_tre
*
* 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. * Provides the regex engine regex/tre, which uses the TRE regex library.
*/ */
#module { name = "regex_tre" } #module { name = "m_regex_tre" }
/* /*
* rewrite * m_rewrite
* *
* Allows rewriting commands sent to/from clients. * Allows rewriting commands sent to/from clients.
*/ */
#module { name = "rewrite" } #module { name = "m_rewrite" }
#command #command
{ {
service = "ChanServ"; name = "CLEAR"; command = "rewrite" service = "ChanServ"; name = "CLEAR"; command = "rewrite"
/* Enable rewrite. */ /* Enable m_rewrite. */
rewrite = true rewrite = yes
/* Source message to match. A $ can be used to match anything. */ /* Source message to match. A $ can be used to match anything. */
rewrite_source = "CLEAR $ USERS" rewrite_source = "CLEAR $ USERS"
@@ -476,7 +462,7 @@ module
} }
/* /*
* proxyscan * m_proxyscan
* *
* This module allows you to scan connecting clients for open proxies. * 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. * Note that using this will allow users to get the IP of your services.
@@ -490,7 +476,7 @@ module
*/ */
#module #module
{ {
name = "proxyscan" name = "m_proxyscan"
/* /*
* The target IP services tells the proxy to connect back to. This must be a publicly * The target IP services tells the proxy to connect back to. This must be a publicly
@@ -558,38 +544,49 @@ module
} }
/* /*
* sasl * m_sasl
* *
* Some IRCds allow "SASL" authentication to let users identify to services * Provides support for authentication to services via IRCv3 SASL. This is a standardised
* during the IRCd user registration process. If this module is loaded, Anope will allow * alternative to ns_identify that is supported by several IRCds.
* authenticating users through this mechanism. Supported mechanisms are: *
* PLAIN, EXTERNAL. * You will need to configure your IRCd to use SASL. See the following links for details:
*
* InspIRCd: https://docs.inspircd.org/4/modules/sasl/
* UnrealIRCd: https://www.unrealircd.org/docs/SASL#Enabling_SASL_on_the_server
*/ */
module { name = "sasl" } module
{
name = "m_sasl"
/*
* The nick of the client which operates as the SASL agent.
*/
#agent = "NickServ"
}
/* /*
* ssl_gnutls [EXTRA] * [EXTRA] m_ssl_gnutls
* *
* This module provides SSL services to Anope using GnuTLS, for example to * This module provides SSL services to Anope using GnuTLS, for example to
* connect to the uplink server(s) via SSL. * connect to the uplink server(s) via SSL.
* *
* You may only load either ssl_gnutls or ssl_openssl, but not both. * You may only load either m_ssl_gnutls or m_ssl_openssl, but not both.
*/ */
#module #module
{ {
name = "ssl_gnutls" name = "m_ssl_gnutls"
/* /*
* An optional certificate and key for ssl_gnutls to give to the uplink. * An optional certificate and key for m_ssl_gnutls to give to the uplink.
* *
* You can generate your own certificate and key pair by using: * You can generate your own certificate and key pair by using:
* *
* certtool --generate-privkey --bits 2048 --outfile privkey.pem * certtool --generate-privkey --bits 2048 --outfile anope.key
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem * certtool --generate-self-signed --load-privkey anope.key --outfile anope.crt
* *
*/ */
cert = "data/fullchain.pem" cert = "data/anope.crt"
key = "data/privkey.pem" key = "data/anope.key"
/* /*
* Diffie-Hellman parameters to use when acting as a server. This is only * Diffie-Hellman parameters to use when acting as a server. This is only
@@ -606,50 +603,49 @@ module { name = "sasl" }
} }
/* /*
* ssl_openssl [EXTRA] * [EXTRA] m_ssl_openssl
* *
* This module provides SSL services to Anope using OpenSSL, for example to * This module provides SSL services to Anope using OpenSSL, for example to
* connect to the uplink server(s) via SSL. * connect to the uplink server(s) via SSL.
* *
* You may only load either ssl_openssl or ssl_gnutls, but not both. * You may only load either m_ssl_openssl or m_ssl_gnutls, but not both.
* *
*/ */
#module #module
{ {
name = "ssl_openssl" name = "m_ssl_openssl"
/* /*
* An optional certificate and key for ssl_openssl to give to the uplink. * An optional certificate and key for m_ssl_openssl to give to the uplink.
* *
* You can generate your own certificate and key pair by using: * You can generate your own certificate and key pair by using:
* *
* openssl genrsa -out privkey.pem 2048 * openssl genrsa -out anope.key 2048
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095 * openssl req -new -x509 -key anope.key -out anope.crt -days 1095
*/ */
cert = "data/fullchain.pem" cert = "data/anope.crt"
key = "data/privkey.pem" key = "data/anope.key"
/* /*
* If you wish to increase security you can disable support for older * As of 2014 SSL 3.0 is considered insecure, but it might be enabled
* versions of TLS with no known vulnerabilities but that provide less * on some systems by default for compatibility reasons.
* security. For your security SSLv2 and SSLv3 are always disabled. * You can use the following option to enable or disable it explicitly.
* Leaving this option not set defaults to the default system behavior.
*/ */
#tlsv10 = no #sslv3 = no
#tlsv11 = no
#tlsv12 = yes
} }
/* /*
* sql_authentication [EXTRA] * [EXTRA] m_sql_authentication
* *
* This module allows authenticating users against an external SQL database using a custom * This module allows authenticating users against an external SQL database using a custom
* query. * query.
*/ */
#module #module
{ {
name = "sql_authentication" name = "m_sql_authentication"
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */ /* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
engine = "mysql/main" engine = "mysql/main"
/* Query to execute to authenticate. A non empty result from this query is considered a success, /* Query to execute to authenticate. A non empty result from this query is considered a success,
@@ -681,20 +677,20 @@ module { name = "sasl" }
* If set, the reason to give the users who try to "/msg NickServ REGISTER". * If set, the reason to give the users who try to "/msg NickServ REGISTER".
* If not set, then registration is not blocked. * If not set, then registration is not blocked.
*/ */
#disable_reason = "To register on this network visit https://some.misconfigured.site/register" #disable_reason = "To register on this network visit https://some.misconfigured.site.example/register"
/* /*
* If set, the reason to give the users who try to "/msg NickServ SET EMAIL". * If set, the reason to give the users who try to "/msg NickServ SET EMAIL".
* If not set, then email changing is not blocked. * If not set, then email changing is not blocked.
*/ */
#disable_email_reason = "To change your email address visit https://some.misconfigured.site" #disable_email_reason = "To change your email address visit https://some.misconfigured.site.example"
} }
/* /*
* sql_log [EXTRA] * [EXTRA] m_sql_log
* *
* This module adds an additional target option to log{} blocks * This module adds an additional target option to log{} blocks
* that allows logging Service's logs to SQL. To log to SQL, add * that allows logging Services' logs to SQL. To log to SQL, add
* the SQL service name to log:targets prefixed by sql_log:. For * the SQL service name to log:targets prefixed by sql_log:. For
* example: * example:
* *
@@ -708,24 +704,24 @@ module { name = "sasl" }
* it if it doesn't exist. This module does not create any indexes (keys) * 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. * on the table and it is recommended you add them yourself as necessary.
*/ */
#module { name = "sql_log" } #module { name = "m_sql_log" }
/* /*
* sql_oper [EXTRA] * [EXTRA] m_sql_oper
* *
* This module allows granting users services operator privileges and possibly IRC Operator * This module allows granting users services operator privileges and possibly IRC Operator
* privileges based on an external SQL database using a custom query. * privileges based on an external SQL database using a custom query.
*/ */
#module #module
{ {
name = "sql_oper" name = "m_sql_oper"
/* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */ /* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */
engine = "mysql/main" engine = "mysql/main"
/* Query to execute to determine if a user should have operator privileges. /* Query to execute to determine if a user should have operator privileges.
* A field named opertype must be returned in order to link the user to their oper type. * A field named opertype must be returned in order to link the user to their oper type.
* The oper types must be configured earlier in anope.conf. * The oper types must be configured earlier in services.conf.
* *
* If a field named modes is returned from this query then those modes are set on the user. * If a field named modes is returned from this query then those modes are set on the user.
* Without this, only a simple +o is sent. * Without this, only a simple +o is sent.
@@ -737,13 +733,13 @@ module { name = "sasl" }
} }
/* /*
* sqlite [EXTRA] * [EXTRA] m_sqlite
* *
* This module allows other modules to use SQLite. * This module allows other modules to use SQLite.
*/ */
#module #module
{ {
name = "sqlite" name = "m_sqlite"
/* A SQLite database */ /* A SQLite database */
sqlite sqlite
@@ -752,7 +748,7 @@ module { name = "sasl" }
name = "sqlite/main" name = "sqlite/main"
/* The database name, it will be created if it does not exist. */ /* The database name, it will be created if it does not exist. */
database = "anope.db" database = "anope.sqlite"
} }
} }
@@ -763,40 +759,40 @@ module { name = "sasl" }
* as they could over IRC. If you are using the default configuration you should be able to access * 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 panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
* *
* This module requires httpd. * This module requires m_httpd.
*/ */
#module #module
{ {
name = "webcpanel" name = "webcpanel"
/* Web server to use. */ /* Web server to use. */
server = "httpd/main"; server = "httpd/main"
/* Template to use. */ /* Template to use. */
template = "default"; template = "default"
/* Page title. */ /* Page title. */
title = "Anope IRC Services"; title = "Anope IRC Services"
} }
/* /*
* xmlrpc * m_xmlrpc
* *
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope. * Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries. * By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
*/ */
#module #module
{ {
name = "xmlrpc" name = "m_xmlrpc"
/* Web service to use. Requires httpd. */ /* Web service to use. Requires m_httpd. */
server = "httpd/main" server = "httpd/main"
} }
/* /*
* xmlrpc_main * m_xmlrpc_main
* *
* Adds the main XMLRPC core functions. * Adds the main XMLRPC core functions.
* Requires xmlrpc. * Requires m_xmlrpc.
*/ */
#module { name = "xmlrpc_main" } #module { name = "m_xmlrpc_main" }
+35 -37
View File
@@ -68,7 +68,7 @@ module
/* /*
* Force users to give an e-mail address when they register a nick. * Force users to give an e-mail address when they register a nick.
* *
* This directive defaults to "yes" and is recommended to be enabled. This is required if e-mail registration is enabled. * This directive defaults to "yes" and is recommended to be enabled.
*/ */
forceemail = yes forceemail = yes
@@ -107,9 +107,8 @@ module
* - memo_receive: Notify user if they have a new memo as soon as it's received * - memo_receive: Notify user if they have a new memo as soon as it's received
* - memo_mail: Notify user if they have a new memo by mail * - memo_mail: Notify user if they have a new memo by mail
* - autoop: User will be automatically opped in channels they enter and have access to * - autoop: User will be automatically opped in channels they enter and have access to
* - neverop: User can not be added to access lists * - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires
* - msg: Messages will be sent as PRIVMSGs instead of NOTICEs, requires options:useprivmsg * options:useprivmsg to be enabled as well
* to be enabled as well
* - ns_keep_modes: Enables keepmodes, which retains user modes across sessions * - ns_keep_modes: Enables keepmodes, which retains user modes across sessions
* *
* This directive is optional, if left blank, the options will default to ns_secure, memo_signon, and * This directive is optional, if left blank, the options will default to ns_secure, memo_signon, and
@@ -126,20 +125,20 @@ module
/* /*
* The length of time before a nick's registration expires. * The length of time before a nick's registration expires.
* *
* This directive is optional, but recommended. If not set, the default is 90 days. * This directive is optional, but recommended. If not set, the default is 21 days.
*/ */
expire = 90d expire = 21d
/* /*
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND * Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND,
* and SET PASSWORD commands by services operators on other services operators. * GETPASS and SET PASSWORD commands by services operators on other services operators.
* *
* This directive is optional, but recommended. * This directive is optional, but recommended.
*/ */
secureadmins = yes secureadmins = yes
/* /*
* If set, Anope will set the channel modes a user has access to upon identifying, assuming * If set, Services will set the channel modes a user has access to upon identifying, assuming
* they are not already set. * they are not already set.
* *
* This directive is optional. * This directive is optional.
@@ -147,14 +146,14 @@ module
modeonid = yes modeonid = yes
/* /*
* If set, Anope will set these user modes on any user who identifies. * If set, Services will set these user modes on any user who identifies.
* *
* This directive is optional. * This directive is optional.
*/ */
#modesonid = "+R" #modesonid = "+R"
/* /*
* If set, Anope will not show netsplits in the last quit message field * If set, Services will not show netsplits in the last quit message field
* of NickServ's INFO command. * of NickServ's INFO command.
*/ */
hidenetsplitquit = no hidenetsplitquit = no
@@ -168,7 +167,7 @@ module
/* /*
* If set, forbids the registration of nicks that contain an existing * If set, forbids the registration of nicks that contain an existing
* nick with services access. For example, if Tester is a Services Oper, * nick with Services access. For example, if Tester is a Services Oper,
* you can't register NewTester or Tester123 unless you are an IRC * you can't register NewTester or Tester123 unless you are an IRC
* Operator. * Operator.
* *
@@ -181,14 +180,14 @@ module
#restrictopernicks = yes #restrictopernicks = yes
/* /*
* The username, and possibly hostname, used for fake users created when Anope needs to * The username, and possibly hostname, used for fake users created when Services needs to
* hold a nickname. * hold a nickname.
*/ */
enforceruser = "enforcer" enforceruser = "enforcer"
enforcerhost = "services.host" enforcerhost = "services.host"
/* /*
* The length of time Anope should hold nicknames for. * The length of time Services hold nicknames.
* *
* This directive is optional, but recommended. If not set it defaults to 1 minute. * This directive is optional, but recommended. If not set it defaults to 1 minute.
*/ */
@@ -204,23 +203,16 @@ module
guestnickprefix = "Guest" guestnickprefix = "Guest"
/* /*
* If set, Anope does not allow ownership of nick names, only ownership of accounts. * If set, Services do not allow ownership of nick names, only ownership of accounts.
*/ */
nonicknameownership = no nonicknameownership = no
/*
* The minimum length of passwords
*
* This directive is optional. If not set it defaults to 8.
*/
minpasslen = 8
/* /*
* The maximum length of passwords * The maximum length of passwords
* *
* This directive is optional. If not set it defaults to 32. * This directive is optional. If not set it defaults to 32.
*/ */
maxpasslen = 32 passlen = 32
} }
/* /*
@@ -266,7 +258,7 @@ module
accessmax = 32 accessmax = 32
/* /*
* If set, Anope will add the usermask of registering users to the access list of their * If set, Services will add the usermask of registering users to the access list of their
* newly created account. If not set, users will always have to identify to NickServ before * newly created account. If not set, users will always have to identify to NickServ before
* being recognized, unless they manually add an address to the access list of their account. * being recognized, unless they manually add an address to the access list of their account.
* This directive is optional. * This directive is optional.
@@ -342,6 +334,18 @@ command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
module { name = "ns_getemail" } module { name = "ns_getemail" }
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; group = "nickserv/admin"; } command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; group = "nickserv/admin"; }
/*
* [DEPRECATED] ns_getpass
*
* Provides the command nickserv/getpass.
*
* Used for getting users passwords.
*
* Requires no encryption is being used.
*/
#module { name = "ns_getpass" }
#command { service = "NickServ"; name = "GETPASS"; command = "nickserv/getpass"; permission = "nickserv/getpass"; }
/* /*
* ns_group * ns_group
* *
@@ -389,7 +393,7 @@ module
*/ */
maxlogins = 10 maxlogins = 10
} }
command { service = "NickServ"; name = "ID"; command = "nickserv/identify"; hide = true; } command { service = "NickServ"; name = "ID"; command = "nickserv/identify"; hide = yes; }
command { service = "NickServ"; name = "IDENTIFY"; command = "nickserv/identify"; } command { service = "NickServ"; name = "IDENTIFY"; command = "nickserv/identify"; }
/* /*
@@ -452,7 +456,7 @@ module
name = "ns_recover" name = "ns_recover"
/* /*
* If set, Anope will svsnick and svsjoin users who use the recover * If set, Services will svsnick and svsjoin users who use the recover
* command on an identified user to the nick and channels of the recovered user. * command on an identified user to the nick and channels of the recovered user.
* *
* This directive is optional. * This directive is optional.
@@ -460,10 +464,9 @@ module
restoreonrecover = yes restoreonrecover = yes
} }
command { service = "NickServ"; name = "RECOVER"; command = "nickserv/recover"; } command { service = "NickServ"; name = "RECOVER"; command = "nickserv/recover"; }
# Uncomment below to emulate 1.8's behavior of ghost and release.
# For compatibility with Anope 1.8 and Atheme. #command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; }
command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; hide = true; } #command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; }
command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; hide = true; }
/* /*
* ns_register * ns_register
@@ -532,7 +535,6 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas
* nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you. * nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you.
* nickserv/set/password, nickserv/saset/password - Used for changing a users password. * nickserv/set/password, nickserv/saset/password - Used for changing a users password.
* nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access. * nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access.
* nickserv/set/neverop, nickserv/saset/neverop - Used to configure whether a user can be added to access lists
* nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring. * nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring.
*/ */
module module
@@ -577,9 +579,6 @@ command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/sas
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; } command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; } command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
command { service = "NickServ"; name = "SET NEVEROP"; command = "nickserv/set/neverop"; }
command { service = "NickServ"; name = "SASET NEVEROP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; }
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; } command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; }
@@ -596,11 +595,10 @@ command { service = "NickServ"; name = "SET URL"; command = "nickserv/set/misc";
command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/misc"; misc_description = _("Associate a URL with this account"); permission = "nickserv/saset/url"; group = "nickserv/admin"; } command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/misc"; misc_description = _("Associate a URL with this account"); permission = "nickserv/saset/url"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET DISCORD"; command = "nickserv/set/misc"; misc_description = _("Associate a Discord account with your account"); } #command { service = "NickServ"; name = "SET DISCORD"; command = "nickserv/set/misc"; misc_description = _("Associate a Discord account with your account"); }
#command { service = "NickServ"; name = "SASET DISCORD"; command = "nickserv/saset/misc"; misc_description = _("Associate a Discord account with this account"); permission = "nickserv/saset/discord"; group = "nickserv/admin"; } #command { service = "NickServ"; name = "SASET DISCORD"; command = "nickserv/saset/misc"; misc_description = _("Associate a Discord account with this account"); permission = "nickserv/saset/discord"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET FACEBOOK"; command = "nickserv/set/misc"; misc_description = _("Associate a Facebook URL with your account"); }
#command { service = "NickServ"; name = "SASET FACEBOOK"; command = "nickserv/saset/misc"; misc_description = _("Associate a Facebook URL with this account"); permission = "nickserv/saset/facebook"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET MASTODON"; command = "nickserv/set/misc"; misc_description = _("Associate a Mastodon account with your account"); } #command { service = "NickServ"; name = "SET MASTODON"; command = "nickserv/set/misc"; misc_description = _("Associate a Mastodon account with your account"); }
#command { service = "NickServ"; name = "SASET MASTODON"; command = "nickserv/saset/misc"; misc_description = _("Associate a Mastodon account with this account"); permission = "nickserv/saset/mastodon"; group = "nickserv/admin"; } #command { service = "NickServ"; name = "SASET MASTODON"; command = "nickserv/saset/misc"; misc_description = _("Associate a Mastodon account with this account"); permission = "nickserv/saset/mastodon"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET TIMEZONE"; command = "nickserv/set/misc"; misc_description = _("Associate a time zone with your account"); }
#command { service = "NickServ"; name = "SASET TIMEZONE"; command = "nickserv/saset/misc"; misc_description = _("Associate a time zone with this account"); permission = "nickserv/saset/timezone"; group = "nickserv/admin"; }
/* /*
* ns_status * ns_status
+26 -15
View File
@@ -75,7 +75,7 @@ module
sqlineexpiry = 30d sqlineexpiry = 30d
/* /*
* If set, this option will make Anope send an AKILL command immediately after it has been * If set, this option will make Services send an AKILL command immediately after it has been
* added with AKILL ADD. This eliminates the need for killing the user after the AKILL has * added with AKILL ADD. This eliminates the need for killing the user after the AKILL has
* been added. * been added.
* *
@@ -84,7 +84,7 @@ module
akillonadd = yes akillonadd = yes
/* /*
* If set, this option will make Anope send an (SVS)KILL command immediately after SNLINE ADD. * If set, this option will make Services send an (SVS)KILL command immediately after SNLINE ADD.
* This eliminates the need for killing the user after the SNLINE has been added. * This eliminates the need for killing the user after the SNLINE has been added.
* *
* This directive is optional. * This directive is optional.
@@ -92,7 +92,7 @@ module
killonsnline = yes killonsnline = yes
/* /*
* If set, this option will make Anope send an (SVS)KILL command immediately after SQLINE ADD. * If set, this option will make Services send an (SVS)KILL command immediately after SQLINE ADD.
* This eliminates the need for killing the user after the SQLINE has been added. * This eliminates the need for killing the user after the SQLINE has been added.
* *
* This directive is optional. * This directive is optional.
@@ -100,7 +100,7 @@ module
killonsqline = yes killonsqline = yes
/* /*
* Adds the nickname of the IRC Operator issuing an AKILL to the kill reason. * Adds the nickname of the Services Operator issuing an AKILL to the kill reason.
* *
* This directive is optional. * This directive is optional.
*/ */
@@ -167,7 +167,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
name = "os_defcon" name = "os_defcon"
/* /*
* Default DefCon level (1-5) to use when starting Anope up. Level 5 constitutes normal operation * Default DefCon level (1-5) to use when starting Services up. Level 5 constitutes normal operation
* while level 1 constitutes the most restrictive operation. If this setting is left out or set to * while level 1 constitutes the most restrictive operation. If this setting is left out or set to
* 0, DefCon will be disabled and the rest of this block will be ignored. * 0, DefCon will be disabled and the rest of this block will be ignored.
*/ */
@@ -209,7 +209,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* The channel modes to set on all channels when the DefCon channel mode system is in use. * The channel modes to set on all channels when the DefCon channel mode system is in use.
* *
* Note 1: Choose these modes carefully, because when DefCon switches to a level which does NOT have * Note 1: Choose these modes carefully, because when DefCon switches to a level which does NOT have
* the mode setting selected, Anope will set the reverse on all channels, e.g. if this setting * the mode setting selected, Services will set the reverse on all channels, e.g. if this setting
* is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all * is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all
* channels will be set to -RN. You don't want to set this to +k for example, because when DefCon * channels will be set to -RN. You don't want to set this to +k for example, because when DefCon
* is removed, all channels are set -k, removing the key from previously keyed channels. * is removed, all channels are set -k, removing the key from previously keyed channels.
@@ -227,14 +227,14 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
#timeout = 15m #timeout = 15m
/* /*
* If set, Anope will send a global message on DefCon level changes. * If set, Services will send a global message on DefCon level changes.
* *
* This directive is optional. * This directive is optional.
*/ */
#globalondefcon = yes #globalondefcon = yes
/* /*
* If set, Anope will send the global message defined in the message directive on DefCon level * If set, Services will send the global message defined in the message directive on DefCon level
* changes. * changes.
* *
* This directive is optional. * This directive is optional.
@@ -267,7 +267,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* *
* Provides the command operserv/dns. * Provides the command operserv/dns.
* *
* This module requires that dns is loaded. * This module requires that m_dns is loaded.
* *
* This module allows controlling a DNS zone. This is useful for * This module allows controlling a DNS zone. This is useful for
* controlling what servers users are placed on for load balancing, * controlling what servers users are placed on for load balancing,
@@ -276,15 +276,15 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* To use this module you must set a nameserver record for services * To use this module you must set a nameserver record for services
* so that DNS queries go to services. * so that DNS queries go to services.
* *
* Alternatively, you may use a slave DNS server to hide service's IP, * Alternatively, you may use a secondary DNS server to hide services' IP,
* provide query caching, and provide better fault tolerance. * provide query caching, and provide better fault tolerance.
* *
* To do this using BIND, configure similar to: * To do this using BIND, configure similar to:
* *
* options { max-refresh-time 60; }; * options { max-refresh-time 60; };
* zone "irc.example.com" IN { * zone "irc.example.com" IN {
* type slave; * type secondary;
* masters { 127.0.0.1 port 5353; }; * primaries { 127.0.0.1 port 5353; };
* }; * };
* *
* Where 127.0.0.1:5353 is the IP and port services are listening on. * Where 127.0.0.1:5353 is the IP and port services are listening on.
@@ -348,7 +348,7 @@ command { service = "OperServ"; name = "FORBID"; command = "operserv/forbid"; pe
* *
* Provides the command operserv/ignore. * Provides the command operserv/ignore.
* *
* Used to make Anope ignore users. * Used to make Services ignore users.
*/ */
module { name = "os_ignore" } module { name = "os_ignore" }
command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; permission = "operserv/ignore"; } command { service = "OperServ"; name = "IGNORE"; command = "operserv/ignore"; permission = "operserv/ignore"; }
@@ -506,6 +506,17 @@ command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomn
module { name = "os_noop" } module { name = "os_noop" }
command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; } command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; }
/*
* [DEPRECATED] os_oline
*
* Provides the command operserv/oline.
*
* Used to set oper flags on users, and is specific to UnrealIRCd 3.2.
* See /helpop ?svso on your IRCd for more information.
*/
#module { name = "os_oline" }
#command { service = "OperServ"; name = "OLINE"; command = "operserv/oline"; permission = "operserv/oline"; }
/* /*
* os_oper * os_oper
* *
@@ -521,7 +532,7 @@ command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permis
* *
* Provides the command operserv/reload. * Provides the command operserv/reload.
* *
* Used to reload the anope.conf configuration file. * Used to reload the services.conf configuration file.
*/ */
module { name = "os_reload" } module { name = "os_reload" }
command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; permission = "operserv/reload"; } command { service = "OperServ"; name = "RELOAD"; command = "operserv/reload"; permission = "operserv/reload"; }
@@ -584,7 +595,7 @@ module
#sessionlimitdetailsloc = "Please visit https://your.website.url/ for more information about session limits." #sessionlimitdetailsloc = "Please visit https://your.website.url/ for more information about session limits."
/* /*
* If set and is not 0, this directive tells Anope to add an AKILL if the number of subsequent kills * If set and is not 0, this directive tells Services to add an AKILL if the number of subsequent kills
* for the same host exceeds this value, preventing the network from experiencing KILL floods. * for the same host exceeds this value, preventing the network from experiencing KILL floods.
* *
* This directive is optional. * This directive is optional.
+54 -60
View File
@@ -1,8 +1,8 @@
/* /*
* Example configuration file for Anope. After making the appropriate * Example configuration file for Services. After making the appropriate
* changes to this file, place it in the Anope conf directory (as * changes to this file, place it in the Services conf directory (as
* specified in the "Config" script, default /home/username/anope/conf) * specified in the "configure" script, default /home/username/services/conf)
* under the name "anope.conf". * under the name "services.conf".
* *
* The format of this file is fairly simple: three types of comments are supported: * The format of this file is fairly simple: three types of comments are supported:
* - All text after a '#' on a line is ignored, as in shell scripting * - All text after a '#' on a line is ignored, as in shell scripting
@@ -53,7 +53,7 @@
* included to indicate whether an option is required: * included to indicate whether an option is required:
* *
* [REQUIRED] * [REQUIRED]
* Indicates a directive which must be given. Without it, Anope will * Indicates a directive which must be given. Without it, Services will
* not start. * not start.
* *
* [RECOMMENDED] * [RECOMMENDED]
@@ -65,13 +65,9 @@
* will typically be disabled. If this is not the case, more * will typically be disabled. If this is not the case, more
* information will be given in the documentation. * information will be given in the documentation.
* *
* [DISCOURAGED]
* Indicates a directive which may cause undesirable side effects if
* specified.
*
* [DEPRECATED] * [DEPRECATED]
* Indicates a directive which will disappear in a future version of * Indicates a directive which will disappear in a future version of
* Anope, usually because its functionality has been either * Services, usually because its functionality has been either
* superseded by that of other directives or incorporated into the main * superseded by that of other directives or incorporated into the main
* program. * program.
*/ */
@@ -84,12 +80,12 @@
*/ */
/* /*
* The stats.host define is used in multiple different locations throughout the * The services.host define is used in multiple different locations throughout the
* configuration for the stats client hostname. * configuration for the server name and pseudoclient hostnames.
*/ */
define define
{ {
name = "stats.host" name = "services.host"
value = "stats.example.com" value = "stats.example.com"
} }
@@ -120,20 +116,23 @@ define
* This section can be included multiple times, and Anope will attempt to * This section can be included multiple times, and Anope will attempt to
* connect to each server until it finally connects. * connect to each server until it finally connects.
* *
* Each uplink IRCd should have a corresponding configuration to allow Anope * Each uplink IRCd should have a corresponding configuration to allow Services
* to link to it. * to link to it.
* *
* An example configuration for InspIRCd that is compatible with the below uplink * An example configuration for InspIRCd that is compatible with the below uplink
* and serverinfo configuration would look like: * and serverinfo configuration would look like:
* *
* # This goes in inspircd.conf, *NOT* your Anope config! * # This goes in inspircd.conf, *NOT* your Anope config!
* <module name="hidechans">
* <module name="services_account">
* <module name="spanningtree">
* <bind address="127.0.0.1" port="7000" type="servers">
* <link name="stats.example.com" * <link name="stats.example.com"
* ipaddr="127.0.0.1" * ipaddr="127.0.0.1"
* port="7000" * port="7000"
* sendpass="mypassword" * sendpass="mypassword"
* recvpass="mypassword"> * recvpass="mypassword">
* <uline server="stats.example.com" silent="yes"> * <uline server="stats.example.com" silent="yes">
* <bind address="127.0.0.1" port="7000" type="servers">
* *
* An example configuration for UnrealIRCd that is compatible with the below uplink * An example configuration for UnrealIRCd that is compatible with the below uplink
* and serverinfo configuration would look like: * and serverinfo configuration would look like:
@@ -158,22 +157,20 @@ define
uplink uplink
{ {
/* /*
* The IP address, hostname, or UNIX socket path of the IRC server you wish * The IP or hostname of the IRC server you wish to connect Services to.
* to connect Anope to. * Usually, you will want to connect Services over 127.0.0.1 (aka localhost).
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
* *
* NOTE: On some shell providers, this will not be an option. * NOTE: On some shell providers, this will not be an option.
*/ */
host = "127.0.0.1" host = "127.0.0.1"
/* /*
* The protocol that Anope should use when connecting to the uplink. Can * Enable if Services should connect using IPv6.
* be set to "ipv4" (the default), "ipv6", or "unix".
*/ */
protocol = "ipv4" ipv6 = no
/* /*
* Enable if Anope should connect using SSL. * Enable if Services should connect using SSL.
* You must have an SSL module loaded for this to work. * You must have an SSL module loaded for this to work.
*/ */
ssl = no ssl = no
@@ -199,12 +196,12 @@ uplink
/* /*
* [REQUIRED] Server Information * [REQUIRED] Server Information
* *
* This section contains information about the services server. * This section contains information about the Services server.
*/ */
serverinfo serverinfo
{ {
/* /*
* The hostname that Anope will be seen as, it must have no conflicts with any * The hostname that Services will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have * other server names on the rest of your IRC network. Note that it does not have
* to be an existing hostname, just one that isn't on your network already. * to be an existing hostname, just one that isn't on your network already.
*/ */
@@ -214,11 +211,11 @@ serverinfo
* The text which should appear as the server's information in /WHOIS and similar * The text which should appear as the server's information in /WHOIS and similar
* queries. * queries.
*/ */
description = "Anope IRC Statistics" description = "Stats for IRC Networks"
/* /*
* The local address that Anope will bind to before connecting to the remote * The local address that Services will bind to before connecting to the remote
* server. This may be useful for multihomed hosts. If omitted, Anope will let * server. This may be useful for multihomed hosts. If omitted, Services will let
* the Operating System choose the local address. This directive is optional. * the Operating System choose the local address. This directive is optional.
* *
* If you don't know what this means or don't need to use it, just leave this * If you don't know what this means or don't need to use it, just leave this
@@ -234,16 +231,16 @@ serverinfo
#id = "00A" #id = "00A"
/* /*
* The filename containing the Anope process ID. The path is relative to the * The filename containing the Services process ID. The path is relative to the
* services root directory. * services root directory.
*/ */
pid = "data/anope.pid" pid = "data/stats.pid"
/* /*
* The filename containing the Message of the Day. The path is relative to the * The filename containing the Message of the Day. The path is relative to the
* services root directory. * services root directory.
*/ */
motd = "conf/motd.txt" motd = "conf/stats.motd"
} }
/* /*
@@ -253,49 +250,52 @@ serverinfo
* You MUST modify this to match the IRCd you run. * You MUST modify this to match the IRCd you run.
* *
* Supported: * Supported:
* - bahamut * - [DEPRECATED] bahamut
* - charybdis
* - hybrid * - hybrid
* - inspircd * - [DEPRECATED] inspircd12
* - [DEPRECATED] inspircd20
* - inspircd3 (for 3.x and 4.x)
* - ngircd * - ngircd
* - plexus * - plexus
* - ratbox * - ratbox
* - solanum * - [DEPRECATED] unreal (for 3.2.x)
* - unrealircd * - unreal4 (for 4.x or later)
*/ */
module module
{ {
name = "inspircd" name = "inspircd3"
} }
/* /*
* [REQUIRED] Network Information * [REQUIRED] Network Information
* *
* This section contains information about the IRC network that Anope will be * This section contains information about the IRC network that Services will be
* connecting to. * connecting to.
*/ */
networkinfo networkinfo
{ {
/* /*
* This is the name of the network that Anope will be running on. * This is the name of the network that Services will be running on.
*/ */
networkname = "LocalNet" networkname = "LocalNet"
/* /*
* Set this to the maximum allowed nick length on your network. * Set this to the maximum allowed nick length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
nicklen = 31 nicklen = 31
/* Set this to the maximum allowed ident length on your network. /* Set this to the maximum allowed ident length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
userlen = 10 userlen = 10
/* Set this to the maximum allowed hostname length on your network. /* Set this to the maximum allowed hostname length on your network.
* Be sure to set this correctly, as setting this wrong can result in * Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network. * Services being disconnected from the network.
*/ */
hostlen = 64 hostlen = 64
@@ -313,11 +313,11 @@ networkinfo
* to services, such as BotServ bot hostnames and user vhosts. Changing this is not * to services, such as BotServ bot hostnames and user vhosts. Changing this is not
* recommended unless you know for sure your IRCd supports whatever characters you are * recommended unless you know for sure your IRCd supports whatever characters you are
* wanting to use. Telling services to set a vHost containing characters your IRCd * wanting to use. Telling services to set a vHost containing characters your IRCd
* disallows could potentially break the IRCd and/or Anope. * disallows could potentially break the IRCd and/or Services.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-" vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-/"
/* /*
* If set to true, allows vHosts to not contain dots (.). * If set to true, allows vHosts to not contain dots (.).
@@ -326,7 +326,7 @@ networkinfo
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
allow_undotted_vhosts = false allow_undotted_vhosts = no
/* /*
* The characters that are not allowed to be at the very beginning or very ending * The characters that are not allowed to be at the very beginning or very ending
@@ -334,26 +334,26 @@ networkinfo
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
disallow_start_or_end = ".-" disallow_start_or_end = ".-/"
} }
/* /*
* [REQUIRED] Anope Options * [REQUIRED] Services Options
* *
* This section contains various options which determine how Anope will operate. * This section contains various options which determine how Services will operate.
*/ */
options options
{ {
/* /*
* On Linux/UNIX systems Anope can setuid and setgid to this user and group * On Linux/UNIX systems Anope can setuid and setgid to this user and group
* after starting up. This is useful if Anope has to bind to privileged ports. * after starting up. This is useful if Anope has to bind to privileged ports
*/ */
#user = "anope" #user = "anope"
#group = "anope" #group = "anope"
/* /*
* The case mapping used by services. This must be set to a valid locale name * The case mapping used by services. This must be set to a valid locale name
* installed on your machine. Anope uses this case map to compare, with * installed on your machine. Services use this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc. * case insensitivity, things such as nick names, channel names, etc.
* *
* We provide two special casemaps shipped with Anope, ascii and rfc1459. * We provide two special casemaps shipped with Anope, ascii and rfc1459.
@@ -371,20 +371,14 @@ options
readtimeout = 5s readtimeout = 5s
/* /*
* Sets the interval between sending warning messages for program errors via * If set, Services will only show /stats o to IRC Operators. This directive
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/*
* If set, Anope will only show /stats o to IRC Operators. This directive
* is optional. * is optional.
*/ */
#hidestatso = yes #hidestatso = yes
/* /*
* A space-separated list of U-lined servers on your network, it is assumed that * A space-separated list of U-lined servers on your network, it is assumed that
* the servers in this list are allowed to set channel modes and Anope will * the servers in this list are allowed to set channel modes and Services will
* not attempt to reverse their mode changes. * not attempt to reverse their mode changes.
* *
* WARNING: Do NOT put your normal IRC user servers in this directive. * WARNING: Do NOT put your normal IRC user servers in this directive.
@@ -431,8 +425,8 @@ log
#source = "" #source = ""
/* /*
* The bot used to log generic messages which have no predefined sender if there * The bot used to log generic messages which have no predefined sender if the
* is a channel in the target directive. * target directive is set to a channel or globops.
*/ */
bot = "Global" bot = "Global"
@@ -483,13 +477,13 @@ log
/* /*
* [REQUIRED] MySQL Database configuration. * [REQUIRED] MySQL Database configuration.
* *
* mysql * m_mysql
* *
* This module allows other modules to use MySQL. * This module allows other modules to use MySQL.
*/ */
module module
{ {
name = "mysql" name = "m_mysql"
mysql mysql
{ {
+1
View File
@@ -0,0 +1 @@
astyle --style=java --indent=tab --brackets=break-closing --indent-switches --indent-cases --brackets=break
+1
View File
@@ -0,0 +1 @@
For all bug reports / updates please see https://github.com/anope/anope/issues
+111
View File
@@ -0,0 +1,111 @@
C++-style Casting
=================
In C, you can cast in one of two ways:
(type)var
type(var)
The problem with C-style casting is that it allows a programmer to get away
with too much, and is also not designed to handle C++ classes.
C++ has 4 types of casting in addition to allowing C-style casting. They are:
static_cast
const_cast
dynamic_cast
reinterpret_cast
The syntax is usually *_cast<type>(var).
static_cast
-----------
From my experience, this cast is closest to C-style casting for non-pointer
types as well as between some (but not all) pointer types. This type of cast,
like C-style casting, is performed at compile-time. static_cast can also do
a downcast of a derived class to a base class, but only if the base class is
not a virtual base class. Sometimes the result of this cast can become
undefined. static_cast is a bit more strict that C-style casting, though. It
disallows certain class conversions that would've been allowed with a C-style
cast. static_cast also doesn't allow you to cast to an incomplete type. In
these cases, I would try either dynamic_cast or reinterpret_cast.
const_cast
----------
This cast is mainly to add or remove const-ness or volatile-ness from a
variable. This is safer than using a C-style cast to change the const-ness
of a variable. In most cases if you try to use one of the other casts and it
complains about const-ness, you will want to either use this cast instead or
wrap the other cast around this cast. An example:
const int *a;
static_cast<void *>(a); <-- This will fail.
To remedy the above, you would might try this:
const int *a;
const_cast<void *>(a); <-- But this will still fail.
The real solution is this:
const int *a;
static_cast<void *>(const_cast<int *>(a));
It is not recommended to use const_cast on the this variable within a member
function of a class that is declared const. Instead you should use the mutable
keyword on the variable in the class's definition.
dynamic_cast
------------
This cast can only be used on pointers or references to classes. It can cast a
derived class to a base class, a derived class to another derived class
(provided that both are children of the same base class), or a base class to a
derived class. You can also use this to cast a class to void *. This cast is
done at run-time as opposed to the other casts, and relies on C++'s RTTI to be
enabled. It is meant to be used on polymorphic classes, so use static_cast on
non-polymorphic classes.
derived-to-base conversions are actually done statically, so you use either
dynamic_cast or static_cast on them, regardless of if the classes are
polymorphic or not.
derived-to-derived or base-to-derived conversions, however, rely on run-time
type information, and this cast is used on those classes that are polymorphic.
This is safer than C-style casting in that an invalid pointer conversion will
return a NULL pointer, and an invalid reference conversion will throw a
Bad_cast exception.
Note that in Anope we prefer if Anope::debug_cast is used.
This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
and static_cast on release builds, to speed up the program because of dynamic_cast's
reliance on RTTI.
reinterpret_cast
----------------
This cast I would use only as a last resort if static_cast isn't allowed on a
conversion. It allows for conversions between two unrelated types, such as
going from char * to int *. It can also be used to convert a pointer to an
integral type and vica versa. The sites I've read mention how the result is
non-portable, which I assume means the resulting object code is non-portable,
so since the code is compiled on many systems anyways, I don't see this as
being a huge issue. It is recommended to only use this if necessary, though.
Links
=====
The following links are web sites I've used to get this information, and might
describe some of the above a bit better than I have. :P
https://www.acm.org/crossroads/xrds3-1/ovp3-1.html
http://www.cplusplus.com/doc/tutorial/typecasting.html
http://www.codeguru.com/forum/showthread.php?t=312456
https://web.archive.org/web/20170810222238/http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html
https://www.microsoft.com/en-us/download/details.aspx?id=55984
https://en.wikibooks.org/wiki/C%2B%2B_Programming/Type_Casting
https://web.archive.org/web/20160510114447/http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=134
-- CyberBotX, Nov 23, 2008
+3 -3
View File
@@ -6,10 +6,10 @@ if(WIN32)
if(IN_SOURCE) if(IN_SOURCE)
# Add README.txt to list of files for CPack to ignore # Add README.txt to list of files for CPack to ignore
add_to_cpack_ignored_files("README.txt$" TRUE) add_to_cpack_ignored_files("README.txt$" TRUE)
endif() endif(IN_SOURCE)
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt) set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
install(FILES ${DOCS} install(FILES ${DOCS}
DESTINATION ${DOC_DIR} DESTINATION ${DOC_DIR}
) )
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt") set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/README.txt")
endif() endif(WIN32)
+239
View File
@@ -0,0 +1,239 @@
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.
+520 -29
View File
@@ -1,34 +1,525 @@
Anope Version 2.1.2 Anope Version 2.0.21-git
------------------- ------------------------
Bumped the minimum OpenSSL version to 1.1.0. No significant changes.
Bumped the minumum GnuTLS version to 3.0.0.
Disabled SSLv3 support in the m_ssl_openssl module. Anope Version 2.0.20
Modernized mutex and thread code to use Modern C++. --------------------
Normalised the program exit codes. Fixed an escaped value that wasn't escaped enough in chanstats.
Fixed not having a handler for the FNAME message on InspIRCd.
Fixed os_stats reporting the SGLine expiry time as the SQLine expiry time.
Fixed the DNs and search filters not being escaped correctly in the ldap_authentication and ldap_oper modules.
Modernised the advice in docs/LANGUAGE regarding the installation of language packs.
Anope Version 2.0.19
--------------------
Added a Doxygen config file.
Backported various minor config changes from 2.1.
Fixed chanserv/enforce enforcing against founders.
Fixed creating channel entries in irc2sql.
Fixed not respecting the mode state when removing a mode lock.
Fixed reading the settings in m_dns.
Fixed resetpass confirming accounts when not using email confirmation.
Fixed trying to write to a buffered socket when there's no data.
Fixed various minor spelling issues.
Updated some messages for the language used by modern BIND versions.
Anope Version 2.0.18
--------------------
Backported better sendmail error messages from 2.1.
Backported the Windows CI fom 2.1.
Fixed a CMake error when it encounters a hard to parse header file.
Fixed being able to group guest nicknames.
Fixed building Anope with CMake 4.
Fixed compatibility with MariaDB.
Fixed counting email addresses in ns_maxemail.
Fixed importing user ICQ and URL data from 1.8.
Fixed operserv/ignore not being prioritised first.
Fixed resetting the stats with operserv/stats.
Updated the Dutch translation.
Anope Version 2.0.17
--------------------
Fixed importing large flatfile databases into SQL.
Fixed marking channels as permanent.
Fixed serialising unset boolean extension items.
Fixed the documentation about how to import SQL databases.
Fixed the documentation of options:usemail.
Fixed the location of the geoipupdate CSV files.
Fixed translating memo emails.
Fixed unnecessary SQL updates caused by dereferencing user accounts.
Increased the size of the chanstats letter and word count columns.
Updated the location of the Anope IRC channels.
Anope Version 2.0.16
--------------------
Added a workaround for users matching expired sqlines.
Fixed a copy/paste error in webcpanel.
Fixed a crash in db_flatfile caused by trying to serialize data without a type.
Fixed duplicate messages when synconset/syncongroup is set.
Fixed expiring channel suspensions.
Fixed expiring forbids.
Fixed expiring nick suspensions.
Fixed feature detection on InspIRCd.
Fixed InspIRCd account cloaks causing CHGHOST spam when a user also has a services vhost.
Fixed joining users to channels with a key set on InspIRCd.
Fixed logging users out fully when their nick gets suspended.
Fixed marking boolean columns in SQL as TEXT instead of INT.
Fixed matching extbans on InspIRCd and implement missing matchers.
Fixed operserv/sqline expiry on UnrealIRCd
Fixed respecting --noexpire in cs_suspend and ns_suspend.
Fixed sending emails to nicks ending with a backslash.
Fixed sending SVSTOPIC when topiclock is loaded on InspIRCd.
Fixed some SQL tables taking up too much space on disk.
Fixed the default config for channel suspensions.
Fixed the TIME message on InspIRCd.
Fixed trying to escape SQL data when not connected to MySQL.
Fixed {ldap,sql}_authentication creating zombie accounts on expiry.
Anope Version 2.0.15
--------------------
Fixed a race condition in changing the nick of a user.
Fixed being able to reset the password of suspended accounts.
Fixed chanserv/suspend info not being visible to regular users.
Fixed removing entries by an alias in chanserv/access and chanserv/xop.
Fixed various grammar issues in messages.
Made the SASL PLAIN implementation more robust.
Updated the Dutch translation. Updated the Dutch translation.
Updated the French translation. Updated the French translation.
Updated the Turkish translation.
Anope Version 2.1.1 Anope Version 2.0.14
------------------- --------------------
Added the UNBANME privilege to allow users to unban themselves. Added support for sqlining channels on UnrealIRCd.
Fixed building on Windows systems without chgrp/chmod. Fixed a crash when trying to access config for non-loaded modules.
Fixed creating sockets in the m_dns, m_httpd, m_proxyscan, and m_redis modules. Fixed detection of the InspIRCd nopartmsg module.
Fixed reading the values of command line arguments. Fixed not getting memo notifications when authing with SASL.
Moved core privilege descriptions to the example configs. Fixed not serialising dontkickops/dontkickvoices in botserv/kick.
Updated the Italian translation. Fixed sending emails with the wrong kind of line terminator.
Updated the Polish translation. Fixed sending log messages from a renamed pseudoclient.
Fixed telling users their passcode is incorrect when they need to authenticate in nickserv/confirm.
Fixed the Config script freezing on some versions of util-linux.
Updated the Windows packaging scripts to use dependencies from Conan.
Anope Version 2.1.0 Anope Version 2.0.13
--------------------
Fixed a crash on some compilers when trying to call methods on a null pointer
Fixed a crash when encountering an unterminated commented config block
Fixed erroneously rejecting spaces in fantasy:name
Fixed marking services pseudoclients as an oper on InspIRCd
Fixed not checking user@ip as well as user@host when logging into an operator account
Fixed setting the vhost/vident during SASL on UnrealIRCd
Updated the German translation
Updated the Italian translation
Anope Version 2.0.12
--------------------
Added account confirmation to the web panel
Added the regex_pcre2 module which provides regex/pcre with PCRE2
Documented the cs_no_expire channel default
Fixed config validation mistakenly allowing spaces in some fields
Fixed the bahamut protocol module not knowing about halfops
Fixed writing a flatfile database not being atomic
Updated the hybrid protocol module for recent protocol changes
Anope Version 2.0.11
--------------------
Fixed ldap on OpenLDAP 2.5+
Fixed not using utf-8 encoding for outgoing email
Fixed ns_resetpass not returning a response for XMLRPC
Fixed some message params being sent as <middle> instead of <trailing>
Fixed unsetting vhosts on unreal4
Fixed username validity checking on ircd-hybrid
Send the oper mode for services pseudoclients on InspIRCd
Updated the pl_PL translation
Updated unreal4 for various protocol changes
Anope Version 2.0.10
--------------------
Add support for channel SQLines on InspIRCd
Change default protocol module from inspircd20 to inspircd3
Change the character set used by chanstats and irc2sql to utf8mb4
Fix a ton of typos in messages
Fix being able to override MAXLIST on InspIRCd
Fix blocking on boot when trying to upgrade SQL databases without account identifiers
Fix not flushing the ERROR message on squit
Fix using an invalidated iterator when deleting bots
Fix various harmless compiler warnings
Fix webcpanel not using the forwarded IP
Show the account name in nickserv/info
Anope Version 2.0.9
------------------- -------------------
Added support for access list entry descriptions. Fix a regression from 2.0.8 that prevented serialising to MySQL
Added support for linking over a UNIX socket. Send account identifiers to InspIRCd on SASL logins too
Added support for server-initiated logins and logouts on UnrealIRCd. Fix a query bug in irc2sql
Added support for server-initiated logouts on InspIRCd.
Added support for the ANONYMOUS SASL mechanism. Anope Version 2.0.8
Allowed users to opt-out of being added to channel access lists. -------------------
Cleaned up the codebase to use Modern C++17. Add +K channel mode for ircd-hybrid
Modernized the build system to use a modern version of CMake. Add immutable identifiers to user accounts
Removed support for using insecure encryption methods as the primary method. Fix build on systems that use musl libc
Removed the Windows-only anopesmtp tool. Fix help of global/global not showing the correct origin nick
Removed the two day X-line cap. Fix not removing vhosts when an nick is dropped
Updated all references to IRCServices to refer to Anope instead. Fix parsing channel metadata on InspIRCd 3+
Fix parsing kicks on InspIRCd 3+
Fix parsing topic changes on InspIRCd 3+
Fix topiclock on InspIRCd
Modernize the ircd-hybrid protocol module
Anope Version 2.0.7
-------------------
Fix not sending login data on successful NickServ GROUP
Fix m_httpd to not consider headers to be case sensitive
Add InspIRCd 3 protocol support
Add 'n' email token for use in the email change template
Add logging for NickServ UNGROUP
Fix setting swhois on UnrealIRCd
Add nickserv/recover permission to allow opers to recover other users
Fix superadmin not being removed when deopering
Fix setting nickserv access list in webcpanel
Add support for post-handshake SASL in Unreal 4.2.2+
Add logging for channel memo deletionso
Anope Version 2.0.6
-------------------
Log client IP for web clients running commands via webcpanel
Fix log file path for the config file could not be opened log message
Allow nickserv/group to be used via XMLRPC
Fix logsearch without wildcards
Support cidr exempts in m_dnsbl
Add support for IPv6 dnsbls
Add +u and +L channel modes for ircd-hybrid
Set +x after hostserv/off on InspIRCd and UnrealIRCd
Fix chanserv/mode not being able to set extbans
Send CHGIDENT/CHGHOST on SVSLOGIN on InspIRCd
Fix escaping replies from commands in webcpanel
Enable require_oper for all opers added via operserv/oper
Advertise SASL mechanisms to UnrealIRCd servers
Anope Version 2.0.5
-------------------
Fix negative levels to not match users with negative access
Fix memo sender to always be the account name of the sender
Allow unregistered users to use the ChanServ seen command
Fix secureops to not be enforced on operators with the chanserv/administration privilege
Fix command name in HELP syntax messages to always be upper case
Show unconfirmed nickname messages on registration in webcpanel
Fix NickServ SET EMAIL to be executable via XMLRPC
Fix OperServ USERLIST/CHANLIST to accept regexes
Allow OperServ USERLIST to also match realname syntax (n!u@h#r)
Fix db_old importing languages to use the UTF-8 version
Fix m_dns to return REFUSED if no answers could be found
Fix ns_maxemail to be case insensitive
Add MemoServ READ ALL command
Add support for NickServ GROUP to be executed via XMLRPC
Add support for logging hostname/ip of SASL authentication attempts, if supported by IRCd
Anope Version 2.0.4
-------------------
Add notice rpc method to XMLRPC
Fix access check in cs_updown to not allow actions on users with equal access
Fix randomnews to work when there are more than 'newscount' random news
Fix crash from handling nick introduction collisions on unreal4
Add support for GCC6
Fix handling /join 0 on ratbox
Fix saset display to update the account of the proper user
Fix nickserv/confirm to send account and +r when appropriate
Fix chankill to not add duplicate akills
Allow nickserv/maxemail to disregard gmail style aliases when comparing emails
Fix chanserv/mode when setting listmodes with CIDR ranges
Fix reported expiry time when the time is divisible by 1 year
Clarify botserv repeat kicker help and allow setting repeat times to 1
Send vident/vhost with SASL login
Add support for SASL reauth
Fix log and database backup directories to be properly created by the installer
Anope Version 2.0.3
-------------------
Add support for UnrealIRCd 4
Fix cs_access to respect chanserv/access/list privilege
Fix cs_access to match level -1 as every user, not any level <0
Fix problems related to object destruction order when using db_sql_live
Show memo notify settings in ms_info
Fix some actions bumping channels last used time that shouldn't have
Add maxlogins configuration directive to limit the number of concurrent logins to one account
Fix race with auto svsnick on ghost sometimes causing nick collisions instead
Fix saset language reply
Show akill/sxlines ids in VIEW
Fix crash when an oper is configured in both the configuration and via os_oper
Fix m_ldap reconnect logic not properly setting protocol and network timeout settings
Fix crash from unloading regex modules when regex xlines exist
Fix irc2sql to store away messages
Add notice method to m_xmlrpc_main
Fix numerics on InspIRCd from being sent to user UID
Fix usermode +I on UnrealIRCd to be considered oper only
Fix crash in webcpanel when deleting your own access on a channel
Fix webcpanel allowing suspended users to login
Fix hs_off on InspIRCd to not desync active user host
Fix bs_bot to not allow colliding bots into users
Don't allow hostserv modules to load if there is no hostserv
Fix ns_register allowing bot nicks to be registered through webcpanel
Don't update chanserv keepmodes during inhabit
Fix build on cmake 2.4
Allow searching emails by wildcard in ns_getemail
Anope Version 2.0.2
-------------------
Fix keepmodes preventing the first user of a channel from being deopped
Fix SQlines that don't begin with # from matching channels
Made cs_clone behave like the help describes, copying many settings and lists by default
Allow cs_clone to clone levels, too
Update Hybrid protocol module for 8.2
Fix not unescaping all characters sent over XMLRPC
Fix crash when os_mode is used to destroy channels, like when unsetting permanent channel mode from an empty channel
Allow users with topic change privilege to change the topic instead of requiring them to use ChanServ's topic command
Fix negatively locking param modes in default mlock
Change entrymsg to check for the SET privilege, not real founder
Allow configuring characters allowed in nicknames
Fix crash when non users register channels externally (like XMLRPC)
Remove operserv/exception MOVE, it did not function correctly. Instead reorder the list by deleting/adding entries.
Allow flood ttb to be 0.
Enforce mlock when disabling defcon modes
Fix cs_mode not being able to apply mlock on register
Add log message when users send memos
Fix old collide timers from staying around after successful identify. Fixes being able to identify and logout and still being hit by the old timers.
Fix undefined behavior in cs_mode which usually crashes when clearing large list modes
Show all opertypes in operserv/info, even if no opers use them
Anope Version 2.0.1
-------------------
Fix access entries on accounts sometimes not updating when a user's display name changes
Fix ns_group to properly validate the account of the user against the target
Fix os_stats not saving max user count and time when using SQL
Fix nickalias's 'nc' field sometimes not being updated when using SQL
Fix several crashes on Windows related to being unable to load modules
Fix bs_bot change not properly reintroducing bots after changing their ident, host, or realname
Add English language file to allow users to easily modify language strings
Add configuring which mode cs_ban sets, and added a MUTE command to BotServ's fantasy
Allow SVSPART to take an optional reason
Allow cs_list to search channel topics and descriptions
Anope Version 2.0.0
-------------------
Added irc2sql stats module
Anope Version 1.9.9
-------------------
A Added a better webpanel template, removed the old one
A Added SQL logging support
A Added Redis database support
A Added ability to configure what privileges XOP commands give
U Updated Dutch language file, from Robby <robby@chat.be>
U Updated Spanish language file, from Isaac Fontal <i_fontal@hotmail.com>
F Fix build on Solaris and OSX
F Fixed setting BotServ's default settings in the config
F Fixed some names of config items, including NickServ's kill protect
Anope Version 1.9.8
-------------------
A Ability to configure fantasy commands in the config
A Add SVSJOIN and SVSPART commands
F Fix "leave" channel log level from not logging
F Fix users able to "resend" their registration mail with registration set to admin only
F Fix build on OpenBSD
F Fix not logging debug logs to the logfile when debug mode is enabled
F Fix defcon timeout timer
F Fix crash in os_forbid with expiring entries
F Fix several issues with db_sql_live
Anope Version 1.9.7
-------------------
A Added ability for using regex as patterns for various commands
A Extended ability of operserv/akill to also match against nick and realname
A Added chanserv:require configuration option
A Added nickserv:unregistered_notice and nickserv:registration configuration option
A Added options:casemap configuration option
A Added a web panel
A db_sql_live now allows all tables to be "live", not just a select few
Anope Version 1.9.6
-------------------
A Added ability to configure emails sent by services
A Added chanserv/up and chanserv/down
A Added m_proxyscan
A Added more configurability for what vhosts are valid
A Added chanserv/log
A Added ability to configure ChanServ privileges
A Added a new database format
A Added SQLite support
A Added more verbose messages on startup
A Added ability for chanserv/suspend and nickserv/suspend to take an expiry time
A Added no nickname ownership config option
A Added m_rewrite
A Added akill IDs
F Fixed crash in clearusers
F Fixed crash in /os oper info
F Fixed eventfd Config check to work properly on OpenVZ
Anope Version 1.9.5
-------------------
A Extended LDAP support
A Added os_oper, os_kill, os_forbid, m_statusupdate, cs_sync, and bs_autoassign
A Added a new configuration file format
A Added a new commands system
A Added a new access system, and cs_flags
F Fixed not logging debug logs to file
F Fixed the mail delay time
F Fixed sending account data for unconfirmed nicks
F Fixed poll() engine build on FreeBSD
F Fixed really large HELP replies being truncated
F Fixed sometimes appending !*@* to valid hosts on access lists
F Fixed m_ssl sometimes failing connecting for no reason
F Fixed crash in cs_entrymsg
F Fixed setting -P on channels with only a botserv bot in it
F Fixed modemanager complaining about prefixless modes on InspIRCd
Anope Version 1.9.4
-------------------
A Automatically set channel founder to the user with the highest access if there is no successor
A /chanserv clone command to copy settings from one channel to another.
A /chanserv mode command
A Ability for users to delete their own access in channels
A Added support for Plexus 3
A Readded in support for /cs op/deop/etc to op/deop you in all channels
A Added LDAP support
A Added live SQL support
A Added support for learning tracking/storing/locking all modes at runtime
A Added m_alias
A Added support for XMLRPC queries
A Added /botserv set msg
A Added /operserv config
A Added /ns cert
A Added /operserv login
F Changed the GHOST command to not allow ghosting unidentified users if the RECOVER command exists
F Some failed logic in /operserv exception that prevents proper exceptions from being added
F Fixed the anope_os_sxlines MySQL table and code to work after restarting
Anope Version 1.9.3
-------------------
A Added italics BotServ kicks support
A Tell users when their nicks expire in /ns glist and /ns info
A Added SSL support
A Prevent negative mode changes, kicks, bans, and autokicks from affecting people with the 'god' user mode (On UnrealIRCd, usermode +q)
A Added nickserv/auxpex permission
A Added nickserv ungroup command
A Renamed the SGLINE to be SNLINE
A Added /chanserv saset command
A Added threads for mail sending
A Added m_dnsbl and an asynchronous DNS system
A Added a new language system that uses gettext
A Added m_mysql which uses threads to execute queries
A Added many subcommand modules for some commands, eg ns_set_autoop, ns_set_email, etc
A Added a new logging system that is a bit more flexible
A Added cs_set_misc and ns_set_misc to add miscellaneous set commands
A Added os_modreload, which allows reloading some modules not normally unloadable, like the protocol module
A Added FOUNDER access level
A Made OperServ, Global, MemoServ, and ChanServ optional
F Shutting down if a config reload fails
F Autoid to live through restarts on Unreal
F Storing vhosts in MySQL
F Not flushing the anope_extra table before rewriting database
F Anoperc start/stop to send the globaloncycle global, and fixed anoperc rehash to really rehash
F Fixed a potential crash if HostServ or BotServ was disabled
Anope Version 1.9.2
-------------------
A K alias to chanserv kick command
A KB alias to chanserv ban command
A The ability to register empty nonregistered channels
A Flatfile plaintext databases and removed old binary ones
A Added in live updating SQL and the ability to execute commands through SQL (see docs/MYSQL)
A Added support for many more modes into Anope and the ability to have generic support for modes unknown to Anope
A Added a mode stacker to combine many mode changes into fewer
A Added in the CS SET PERSIST command which can be used to keep service bots in channels even when the channel is empty
A Added AUTOOWNER OWNER and OWNERME into CS LEVELS
A Added ns_resetpass module to the core
A CS ACCESS VIEW which shows who added the access and last time used
A Last used time to CS AKICK VIEW
A Added a sha_256 encryption module
A Added the ability to load multiple encryption modules, and the ability to seamlessly convert your database between different encryptions
A Added configuration options to allow Anope to reconnect if it disconnects from the uplink instead of dying
A Added support for linking with IPv6
F Unban command to accept an optional nick arg
F Some typos in services.conf
F Crash when users change their host that are identified to a group, but not a nick
F Host length checking in HS SET(ALL) and HS REQUEST
F Only show if a user is online in NS INFO if they are really identified for the group of the nick they are on
F Crash when using BSSmartJoin
F Converting access entries to access from xop when a users access is below voice
F A bad pointer passed to the OnDelEvent which could cause some 3rd party modules to crash
F CS FORBID allows to you forbid unregistered channels
F The -nothird command line option to work
F ms_rsend to really work
F SQUITing juped servers on InspIRCd1.2+
Anope Version 1.9.1
-------------------
F Don't enforce akick/forbidden/etc.-restrictions on clients on ulined servers.
F Remove modules_unload_all fini + hack that goes with it.
F Signal handling cleanup.
A Seamless fantasy support on all ChanServ commands, instead of requiring bs_fantasy_*.
F Allow fantasy to be disabled on some commands (e.g. FORBID).
F Some commands (e.g. !help) need to strip the pre-provided channelname from them.
D HelpServ removed
F Command parser cleanup: mod_current_buffer removed and replaced with proper parser. Commands now indicate how they want the buffer split.
F Make NS ENFORCE/RELEASE stuff more sane, redo timers.
A Opertypes (similar to InspIRCd's opertypes)
Provided by Ankit <ankit@nevitus.com> - 2009
F Segfault on shutdown
Provided by Adam <adam@anope.org> - 2009
F NickServ registration is sometimes denied.
F Applied patch from Adam to fix some potential screwups
F More fixes to bs_bot from Adam, plus an extra fix within DoAdd not covered in Adam's patch.
F Fix bs_bot to use the correct parameters, patch from Adam.
F Fix for bug #1004, based from second half of patch from Adam.
F Partial patch by Adam, commenting fix for #1006 for future reference.
F Forward-port r1946: Patch by Adam fixing #1006 (originally caused by #922): modes set by ChanServ are reversed. Thanks!
Provided by DukePyrolator <dukepyrolator@gmx.de> - 2009
F Patch converting all match calls to new method, thanks!
F Add 'w' and 'y' support to dotime(), also prevent an overflow.
F Allow NS STATUS from unregistered users, thanks DP!
F Wild pointers do not a happy Anope make. Thanks DP :)
F Allow NS REGISTER to unregistered nicks, silly oversight. Thanks DP! :)
F Fix call order, thanks to DP
F Pass the right array to do_umode(), fixes mode tracking on Unreal. Thanks to DukePyrolator (yet again :P)
F Fix bs_set help, thanks to DukePyrolator! :)
F Fix two segfaults, noted by DukePyrolator. Thanks!
F Fix part one of #1010, reported by DukePyrolator. (Language settings are not respected in message sending.) Thanks!
F Memory leak on +beI modes.
Provided by Liber <Liber@jasonirc.net> - 2009
F Support operoverride and such things (stop reversing changes from nonopped people where unnecessary)
Anope Version 1.9.0
-------------------
F Modified compile to use g++
F Improve protocol modules support (classes, virtual methods, etc)
F Move core services to use BotInfo
F Move BotInfo and related methods into a class
F Move modules into a class
F Fixed ns resending of passcode issue
F Modules now delete themselves
F additional field where users' masked host can be stored so both masked IP and vhost are available instead of just one.
F No struct Uid, ugly, and, unnecessary that we store UID in BotInfo.
F Prevent deletion of core services via /bs bot
F Module subsystem cleanup ('modules' branch)
F Move modules to use classes somewhat (AnopeInit, AnopeFini)
F Change MODULE_INIT to return a pointer
F Remove duplicate module creation.. have loadModule return a pointer rather than creating one
F Remove buffered loading/unloading, this makes os_modunload perm, but who cares
F Remove 'delayed' loading, this is necessary because of before/after connected to ircd (ircd is before, rest after), I'm sure this can be done better.
A Remove old config, replace with insp-inspired (albeit bind format) config (CBX)
F Clean up protocol modules a bit
A InspIRCd 1.2 support
F Remove old (prior to 1.8.0) db compat
F Establish a proper base for services pseudoclients
F Add ss_main StatServ Hal9000 to play with :)
F Burn automake with fire (CBX)
Provided by mooncup <mooncup@anonnet.org> - 2009
F Automatically reapply vhost on hs off for unreal.
+253 -23
View File
@@ -1,26 +1,256 @@
Anope Version 2.1.2 Anope Version 2.0.21-git
------------------- ------------------------
Added module:tlsv10 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to no). No significant changes.
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 Anope Version 2.0.20
------------------- --------------------
Added the m_regex_stdlib module. No significant changes.
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
Anope Version 2.1.0 Anope Version 2.0.19
--------------------
No significant changes.
Anope Version 2.0.18
--------------------
No significant changes.
Anope Version 2.0.17
--------------------
No significant changes.
Anope Version 2.0.16
--------------------
No significant changes.
Anope Version 2.0.15
--------------------
No significant changes.
Anope Version 2.0.14
--------------------
Added mail:content_type to allow customizing the content type of emails.
Anope Version 2.0.13
--------------------
No significant changes.
Anope Version 2.0.12
--------------------
Added the regex_pcre2 module
Anope Version 2.0.11
--------------------
No significant changes.
Anope Version 2.0.10
--------------------
No significant changes.
Anope Version 2.0.9
------------------- -------------------
Added nickserv:minpasslen for configuring the minimum password length (defaults to 8). No significant changes.
Removed nickserv:strictpasswords as it is obsolete now nickserv:minpasslen exists.
Removed the inspircd12 and inspircd20 modules (use inspircd instead). Anope Version 2.0.8
Removed the ns_getpass module (no supported encryption modules). -------------------
Removed the os_oline module (no supported IRCds). Fix ns_register:unconfirmedexpire not being used
Removed the unreal module (use unrealircd instead).
Renamed nickserv:passlen to nickserv:maxpasslen. Anope Version 2.0.7
Renamed the charybdis module to solanum. -------------------
Renamed the inspircd3 module to inspircd. Add nickserv/recover permission
Renamed the unreal4 module to unrealircd. Add inspircd3 protocol module
Replaced uplink:ipv6 with uplink:protocol. Add default permission for chanstats saset chanstats command
Anope Version 2.0.6
-------------------
Mark enc_md5 and enc_sha1 as deprecated. Their use has been discouraged for years, and they will be removed in a future release.
Exempt all of 127.0.0.0/8 from m_dnsbl by default
Load m_sasl by default
Fix documentation for nickserv default option ns_keep_modes
Anope Version 2.0.5
-------------------
No significant changes.
Anope Version 2.0.4
-------------------
Removed m_sasl_dh-aes and m_sasl_dh-blowfish
Anope Version 2.0.3
-------------------
Add operserv/chankill to default globops log
Add ns_identify:maxlogins to limit the max number of concurrent logins per account
Document ns_no_expire nickserv default
Remove default session exception expiry time
Anope Version 2.0.2
-------------------
Add an operserv/oper/modify privilege, required to use oper add and oper del
Add a chanserv/access/list privilege, which allow readonly access to ChanServ access and akick lists
Changed m_dnsbl's result configuration to be more extensible
Add 'max' setting to cs_mode
Add 'nickchars' setting to networkinfo
Add 'botserv/fantasy', 'chanserv/access/list', and 'operserv/oper/modify' oper privileges
Fix 'emailchange_message' to include the proper email address
Set a default permission on operserv/defcon
Anope Version 2.0.1
-------------------
Add MUTE command to BotServ fantasy configuration
Document memo_mail option in nickserv.conf
Add 'show' setting to ns_info and cs_info to control which fields are shown to non opers
Anope Version 2.0.0
-------------------
options:passlen, enforceruser, enforcerhost, releasetimeout, and guestnickprefix moved to nickserv's module configuration
options:hideregisteredcommands added
m_ssl renamed to m_ssl_openssl
mail:restrict removed
Anope Version 1.9.9
-------------------
There is not many config changes between 1.9.8 and 1.9.9, however many of the
options have been moved around to make more sense, too many to list here,
so get a new config.
Anope Version 1.9.8
-------------------
networkinfo:chanlen added
options:user and options:group added
nickserv:modesonid added to set modes on everyone who identifies
nickserv:kill and nickserv:killquick added to configure NickServ's kill timeout
nickserv:restoreonrecover added to try to restore a user's session after a ghost
command:group added
fantasy block added
dns block has been moved to modules.conf as a part of m_dns
Anope Version 1.9.7
-------------------
operserv:notifications removed in favor of log{} blocks
options:regexengine added
options:casemap added
chanserv:require added
nickserv:registration added, emailregistration removed.
nickserv:unregistered_notice added
Anope Version 1.9.6
-------------------
service:channels added to join services to channels
mail block modified to allow configuring of email messages
oper:host and oper:vhost added
oper:require_oper added
options:nonicknameownership added
operserv:akillids added
nickserv/access oper privilege added
Anope Version 1.9.5
-------------------
Don't even try it, get a new config and start over.
Anope Version 1.9.4
-------------------
** ADDED CONFIGURATION DIRECTIVES **
memoserv:modules added ms_ignore
chanserv:modules added cs_clone and cs_mode
nickserv:suspendexpire and nickserv:forbidexpire added
chanserv:suspendexpire and chanserv:forbidexpire added
module added cs_entrymsg
nickserv:modules added ns_ajoin, ns_cert
options:nomlock added
log:target added globops
nickserv:confirmemailchanges added
operserv:modules added os_config, os_login
** MODIFIED CONFIGURATION DIRECTIVES **
operserv:notifications removed osglobal, osmode, oskick, osakill, ossnline, ossqline, osszline, osnoop, osjupe, getpass, setpass, forbid, drop
renamed nickserv:preregexpire to nickserv:unconfirmedexpire
** DELETED CONFIGURATION DIRECTIVES **
opertype:commands removed operserv/umode
operserv:modules removed os_umode
Anope Version 1.9.3
-------------------
** ADDED CONFIGURATION DIRECTIVES **
nickserv/auspex privilege added
SSL module added for SSL support
opertype:inherits added to allow opertypes to inherit commands and privs from other opertypes
Various nickserv/saset/* and chanserv/saset/* opertype command privileges added
nickserv:modules added many new ns_set_command modules
chanserv:modules added many new cs_set_command modules
opertype:commands added nickserv/saset/* and chanserv/saset/*
options:socketengine added to choose what socket engine to use
module:cs_set_misc and module:ns_set_misc added to replace the old set url/icq/email modules
options:hideprivilegedcommands added to hide privileged commands from normal users
log block added to customize logging
dns block added to configure dns settings
m_dnsbl added
mysql configuration block added
** MODIFIED CONFIGURATION DIRECTIVES **
opertype:commands changed operserv/sgline to opserv/snline
operserv:modules changed os_sgline to os_snline
operserv:modules added os_modreload
operserv:sglineexpiry changed to operserv:snlineexpiry
operserv:killonsgline changed to operserv:killonsnline
operserv:notifications ossgline changed ossnline
memoserv was made optional
moved operserv:global configuration into its own global block
chanserv was made optional
** DELETED CONFIGURATION DIRECTIVES **
serverinfo:helpchannel removed because it has been readded in m_helpchan
networkinfo:logchannel, logbot, logusers, logmaxusers, logchannel, and options:keeplogs removed because of the log block
dumpcore because it really didn't do anything
Anope Version 1.9.2
-------------------
** ADDED CONFIGURATION DIRECTIVES **
options:enablelogchannel added to auto turn on the logchannel on startup
options:mlock added to configure the default mlock modes on new channels
options:database added for the database modules
options:botmodes added to configure modes BotServ bots should use
options:userlen added to configure maximum ident length
options:hostlen added to configure maximum hostname length
options:database added to configure what database modules to use
options:passlen added to specify the maximum length of passwords
uplink:ipv6 added to enable IPv6 connectivity
options:maxretries added to specify the number of reconnect attempts allowed
options:retrywait added to specify how long to wait between reconnect attempts
opertype command chanserv/aop/list removed as it was unnecessary, use chanserv/access/list instead
** MODIFIED CONFIGURATION DIRECTIVES **
options:encryption added enc_sha256
chanserv:modules added cs_unban
nickserv:modules added ns_resetpass
** DELETED CONFIGURATION DIRECTIVES **
nickserv:database deleted because of new database system
nickserv:prenickdatabase deleted because of new database system
chanserv:database deleted because of the new database system
botserv:database deleted because of the new database system
hostserv:database deleted because of the new database system
operserv:database deleted because of the new database system
operserv:newsdatabase deleted because of the new database system
operserv:exceptiondatabase deleted because of the new database system
hs_request:database deleted because of the new database system
os_ignore:database deleted because of the new database system
serverinfo:localport deleted
Anope Version 1.9.1
-------------------
** ADDED CONFIGURATION DIRECTIVES **
Opertypes have been added, through the opertype blocks.
Services Operators are now specified in the oper blocks.
** MODIFIED CONFIGURATION DIRECTIVES **
botserv:modules no longer contains bs_fantasy* modules, fantasy is now seamless.
operserv:modules has replaced os_logonnews, os_opernews, and os_randomnews with os_news.
operserv:modules no longer contains os_admin and os_oper modules, removed in favor of oper blocks.
operserv:notifications no longer contains osraw due to removal of OS RAW.
** DELETED CONFIGURATION DIRECTIVES **
Nick tracking has been removed as an option.
Restricting of NS GETPASS and CS GETPASS removed in favor of opertypes.
Host Setters were removed in favor of opertypes.
HelpServ has been removed entirely.
operserv:disableraw removed due to removal of OS RAW.
+5 -5
View File
@@ -10,7 +10,7 @@ Anope DefCon
1) Introduction 1) Introduction
Anope supports a unique protection mechanism based on the Anope 1.6 onwards supports a unique protection mechanism based on the
military "Defense Readiness Condition" (DefCon) system. It is based on military "Defense Readiness Condition" (DefCon) system. It is based on
5 levels of defense readiness defined as: 5 levels of defense readiness defined as:
@@ -23,7 +23,7 @@ Anope DefCon
These are configurable levels that mandates what actions Anope should These are configurable levels that mandates what actions Anope should
take in case of emergency and change in readiness status. take in case of emergency and change in readiness status.
It is used to prevent abuse to both Anope, and the IRCd on which they It is used to prevent abuse to both Services, and the ircd on which they
are running. Also to protect the users, primarily in the event of Clones are running. Also to protect the users, primarily in the event of Clones
and/or FloodBOT attacks. and/or FloodBOT attacks.
@@ -50,8 +50,8 @@ Anope DefCon
Force Chan Mode Force Chan Mode
Use Reduced Session Limit Use Reduced Session Limit
KILL any new clients trying to connect KILL any new clients trying to connect
Ignore everyone but opers Services will ignore everyone but opers
Silently ignore everyone but opers Services will silently ignore everyone but opers
AKILL all new clients trying to connect AKILL all new clients trying to connect
No new memos sent to block MemoServ attacks No new memos sent to block MemoServ attacks
@@ -90,4 +90,4 @@ Anope DefCon
6) Support 6) Support
You might get DefCon support by posting on our online forum, or maybe on You might get DefCon support by posting on our online forum, or maybe on
our #anope channel at /server irc.anope.org. our #anope channel at /server irc.teranova.net.
+313
View File
@@ -0,0 +1,313 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Anope"
PROJECT_NUMBER = 2.0
PROJECT_BRIEF =
PROJECT_LOGO =
PROJECT_ICON = src/win32/anope-icon.ico
OUTPUT_DIRECTORY = docs/doxygen
CREATE_SUBDIRS = NO
CREATE_SUBDIRS_LEVEL = 8
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 5
MARKDOWN_ID_STYLE = GITHUB
AUTOLINK_SUPPORT = YES
AUTOLINK_IGNORE_WORDS =
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 0
TIMESTAMP = NO
EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_UNDOC_NAMESPACES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = SYSTEM
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_MEMBERS_CTORS_1ST = NO
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
STRICT_PROTO_MATCHING = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
EXTERNAL_TOOL_PATH =
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = NO
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_IF_UNDOC_ENUM_VAL = NO
WARN_LAYOUT_FILE = YES
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LINE_FORMAT = "at line $line of file $file"
WARN_LOGFILE =
INPUT = README.md \
include
INPUT_ENCODING = UTF-8
INPUT_FILE_ENCODING =
FILE_PATTERNS =
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = YES
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE = README.md
IMPLICIT_DIR_DOCS = YES
FORTRAN_COMMENT_AFTER = 72
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
IGNORE_PREFIX =
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE = AUTO_LIGHT
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_CODE_FOLDING = YES
HTML_COPY_CLIPBOARD = YES
HTML_PROJECT_COOKIE =
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated documentation"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
SITEMAP_URL =
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
SHOW_ENUM_VALUES = NO
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME =
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_BIB_STYLE = plainnat
LATEX_EMOJI_DIRECTORY =
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_EXTRA_FILES =
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
GENERATE_AUTOGEN_DEF = NO
GENERATE_SQLITE3 = NO
SQLITE3_OUTPUT = sqlite3
SQLITE3_RECREATE_DB = YES
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = CoreExport=/**/ \
ATTR_NOT_NULL(...)=/**/
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10"
DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10"
DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
DIA_PATH =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
PLANTUMLFILE_DIRS =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
MSCGEN_TOOL =
MSCFILE_DIRS =
+34
View File
@@ -0,0 +1,34 @@
Anope Internal Events
---------------------
1) Intro
2) Using Events
1) Introduction to Internal Events
Internal Events are setup to give module developers more information
about what the core is doing at different times. This information can
be as complex as data we are feeding to the uplink, to simple triggered
events such as the databases being saved.
Additionally there is a module included with the core
which can provide some clue as to how to use the code in your modules.
The rest of this document assumes that you are used to writing modules.
2) Using Events
Each Event in Anope calls a function.
You must override these functions in your main modules class.
The full list of functions and parameters are in modules.h. In this
case, you would be overriding OnJoinChannel() and OnPartChannel() like so:
void OnJoinChannel(User *u, Channel *c) anope_override { }
void OnPartChannel(User *u, Channel *c) anope_override { }
Some of these event overrides can be used to prevent or allow things to
happen that would normally not be allowed or denied. You can also use
ModuleManager (not explained here) to set control which order the modules
are queried (when multiple modules hook to the same event).
The "anope_override" identifier is for compatibility with C++11.
Its usage is highly recommended.
+13 -13
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 Next, unpack the package in your home directory, and go into the created
directory. directory.
If there are any extra modules you want to enable, such as mysql, run If there are any extra modules you want to enable, such as m_mysql, run
the 'extras' script to enable them. If you do not know you can come back the 'extras' script to enable them. If you do not know you can come back
later and enable them. later and enable them.
@@ -52,15 +52,15 @@ Note: You should also read the README and FAQ files!
cause trouble on your network if passwords are not encrypted, or read cause trouble on your network if passwords are not encrypted, or read
the memos of any user. the memos of any user.
Now go into the conf directory (by default, ~/anope/conf). Copy the example Now go into the conf directory (by default, ~/services/conf). Copy the example
configuration file (anope.example.conf) to anope.conf, and open the latter configuration file (example.conf) to services.conf, and open the latter
with your favorite text editor. It contains all the configuration with your favorite text editor. It contains all the configuration
directives Anope will use at startup. Read the instructions contained in directives Anope will use at startup. Read the instructions contained in
the file carefully. Using the default values is NOT a good idea, and will the file carefully. Using the default values is NOT a good idea, and will
most likely not work! most likely not work!
If you need help, you should visit https://forum.anope.org/ or #anope on If you need help, you should visit https://forum.anope.org/ or #anope on
irc.anope.org. Provide *complete* error output, along with other relevant irc.teranova.net. Provide *complete* error output, along with other relevant
information eg. OS, compiler and C++ library versions. information eg. OS, compiler and C++ library versions.
See the README file for more information. See the README file for more information.
@@ -71,11 +71,11 @@ Note: You should also read the README and FAQ files!
* IMPORTANT: Back up your old databases! * IMPORTANT: Back up your old databases!
* If you are upgrading to a new major release, ALWAYS restart a * If you are upgrading to a new major release, ALWAYS restart a
fresh configuration file from anope.example.conf. fresh configuration file from example.conf.
3) Setting up the IRCd 3) Setting up the IRCd
Anope acts as an IRC server with pseudo-clients on it. To link them to Services acts as an IRC server with pseudo-clients on it. To link them to
your network, you'll need to configure your IRCd to allow services to link. your network, you'll need to configure your IRCd to allow services to link.
The configuration varies depending on the IRCd, but you will probably need The configuration varies depending on the IRCd, but you will probably need
@@ -83,7 +83,7 @@ Note: You should also read the README and FAQ files!
a shared block), and be sure that the IRCd is listening on the given port a shared block), and be sure that the IRCd is listening on the given port
in the link block. in the link block.
Example link configurations can be found in anope.example.conf for some of the Example link configurations can be found in example.conf for some of the
popular IRCds. popular IRCds.
Don't forget to /rehash your IRCd to apply changes. Don't forget to /rehash your IRCd to apply changes.
@@ -91,16 +91,16 @@ Note: You should also read the README and FAQ files!
4) Starting Anope 4) Starting Anope
Go into the directory where binaries were installed (by default, this is Go into the directory where binaries were installed (by default, this is
~/anope/bin). Type ./anope to launch Anope. ~/services/bin). Type ./services to launch Anope.
If there are syntax errors in the configuration file they will be If there are syntax errors in the configuration file they will be
displayed on the screen. Correct them until there are no errors anymore. displayed on the screen. Correct them until there are no errors anymore.
A successful startup won't generate any message. A successful startup won't generate any message.
Give Anope at least one minute to link to your network, as certain Give Services at least one minute to link to your network, as certain
IRCds on some OSes may be really slow for the link process. If nothing IRCds on some OSes may be really slow for the link process. If nothing
happens after about a minute, it is probably a configuration problem. Try happens after about a minute, it is probably a configuration problem. Try
to launch Anope with ./anope -debug -nofork to see any errors that it to launch Anope with ./services -debug -nofork to see any errors that it
encounters, and try to correct them. encounters, and try to correct them.
If you need help to solve errors, feel free to subscribe to the Anope If you need help to solve errors, feel free to subscribe to the Anope
@@ -112,16 +112,16 @@ Note: You should also read the README and FAQ files!
still running, and restart it if not. still running, and restart it if not.
First rename the example.chk script that is in Anope path (by default, First rename the example.chk script that is in Anope path (by default,
this is ~/anope/conf) to anope.chk and edit it. You'll need to this is ~/services/conf) to services.chk and edit it. You'll need to
modify the CONFIGURATION part of the file. Then ensure that the file is modify the CONFIGURATION part of the file. Then ensure that the file is
marked as executable by typing chmod +x anope.chk, and try to launch the marked as executable by typing chmod +x services.chk, and try to launch the
script to see if it works (Anope must not be running when you do this ;)) script to see if it works (Anope must not be running when you do this ;))
When this is done, you'll have to add the crontab entry. Type crontab -e. When this is done, you'll have to add the crontab entry. Type crontab -e.
This will open the default text editor with the crontab file. Enter the This will open the default text editor with the crontab file. Enter the
following (with correct path): following (with correct path):
*/5 * * * * /home/ircd/anope/conf/anope.chk >/dev/null 2>&1 */5 * * * * /home/ircd/services/conf/services.chk >/dev/null 2>&1
The */5 at the beginning means "check every 5 minutes". You may replace The */5 at the beginning means "check every 5 minutes". You may replace
the 5 with other another number if you want (but less than 60). Consult the 5 with other another number if you want (but less than 60). Consult
+13 -13
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 Ensuite, décompressez le package dans votre répertoire home, et allez
dans le répértoire qui vient d'être créé. dans le répértoire qui vient d'être créé.
Si il y a des modules facultatifs que vous voulez activer comme mysql, Si il y a des modules facultatifs que vous voulez activer comme m_mysql,
exécuter le script 'extras' pour les activer. Si vous ne savez pas, vous exécuter le script 'extras' pour les activer. Si vous ne savez pas, vous
pouvez les activer plus tard. pouvez les activer plus tard.
@@ -55,16 +55,16 @@ Note : Vous devrez également lire les fichiers README et FAQ !
mots de passe ne sont pas chiffrés, ou lire les mémos de tous les mots de passe ne sont pas chiffrés, ou lire les mémos de tous les
utilisateurs. utilisateurs.
Allez maintenant dans le répertoire conf (par défaut, ~/anope/conf). Allez maintenant dans le répertoire conf (par défaut, ~/services/conf).
Copiez l'exemple de fichier de configuration (anope.example.conf) en Copiez l'exemple de fichier de configuration (example.conf) en
anope.conf et ouvrez ce dernier avec votre éditeur de texte favori. services.conf et ouvrez ce dernier avec votre éditeur de texte favori.
Il contient toutes les directives de configuration qu'Anope va utiliser Il contient toutes les directives de configuration qu'Anope va utiliser
en démarrant. Lisez attentivement les instructions contenues dans le en démarrant. Lisez attentivement les instructions contenues dans le
fichier. L'utilisation des valeurs par défaut n'est pas toujours fichier. L'utilisation des valeurs par défaut n'est pas toujours
recommandée, et Anope ne fonctionnera probablement pas ! recommandée, et Anope ne fonctionnera probablement pas !
Si vous avez besoin d'aide, vous pouvez aller sur le site Si vous avez besoin d'aide, vous pouvez aller sur le site
https://forum.anope.org/ ou le canal #anope sur irc.anope.org. https://forum.anope.org/ ou le canal #anope sur irc.teranova.net.
Fournissez *l'essemble* des erreurs qui apparaîssent, en plus de Fournissez *l'essemble* des erreurs qui apparaîssent, en plus de
toutes informations utiles, comme les versions de votre OS, du toutes informations utiles, comme les versions de votre OS, du
compilateur utilisé et de la librairie C++. Lisez le fichier README compilateur utilisé et de la librairie C++. Lisez le fichier README
@@ -78,11 +78,11 @@ Note : Vous devrez également lire les fichiers README et FAQ !
* IMPORTANT : Sauvegardez vos anciennes bases de données ! * IMPORTANT : Sauvegardez vos anciennes bases de données !
* Si vous mettez Ă  jour vers une nouvelle version majeure, * Si vous mettez Ă  jour vers une nouvelle version majeure,
recommencez *toujours* toute votre configuration Ă  partir du recommencez *toujours* toute votre configuration Ă  partir du
fichier anope.example.conf. fichier example.conf.
3) Configuration de l'IRCd 3) Configuration de l'IRCd
Anope agit comme un serveur IRC avec des pseudo-clients. Les Services agissent comme un serveur IRC avec des pseudo-clients.
Pour les relier à votre réseau, vous aurez besoin de configurer votre Pour les relier à votre réseau, vous aurez besoin de configurer votre
IRCd pour permettre aux services de se connecter. IRCd pour permettre aux services de se connecter.
@@ -92,14 +92,14 @@ Note : Vous devrez également lire les fichiers README et FAQ !
sur le port donné dans le bloc link. sur le port donné dans le bloc link.
Des exemples de configurations de bloc link peuvent être trouvés dans Des exemples de configurations de bloc link peuvent être trouvés dans
le fichier anope.example.conf pour certains des IRCd les plus populaires. le fichier example.conf pour certains des IRCd les plus populaires.
Souvenez-vous de /rehash votre IRCd pour appliquer les changements. Souvenez-vous de /rehash votre IRCd pour appliquer les changements.
4) Mettre en route Anope 4) Mettre en route Anope
Allez dans le répertoire où les fichiers binaires ont été installés Allez dans le répertoire où les fichiers binaires ont été installés
(par défaut, ~/anope/bin). Tapez ./anope pour lancer Anope. (par défaut, ~/services/bin). Tapez ./services pour lancer Anope.
S'il y a des erreurs de syntaxe dans le fichier de configuration, elles S'il y a des erreurs de syntaxe dans le fichier de configuration, elles
seront affichées à l'écran. Corrigez-les jusqu'à ce qu'il n'y en ait seront affichées à l'écran. Corrigez-les jusqu'à ce qu'il n'y en ait
@@ -109,7 +109,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
réseau, car certains IRCds sur certains systèmes peuvent être très réseau, car certains IRCds sur certains systèmes peuvent être très
lents pour le processus de liaison. Si rien ne se passe après environ lents pour le processus de liaison. Si rien ne se passe après environ
une minute, il y a probablement un problème de configuration. Essayez une minute, il y a probablement un problème de configuration. Essayez
de lancer Anope en mode debug avec ./anope -debug -nofork pour voir de lancer Anope en mode debug avec ./services -debug -nofork pour voir
toutes les erreurs rencontrées et essayez de les corriger. toutes les erreurs rencontrées et essayez de les corriger.
Si vous avez besoin d'aide pour résoudre des erreurs, n'hésitez pas à Si vous avez besoin d'aide pour résoudre des erreurs, n'hésitez pas à
@@ -122,10 +122,10 @@ Note : Vous devrez également lire les fichiers README et FAQ !
est toujours en cours d'exécution et de le redémarrer s'il n'est pas. est toujours en cours d'exécution et de le redémarrer s'il n'est pas.
D'abord renommez le script example.chk qui est dans les dossiers D'abord renommez le script example.chk qui est dans les dossiers
d'Anope (par défaut, ~/anope/conf) en anope.chk et modifiez-le. d'Anope (par défaut, ~/services/conf) en services.chk et modifiez-le.
Vous aurez besoin de modifier la partie CONFIGURATION du fichier. Vous aurez besoin de modifier la partie CONFIGURATION du fichier.
Assurez-vous ensuite que le fichier est marqué comme exécutable en Assurez-vous ensuite que le fichier est marqué comme exécutable en
tapant chmod +x anope.chk et essayez de lancer le script pour voir tapant chmod +x services.chk et essayez de lancer le script pour voir
si cela fonctionne (Anope ne doit pas ĂŞtre en marche lorsque vous si cela fonctionne (Anope ne doit pas ĂŞtre en marche lorsque vous
testez cela ;)) testez cela ;))
@@ -133,7 +133,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
crontab -e. Cela va ouvrir l'éditeur de texte par défaut avec le crontab -e. Cela va ouvrir l'éditeur de texte par défaut avec le
fichier crontab. Entrez la ligne suivante (avec le chemin correct) : fichier crontab. Entrez la ligne suivante (avec le chemin correct) :
*/5 * * * * /home/ircd/anope/conf/anope.chk > /dev/null 2>&1 */5 * * * * /home/ircd/services/conf/services.chk > /dev/null 2>&1
Le */5 au début signifie "vérifier toutes les 5 minutes". Vous pouvez Le */5 au début signifie "vérifier toutes les 5 minutes". Vous pouvez
remplacer le 5 par un autre numéro si vous voulez (mais moins de 60). remplacer le 5 par un autre numéro si vous voulez (mais moins de 60).
+6 -11
View File
@@ -10,14 +10,11 @@ Anope Multi Language Support
To build Anope with gettext support, gettext and its development libraries must be installed on the system. To build Anope with gettext support, gettext and its development libraries must be installed on the system.
On Debian install the locales-all package. On Debian-based systems install the locales-all package.
On Ubuntu run locale-gen for each language you want to enable. On RHEL-based systems run `yum list glibc-langpack-*` and install the languages you want to enable.
For example:
locale-gen es_ES.UTF-8
Then execute: If you have already built Anope you will need to delete the build directory and rebuild from scratch.
dpkg-reconfigure locales
Building Anope on Windows with gettext support is explained in docs/WIN32.txt Building Anope on Windows with gettext support is explained in docs/WIN32.txt
@@ -26,16 +23,14 @@ Anope Multi Language Support
Anope uses gettext (https://www.gnu.org/software/gettext/) to translate messages for users. To add a new language Anope uses gettext (https://www.gnu.org/software/gettext/) to translate messages for users. To add a new language
install gettext and run `msginit -l language -o anope.language.po -i anope.pot`. For example if I was translating to install gettext and run `msginit -l language -o anope.language.po -i anope.pot`. For example if I was translating to
Spanish I could run `msginit -l es_ES -o anope.es_ES.po -i anope.pot`. Open the newly generating .po file and start Spanish I could run `msginit -l es_ES -o anope.es_ES.po -i anope.pot`. Open the newly generating .po file and start
translating. Once you are done simply rerun ./Config; make && make install and add the language to your anope.conf. translating. Once you are done simply rerun ./Config; make && make install and add the language to your services.conf.
Note that on Windows it is not quite this simple, windows.cpp must be edited and Anope recompiled and restarted. Note that on Windows it is not quite this simple, windows.cpp must be edited and Anope recompiled and restarted.
Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit Poedit (https://poedit.net/) is a popular po file editor, and we recommend using it or another editor designed to edit
po files (especially on Windows). po files (especially on Windows).
If you have finished a language file translation and you want others to use it, please send it to team@anope.org If you have finished a language file translation and you want others to use it, please file a pull request on GitHub.
(don't forget to mention clearly your (nick)name, your e-mail and the language name). You'll of course get full credit for it. You'll of course get full credit for it.
NOTE: There is no guarantee we will use your work so please do not be offended if we say no thanks.
3) Using languages with modules 3) Using languages with modules
+4 -4
View File
@@ -12,7 +12,7 @@ Anope Modules
1) Introduction 1) Introduction
Anope supports external modules. External modules are pieces Anope 1.6 onwards supports external modules. External modules are pieces
of code that can be attached to a running Anope process dynamically. These 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 modules can serve several purposes, and perform all kind of operations to
enhance your network. enhance your network.
@@ -22,7 +22,7 @@ Anope Modules
1. If modules are supported by your system, they will be configured 1. If modules are supported by your system, they will be configured
automatically when you run ./Config. The modules will be installed automatically when you run ./Config. The modules will be installed
to the modules directory in your data path (by default this will to the modules directory in your data path (by default this will
be ~/anope/data/modules). be ~/services/data/modules).
2. Compile Anope as usual using ./Config. The "make" process will now 2. Compile Anope as usual using ./Config. The "make" process will now
compile module support into Anope, and compile the default sample compile module support into Anope, and compile the default sample
@@ -98,7 +98,7 @@ Anope Modules
1. Make sure you're in the main source directory. (usually anope-1.X.XX/) 1. Make sure you're in the main source directory. (usually anope-1.X.XX/)
2. Run ./Config to find and configure modules, then `cd build`. 2. Run ./Config to find and configure modules, then `cd build`.
3. Run `make` to compile Anope, and any modules. 3. Run `make` to compile Anope, and any modules.
4. Run `make install` to copy the compiled binaries to the ~/anope/ 4. Run `make install` to copy the compiled binaries to the ~/services/
directory. directory.
You can now use /msg OperServ MODLOAD to load the new modules. You can now use /msg OperServ MODLOAD to load the new modules.
@@ -111,7 +111,7 @@ Anope Modules
Use modules at your own risk, and make sure you get them from a Use modules at your own risk, and make sure you get them from a
reputable source. You might get module support by contacting the module reputable source. You might get module support by contacting the module
author, posting on our online forum, or maybe on our #anope channel author, posting on our online forum, or maybe on our #anope channel
at /server irc.anope.org. at /server irc.teranova.net.
7) Information for Developers 7) Information for Developers
+6
View File
@@ -0,0 +1,6 @@
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++
+6 -6
View File
@@ -120,7 +120,7 @@ Table of Contents
2) Presentation 2) Presentation
Anope is a set of services for IRC networks that allows users to manage Anope is a set of Services for IRC networks that allows users to manage
their nicks and channels in a secure and efficient way, and administrators their nicks and channels in a secure and efficient way, and administrators
to manage their network with powerful tools. to manage their network with powerful tools.
@@ -167,13 +167,13 @@ Table of Contents
Anope currently works with: Anope currently works with:
* Bahamut 1.4.27 or later (including 1.8) * Bahamut 1.4.27 or later (including 1.8)
* Charybdis 3.4 or later
* ircd-hybrid 8.2.23 or later * ircd-hybrid 8.2.23 or later
* InspIRCd 3 or later * InspIRCd 1.2 or later
* ngIRCd 19.2 or later * ngIRCd 19.2 or later
* Plexus 3 or later * Plexus 3 or later
* Ratbox 2.0.6 or later * Ratbox 2.0.6 or later
* Solanum (all versions) * UnrealIRCd 3.2 or later
* UnrealIRCd 4 or later
Anope could also work with some of the daemons derived by the ones listed Anope could also work with some of the daemons derived by the ones listed
above, but there's no support for them if they work or don't work. above, but there's no support for them if they work or don't work.
@@ -225,7 +225,7 @@ Table of Contents
the log file; if you send a bug report, PLEASE include an excerpt from the log file; if you send a bug report, PLEASE include an excerpt from
the log file WITH DEBUGGING ACTIVE; we cannot emphasize enough how the log file WITH DEBUGGING ACTIVE; we cannot emphasize enough how
important this is to tracking down problems. (You can also enable important this is to tracking down problems. (You can also enable
debugging while Anope is running using OperServ's SET DEBUG command.) debugging while Services is running using OperServ's SET DEBUG command.)
If you repeat use --debug=<level>, the debugging level will be increased, If you repeat use --debug=<level>, the debugging level will be increased,
which provides more detailed information but may also slow Anope down which provides more detailed information but may also slow Anope down
considerably and make the log file grow dramatically faster. In general, considerably and make the log file grow dramatically faster. In general,
@@ -245,7 +245,7 @@ Table of Contents
If you read the documentation carefully, and didn't find the answer to If you read the documentation carefully, and didn't find the answer to
your question, feel free to post on the website forums or join our irc your question, feel free to post on the website forums or join our irc
channel (irc.anope.org #anope). Once you join our Support channel be as channel (irc.teranova.net #anope). Once you join our Support channel be as
precise as possible when asking a question, because we have no extraordinary precise as possible when asking a question, because we have no extraordinary
powers and can't guess things if they aren't provided. powers and can't guess things if they aren't provided.
+3 -3
View File
@@ -1,4 +1,4 @@
Anope has Redis database support (https://redis.io/). Starting in Anope 1.9.9, Anope has Redis database support (https://redis.io/).
This document explains the data structure used by Anope, and explains how This document explains the data structure used by Anope, and explains how
keyspace notification works. keyspace notification works.
@@ -149,12 +149,12 @@ Table of Contents
Which returns a new object ID for me, in this example it will be "8". Which returns a new object ID for me, in this example it will be "8".
Now I can create the object: Now I can create the object:
HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "Anope IRC Services" HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "Services for IRC Networks"
Note if you are using HSET instead of HMSET you will need to use a transaction, as shown in the above example. Note if you are using HSET instead of HMSET you will need to use a transaction, as shown in the above example.
If you are watching your services logs you will immediately see: If you are watching your services logs you will immediately see:
USERS: redis!redis@services.anope.org (Anope IRC Services) connected to the network (services.anope.org) USERS: redis!redis@services.anope.org (Services for IRC Networks) connected to the network (services.anope.org)
And the bot redis will be in BotServ's bot list. And the bot redis will be in BotServ's bot list.
Notice how ids:BotInfo and the value keys are updated automatically. Notice how ids:BotInfo and the value keys are updated automatically.
+25
View File
@@ -0,0 +1,25 @@
Anope Bundled Tools
-------------------
1) Anope SMTP Client
Provided with Anope is a simple SMTP client which can be used instead of
programs like SendMail in some cases.
The SMTP client can be used instead of sendmail for use with Anope's mail
options. To use the SMTP client instead of sendmail, find the line in your
services configuration file (services.conf) that defines sendmailpath. On
that line, change the path to your services installation directory, then
followed by "bin/anopesmtp" and the IP address of a valid SMTP server. It
should look like this:
sendmailpath = "/home/anope/services/bin/anopesmtp 127.0.0.1"
If the SMTP client doesn't send mail, or if there's an other problem with
it, you can enable debug mode by passing the --debug flag after the server
address. This should generate a log file of what happened when it tried
to connect to the SMTP server.
Credits:
Originally written by Dominick Meglio <codemastr@unrealircd.com>
Ported to *nix by Trystan Scott Lee <trystan@nomadirc.net>
+3 -3
View File
@@ -70,7 +70,7 @@ Anope for Windows
If you cannot find whats causing the error, please visit our forums or If you cannot find whats causing the error, please visit our forums or
our IRC Support channel for assistance. our IRC Support channel for assistance.
Some Anope modules require third party libraries, such as mysql and Some Anope modules require third party libraries, such as m_mysql and
the SSL modules. If these libraries are installed in nonstandard the SSL modules. If these libraries are installed in nonstandard
locations, cmake will probably not find them and should be told where locations, cmake will probably not find them and should be told where
they are by passing their location to Config. they are by passing their location to Config.
@@ -103,7 +103,7 @@ Anope for Windows
INSTALL within the Solution Explorer. Right-click on INSTALL and choose Build. INSTALL within the Solution Explorer. Right-click on INSTALL and choose Build.
When you have done this, all the files will be installed to where they belong. When you have done this, all the files will be installed to where they belong.
The only thing you need to do is rename "data/anope.example.conf" to be "data/anope.conf", The only thing you need to do is rename "data/example.conf" to be "data/services.conf",
and then follow the steps to set up Anope. and then follow the steps to set up Anope.
You have now completed the building phase of Anope for Windows. You can You have now completed the building phase of Anope for Windows. You can
@@ -120,7 +120,7 @@ Anope for Windows
Notepad will cause strange characters to appear, and you may not be able to Notepad will cause strange characters to appear, and you may not be able to
edit the file correctly. edit the file correctly.
Open anope.conf, and read through it carefully and adjust the settings Open services.conf, and read through it carefully and adjust the settings
you think you need to adjust. you think you need to adjust.
If you are unsure of the settings, you can go to the dos command prompt If you are unsure of the settings, you can go to the dos command prompt
+2 -2
View File
@@ -1,7 +1,7 @@
XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported. Starting with Anope 1.9.4 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. 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 xmlrpc_main: Currently there are 5 supported XMLRPC calls, provided by m_xmlrpc_main:
checkAuthentication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password 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. is correct for the account name, useful for making login pages on websites.
+44 -2
View File
@@ -16,7 +16,49 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
if(NOT WIN32) if(NOT WIN32)
add_to_cpack_ignored_files("version.h$" TRUE) add_to_cpack_ignored_files("version.h$" TRUE)
add_to_cpack_ignored_files("build.h$" TRUE) add_to_cpack_ignored_files("build.h$" TRUE)
endif() endif(NOT WIN32)
set(PCH_SOURCES_GCH "")
if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}")
file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
sort_list(PCH_SOURCES)
foreach(PCH_SOURCE ${PCH_SOURCES})
find_includes(${PCH_SOURCE} INCLUDES)
set(INCLUDES_LIST)
append_to_list(INCLUDES_LIST ${PCH_SOURCE})
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
if(QUOTE_TYPE STREQUAL "quotes")
find_in_list(PCH_SOURCES "${FILENAME}" FOUND)
if(NOT FOUND EQUAL -1)
append_to_list(INCLUDES_LIST ${FILENAME})
endif(NOT FOUND EQUAL -1)
endif(QUOTE_TYPE STREQUAL "quotes")
endforeach(INCLUDE)
set(PCH_EXTRAFLAGS "")
if(DEBUG_BUILD)
set(PCH_EXTRAFLAGS "-g")
endif(DEBUG_BUILD)
if(PCH_SOURCE STREQUAL "module.h")
set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC)
endif(PCH_SOURCE STREQUAL "module.h")
if(GETTEXT_INCLUDE)
set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}")
endif(GETTEXT_INCLUDE)
set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS}
${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch
DEPENDS ${INCLUDES_LIST} VERBATIM
)
endforeach(PCH_SOURCE ${PCH_SOURCES})
endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX)
# Add a custom target to the above file # Add a custom target to the above file
add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h) add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h ${PCH_SOURCES_GCH})
+17 -17
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef ACCESS_H
#define ACCESS_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -27,7 +28,7 @@ enum
* backing each ChanAccess determines whether that ChanAccess has a given * backing each ChanAccess determines whether that ChanAccess has a given
* privilege. * privilege.
*/ */
struct CoreExport Privilege final struct CoreExport Privilege
{ {
Anope::string name; Anope::string name;
Anope::string desc; Anope::string desc;
@@ -38,10 +39,10 @@ struct CoreExport Privilege final
bool operator==(const Privilege &other) const; bool operator==(const Privilege &other) const;
}; };
class CoreExport PrivilegeManager final class CoreExport PrivilegeManager
{ {
static std::vector<Privilege> Privileges; static std::vector<Privilege> Privileges;
public: public:
static void AddPrivilege(Privilege p); static void AddPrivilege(Privilege p);
static void RemovePrivilege(Privilege &p); static void RemovePrivilege(Privilege &p);
static Privilege *FindPrivilege(const Anope::string &name); static Privilege *FindPrivilege(const Anope::string &name);
@@ -52,10 +53,9 @@ public:
/* A provider of access. Only used for creating ChanAccesses, as /* A provider of access. Only used for creating ChanAccesses, as
* they contain pure virtual functions. * they contain pure virtual functions.
*/ */
class CoreExport AccessProvider class CoreExport AccessProvider : public Service
: public Service
{ {
public: public:
AccessProvider(Module *owner, const Anope::string &name); AccessProvider(Module *owner, const Anope::string &name);
virtual ~AccessProvider(); virtual ~AccessProvider();
@@ -64,21 +64,20 @@ public:
*/ */
virtual ChanAccess *Create() = 0; virtual ChanAccess *Create() = 0;
private: private:
static std::list<AccessProvider *> Providers; static std::list<AccessProvider *> Providers;
public: public:
static const std::list<AccessProvider *>& GetProviders(); static const std::list<AccessProvider *>& GetProviders();
}; };
/* Represents one entry of an access list on a channel. */ /* Represents one entry of an access list on a channel. */
class CoreExport ChanAccess class CoreExport ChanAccess : public Serializable
: public Serializable
{ {
Anope::string mask; Anope::string mask;
/* account this access entry is for, if any */ /* account this access entry is for, if any */
Serialize::Reference<NickCore> nc; Serialize::Reference<NickCore> nc;
public: public:
typedef std::vector<ChanAccess *> Path; typedef std::vector<ChanAccess *> Path;
/* The provider that created this access entry */ /* The provider that created this access entry */
@@ -86,7 +85,6 @@ public:
/* Channel this access entry is on */ /* Channel this access entry is on */
Serialize::Reference<ChannelInfo> ci; Serialize::Reference<ChannelInfo> ci;
Anope::string creator; Anope::string creator;
Anope::string description;
time_t last_seen; time_t last_seen;
time_t created; time_t created;
@@ -97,7 +95,7 @@ public:
const Anope::string &Mask() const; const Anope::string &Mask() const;
NickCore *GetAccount() const; NickCore *GetAccount() const;
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static const unsigned int MAX_DEPTH = 4; static const unsigned int MAX_DEPTH = 4;
@@ -135,9 +133,9 @@ public:
/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor, /* 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. * to show what access a user has on a channel because users can match multiple access entries.
*/ */
class CoreExport AccessGroup final class CoreExport AccessGroup
{ {
public: public:
/* access entries + paths */ /* access entries + paths */
std::vector<ChanAccess::Path> paths; std::vector<ChanAccess::Path> paths;
/* Channel these access entries are on */ /* Channel these access entries are on */
@@ -172,3 +170,5 @@ public:
inline bool empty() const { return paths.empty(); } inline bool empty() const { return paths.empty(); }
}; };
#endif
+16 -17
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef ACCOUNT_H
#define ACCOUNT_H
#include "extensible.h" #include "extensible.h"
#include "serialize.h" #include "serialize.h"
@@ -19,7 +20,7 @@
typedef Anope::hash_map<NickAlias *> nickalias_map; typedef Anope::hash_map<NickAlias *> nickalias_map;
typedef Anope::hash_map<NickCore *> nickcore_map; typedef Anope::hash_map<NickCore *> nickcore_map;
typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map; typedef TR1NS::unordered_map<uint64_t, NickCore *> nickcoreid_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList; extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList; extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
@@ -28,14 +29,12 @@ extern CoreExport nickcoreid_map NickCoreIdList;
/* A registered nickname. /* A registered nickname.
* It matters that Base is here before Extensible (it is inherited by Serializable) * It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport NickAlias final class CoreExport NickAlias : public Serializable, public Extensible
: public Serializable
, public Extensible
{ {
Anope::string vhost_ident, vhost_host, vhost_creator; Anope::string vhost_ident, vhost_host, vhost_creator;
time_t vhost_created; time_t vhost_created;
public: public:
Anope::string nick; Anope::string nick;
Anope::string last_quit; Anope::string last_quit;
Anope::string last_realname; Anope::string last_realname;
@@ -55,7 +54,7 @@ public:
NickAlias(const Anope::string &nickname, NickCore *nickcore); NickAlias(const Anope::string &nickname, NickCore *nickcore);
~NickAlias(); ~NickAlias();
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Set a vhost for the user /** Set a vhost for the user
@@ -106,15 +105,13 @@ public:
* account's display. * account's display.
* It matters that Base is here before Extensible (it is inherited by Serializable) * It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport NickCore final class CoreExport NickCore : public Serializable, public Extensible
: public Serializable
, public Extensible
{ {
/* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */ /* 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; Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
/* Unique identifier for the account. */ /* Unique identifier for the account. */
uint64_t id; uint64_t id;
public: public:
/* Name of the account. Find(display)->nc == this. */ /* Name of the account. Find(display)->nc == this. */
Anope::string display; Anope::string display;
/* User password in form of hashm:data */ /* User password in form of hashm:data */
@@ -152,7 +149,7 @@ public:
NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0); NickCore(const Anope::string &nickdisplay, uint64_t nickid = 0);
~NickCore(); ~NickCore();
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Changes the display for this account /** Changes the display for this account
@@ -243,16 +240,16 @@ class CoreExport IdentifyRequest
Anope::string password; Anope::string password;
std::set<Module *> holds; std::set<Module *> holds;
bool dispatched = false; bool dispatched;
bool success = false; bool success;
static std::set<IdentifyRequest *> Requests; static std::set<IdentifyRequest *> Requests;
protected: protected:
IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass); IdentifyRequest(Module *o, const Anope::string &acc, const Anope::string &pass);
virtual ~IdentifyRequest(); virtual ~IdentifyRequest();
public: public:
/* One of these is called when the request goes through */ /* One of these is called when the request goes through */
virtual void OnSuccess() = 0; virtual void OnSuccess() = 0;
virtual void OnFail() = 0; virtual void OnFail() = 0;
@@ -289,3 +286,5 @@ public:
static void ModuleUnload(Module *m); static void ModuleUnload(Module *m);
}; };
#endif // ACCOUNT_H
+52 -53
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef ANOPE_H
#define ANOPE_H
#include <signal.h> #include <signal.h>
@@ -22,15 +23,15 @@ namespace Anope
* allow us to only require one type of string everywhere that can be converted * allow us to only require one type of string everywhere that can be converted
* at any time to a specific type of string. * at any time to a specific type of string.
*/ */
class CoreExport string final class CoreExport string
{ {
private: private:
/** /**
* The actual string is stored in an std::string as it can be converted to * 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. * ci::string, or a C-style string at any time.
*/ */
std::string _string; std::string _string;
public: public:
/** /**
* Extras. * Extras.
*/ */
@@ -53,7 +54,9 @@ namespace Anope
string(const ci::string &_str) : _string(_str.c_str()) { } string(const ci::string &_str) : _string(_str.c_str()) { }
string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { } string(const string &_str, size_type pos, size_type n = npos) : _string(_str._string, pos, n) { }
template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { } template <class InputIterator> string(InputIterator first, InputIterator last) : _string(first, last) { }
#if __cplusplus >= 201103L
string(const string &) = default; string(const string &) = default;
#endif
/** /**
* Assignment operators, so any type of string can be assigned to this class. * Assignment operators, so any type of string can be assigned to this class.
@@ -210,10 +213,6 @@ 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(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 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. * Determine if string consists of only numbers.
*/ */
@@ -258,8 +257,8 @@ namespace Anope
inline string lower() const inline string lower() const
{ {
Anope::string new_string = *this; Anope::string new_string = *this;
for (auto &chr : new_string) for (size_type i = 0; i < new_string.length(); ++i)
chr = Anope::tolower(chr); new_string[i] = Anope::tolower(new_string[i]);
return new_string; return new_string;
} }
@@ -269,8 +268,8 @@ namespace Anope
inline string upper() const inline string upper() const
{ {
Anope::string new_string = *this; Anope::string new_string = *this;
for (auto &chr : new_string) for (size_type i = 0; i < new_string.length(); ++i)
chr = Anope::toupper(chr); new_string[i] = Anope::toupper(new_string[i]);
return new_string; return new_string;
} }
@@ -312,23 +311,23 @@ namespace Anope
inline const string operator+(const char *_str, const string &str) { string tmp(_str); tmp += str; return tmp; } inline const string operator+(const 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; } inline const string operator+(const std::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
struct hash_ci final struct hash_ci
{ {
inline size_t operator()(const string &s) const inline size_t operator()(const string &s) const
{ {
return std::hash<std::string>()(s.lower().str()); return TR1NS::hash<std::string>()(s.lower().str());
} }
}; };
struct hash_cs final struct hash_cs
{ {
inline size_t operator()(const string &s) const inline size_t operator()(const string &s) const
{ {
return std::hash<std::string>()(s.str()); return TR1NS::hash<std::string>()(s.str());
} }
}; };
struct compare final struct compare
{ {
inline bool operator()(const string &s1, const string &s2) const inline bool operator()(const string &s1, const string &s2) const
{ {
@@ -336,14 +335,9 @@ namespace Anope
} }
}; };
template<typename T> template<typename T> class map : public std::map<string, T, ci::less> { };
using map = std::map<string, T, ci::less>; template<typename T> class multimap : public std::multimap<string, T, ci::less> { };
template<typename T> class hash_map : public TR1NS::unordered_map<string, T, hash_ci, compare> { };
template<typename T>
using multimap = std::multimap<string, T, ci::less>;
template<typename T>
using hash_map = std::unordered_map<string, T, hash_ci, compare>;
#ifndef REPRODUCIBLE_BUILD #ifndef REPRODUCIBLE_BUILD
static const char *const compiled = __TIME__ " " __DATE__; static const char *const compiled = __TIME__ " " __DATE__;
@@ -375,11 +369,11 @@ namespace Anope
*/ */
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug; extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
/** The root of the Anope installation. Usually ~/anope /** The root of the services installation. Usually ~/services
*/ */
extern CoreExport Anope::string ServicesDir; extern CoreExport Anope::string ServicesDir;
/** Anope binary name (eg anope) /** Services binary name (eg services)
*/ */
extern CoreExport Anope::string ServicesBin; extern CoreExport Anope::string ServicesBin;
@@ -393,7 +387,7 @@ namespace Anope
/** The uplink we are currently connected to /** The uplink we are currently connected to
*/ */
extern CoreExport size_t CurrentUplink; extern CoreExport int CurrentUplink;
/** Various methods to determine the Anope version running /** Various methods to determine the Anope version running
*/ */
@@ -425,7 +419,7 @@ namespace Anope
* initializing language support, loading modules, and loading databases. * initializing language support, loading modules, and loading databases.
* @throws CoreException if something bad went wrong * @throws CoreException if something bad went wrong
*/ */
extern bool Init(int ac, char **av); extern void Init(int ac, char **av);
/** Calls the save database event /** Calls the save database event
*/ */
@@ -471,6 +465,14 @@ namespace Anope
*/ */
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest); extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
/** Decrypts what is in 'src' to 'dest'.
* @param src The source string to decrypt
* @param dest The destination where the decrypted string is placed
* @return true if decryption was successful. This is usually not the case
* as most encryption methods we use are one way.
*/
extern CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest);
/** Hashes a buffer with SipHash-2-4 /** Hashes a buffer with SipHash-2-4
* @param src The start of the buffer to hash * @param src The start of the buffer to hash
* @param src_sz The total number of bytes in the buffer * @param src_sz The total number of bytes in the buffer
@@ -485,7 +487,7 @@ namespace Anope
* @param ... any number of parameters * @param ... any number of parameters
* @return a Anope::string * @return a Anope::string
*/ */
extern CoreExport string printf(const char *fmt, ...) ATTR_FORMAT(1, 2); extern CoreExport string printf(const char *fmt, ...);
/** Return the last error code /** Return the last error code
* @return The error code * @return The error code
@@ -566,7 +568,7 @@ namespace Anope
*/ */
class CoreExport sepstream class CoreExport sepstream
{ {
private: private:
/** Original string. /** Original string.
*/ */
Anope::string tokens; Anope::string tokens;
@@ -575,11 +577,11 @@ private:
char sep; char sep;
/** Current string position /** Current string position
*/ */
size_t pos = 0; size_t pos;
/** If set then GetToken() can return an empty string /** If set then GetToken() can return an empty string
*/ */
bool allow_empty; bool allow_empty;
public: public:
/** Create a sepstream and fill it with the provided data /** Create a sepstream and fill it with the provided data
*/ */
sepstream(const Anope::string &source, char separator, bool allowempty = false); sepstream(const Anope::string &source, char separator, bool allowempty = false);
@@ -633,10 +635,9 @@ public:
/** A derived form of sepstream, which separates on commas /** A derived form of sepstream, which separates on commas
*/ */
class commasepstream final class commasepstream : public sepstream
: public sepstream
{ {
public: public:
/** Initialize with comma separator /** Initialize with comma separator
*/ */
commasepstream(const Anope::string &source, bool allowempty = false) : sepstream(source, ',', allowempty) { } commasepstream(const Anope::string &source, bool allowempty = false) : sepstream(source, ',', allowempty) { }
@@ -644,10 +645,9 @@ public:
/** A derived form of sepstream, which separates on spaces /** A derived form of sepstream, which separates on spaces
*/ */
class spacesepstream final class spacesepstream : public sepstream
: public sepstream
{ {
public: public:
/** Initialize with space separator /** Initialize with space separator
*/ */
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { } spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
@@ -659,17 +659,16 @@ public:
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user * 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. * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/ */
class CoreExport CoreException class CoreException : public std::exception
: public std::exception
{ {
protected: protected:
/** Holds the error message to be displayed /** Holds the error message to be displayed
*/ */
Anope::string err; Anope::string err;
/** Source of the exception /** Source of the exception
*/ */
Anope::string source; Anope::string source;
public: public:
/** Default constructor, just uses the error message 'Core threw an exception'. /** Default constructor, just uses the error message 'Core threw an exception'.
*/ */
CoreException() : err("Core threw an exception"), source("The core") { } CoreException() : err("Core threw an exception"), source("The core") { }
@@ -684,7 +683,7 @@ public:
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~CoreException() noexcept = default; virtual ~CoreException() throw() { }
/** Returns the reason for the exception. /** Returns the reason for the exception.
* The module should probably put something informative here as the user will see this upon failure. * The module should probably put something informative here as the user will see this upon failure.
*/ */
@@ -699,10 +698,9 @@ public:
} }
}; };
class CoreExport ModuleException class ModuleException : public CoreException
: public CoreException
{ {
public: public:
/** Default constructor, just uses the error message 'Module threw an exception'. /** Default constructor, just uses the error message 'Module threw an exception'.
*/ */
ModuleException() : CoreException("Module threw an exception", "A Module") { } ModuleException() : CoreException("Module threw an exception", "A Module") { }
@@ -714,16 +712,15 @@ public:
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~ModuleException() noexcept = default; virtual ~ModuleException() throw() { }
}; };
class CoreExport ConvertException final class ConvertException : public CoreException
: public CoreException
{ {
public: public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { } ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() noexcept = default; virtual ~ConvertException() throw() { }
}; };
/** Convert something to a string /** Convert something to a string
@@ -797,3 +794,5 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
return static_cast<T>(ptr); return static_cast<T>(ptr);
} }
#endif #endif
#endif // ANOPE_H
+20 -15
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2008-2011 Adam <Adam@anope.org> * (C) 2008-2011 Adam <Adam@anope.org>
* (C) 2008-2024 Anope Team <team@anope.org> * (C) 2008-2026 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef BASE_H
#define BASE_H
#include "services.h" #include "services.h"
@@ -15,8 +16,9 @@
class CoreExport Base class CoreExport Base
{ {
/* References to this base class */ /* References to this base class */
std::set<ReferenceBase *> *references = nullptr; std::set<ReferenceBase *> *references;
public: public:
Base();
virtual ~Base(); virtual ~Base();
/** Adds a reference to this object. Eg, when a Reference /** Adds a reference to this object. Eg, when a Reference
@@ -30,12 +32,12 @@ public:
class ReferenceBase class ReferenceBase
{ {
protected: protected:
bool invalid = false; bool invalid;
public: public:
ReferenceBase() = default; ReferenceBase() : invalid(false) { }
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { } ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
virtual ~ReferenceBase() = default; virtual ~ReferenceBase() { }
inline void Invalidate() { this->invalid = true; } inline void Invalidate() { this->invalid = true; }
}; };
@@ -43,13 +45,14 @@ public:
* no longer be valid once the object it refers is destructed. * no longer be valid once the object it refers is destructed.
*/ */
template<typename T> template<typename T>
class Reference class Reference : public ReferenceBase
: public ReferenceBase
{ {
protected: protected:
T *ref = nullptr; T *ref;
public: public:
Reference() = default; Reference() : ref(NULL)
{
}
Reference(T *obj) : ref(obj) Reference(T *obj) : ref(obj)
{ {
@@ -136,3 +139,5 @@ public:
return false; return false;
} }
}; };
#endif // BASE_H
+7 -6
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org> * (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2008-2024 Anope Team <team@anope.org> * (C) 2008-2026 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef BOTS_H
#define BOTS_H
#include "users.h" #include "users.h"
#include "anope.h" #include "anope.h"
@@ -19,13 +20,11 @@ typedef Anope::map<BotInfo *> botinfo_map;
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID; extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */ /* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
class CoreExport BotInfo final class CoreExport BotInfo : public User, public Serializable
: public User
, public Serializable
{ {
/* Channels this bot is assigned to */ /* Channels this bot is assigned to */
Serialize::Checker<std::set<ChannelInfo *> > channels; Serialize::Checker<std::set<ChannelInfo *> > channels;
public: public:
time_t created; time_t created;
/* Last time this bot said something (via privmsg) */ /* Last time this bot said something (via privmsg) */
time_t lastmsg; time_t lastmsg;
@@ -132,3 +131,5 @@ public:
*/ */
static BotInfo* Find(const Anope::string &nick, bool nick_only = false); static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
}; };
#endif // BOTS_H
+14 -16
View File
@@ -1,12 +1,13 @@
/* Channel support /* Channel support
* *
* (C) 2008-2024 Anope Team * (C) 2008-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef CHANNELS_H
#define CHANNELS_H
#include "anope.h" #include "anope.h"
#include "extensible.h" #include "extensible.h"
@@ -18,8 +19,7 @@ typedef Anope::hash_map<Channel *> channel_map;
extern CoreExport channel_map ChannelList; extern CoreExport channel_map ChannelList;
/* A user container, there is one of these per user per channel. */ /* A user container, there is one of these per user per channel. */
struct ChanUserContainer final struct ChanUserContainer : public Extensible
: public Extensible
{ {
User *user; User *user;
Channel *chan; Channel *chan;
@@ -29,20 +29,18 @@ struct ChanUserContainer final
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { } ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
}; };
class CoreExport Channel final class CoreExport Channel : public Base, public Extensible
: public Base
, public Extensible
{ {
static std::vector<Channel *> deleting; static std::vector<Channel *> deleting;
public: public:
typedef std::multimap<Anope::string, Anope::string> ModeList; typedef std::multimap<Anope::string, Anope::string> ModeList;
private: private:
/** A map of channel modes with their parameters set on this channel /** A map of channel modes with their parameters set on this channel
*/ */
ModeList modes; ModeList modes;
public: public:
/* Channel name */ /* Channel name */
Anope::string name; Anope::string name;
/* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */ /* Set if this channel is registered. ci->c == this. Contains information relevant to the registered channel */
@@ -76,14 +74,14 @@ public:
int16_t chanserv_modecount; /* Number of check_mode()'s this sec */ int16_t chanserv_modecount; /* Number of check_mode()'s this sec */
int16_t bouncy_modes; /* Did we fail to set modes here? */ int16_t bouncy_modes; /* Did we fail to set modes here? */
private: private:
/** Constructor /** Constructor
* @param name The channel name * @param name The channel name
* @param ts The time the channel was created * @param ts The time the channel was created
*/ */
Channel(const Anope::string &nname, time_t ts = Anope::CurTime); Channel(const Anope::string &nname, time_t ts = Anope::CurTime);
public: public:
/** Destructor /** Destructor
*/ */
~Channel(); ~Channel();
@@ -207,8 +205,7 @@ public:
* @param enforce_mlock Should mlock be enforced on this mode change * @param enforce_mlock Should mlock be enforced on this mode change
* @param cmodes The modes to set * @param cmodes The modes to set
*/ */
void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...) ATTR_FORMAT(4, 5); void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...);
void SetModes(BotInfo *bi, bool enforce_mlock, const Anope::string &cmodes);
/** Set a string of modes internally on a channel /** Set a string of modes internally on a channel
* @param source The setter * @param source The setter
@@ -237,8 +234,7 @@ public:
* @param reason The reason for the kick * @param reason The reason for the kick
* @return true if the kick was successful, false if a module blocked 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, ...) ATTR_FORMAT(4, 5); bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
bool Kick(BotInfo *bi, User *u, const Anope::string &reason);
/** Get all modes set on this channel, excluding status modes. /** Get all modes set on this channel, excluding status modes.
* @return a map of modes and their optional parameters. * @return a map of modes and their optional parameters.
@@ -315,3 +311,5 @@ public:
static void DeleteChannels(); static void DeleteChannels();
}; };
#endif // CHANNELS_H
+22 -18
View File
@@ -1,6 +1,6 @@
/* Declarations for command data. /* Declarations for command data.
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,22 +9,25 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef COMMAND_H
#define COMMAND_H
#include "service.h" #include "service.h"
#include "anope.h" #include "anope.h"
#include "channels.h" #include "channels.h"
struct CommandGroup final struct CommandGroup
{ {
Anope::string name, description; Anope::string name, description;
}; };
/* Used in BotInfo::commands */ /* Used in BotInfo::commands */
struct CommandInfo final struct CommandInfo
{ {
typedef Anope::map<CommandInfo> map; typedef Anope::map<CommandInfo> map;
CommandInfo() : hide(false), prepend_channel(false) { }
/* Service name of the command */ /* Service name of the command */
Anope::string name; Anope::string name;
/* Permission required to execute the command */ /* Permission required to execute the command */
@@ -32,9 +35,9 @@ struct CommandInfo final
/* Group this command is in */ /* Group this command is in */
Anope::string group; Anope::string group;
/* whether or not to hide this command in help output */ /* whether or not to hide this command in help output */
bool hide = false; bool hide;
/* Only used with fantasy */ /* Only used with fantasy */
bool prepend_channel = false; bool prepend_channel;
}; };
/* Where the replies from commands go to. User inherits from this and is the normal /* Where the replies from commands go to. User inherits from this and is the normal
@@ -42,18 +45,18 @@ struct CommandInfo final
*/ */
struct CoreExport CommandReply struct CoreExport CommandReply
{ {
virtual ~CommandReply() = default; virtual ~CommandReply() { }
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0; virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
}; };
/* The source for a command */ /* The source for a command */
class CoreExport CommandSource final class CoreExport CommandSource
{ {
/* The nick executing the command */ /* The nick executing the command */
Anope::string nick; Anope::string nick;
/* User executing the command, may be NULL */ /* User executing the command, may be NULL */
Reference<User> u; Reference<User> u;
public: public:
/* The account executing the command */ /* The account executing the command */
Reference<NickCore> nc; Reference<NickCore> nc;
/* for web clients */ /* for web clients */
@@ -77,7 +80,7 @@ public:
AccessGroup AccessFor(ChannelInfo *ci); AccessGroup AccessFor(ChannelInfo *ci);
bool IsFounder(ChannelInfo *ci); bool IsFounder(ChannelInfo *ci);
void Reply(const char *message, ...) ATTR_FORMAT(2, 3); void Reply(const char *message, ...);
void Reply(const Anope::string &message); void Reply(const Anope::string &message);
bool HasCommand(const Anope::string &cmd); bool HasCommand(const Anope::string &cmd);
@@ -88,8 +91,7 @@ public:
/** Every services command is a class, inheriting from Command. /** Every services command is a class, inheriting from Command.
*/ */
class CoreExport Command class CoreExport Command : public Service
: public Service
{ {
Anope::string desc; Anope::string desc;
std::vector<Anope::string> syntax; std::vector<Anope::string> syntax;
@@ -98,7 +100,7 @@ class CoreExport Command
/* Command requires that a user is executing it */ /* Command requires that a user is executing it */
bool require_user; bool require_user;
public: public:
/* Maximum parameters accepted by this command */ /* Maximum parameters accepted by this command */
size_t max_params; size_t max_params;
/* Minimum parameters required to use this command */ /* Minimum parameters required to use this command */
@@ -107,7 +109,7 @@ public:
/* Module which owns us */ /* Module which owns us */
Module *module; Module *module;
protected: protected:
/** Create a new command. /** Create a new command.
* @param owner The owner of the command * @param owner The owner of the command
* @param sname The command name * @param sname The command name
@@ -117,10 +119,10 @@ protected:
*/ */
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0); Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
public: public:
virtual ~Command() = default; virtual ~Command();
protected: protected:
void SetDesc(const Anope::string &d); void SetDesc(const Anope::string &d);
void ClearSyntax(); void ClearSyntax();
@@ -130,7 +132,7 @@ protected:
void AllowUnregistered(bool b); void AllowUnregistered(bool b);
void RequireUser(bool b); void RequireUser(bool b);
public: public:
bool AllowUnregistered() const; bool AllowUnregistered() const;
bool RequireUser() const; bool RequireUser() const;
@@ -181,3 +183,5 @@ public:
*/ */
static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name); static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name);
}; };
#endif // COMMANDS_H
+20 -19
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef CONFIG_H
#define CONFIG_H
#include "account.h" #include "account.h"
#include "regchannel.h" #include "regchannel.h"
@@ -25,11 +26,11 @@ namespace Configuration
{ {
friend struct Configuration::Conf; friend struct Configuration::Conf;
public: public:
typedef Anope::map<Anope::string> item_map; typedef Anope::map<Anope::string> item_map;
typedef Anope::multimap<Block> block_map; typedef Anope::multimap<Block> block_map;
private: private:
Anope::string name; Anope::string name;
item_map items; item_map items;
block_map blocks; block_map blocks;
@@ -38,7 +39,7 @@ namespace Configuration
/* Represents a missing tag. */ /* Represents a missing tag. */
static Block EmptyBlock; static Block EmptyBlock;
public: public:
Block(const Anope::string &); Block(const Anope::string &);
const Anope::string &GetName() const; const Anope::string &GetName() const;
int CountBlock(const Anope::string &name) const; int CountBlock(const Anope::string &name) const;
@@ -65,7 +66,7 @@ namespace Configuration
} }
bool Set(const Anope::string &tag, const Anope::string &value); bool Set(const Anope::string &tag, const Anope::string &value);
const item_map &GetItems() const; const item_map* GetItems() const;
}; };
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const; template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
@@ -78,12 +79,12 @@ namespace Configuration
/** Represents a configuration file /** Represents a configuration file
*/ */
class File final class File
{ {
Anope::string name; Anope::string name;
bool executable; bool executable;
FILE *fp = nullptr; FILE *fp;
public: public:
File(const Anope::string &, bool); File(const Anope::string &, bool);
~File(); ~File();
const Anope::string &GetName() const; const Anope::string &GetName() const;
@@ -98,8 +99,7 @@ namespace Configuration
struct Uplink; struct Uplink;
struct CoreExport Conf final struct CoreExport Conf : Block
: Block
{ {
/* options:readtimeout */ /* options:readtimeout */
time_t ReadTimeout; time_t ReadTimeout;
@@ -153,15 +153,15 @@ namespace Configuration
const Block *GetCommand(CommandSource &); const Block *GetCommand(CommandSource &);
}; };
struct Uplink final struct Uplink
{ {
Anope::string host; Anope::string host;
unsigned port; unsigned port;
Anope::string password; Anope::string password;
int protocol; bool ipv6;
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, int _protocol) : host(_host), port(_port), password(_password), protocol(_protocol) { } Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { }
inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && protocol == other.protocol; } inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && ipv6 == other.ipv6; }
inline bool operator!=(const Uplink &other) const { return !(*this == other); } inline bool operator!=(const Uplink &other) const { return !(*this == other); }
}; };
} }
@@ -172,10 +172,9 @@ namespace Configuration
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user * 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. * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/ */
class CoreExport ConfigException final class ConfigException : public CoreException
: public CoreException
{ {
public: public:
/** Default constructor, just uses the error message 'Config threw an exception'. /** Default constructor, just uses the error message 'Config threw an exception'.
*/ */
ConfigException() : CoreException("Config threw an exception", "Config Parser") { } ConfigException() : CoreException("Config threw an exception", "Config Parser") { }
@@ -186,8 +185,10 @@ public:
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~ConfigException() noexcept = default; virtual ~ConfigException() throw() { }
}; };
extern Configuration::File ServicesConf; extern Configuration::File ServicesConf;
extern CoreExport Configuration::Conf *Config; extern CoreExport Configuration::Conf *Config;
#endif // CONFIG_H
+1 -3
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
class AccessGroup; class AccessGroup;
class AutoKick; class AutoKick;
class BotInfo; class BotInfo;
+34 -36
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef EXTENSIBLE_H
#define EXTENSIBLE_H
#include "anope.h" #include "anope.h"
#include "serialize.h" #include "serialize.h"
@@ -15,16 +16,15 @@
class Extensible; class Extensible;
class CoreExport ExtensibleBase class CoreExport ExtensibleBase : public Service
: public Service
{ {
protected: protected:
std::map<Extensible *, void *> items; std::map<Extensible *, void *> items;
ExtensibleBase(Module *m, const Anope::string &n); ExtensibleBase(Module *m, const Anope::string &n);
~ExtensibleBase(); ~ExtensibleBase();
public: public:
virtual void Unset(Extensible *obj) = 0; virtual void Unset(Extensible *obj) = 0;
/* called when an object we are keep track of is serializing */ /* called when an object we are keep track of is serializing */
@@ -34,7 +34,7 @@ public:
class CoreExport Extensible class CoreExport Extensible
{ {
public: public:
std::set<ExtensibleBase *> extension_items; std::set<ExtensibleBase *> extension_items;
virtual ~Extensible(); virtual ~Extensible();
@@ -54,13 +54,12 @@ public:
}; };
template<typename T> template<typename T>
class BaseExtensibleItem class BaseExtensibleItem : public ExtensibleBase
: public ExtensibleBase
{ {
protected: protected:
virtual T *Create(Extensible *) = 0; virtual T *Create(Extensible *) = 0;
public: public:
BaseExtensibleItem(Module *m, const Anope::string &n) : ExtensibleBase(m, n) { } BaseExtensibleItem(Module *m, const Anope::string &n) : ExtensibleBase(m, n) { }
~BaseExtensibleItem() ~BaseExtensibleItem()
@@ -94,7 +93,7 @@ public:
return t; return t;
} }
void Unset(Extensible *obj) override void Unset(Extensible *obj) anope_override
{ {
T *value = Get(obj); T *value = Get(obj);
items.erase(obj); items.erase(obj);
@@ -126,57 +125,54 @@ public:
}; };
template<typename T> template<typename T>
class ExtensibleItem class ExtensibleItem : public BaseExtensibleItem<T>
: public BaseExtensibleItem<T>
{ {
protected: protected:
T* Create(Extensible *obj) override T* Create(Extensible *obj) anope_override
{ {
return new T(obj); return new T(obj);
} }
public: public:
ExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { } ExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { }
}; };
template<typename T> template<typename T>
class PrimitiveExtensibleItem class PrimitiveExtensibleItem : public BaseExtensibleItem<T>
: public BaseExtensibleItem<T>
{ {
protected: protected:
T* Create(Extensible *obj) override T* Create(Extensible *obj) anope_override
{ {
return new T(); return new T();
} }
public: public:
PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { } PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<T>(m, n) { }
}; };
template<> template<>
class PrimitiveExtensibleItem<bool> : public BaseExtensibleItem<bool> class PrimitiveExtensibleItem<bool> : public BaseExtensibleItem<bool>
{ {
protected: protected:
bool* Create(Extensible *) override bool* Create(Extensible *) anope_override
{ {
return NULL; return NULL;
} }
public: public:
PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<bool>(m, n) { } PrimitiveExtensibleItem(Module *m, const Anope::string &n) : BaseExtensibleItem<bool>(m, n) { }
}; };
template<typename T> template<typename T>
class SerializableExtensibleItem class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
: public PrimitiveExtensibleItem<T>
{ {
public: public:
SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<T>(m, n) { } SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<T>(m, n) { }
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
{ {
T* t = this->Get(e); T* t = this->Get(e);
data[this->name] << *t; data[this->name] << *t;
} }
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
{ {
T t; T t;
if (data[this->name] >> t) if (data[this->name] >> t)
@@ -189,15 +185,16 @@ public:
template<> template<>
class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool> class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
{ {
public: public:
SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<bool>(m, n) { } SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem<bool>(m, n) { }
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
{ {
data[this->name] << true; data.SetType(this->name, Serialize::Data::DT_INT);
data[this->name] << this->HasExt(e);
} }
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
{ {
bool b = false; bool b = false;
data[this->name] >> b; data[this->name] >> b;
@@ -209,8 +206,7 @@ public:
}; };
template<typename T> template<typename T>
struct ExtensibleRef final struct ExtensibleRef : ServiceReference<BaseExtensibleItem<T> >
: ServiceReference<BaseExtensibleItem<T> >
{ {
ExtensibleRef(const Anope::string &n) : ServiceReference<BaseExtensibleItem<T> >("Extensible", n) { } ExtensibleRef(const Anope::string &n) : ServiceReference<BaseExtensibleItem<T> >("Extensible", n) { }
}; };
@@ -264,3 +260,5 @@ void Extensible::Shrink(const Anope::string &name)
else else
Log(LOG_DEBUG) << "Shrink for nonexistent type " << name << " on " << static_cast<void *>(this); Log(LOG_DEBUG) << "Shrink for nonexistent type " << name << " on " << static_cast<void *>(this);
} }
#endif // EXTENSIBLE_H
+25 -18
View File
@@ -1,16 +1,24 @@
/* /*
* *
* (C) 2002-2011 InspIRCd Development Team * (C) 2002-2011 InspIRCd Development Team
* (C) 2009-2024 Anope Team <team@anope.org> * (C) 2009-2026 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef HASHCOMP_H
#define HASHCOMP_H
#include <string> #include <string>
#include <locale> #include <locale>
#if defined _LIBCPP_VERSION || defined _WIN32
#include <unordered_map> #include <unordered_map>
#define TR1NS std
#else
#include <tr1/unordered_map>
#define TR1NS std::tr1
#endif
#include "services.h" #include "services.h"
@@ -21,17 +29,16 @@ namespace Anope
/* Casemap in use by Anope. ci::string's comparison functions use this (and thus Anope::string) */ /* Casemap in use by Anope. ci::string's comparison functions use this (and thus Anope::string) */
extern std::locale casemap; extern std::locale casemap;
extern CoreExport void CaseMapRebuild(); extern void CaseMapRebuild();
extern CoreExport unsigned char tolower(unsigned char); extern unsigned char tolower(unsigned char);
extern CoreExport unsigned char toupper(unsigned char); extern unsigned char toupper(unsigned char);
/* ASCII case insensitive ctype. */ /* ASCII case insensitive ctype. */
template<typename char_type> template<typename char_type>
class ascii_ctype class ascii_ctype : public std::ctype<char_type>
: public std::ctype<char_type>
{ {
public: public:
char_type do_toupper(char_type c) const override char_type do_toupper(char_type c) const anope_override
{ {
if (c >= 'a' && c <= 'z') if (c >= 'a' && c <= 'z')
return c - 32; return c - 32;
@@ -39,7 +46,7 @@ namespace Anope
return c; return c;
} }
char_type do_tolower(char_type c) const override char_type do_tolower(char_type c) const anope_override
{ {
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
return c + 32; return c + 32;
@@ -50,11 +57,10 @@ namespace Anope
/* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */ /* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */
template<typename char_type> template<typename char_type>
class rfc1459_ctype final class rfc1459_ctype : public ascii_ctype<char_type>
: public ascii_ctype<char_type>
{ {
public: public:
char_type do_toupper(char_type c) const override char_type do_toupper(char_type c) const anope_override
{ {
if (c == '{' || c == '}' || c == '|') if (c == '{' || c == '}' || c == '|')
return c - 32; return c - 32;
@@ -62,7 +68,7 @@ namespace Anope
return ascii_ctype<char_type>::do_toupper(c); return ascii_ctype<char_type>::do_toupper(c);
} }
char_type do_tolower(char_type c) const override char_type do_tolower(char_type c) const anope_override
{ {
if (c == '[' || c == ']' || c == '\\') if (c == '[' || c == ']' || c == '\\')
return c + 32; return c + 32;
@@ -80,8 +86,7 @@ namespace ci
* This class is used to implement ci::string, a case-insensitive, ASCII- * This class is used to implement ci::string, a case-insensitive, ASCII-
* comparing string class. * comparing string class.
*/ */
struct CoreExport ci_char_traits final struct CoreExport ci_char_traits : std::char_traits<char>
: std::char_traits<char>
{ {
/** Check if two chars match. /** Check if two chars match.
* @param c1st First character * @param c1st First character
@@ -126,7 +131,7 @@ namespace ci
*/ */
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string; typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
struct CoreExport less final struct CoreExport less
{ {
/** Compare two Anope::strings as ci::strings and find which one is less /** Compare two Anope::strings as ci::strings and find which one is less
* @param s1 The first string * @param s1 The first string
@@ -190,3 +195,5 @@ inline bool operator!=(const std::string &leftval, const ci::string &rightval)
{ {
return !(leftval.c_str() == rightval); return !(leftval.c_str() == rightval);
} }
#endif // HASHCOMP_H
+8 -11
View File
@@ -1,19 +1,17 @@
/* /*
* *
* (C) 2008-2024 Anope Team * (C) 2008-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
#include "anope.h" #include "anope.h"
namespace Language namespace Language
{ {
/* Languages we support as configured in anope.conf. They are /* Languages we support as configured in services.conf. They are
* added to this list if we detect a language exists in the correct * added to this list if we detect a language exists in the correct
* location for each language. * location for each language.
*/ */
@@ -72,11 +70,10 @@ namespace Language
#define READ_ONLY_MODE _("Services are in read-only mode!") #define READ_ONLY_MODE _("Services are in read-only mode!")
#define PASSWORD_INCORRECT _("Password incorrect.") #define PASSWORD_INCORRECT _("Password incorrect.")
#define ACCESS_DENIED _("Access denied.") #define ACCESS_DENIED _("Access denied.")
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should not be\n" \ #define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \
"something that could be easily guessed (e.g. your real name or your nick) and\n" \ "five characters long, should not be something easily guessed\n" \
"cannot contain the space or tab characters.\n") "(e.g. your real name or your nick), and cannot contain the space or tab 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 not exceed %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_NOT_REGISTERED _("Your nick isn't registered.")
#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.") #define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.")
#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.") #define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.")
@@ -111,9 +108,9 @@ namespace Language
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:") #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 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" \ #define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %zu\002 to read it.") "Type \002%s%s READ %s %d\002 to read it.")
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \ #define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
"Type \002%s%s READ %zu\002 to read it.") "Type \002%s%s READ %d\002 to read it.")
#define MEMO_HAVE_NO_MEMOS _("You have no memos.") #define MEMO_HAVE_NO_MEMOS _("You have no memos.")
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.") #define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.") #define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
+16 -13
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef LISTS_H
#define LISTS_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -23,13 +24,13 @@
*/ */
class CoreExport NumberList class CoreExport NumberList
{ {
private: private:
bool is_valid = true; bool is_valid;
std::set<unsigned> numbers; std::set<unsigned> numbers;
bool desc; bool desc;
public: public:
/** Processes a numbered list /** Processes a numbered list
* @param list The list * @param list The list
* @param descending True to make HandleNumber get called with numbers in descending order * @param descending True to make HandleNumber get called with numbers in descending order
@@ -38,7 +39,7 @@ public:
/** Destructor, does nothing /** Destructor, does nothing
*/ */
virtual ~NumberList() = default; virtual ~NumberList();
/** Should be called after the constructors are done running. This calls the callbacks. /** Should be called after the constructors are done running. This calls the callbacks.
*/ */
@@ -60,15 +61,15 @@ public:
/** This class handles formatting LIST/VIEW replies. /** This class handles formatting LIST/VIEW replies.
*/ */
class CoreExport ListFormatter final class CoreExport ListFormatter
{ {
public: public:
typedef std::map<Anope::string, Anope::string> ListEntry; typedef std::map<Anope::string, Anope::string> ListEntry;
private: private:
NickCore *nc; NickCore *nc;
std::vector<Anope::string> columns; std::vector<Anope::string> columns;
std::vector<ListEntry> entries; std::vector<ListEntry> entries;
public: public:
ListFormatter(NickCore *nc); ListFormatter(NickCore *nc);
ListFormatter &AddColumn(const Anope::string &name); ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry); void AddEntry(const ListEntry &entry);
@@ -78,14 +79,16 @@ public:
/** This class handles formatting INFO replies /** This class handles formatting INFO replies
*/ */
class CoreExport InfoFormatter final class CoreExport InfoFormatter
{ {
NickCore *nc; NickCore *nc;
std::vector<std::pair<Anope::string, Anope::string> > replies; std::vector<std::pair<Anope::string, Anope::string> > replies;
unsigned longest = 0; unsigned longest;
public: public:
InfoFormatter(NickCore *nc); InfoFormatter(NickCore *nc);
void Process(std::vector<Anope::string> &); void Process(std::vector<Anope::string> &);
Anope::string &operator[](const Anope::string &key); Anope::string &operator[](const Anope::string &key);
void AddOption(const Anope::string &opt); void AddOption(const Anope::string &opt);
}; };
#endif // LISTS_H
+23 -20
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef LOGGER_H
#define LOGGER_H
#include "anope.h" #include "anope.h"
#include "defs.h" #include "defs.h"
@@ -37,7 +38,7 @@ enum LogType
LOG_DEBUG_4 LOG_DEBUG_4
}; };
struct LogFile final struct LogFile
{ {
Anope::string filename; Anope::string filename;
std::ofstream stream; std::ofstream stream;
@@ -48,27 +49,27 @@ struct LogFile final
}; };
/* Represents a single log message */ /* Represents a single log message */
class CoreExport Log final class CoreExport Log
{ {
public: public:
/* Bot that should log this message */ /* Bot that should log this message */
BotInfo *bi = nullptr; BotInfo *bi;
/* For commands, the user executing the command, but might not always exist */ /* For commands, the user executing the command, but might not always exist */
User *u = nullptr; User *u;
/* For commands, the account executing the command, but will not always exist */ /* For commands, the account executing the command, but will not always exist */
NickCore *nc = nullptr; NickCore *nc;
/* For commands, the command being executed */ /* For commands, the command being executed */
Command *c = nullptr; Command *c;
/* For commands, the command source */ /* For commands, the command source */
CommandSource *source = nullptr; CommandSource *source;
/* Used for LOG_CHANNEL */ /* Used for LOG_CHANNEL */
Channel *chan = nullptr; Channel *chan;
/* For commands, the channel the command was executed on, will not always exist */ /* For commands, the channel the command was executed on, will not always exist */
const ChannelInfo *ci = nullptr; const ChannelInfo *ci;
/* For LOG_SERVER */ /* For LOG_SERVER */
Server *s = nullptr; Server *s;
/* For LOG_MODULE */ /* For LOG_MODULE */
Module *m = nullptr; Module *m;
LogType type; LogType type;
Anope::string category; Anope::string category;
@@ -94,11 +95,11 @@ public:
~Log(); ~Log();
private: private:
Anope::string FormatSource() const; Anope::string FormatSource() const;
Anope::string FormatCommand() const; Anope::string FormatCommand() const;
public: public:
Anope::string BuildPrefix() const; Anope::string BuildPrefix() const;
template<typename T> Log &operator<<(T val) template<typename T> Log &operator<<(T val)
@@ -109,13 +110,13 @@ public:
}; };
/* Configured in the configuration file, actually does the message logging */ /* Configured in the configuration file, actually does the message logging */
class CoreExport LogInfo final class CoreExport LogInfo
{ {
public: public:
BotInfo *bot = nullptr; BotInfo *bot;
std::vector<Anope::string> targets; std::vector<Anope::string> targets;
std::vector<LogFile *> logfiles; std::vector<LogFile *> logfiles;
int last_day = 0; int last_day;
std::vector<Anope::string> sources; std::vector<Anope::string> sources;
int log_age; int log_age;
std::vector<Anope::string> admin; std::vector<Anope::string> admin;
@@ -139,3 +140,5 @@ public:
/* Logs the message l if configured to */ /* Logs the message l if configured to */
void ProcessMessage(const Log *l); void ProcessMessage(const Log *l);
}; };
#endif // LOGGER_H
+10 -8
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef MAIL_H
#define MAIL_H
#include "anope.h" #include "anope.h"
#include "threadengine.h" #include "threadengine.h"
@@ -22,10 +23,10 @@ namespace Mail
extern CoreExport bool Validate(const Anope::string &email); extern CoreExport bool Validate(const Anope::string &email);
/* A email message being sent */ /* A email message being sent */
class Message final class Message : public Thread
: public Thread
{ {
private: private:
Anope::string error;
Anope::string sendmail_path; Anope::string sendmail_path;
Anope::string send_from; Anope::string send_from;
Anope::string mail_to; Anope::string mail_to;
@@ -35,8 +36,7 @@ namespace Mail
Anope::string content_type; Anope::string content_type;
bool dont_quote_addresses; bool dont_quote_addresses;
bool success = false; public:
public:
/** Construct this message. Once constructed call Thread::Start to launch the mail sending. /** Construct this message. Once constructed call Thread::Start to launch the mail sending.
* @param sf Config->SendFrom * @param sf Config->SendFrom
* @param mailto Name of person being mailed (u->nick, nc->display, etc) * @param mailto Name of person being mailed (u->nick, nc->display, etc)
@@ -49,7 +49,9 @@ namespace Mail
~Message(); ~Message();
/* Called from within the thread to actually send the mail */ /* Called from within the thread to actually send the mail */
void Run() override; void Run() anope_override;
}; };
} // namespace Mail } // namespace Mail
#endif // MAIL_H
+10 -8
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,22 +9,22 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef MEMO_H
#define MEMO_H
#include "anope.h" #include "anope.h"
#include "serialize.h" #include "serialize.h"
class CoreExport Memo final class CoreExport Memo : public Serializable
: public Serializable
{ {
public: public:
MemoInfo *mi; MemoInfo *mi;
bool unread; bool unread;
bool receipt; bool receipt;
Memo(); Memo();
~Memo(); ~Memo();
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
Anope::string owner; Anope::string owner;
@@ -37,9 +37,9 @@ public:
/* Memo info structures. Since both nicknames and channels can have memos, /* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoInfo to make it easier to handle. * we encapsulate memo data in a MemoInfo to make it easier to handle.
*/ */
struct CoreExport MemoInfo final struct CoreExport MemoInfo
{ {
int16_t memomax = 0; int16_t memomax;
Serialize::Checker<std::vector<Memo *> > memos; Serialize::Checker<std::vector<Memo *> > memos;
std::vector<Anope::string> ignores; std::vector<Anope::string> ignores;
@@ -51,3 +51,5 @@ struct CoreExport MemoInfo final
static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan); static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
}; };
#endif // MEMO_H
+41 -63
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
#include "protocol.h" #include "protocol.h"
/* Common IRCD messages. /* Common IRCD messages.
@@ -21,44 +19,39 @@
namespace Message namespace Message
{ {
struct CoreExport Away struct CoreExport Away : IRCDMessage
: IRCDMessage
{ {
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Capab struct CoreExport Capab : IRCDMessage
: IRCDMessage
{ {
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Error struct CoreExport Error : IRCDMessage
: IRCDMessage
{ {
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { } 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; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Invite struct CoreExport Invite : IRCDMessage
: IRCDMessage
{ {
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Join struct CoreExport Join : IRCDMessage
: IRCDMessage
{ {
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
typedef std::pair<ChannelStatus, User *> SJoinUser; typedef std::pair<ChannelStatus, User *> SJoinUser;
@@ -72,124 +65,109 @@ namespace Message
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users); static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
}; };
struct CoreExport Kick struct CoreExport Kick : IRCDMessage
: IRCDMessage
{ {
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Kill struct CoreExport Kill : IRCDMessage
: IRCDMessage
{ {
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { } 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; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Mode struct CoreExport Mode : IRCDMessage
: IRCDMessage
{ {
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport MOTD struct CoreExport MOTD : IRCDMessage
: IRCDMessage
{ {
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { } 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; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Notice struct CoreExport Notice : IRCDMessage
: IRCDMessage
{ {
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Part struct CoreExport Part : IRCDMessage
: IRCDMessage
{ {
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Ping struct CoreExport Ping : IRCDMessage
: IRCDMessage
{ {
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Privmsg struct CoreExport Privmsg : IRCDMessage
: IRCDMessage
{ {
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Quit struct CoreExport Quit : IRCDMessage
: IRCDMessage
{ {
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport SQuit struct CoreExport SQuit : IRCDMessage
: IRCDMessage
{ {
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { } 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; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Stats struct CoreExport Stats : IRCDMessage
: IRCDMessage
{ {
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Time struct CoreExport Time : IRCDMessage
: IRCDMessage
{ {
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Topic struct CoreExport Topic : IRCDMessage
: IRCDMessage
{ {
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Version struct CoreExport Version : IRCDMessage
: IRCDMessage
{ {
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
struct CoreExport Whois struct CoreExport Whois : IRCDMessage
: IRCDMessage
{ {
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override; void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
}; };
} // namespace Message } // namespace Message
+50 -60
View File
@@ -1,12 +1,13 @@
/* Mode support /* Mode support
* *
* (C) 2008-2011 Adam <Adam@anope.org> * (C) 2008-2011 Adam <Adam@anope.org>
* (C) 2008-2024 Anope Team <team@anope.org> * (C) 2008-2026 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef MODES_H
#define MODES_H
#include "anope.h" #include "anope.h"
#include "base.h" #include "base.h"
@@ -35,10 +36,9 @@ enum ModeClass
/** This class is the basis of all modes in Anope /** This class is the basis of all modes in Anope
*/ */
class CoreExport Mode class CoreExport Mode : public Base
: public Base
{ {
public: public:
/* Mode name */ /* Mode name */
Anope::string name; Anope::string name;
/* Class of mode this is (user/channel) */ /* Class of mode this is (user/channel) */
@@ -55,7 +55,7 @@ public:
* @param type The mode type * @param type The mode type
*/ */
Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type); Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
virtual ~Mode() = default; virtual ~Mode();
/** Can a user set this mode, used for mlock /** Can a user set this mode, used for mlock
* @param u The user * @param u The user
@@ -65,10 +65,9 @@ public:
/** This class is a user mode, all user modes use this/inherit from this /** This class is a user mode, all user modes use this/inherit from this
*/ */
class CoreExport UserMode class CoreExport UserMode : public Mode
: public Mode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -76,10 +75,9 @@ public:
UserMode(const Anope::string &name, char mc); UserMode(const Anope::string &name, char mc);
}; };
class CoreExport UserModeParam class CoreExport UserModeParam : public UserMode
: public UserMode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -95,10 +93,9 @@ public:
/** This class is a channel mode, all channel modes use this/inherit from this /** This class is a channel mode, all channel modes use this/inherit from this
*/ */
class CoreExport ChannelMode class CoreExport ChannelMode : public Mode
: public Mode
{ {
public: public:
/* channel modes that can possibly unwrap this mode */ /* channel modes that can possibly unwrap this mode */
std::vector<ChannelMode *> listeners; std::vector<ChannelMode *> listeners;
@@ -108,7 +105,7 @@ public:
*/ */
ChannelMode(const Anope::string &name, char mc); ChannelMode(const Anope::string &name, char mc);
bool CanSet(User *u) const override; bool CanSet(User *u) const anope_override;
virtual void Check() { } virtual void Check() { }
@@ -127,10 +124,9 @@ public:
/** This is a mode for lists, eg b/e/I. These modes should inherit from this /** This is a mode for lists, eg b/e/I. These modes should inherit from this
*/ */
class CoreExport ChannelModeList class CoreExport ChannelModeList : public ChannelMode
: public ChannelMode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -166,10 +162,9 @@ public:
/** This is a mode with a parameter, 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 class CoreExport ChannelModeParam : public ChannelMode
: public ChannelMode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -189,10 +184,9 @@ public:
/** This is a mode that is a channel status, eg +v/h/o/a/q. /** This is a mode that is a channel status, eg +v/h/o/a/q.
*/ */
class CoreExport ChannelModeStatus class CoreExport ChannelModeStatus : public ChannelMode
: public ChannelMode
{ {
public: public:
/* The symbol, eg @ % + */ /* The symbol, eg @ % + */
char symbol; char symbol;
/* The "level" of the mode, used to compare with other modes. /* The "level" of the mode, used to compare with other modes.
@@ -213,30 +207,29 @@ public:
* but we still have a representation for it. * but we still have a representation for it.
*/ */
template<typename T> template<typename T>
class CoreExport ChannelModeVirtual class CoreExport ChannelModeVirtual : public T
: public T
{ {
Anope::string base; Anope::string base;
ChannelMode *basech; ChannelMode *basech;
public: public:
ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename); ChannelModeVirtual(const Anope::string &mname, const Anope::string &basename);
~ChannelModeVirtual(); ~ChannelModeVirtual();
void Check() override; void Check() anope_override;
ChannelMode *Wrap(Anope::string &param) override; ChannelMode *Wrap(Anope::string &param) anope_override;
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) override = 0; ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) anope_override = 0;
}; };
/* The status a user has on a channel (+v, +h, +o) etc */ /* The status a user has on a channel (+v, +h, +o) etc */
class CoreExport ChannelStatus final class CoreExport ChannelStatus
{ {
Anope::string modes; Anope::string modes;
public: public:
ChannelStatus() = default; ChannelStatus();
ChannelStatus(const Anope::string &modes); ChannelStatus(const Anope::string &modes);
void AddMode(char c); void AddMode(char c);
void DelMode(char c); void DelMode(char c);
@@ -247,56 +240,51 @@ public:
Anope::string BuildModePrefixList() const; Anope::string BuildModePrefixList() const;
}; };
class CoreExport UserModeOperOnly class CoreExport UserModeOperOnly : public UserMode
: public UserMode
{ {
public: public:
UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { } UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { }
bool CanSet(User *u) const override; bool CanSet(User *u) const anope_override;
}; };
class CoreExport UserModeNoone class CoreExport UserModeNoone : public UserMode
: public UserMode
{ {
public: public:
UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { } UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { }
bool CanSet(User *u) const override; bool CanSet(User *u) const anope_override;
}; };
/** Channel mode +k (key) /** Channel mode +k (key)
*/ */
class CoreExport ChannelModeKey class CoreExport ChannelModeKey : public ChannelModeParam
: public ChannelModeParam
{ {
public: public:
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
bool IsValid(Anope::string &value) const override; bool IsValid(Anope::string &value) const anope_override;
}; };
/** This class is used for oper only channel modes /** This class is used for oper only channel modes
*/ */
class CoreExport ChannelModeOperOnly class CoreExport ChannelModeOperOnly : public ChannelMode
: public ChannelMode
{ {
public: public:
ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
/* Opers only */ /* Opers only */
bool CanSet(User *u) const override; bool CanSet(User *u) const anope_override;
}; };
/** This class is used for channel modes only servers may set /** This class is used for channel modes only servers may set
*/ */
class CoreExport ChannelModeNoone class CoreExport ChannelModeNoone : public ChannelMode
: public ChannelMode
{ {
public: public:
ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
bool CanSet(User *u) const override; bool CanSet(User *u) const anope_override;
}; };
/** This is the mode manager /** This is the mode manager
@@ -305,9 +293,9 @@ public:
* This also contains a mode stacker that will combine multiple modes and set * This also contains a mode stacker that will combine multiple modes and set
* them on a channel or user at once * them on a channel or user at once
*/ */
class CoreExport ModeManager final class CoreExport ModeManager
{ {
public: public:
/* Number of generic channel and user modes we are tracking */ /* Number of generic channel and user modes we are tracking */
static unsigned GenericChannelModes; static unsigned GenericChannelModes;
@@ -401,13 +389,13 @@ public:
/** Represents a mask set on a channel (b/e/I) /** Represents a mask set on a channel (b/e/I)
*/ */
class CoreExport Entry final class CoreExport Entry
{ {
Anope::string name; Anope::string name;
Anope::string mask; Anope::string mask;
public: public:
unsigned short cidr_len = 0; unsigned short cidr_len;
int family = 0; int family;
Anope::string nick, user, host, real; Anope::string nick, user, host, real;
/** Constructor /** Constructor
@@ -430,3 +418,5 @@ public:
*/ */
bool Matches(User *u, bool full = false) const; bool Matches(User *u, bool full = false) const;
}; };
#endif // MODES_H
+5 -2
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef MODULE_H
#define MODULE_H
#include "access.h" #include "access.h"
#include "account.h" #include "account.h"
@@ -49,3 +50,5 @@
#include "modules/pseudoclients/global.h" #include "modules/pseudoclients/global.h"
#include "modules/pseudoclients/memoserv.h" #include "modules/pseudoclients/memoserv.h"
#include "modules/pseudoclients/nickserv.h" #include "modules/pseudoclients/nickserv.h"
#endif // MODULE_H
+47 -21
View File
@@ -1,6 +1,6 @@
/* Modular support /* Modular support
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,10 +9,11 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
#include "serialize.h" #include "serialize.h"
#ifndef MODULES_H
#define MODULES_H
#include "base.h" #include "base.h"
#include "modes.h" #include "modes.h"
#include "timers.h" #include "timers.h"
@@ -24,7 +25,32 @@
* and functions needed to make a module loadable by the OS. * and functions needed to make a module loadable by the OS.
* It defines the class factory and external AnopeInit and AnopeFini functions. * It defines the class factory and external AnopeInit and AnopeFini functions.
*/ */
#define MODULE_INIT(x) \ #ifdef _WIN32
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &, const Anope::string &); \
extern "C" Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \
return new x(modname, creator); \
} \
BOOLEAN WINAPI DllMain(HINSTANCE, DWORD, LPVOID) \
{ \
return TRUE; \
} \
extern "C" DllExport void AnopeFini(x *); \
extern "C" void AnopeFini(x *m) \
{ \
delete m; \
} \
extern "C" DllExport ModuleVersionC AnopeVersion() \
{ \
ModuleVersionC ver; \
ver.version_major = VERSION_MAJOR; \
ver.version_minor = VERSION_MINOR; \
ver.version_patch = VERSION_PATCH; \
return ver; \
}
#else
# define MODULE_INIT(x) \
extern "C" DllExport Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \ extern "C" DllExport Module *AnopeInit(const Anope::string &modname, const Anope::string &creator) \
{ \ { \
return new x(modname, creator); \ return new x(modname, creator); \
@@ -41,6 +67,7 @@
ver.version_patch = VERSION_PATCH; \ ver.version_patch = VERSION_PATCH; \
return ver; \ return ver; \
} }
#endif
/** /**
* This #define allows us to call a method in all * This #define allows us to call a method in all
@@ -162,7 +189,7 @@ enum
}; };
typedef unsigned short ModType; typedef unsigned short ModType;
struct ModuleVersionC final struct ModuleVersionC
{ {
int version_major, version_minor, version_patch; int version_major, version_minor, version_patch;
}; };
@@ -170,14 +197,14 @@ struct ModuleVersionC final
/** Returned by Module::GetVersion, used to see what version of Anope /** Returned by Module::GetVersion, used to see what version of Anope
* a module is compiled against. * a module is compiled against.
*/ */
class ModuleVersion final class ModuleVersion
{ {
private: private:
int version_major; int version_major;
int version_minor; int version_minor;
int version_patch; int version_patch;
public: public:
ModuleVersion(const ModuleVersionC &); ModuleVersion(const ModuleVersionC &);
/** Get the major version of Anope this was built against /** Get the major version of Anope this was built against
@@ -196,19 +223,15 @@ public:
int GetPatch() const; int GetPatch() const;
}; };
class CoreExport NotImplementedException final class NotImplementedException : public CoreException { };
: public CoreException
{
};
/** Every module in Anope is actually a class. /** Every module in Anope is actually a class.
*/ */
class CoreExport Module class CoreExport Module : public Extensible
: public Extensible
{ {
private: private:
bool permanent; bool permanent;
public: public:
/** The module name (e.g. os_modload) /** The module name (e.g. os_modload)
*/ */
Anope::string name; Anope::string name;
@@ -299,7 +322,7 @@ public:
*/ */
virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); } virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); }
/** Called when the configuration is being (re)loaded. /** Called when Services' configuration is being (re)loaded.
* @param conf The config that is being built now and will replace the global Config object * @param conf The config that is being built now and will replace the global Config object
* @throws A ConfigException to abort the config (re)loading process. * @throws A ConfigException to abort the config (re)loading process.
*/ */
@@ -381,6 +404,7 @@ public:
/** Called when anope needs to check passwords against encryption /** Called when anope needs to check passwords against encryption
*/ */
virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); } virtual EventReturn OnEncrypt(const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); }
virtual EventReturn OnDecrypt(const Anope::string &hashm, const Anope::string &src, Anope::string &dest) { throw NotImplementedException(); }
/** Called on fantasy command /** Called on fantasy command
* @param source The source of the command * @param source The source of the command
@@ -1113,9 +1137,9 @@ enum Implementation
/** Used to manage modules. /** Used to manage modules.
*/ */
class CoreExport ModuleManager final class CoreExport ModuleManager
{ {
public: public:
/** Event handler hooks. /** Event handler hooks.
*/ */
static std::vector<Module *> EventHandlers[I_SIZE]; static std::vector<Module *> EventHandlers[I_SIZE];
@@ -1198,7 +1222,7 @@ public:
*/ */
static void UnloadAll(); static void UnloadAll();
private: private:
/** Call the module_delete function to safely delete the module /** Call the module_delete function to safely delete the module
* @param m the module to delete * @param m the module to delete
* @return MOD_ERR_OK on success, anything else on fail * @return MOD_ERR_OK on success, anything else on fail
@@ -1210,3 +1234,5 @@ private:
*/ */
static ModuleVersion GetVersion(void *handle); static ModuleVersion GetVersion(void *handle);
}; };
#endif // MODULES_H
+5 -7
View File
@@ -1,6 +1,6 @@
/* BotServ core functions /* BotServ core functions
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
/** Flags for badwords /** Flags for badwords
*/ */
enum BadWordType enum BadWordType
@@ -32,14 +30,14 @@ struct BadWord
Anope::string word; Anope::string word;
BadWordType type; BadWordType type;
virtual ~BadWord() = default; virtual ~BadWord() { }
protected: protected:
BadWord() = default; BadWord() { }
}; };
struct BadWords struct BadWords
{ {
virtual ~BadWords() = default; virtual ~BadWords() { }
/** Add a badword to the badword list /** Add a badword to the badword list
* @param word The badword * @param word The badword
+5 -7
View File
@@ -1,6 +1,6 @@
/* BotServ core functions /* BotServ core functions
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
/* Indices for TTB (Times To Ban) */ /* Indices for TTB (Times To Ban) */
enum enum
{ {
@@ -37,10 +35,10 @@ struct KickerData
bool dontkickops, dontkickvoices; bool dontkickops, dontkickvoices;
protected: protected:
KickerData() = default; KickerData() { }
public: public:
virtual ~KickerData() = default; virtual ~KickerData() { }
virtual void Check(ChannelInfo *ci) = 0; virtual void Check(ChannelInfo *ci) = 0;
}; };
+7 -10
View File
@@ -1,13 +1,11 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
struct EntryMsg struct EntryMsg
{ {
Anope::string chan; Anope::string chan;
@@ -15,18 +13,17 @@ struct EntryMsg
Anope::string message; Anope::string message;
time_t when; time_t when;
virtual ~EntryMsg() = default; virtual ~EntryMsg() { }
protected: protected:
EntryMsg() = default; EntryMsg() { }
}; };
struct EntryMessageList struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
: Serialize::Checker<std::vector<EntryMsg *> >
{ {
protected: protected:
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { } EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
public: public:
virtual ~EntryMessageList() virtual ~EntryMessageList()
{ {
for (unsigned i = (*this)->size(); i > 0; --i) for (unsigned i = (*this)->size(); i > 0; --i)
+8 -11
View File
@@ -1,6 +1,6 @@
/* ChanServ core functions /* ChanServ core functions
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
struct LogSetting struct LogSetting
{ {
Anope::string chan; Anope::string chan;
@@ -24,22 +22,21 @@ struct LogSetting
Anope::string creator; Anope::string creator;
time_t created; time_t created;
virtual ~LogSetting() = default; virtual ~LogSetting() { }
protected: protected:
LogSetting() = default; LogSetting() { }
}; };
struct LogSettings struct LogSettings : Serialize::Checker<std::vector<LogSetting *> >
: Serialize::Checker<std::vector<LogSetting *> >
{ {
typedef std::vector<LogSetting *>::iterator iterator; typedef std::vector<LogSetting *>::iterator iterator;
protected: protected:
LogSettings() : Serialize::Checker<std::vector<LogSetting *> >("LogSetting") LogSettings() : Serialize::Checker<std::vector<LogSetting *> >("LogSetting")
{ {
} }
public: public:
virtual ~LogSettings() = default; virtual ~LogSettings() { }
virtual LogSetting *Create() = 0; virtual LogSetting *Create() = 0;
}; };
+5 -7
View File
@@ -1,6 +1,6 @@
/* ChanServ core functions /* ChanServ core functions
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
struct ModeLock struct ModeLock
{ {
Anope::string ci; Anope::string ci;
@@ -20,16 +18,16 @@ struct ModeLock
Anope::string setter; Anope::string setter;
time_t created; time_t created;
virtual ~ModeLock() = default; virtual ~ModeLock() { }
protected: protected:
ModeLock() = default; ModeLock() { }
}; };
struct ModeLocks struct ModeLocks
{ {
typedef std::vector<ModeLock *> ModeList; typedef std::vector<ModeLock *> ModeList;
virtual ~ModeLocks() = default; virtual ~ModeLocks() { }
/** Check if a mode is mlocked /** Check if a mode is mlocked
* @param mode The mode * @param mode The mode
+22 -29
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef DNS_H
#define DNS_H
namespace DNS namespace DNS
{ {
@@ -72,14 +73,14 @@ namespace DNS
struct Question struct Question
{ {
Anope::string name; Anope::string name;
QueryType type = QUERY_NONE; QueryType type;
unsigned short qclass = 0; unsigned short qclass;
Question() = default; Question() : type(QUERY_NONE), qclass(0) { }
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { } 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; } inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
struct hash final struct hash
{ {
size_t operator()(const Question &q) const size_t operator()(const Question &q) const
{ {
@@ -88,15 +89,14 @@ namespace DNS
}; };
}; };
struct ResourceRecord final struct ResourceRecord : Question
: Question
{ {
unsigned int ttl = 0; unsigned int ttl;
Anope::string rdata; Anope::string rdata;
time_t created; time_t created;
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { } ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { } ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
}; };
struct Query struct Query
@@ -114,12 +114,11 @@ namespace DNS
/** DNS manager /** DNS manager
*/ */
class Manager class Manager : public Service
: public Service
{ {
public: public:
Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { } Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { }
virtual ~Manager() = default; virtual ~Manager() { }
virtual void Process(Request *req) = 0; virtual void Process(Request *req) = 0;
virtual void RemoveRequest(Request *req) = 0; virtual void RemoveRequest(Request *req) = 0;
@@ -133,27 +132,19 @@ namespace DNS
/** A DNS query. /** A DNS query.
*/ */
class Request class Request : public Timer, public Question
: public Timer
, public Question
{ {
Manager *manager; Manager *manager;
public: public:
/* Use result cache if available */ /* Use result cache if available */
bool use_cache; bool use_cache;
/* Request id */ /* Request id */
unsigned short id = 0; unsigned short id;
/* Creator of this request */ /* Creator of this request */
Module *creator; Module *creator;
Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
: Timer(0) use_cache(cache), id(0), creator(c) { }
, Question(addr, qt)
, manager(mgr)
, use_cache(cache)
, creator(c)
{
}
virtual ~Request() virtual ~Request()
{ {
@@ -173,7 +164,7 @@ namespace DNS
/** Used to time out the query, xalls OnError and lets the TimerManager /** Used to time out the query, xalls OnError and lets the TimerManager
* delete this request. * delete this request.
*/ */
void Tick() override void Tick(time_t) anope_override
{ {
Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name; Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name;
Query rr(*this); Query rr(*this);
@@ -183,3 +174,5 @@ namespace DNS
}; };
} // namespace DNS } // namespace DNS
#endif // DNS_H
+6 -9
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,6 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
namespace Encryption namespace Encryption
{ {
typedef std::pair<const unsigned char *, size_t> Hash; typedef std::pair<const unsigned char *, size_t> Hash;
@@ -18,19 +16,18 @@ namespace Encryption
class Context class Context
{ {
public: public:
virtual ~Context() = default; virtual ~Context() { }
virtual void Update(const unsigned char *data, size_t len) = 0; virtual void Update(const unsigned char *data, size_t len) = 0;
virtual void Finalize() = 0; virtual void Finalize() = 0;
virtual Hash GetFinalizedHash() = 0; virtual Hash GetFinalizedHash() = 0;
}; };
class Provider class Provider : public Service
: public Service
{ {
public: public:
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { } Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
virtual ~Provider() = default; virtual ~Provider() { }
virtual Context *CreateContext(IV * = NULL) = 0; virtual Context *CreateContext(IV * = NULL) = 0;
virtual IV GetDefaultIV() = 0; virtual IV GetDefaultIV() = 0;
+28 -30
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2012-2024 Anope Team * (C) 2012-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef ANOPE_HTTPD_H
#define ANOPE_HTTPD_H
enum HTTPError enum HTTPError
{ {
@@ -18,16 +19,15 @@ enum HTTPError
}; };
/* A message to someone */ /* A message to someone */
struct HTTPReply final struct HTTPReply
{ {
HTTPError error = HTTP_ERROR_OK; HTTPError error;
Anope::string content_type; Anope::string content_type;
std::map<Anope::string, Anope::string, ci::less> headers; std::map<Anope::string, Anope::string, ci::less> headers;
typedef std::list<std::pair<Anope::string, Anope::string> > cookie; typedef std::list<std::pair<Anope::string, Anope::string> > cookie;
std::vector<cookie> cookies; std::vector<cookie> cookies;
HTTPReply() = default; HTTPReply() : error(HTTP_ERROR_OK), length(0) { }
HTTPReply& operator=(const HTTPReply &) = default;
HTTPReply(const HTTPReply& other) : error(other.error), length(other.length) HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
{ {
@@ -35,18 +35,18 @@ struct HTTPReply final
headers = other.headers; headers = other.headers;
cookies = other.cookies; cookies = other.cookies;
for (const auto &datum : other.out) for (unsigned i = 0; i < other.out.size(); ++i)
out.push_back(new Data(datum->buf, datum->len)); out.push_back(new Data(other.out[i]->buf, other.out[i]->len));
} }
~HTTPReply() ~HTTPReply()
{ {
for (const auto *datum : out) for (unsigned i = 0; i < out.size(); ++i)
delete datum; delete out[i];
out.clear(); out.clear();
} }
struct Data final struct Data
{ {
char *buf; char *buf;
size_t len; size_t len;
@@ -65,7 +65,7 @@ struct HTTPReply final
}; };
std::deque<Data *> out; std::deque<Data *> out;
size_t length = 0; size_t length;
void Write(const Anope::string &message) void Write(const Anope::string &message)
{ {
@@ -81,7 +81,7 @@ struct HTTPReply final
}; };
/* A message from someone */ /* A message from someone */
struct HTTPMessage final struct HTTPMessage
{ {
std::map<Anope::string, Anope::string> headers; std::map<Anope::string, Anope::string> headers;
std::map<Anope::string, Anope::string> cookies; std::map<Anope::string, Anope::string> cookies;
@@ -93,13 +93,12 @@ struct HTTPMessage final
class HTTPClient; class HTTPClient;
class HTTPProvider; class HTTPProvider;
class HTTPPage class HTTPPage : public Base
: public virtual Base
{ {
Anope::string url; Anope::string url;
Anope::string content_type; Anope::string content_type;
public: public:
HTTPPage(const Anope::string &u, const Anope::string &ct = "text/html") : url(u), content_type(ct) { } HTTPPage(const Anope::string &u, const Anope::string &ct = "text/html") : url(u), content_type(ct) { }
const Anope::string &GetURL() const { return this->url; } const Anope::string &GetURL() const { return this->url; }
@@ -116,18 +115,15 @@ public:
virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0; virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
}; };
class HTTPClient class HTTPClient : public ClientSocket, public BinarySocket, public Base
: public ClientSocket
, public BinarySocket
, public Base
{ {
protected: protected:
void WriteClient(const Anope::string &message) void WriteClient(const Anope::string &message)
{ {
BinarySocket::Write(message + "\r\n"); BinarySocket::Write(message + "\r\n");
} }
public: public:
HTTPClient(ListenSocket *l, int f, const sockaddrs &a) : ClientSocket(l, a), BinarySocket() { } HTTPClient(ListenSocket *l, int f, const sockaddrs &a) : ClientSocket(l, a), BinarySocket() { }
virtual const Anope::string GetIP() virtual const Anope::string GetIP()
@@ -139,14 +135,12 @@ public:
virtual void SendReply(HTTPReply *) = 0; virtual void SendReply(HTTPReply *) = 0;
}; };
class HTTPProvider class HTTPProvider : public ListenSocket, public Service
: public ListenSocket
, public Service
{ {
Anope::string ip; Anope::string ip;
unsigned short port; unsigned short port;
bool ssl; bool ssl;
public: public:
std::vector<Anope::string> ext_ips; std::vector<Anope::string> ext_ips;
std::vector<Anope::string> ext_headers; std::vector<Anope::string> ext_headers;
@@ -202,8 +196,10 @@ namespace HTTPUtils
{ {
Anope::string encoded; Anope::string encoded;
for (const auto c : url) for (unsigned i = 0; i < url.length(); ++i)
{ {
const char& c = url[i];
if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_') if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_')
encoded += c; encoded += c;
else if (c == ' ') else if (c == ' ')
@@ -219,9 +215,9 @@ namespace HTTPUtils
{ {
Anope::string dst; Anope::string dst;
for (const auto c : src) for (unsigned i = 0; i < src.length(); ++i)
{ {
switch (c) switch (src[i])
{ {
case '<': case '<':
dst += "&lt;"; dst += "&lt;";
@@ -236,10 +232,12 @@ namespace HTTPUtils
dst += "&amp;"; dst += "&amp;";
break; break;
default: default:
dst += c; dst += src[i];
} }
} }
return dst; return dst;
} }
} }
#endif // ANOPE_HTTPD_H
+27 -16
View File
@@ -1,22 +1,23 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef ANOPE_LDAP_H
#define ANOPE_LDAP_H
class DllExport LDAPException : public ModuleException class LDAPException : public ModuleException
{ {
public: public:
LDAPException(const Anope::string &reason) : ModuleException(reason) { } LDAPException(const Anope::string &reason) : ModuleException(reason) { }
virtual ~LDAPException() noexcept = default; virtual ~LDAPException() throw() { }
}; };
struct LDAPModification final struct LDAPModification
{ {
enum LDAPOperation enum LDAPOperation
{ {
@@ -31,8 +32,7 @@ struct LDAPModification final
}; };
typedef std::vector<LDAPModification> LDAPMods; typedef std::vector<LDAPModification> LDAPMods;
struct LDAPAttributes final struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string> >
: public std::map<Anope::string, std::vector<Anope::string>>
{ {
size_t size(const Anope::string &attr) const size_t size(const Anope::string &attr) const
{ {
@@ -43,8 +43,8 @@ struct LDAPAttributes final
const std::vector<Anope::string> keys() const const std::vector<Anope::string> keys() const
{ {
std::vector<Anope::string> k; std::vector<Anope::string> k;
for (const auto &[key, _] : *this) for (const_iterator it = this->begin(), it_end = this->end(); it != it_end; ++it)
k.push_back(key); k.push_back(it->first);
return k; return k;
} }
@@ -75,7 +75,7 @@ enum QueryType
QUERY_MODIFY QUERY_MODIFY
}; };
struct LDAPResult final struct LDAPResult
{ {
std::vector<LDAPAttributes> messages; std::vector<LDAPAttributes> messages;
Anope::string error; Anope::string error;
@@ -112,21 +112,20 @@ struct LDAPResult final
class LDAPInterface class LDAPInterface
{ {
public: public:
Module *owner; Module *owner;
LDAPInterface(Module *m) : owner(m) { } LDAPInterface(Module *m) : owner(m) { }
virtual ~LDAPInterface() = default; virtual ~LDAPInterface() { }
virtual void OnResult(const LDAPResult &r) = 0; virtual void OnResult(const LDAPResult &r) = 0;
virtual void OnError(const LDAPResult &err) = 0; virtual void OnError(const LDAPResult &err) = 0;
virtual void OnDelete() { } virtual void OnDelete() { }
}; };
class LDAPProvider class LDAPProvider : public Service
: public Service
{ {
public: public:
LDAPProvider(Module *c, const Anope::string &n) : Service(c, "LDAPProvider", n) { } LDAPProvider(Module *c, const Anope::string &n) : Service(c, "LDAPProvider", n) { }
/** Attempt to bind to the LDAP server as an admin /** Attempt to bind to the LDAP server as an admin
@@ -167,4 +166,16 @@ public:
* @param attributes The attributes to modify * @param attributes The attributes to modify
*/ */
virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0; virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0;
/** Escapes a LDAP string for use in a DN.
* @param str The string to escape.
*/
virtual Anope::string EscapeDN(const Anope::string &str) const = 0;
/** Escapes a LDAP string for use in a search filter.
* @param str The string to escape.
*/
virtual Anope::string EscapeSF(const Anope::string &str) const = 0;
}; };
#endif // ANOPE_LDAP_H
+7 -10
View File
@@ -1,6 +1,6 @@
/* NickServ core functions /* NickServ core functions
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,14 +9,12 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
struct NSCertList struct NSCertList
{ {
protected: protected:
NSCertList() = default; NSCertList() { }
public: public:
virtual ~NSCertList() = default; virtual ~NSCertList() { }
/** Add an entry to the nick's certificate list /** Add an entry to the nick's certificate list
* *
@@ -63,10 +61,9 @@ public:
virtual void Check() = 0; virtual void Check() = 0;
}; };
class CertService class CertService : public Service
: public Service
{ {
public: public:
CertService(Module *c) : Service(c, "CertService", "certs") { } CertService(Module *c) : Service(c, "CertService", "certs") { }
virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0; virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
+12 -10
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef OS_FORBID_H
#define OS_FORBID_H
enum ForbidType enum ForbidType
{ {
@@ -22,19 +23,18 @@ struct ForbidData
Anope::string mask; Anope::string mask;
Anope::string creator; Anope::string creator;
Anope::string reason; Anope::string reason;
time_t created = 0; time_t created;
time_t expires = 0; time_t expires;
ForbidType type; ForbidType type;
virtual ~ForbidData() = default; virtual ~ForbidData() { }
protected: protected:
ForbidData() = default; ForbidData() : created(0), expires(0) { }
}; };
class ForbidService class ForbidService : public Service
: public Service
{ {
public: public:
ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { } ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { }
virtual void AddForbid(ForbidData *d) = 0; virtual void AddForbid(ForbidData *d) = 0;
@@ -51,3 +51,5 @@ public:
}; };
static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
#endif
+8 -11
View File
@@ -1,6 +1,6 @@
/* OperServ ignore interface /* OperServ ignore interface
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,27 +9,24 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
struct IgnoreData struct IgnoreData
{ {
Anope::string mask; Anope::string mask;
Anope::string creator; Anope::string creator;
Anope::string reason; Anope::string reason;
time_t time = 0; /* When do we stop ignoring them? */ time_t time; /* When do we stop ignoring them? */
virtual ~IgnoreData() = default; virtual ~IgnoreData() { }
protected: protected:
IgnoreData() = default; IgnoreData() : time(0) { }
}; };
class IgnoreService class IgnoreService : public Service
: public Service
{ {
protected: protected:
IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { } IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
public: public:
virtual void AddIgnore(IgnoreData *) = 0; virtual void AddIgnore(IgnoreData *) = 0;
virtual void DelIgnore(IgnoreData *) = 0; virtual void DelIgnore(IgnoreData *) = 0;
+9 -8
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef OS_NEWS
#define OS_NEWS
enum NewsType enum NewsType
{ {
@@ -15,15 +16,14 @@ enum NewsType
NEWS_OPER NEWS_OPER
}; };
struct NewsMessages final struct NewsMessages
{ {
NewsType type; NewsType type;
Anope::string name; Anope::string name;
const char *msgs[10]; const char *msgs[10];
}; };
struct NewsItem struct NewsItem : Serializable
: Serializable
{ {
NewsType type; NewsType type;
Anope::string text; Anope::string text;
@@ -33,10 +33,9 @@ struct NewsItem
NewsItem() : Serializable("NewsItem") { } NewsItem() : Serializable("NewsItem") { }
}; };
class NewsService class NewsService : public Service
: public Service
{ {
public: public:
NewsService(Module *m) : Service(m, "NewsService", "news") { } NewsService(Module *m) : Service(m, "NewsService", "news") { }
virtual NewsItem *CreateNewsItem() = 0; virtual NewsItem *CreateNewsItem() = 0;
@@ -49,3 +48,5 @@ public:
}; };
static ServiceReference<NewsService> news_service("NewsService", "news"); static ServiceReference<NewsService> news_service("NewsService", "news");
#endif // OS_NEWS
+14 -13
View File
@@ -1,24 +1,24 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef OS_SESSION_H
#define OS_SESSION_H
struct Session final struct Session
{ {
cidr addr; /* A cidr (sockaddrs + len) representing this session */ cidr addr; /* A cidr (sockaddrs + len) representing this session */
unsigned count = 1; /* Number of clients with this host */ unsigned count; /* Number of clients with this host */
unsigned hits = 0; /* Number of subsequent kills for a host */ unsigned hits; /* Number of subsequent kills for a host */
Session(const sockaddrs &ip, int len) : addr(ip, len) { } Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
}; };
struct Exception final struct Exception : Serializable
: Serializable
{ {
Anope::string mask; /* Hosts to which this exception applies */ Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */ unsigned limit; /* Session limit for exception */
@@ -28,15 +28,14 @@ struct Exception final
time_t expires; /* Time when it expires. 0 == no expiry */ time_t expires; /* Time when it expires. 0 == no expiry */
Exception() : Serializable("Exception") { } Exception() : Serializable("Exception") { }
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
}; };
class SessionService class SessionService : public Service
: public Service
{ {
public: public:
typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap; typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap;
typedef std::vector<Exception *> ExceptionVector; typedef std::vector<Exception *> ExceptionVector;
SessionService(Module *m) : Service(m, "SessionService", "session") { } SessionService(Module *m) : Service(m, "SessionService", "session") { }
@@ -91,3 +90,5 @@ Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
session_service->AddException(ex); session_service->AddException(ex);
return ex; return ex;
} }
#endif
+7 -5
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef CHANSERV_H
#define CHANSERV_H
class ChanServService class ChanServService : public Service
: public Service
{ {
public: public:
ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ") ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ")
{ {
} }
@@ -21,3 +21,5 @@ public:
*/ */
virtual void Hold(Channel *c) = 0; virtual void Hold(Channel *c) = 0;
}; };
#endif // CHANSERV_H
+7 -5
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef GLOBAL_H
#define GLOBAL_H
class GlobalService class GlobalService : public Service
: public Service
{ {
public: public:
GlobalService(Module *m) : Service(m, "GlobalService", "Global") GlobalService(Module *m) : Service(m, "GlobalService", "Global")
{ {
} }
@@ -26,3 +26,5 @@ public:
*/ */
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0; virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
}; };
#endif // GLOBAL_H
+7 -5
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef MEMOSERV_H
#define MEMOSERV_H
class MemoServService class MemoServService : public Service
: public Service
{ {
public: public:
enum MemoResult enum MemoResult
{ {
MEMO_SUCCESS, MEMO_SUCCESS,
@@ -37,3 +37,5 @@ public:
*/ */
virtual void Check(User *u) = 0; virtual void Check(User *u) = 0;
}; };
#endif // MEMOSERV_H
+7 -5
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2024 Anope Team * (C) 2011-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef NICKSERV_H
#define NICKSERV_H
class NickServService class NickServService : public Service
: public Service
{ {
public: public:
NickServService(Module *m) : Service(m, "NickServService", "NickServ") NickServService(Module *m) : Service(m, "NickServService", "NickServ")
{ {
} }
@@ -20,3 +20,5 @@ public:
virtual void Collide(User *u, NickAlias *na) = 0; virtual void Collide(User *u, NickAlias *na) = 0;
virtual void Release(NickAlias *na) = 0; virtual void Release(NickAlias *na) = 0;
}; };
#endif // NICKSERV_H
+8 -11
View File
@@ -1,16 +1,14 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace Redis namespace Redis
{ {
struct Reply final struct Reply
{ {
enum Type enum Type
{ {
@@ -32,8 +30,8 @@ namespace Redis
i = 0; i = 0;
bulk.clear(); bulk.clear();
multi_bulk_size = 0; multi_bulk_size = 0;
for (const auto *reply : multi_bulk) for (unsigned j = 0; j < multi_bulk.size(); ++j)
delete reply; delete multi_bulk[j];
multi_bulk.clear(); multi_bulk.clear();
} }
@@ -45,20 +43,19 @@ namespace Redis
class Interface class Interface
{ {
public: public:
Module *owner; Module *owner;
Interface(Module *m) : owner(m) { } Interface(Module *m) : owner(m) { }
virtual ~Interface() = default; virtual ~Interface() { }
virtual void OnResult(const Reply &r) = 0; virtual void OnResult(const Reply &r) = 0;
virtual void OnError(const Anope::string &error) { Log(owner) << error; } virtual void OnError(const Anope::string &error) { Log(owner) << error; }
}; };
class Provider class Provider : public Service
: public Service
{ {
public: public:
Provider(Module *c, const Anope::string &n) : Service(c, "Redis::Provider", n) { } Provider(Module *c, const Anope::string &n) : Service(c, "Redis::Provider", n) { }
virtual bool IsSocketDead() = 0; virtual bool IsSocketDead() = 0;
+10 -15
View File
@@ -1,16 +1,14 @@
/* /*
* *
* (C) 2014-2024 Anope Team * (C) 2014-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SASL namespace SASL
{ {
struct Message final struct Message
{ {
Anope::string source; Anope::string source;
Anope::string target; Anope::string target;
@@ -22,10 +20,9 @@ namespace SASL
class Mechanism; class Mechanism;
struct Session; struct Session;
class Service class Service : public ::Service
: public ::Service
{ {
public: public:
Service(Module *o) : ::Service(o, "SASL::Service", "sasl") { } Service(Module *o) : ::Service(o, "SASL::Service", "sasl") { }
virtual void ProcessMessage(const Message &) = 0; virtual void ProcessMessage(const Message &) = 0;
@@ -61,10 +58,9 @@ namespace SASL
}; };
/* PLAIN, EXTERNAL, etc */ /* PLAIN, EXTERNAL, etc */
class Mechanism class Mechanism : public ::Service
: public ::Service
{ {
public: public:
Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { } Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { }
virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); } virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); }
@@ -78,16 +74,15 @@ namespace SASL
} }
}; };
class IdentifyRequest class IdentifyRequest : public ::IdentifyRequest
: public ::IdentifyRequest
{ {
Anope::string uid; Anope::string uid;
Anope::string hostname, ip; 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) { } 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 void OnSuccess() anope_override
{ {
if (!sasl) if (!sasl)
return; return;
@@ -113,7 +108,7 @@ namespace SASL
} }
} }
void OnFail() override void OnFail() anope_override
{ {
if (!sasl) if (!sasl)
return; return;
+3 -6
View File
@@ -1,20 +1,17 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
struct MiscData struct MiscData
{ {
Anope::string object; Anope::string object;
Anope::string name; Anope::string name;
Anope::string data; Anope::string data;
virtual ~MiscData() = default; MiscData() { }
protected: virtual ~MiscData() { }
MiscData() = default;
}; };
+30 -36
View File
@@ -1,20 +1,17 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SQL namespace SQL
{ {
class Data final class Data : public Serialize::Data
: public Serialize::Data
{ {
public: public:
typedef std::map<Anope::string, std::stringstream *> Map; typedef std::map<Anope::string, std::stringstream *> Map;
Map data; Map data;
std::map<Anope::string, Type> types; std::map<Anope::string, Type> types;
@@ -24,7 +21,7 @@ namespace SQL
Clear(); Clear();
} }
std::iostream& operator[](const Anope::string &key) override std::iostream& operator[](const Anope::string &key) anope_override
{ {
std::stringstream *&ss = data[key]; std::stringstream *&ss = data[key];
if (!ss) if (!ss)
@@ -32,46 +29,44 @@ namespace SQL
return *ss; return *ss;
} }
std::set<Anope::string> KeySet() const override std::set<Anope::string> KeySet() const anope_override
{ {
std::set<Anope::string> keys; std::set<Anope::string> keys;
for (const auto &[key, _] : this->data) for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
keys.insert(key); keys.insert(it->first);
return keys; return keys;
} }
size_t Hash() const override size_t Hash() const anope_override
{ {
size_t hash = 0; size_t hash = 0;
for (const auto &[_, value] : this->data) for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
{ if (!it->second->str().empty())
if (!value->str().empty()) hash ^= Anope::hash_cs()(it->second->str());
hash ^= Anope::hash_cs()(value->str());
}
return hash; return hash;
} }
std::map<Anope::string, std::iostream *> GetData() const std::map<Anope::string, std::iostream *> GetData() const
{ {
std::map<Anope::string, std::iostream *> d; std::map<Anope::string, std::iostream *> d;
for (const auto &[key, value] : this->data) for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
d[key] = value; d[it->first] = it->second;
return d; return d;
} }
void Clear() void Clear()
{ {
for (const auto &[_, value] : this->data) for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
delete value; delete it->second;
this->data.clear(); this->data.clear();
} }
void SetType(const Anope::string &key, Type t) override void SetType(const Anope::string &key, Type t) anope_override
{ {
this->types[key] = t; this->types[key] = t;
} }
Type GetType(const Anope::string &key) const override Type GetType(const Anope::string &key) const anope_override
{ {
std::map<Anope::string, Type>::const_iterator it = this->types.find(key); std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
if (it != this->types.end()) if (it != this->types.end())
@@ -82,24 +77,24 @@ namespace SQL
/** A SQL exception, can be thrown at various points /** A SQL exception, can be thrown at various points
*/ */
class DllExport Exception : public ModuleException class Exception : public ModuleException
{ {
public: public:
Exception(const Anope::string &reason) : ModuleException(reason) { } Exception(const Anope::string &reason) : ModuleException(reason) { }
virtual ~Exception() noexcept = default; virtual ~Exception() throw() { }
}; };
/** A SQL query /** A SQL query
*/ */
struct QueryData final struct QueryData
{ {
Anope::string data; Anope::string data;
bool escape; bool escape;
}; };
struct Query final struct Query
{ {
Anope::string query; Anope::string query;
std::map<Anope::string, QueryData> parameters; std::map<Anope::string, QueryData> parameters;
@@ -140,16 +135,16 @@ namespace SQL
*/ */
class Result class Result
{ {
protected: protected:
/* Rows, column, item */ /* Rows, column, item */
std::vector<std::map<Anope::string, Anope::string> > entries; std::vector<std::map<Anope::string, Anope::string> > entries;
Query query; Query query;
Anope::string error; Anope::string error;
public: public:
unsigned int id = 0; unsigned int id;
Anope::string finished_query; Anope::string finished_query;
Result() = default; Result() : id(0) { }
Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { } Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { }
inline operator bool() const { return this->error.empty(); } inline operator bool() const { return this->error.empty(); }
@@ -188,11 +183,11 @@ namespace SQL
*/ */
class Interface class Interface
{ {
public: public:
Module *owner; Module *owner;
Interface(Module *m) : owner(m) { } Interface(Module *m) : owner(m) { }
virtual ~Interface() = default; virtual ~Interface() { }
virtual void OnResult(const Result &r) = 0; virtual void OnResult(const Result &r) = 0;
virtual void OnError(const Result &r) = 0; virtual void OnError(const Result &r) = 0;
@@ -200,10 +195,9 @@ namespace SQL
/** Class providing the SQL service, modules call this to execute queries /** Class providing the SQL service, modules call this to execute queries
*/ */
class Provider class Provider : public Service
: public Service
{ {
public: public:
Provider(Module *c, const Anope::string &n) : Service(c, "SQL::Provider", n) { } Provider(Module *c, const Anope::string &n) : Service(c, "SQL::Provider", n) { }
virtual void Run(Interface *i, const Query &query) = 0; virtual void Run(Interface *i, const Query &query) = 0;
+3 -6
View File
@@ -1,17 +1,14 @@
/* /*
* *
* (C) 2010-2024 Anope Team * (C) 2010-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once class SSLService : public Service
class SSLService
: public Service
{ {
public: public:
SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { } SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
virtual void Init(Socket *s) = 0; virtual void Init(Socket *s) = 0;
+3 -5
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,13 +9,11 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once
struct SuspendInfo struct SuspendInfo
{ {
Anope::string what, by, reason; Anope::string what, by, reason;
time_t when, expires; time_t when, expires;
SuspendInfo() = default; SuspendInfo() { }
virtual ~SuspendInfo() = default; virtual ~SuspendInfo() { }
}; };
+8 -11
View File
@@ -1,27 +1,25 @@
/* /*
* *
* (C) 2010-2024 Anope Team * (C) 2010-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
#include "httpd.h" #include "httpd.h"
class XMLRPCRequest final class XMLRPCRequest
{ {
std::map<Anope::string, Anope::string> replies; std::map<Anope::string, Anope::string> replies;
public: public:
Anope::string name; Anope::string name;
Anope::string id; Anope::string id;
std::deque<Anope::string> data; std::deque<Anope::string> data;
HTTPReply& r; HTTPReply& r;
XMLRPCRequest(HTTPReply &_r) : r(_r) { } XMLRPCRequest(HTTPReply &_r) : r(_r) { }
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); } inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.insert(std::make_pair(dname, ddata)); }
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; } inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
}; };
@@ -29,15 +27,14 @@ class XMLRPCServiceInterface;
class XMLRPCEvent class XMLRPCEvent
{ {
public: public:
virtual ~XMLRPCEvent() = default; virtual ~XMLRPCEvent() { }
virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0; virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
}; };
class XMLRPCServiceInterface class XMLRPCServiceInterface : public Service
: public Service
{ {
public: public:
XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { } XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }
virtual void Register(XMLRPCEvent *event) = 0; virtual void Register(XMLRPCEvent *event) = 0;
+9 -6
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org> * (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2008-2024 Anope Team <team@anope.org> * (C) 2008-2026 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef OPERTYPE_H
#define OPERTYPE_H
#include "services.h" #include "services.h"
#include "account.h" #include "account.h"
@@ -21,7 +22,7 @@ struct CoreExport Oper
/* The type of operator this operator is */ /* The type of operator this operator is */
OperType *ot; OperType *ot;
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */ /* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
bool require_oper = true; bool require_oper;
Anope::string password; Anope::string password;
Anope::string certfp; Anope::string certfp;
/* Hosts allowed to use this operator block */ /* Hosts allowed to use this operator block */
@@ -40,9 +41,9 @@ struct CoreExport Oper
static Oper *Find(const Anope::string &name); static Oper *Find(const Anope::string &name);
}; };
class CoreExport OperType final class CoreExport OperType
{ {
private: private:
/** The name of this opertype, e.g. "sra". /** The name of this opertype, e.g. "sra".
*/ */
Anope::string name; Anope::string name;
@@ -65,7 +66,7 @@ private:
/** Set of opertypes we inherit from /** Set of opertypes we inherit from
*/ */
std::set<OperType *> inheritances; std::set<OperType *> inheritances;
public: public:
/** Modes to set when someone identifies using this opertype /** Modes to set when someone identifies using this opertype
*/ */
Anope::string modes; Anope::string modes;
@@ -122,3 +123,5 @@ public:
*/ */
const std::list<Anope::string> GetPrivs() const; const std::list<Anope::string> GetPrivs() const;
}; };
#endif // OPERTYPE_H
+38 -34
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef PROTOCOL_H
#define PROTOCOL_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -17,14 +18,13 @@
#include "modes.h" #include "modes.h"
/* Encapsulates the IRCd protocol we are speaking. */ /* Encapsulates the IRCd protocol we are speaking. */
class CoreExport IRCDProto class CoreExport IRCDProto : public Service
: public Service
{ {
Anope::string proto_name; Anope::string proto_name;
protected: protected:
IRCDProto(Module *creator, const Anope::string &proto_name); IRCDProto(Module *creator, const Anope::string &proto_name);
public: public:
virtual ~IRCDProto(); virtual ~IRCDProto();
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &); virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &);
@@ -61,12 +61,10 @@ public:
bool CanSZLine; bool CanSZLine;
/* Can we place temporary holds on specific nicknames? */ /* Can we place temporary holds on specific nicknames? */
bool CanSVSHold; bool CanSVSHold;
/* See os_oline */
bool CanSVSO;
/* See ns_cert */ /* See ns_cert */
bool CanCertFP; bool CanCertFP;
/* Can we send arbitrary message tags? */
bool CanSendTags;
/* Can users log out before being fully connected? */
bool CanSVSLogout;
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */ /* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
bool RequiresID; bool RequiresID;
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */ /* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
@@ -129,27 +127,27 @@ public:
* @param user The user to be killed * @param user The user to be killed
* @param fmt Kill reason * @param fmt Kill reason
*/ */
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...) ATTR_FORMAT(4, 5); virtual void SendSVSKill(const MessageSource &source, User *user, 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, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...) ATTR_FORMAT(4, 5); virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...);
/** Introduces a client to the rest of the network /** Introduces a client to the rest of the network
* @param u The client to introduce * @param u The client to introduce
*/ */
virtual void SendClientIntroduction(User *u) = 0; virtual void SendClientIntroduction(User *u) = 0;
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...) ATTR_FORMAT(5, 6); virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...);
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5); 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, ...) ATTR_FORMAT(4, 5); 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, ...) ATTR_FORMAT(4, 5); 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, ...) ATTR_FORMAT(4, 5); virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...);
virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0; 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 SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendQuit(User *u, const char *fmt, ...) ATTR_FORMAT(3, 4); virtual void SendQuit(User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who); virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who); virtual void SendPong(const Anope::string &servname, const Anope::string &who);
@@ -161,7 +159,7 @@ public:
* stacker to be set "soon". * stacker to be set "soon".
*/ */
virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0; virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0;
virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...) ATTR_FORMAT(4, 5); virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...);
/** Force joins a user that isn't ours to a channel. /** Force joins a user that isn't ours to a channel.
* @param bi The source of the message * @param bi The source of the message
@@ -180,7 +178,11 @@ public:
virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { } 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 SendInvite(const MessageSource &source, const Channel *c, User *u);
virtual void SendGlobops(const MessageSource &source, const char *fmt, ...) ATTR_FORMAT(3, 4); virtual void SendGlobops(const MessageSource &source, const char *fmt, ...);
/** Sets oper flags on a user, currently only supported by Unreal
*/
virtual void SendSVSO(BotInfo *, const Anope::string &, const Anope::string &) { }
/** Sends a nick change of one of our clients. /** Sends a nick change of one of our clients.
*/ */
@@ -211,7 +213,7 @@ public:
virtual void SendServer(const Server *) = 0; virtual void SendServer(const Server *) = 0;
virtual void SendSquit(Server *, const Anope::string &message); virtual void SendSquit(Server *, const Anope::string &message);
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5); virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...);
virtual void SendLogin(User *u, NickAlias *na) = 0; virtual void SendLogin(User *u, NickAlias *na) = 0;
virtual void SendLogout(User *u) = 0; virtual void SendLogout(User *u) = 0;
@@ -228,7 +230,7 @@ public:
virtual void SendSASLMechanisms(std::vector<Anope::string> &) { } virtual void SendSASLMechanisms(std::vector<Anope::string> &) { }
virtual void SendSASLMessage(const SASL::Message &) { } virtual void SendSASLMessage(const SASL::Message &) { }
virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { } virtual void SendSVSLogin(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) { }
virtual bool IsNickValid(const Anope::string &); virtual bool IsNickValid(const Anope::string &);
virtual bool IsChannelValid(const Anope::string &); virtual bool IsChannelValid(const Anope::string &);
@@ -245,13 +247,13 @@ public:
virtual Anope::string NormalizeMask(const Anope::string &mask); virtual Anope::string NormalizeMask(const Anope::string &mask);
}; };
class CoreExport MessageSource final class CoreExport MessageSource
{ {
Anope::string source; Anope::string source;
User *u = nullptr; User *u;
Server *s = nullptr; Server *s;
public: public:
MessageSource(const Anope::string &); MessageSource(const Anope::string &);
MessageSource(User *u); MessageSource(User *u);
MessageSource(Server *s); MessageSource(Server *s);
@@ -269,32 +271,32 @@ enum IRCDMessageFlag
IRCDMESSAGE_REQUIRE_USER IRCDMESSAGE_REQUIRE_USER
}; };
class CoreExport IRCDMessage class CoreExport IRCDMessage : public Service
: public Service
{ {
Anope::string name; Anope::string name;
unsigned param_count; unsigned param_count;
std::set<IRCDMessageFlag> flags; std::set<IRCDMessageFlag> flags;
public: public:
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0); IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
unsigned GetParamCount() const; unsigned GetParamCount() const;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) = 0; virtual void Run(MessageSource &, const std::vector<Anope::string> &params) = 0;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags);
void SetFlag(IRCDMessageFlag f) { flags.insert(f); } void SetFlag(IRCDMessageFlag f) { flags.insert(f); }
bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); } bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); }
}; };
/** MessageTokenizer allows tokens in the IRC wire format to be read from a string */ /** MessageTokenizer allows tokens in the IRC wire format to be read from a string */
class CoreExport MessageTokenizer final class CoreExport MessageTokenizer
{ {
private: private:
/** The message we are parsing tokens from. */ /** The message we are parsing tokens from. */
Anope::string message; Anope::string message;
/** The current position within the message. */ /** The current position within the message. */
Anope::string::size_type position = 0; Anope::string::size_type position;
public: public:
/** Create a tokenstream and fill it with the provided data. */ /** Create a tokenstream and fill it with the provided data. */
MessageTokenizer(const Anope::string &msg); MessageTokenizer(const Anope::string &msg);
@@ -312,3 +314,5 @@ public:
}; };
extern CoreExport IRCDProto *IRCD; extern CoreExport IRCDProto *IRCD;
#endif // PROTOCOL_H
+800
View File
@@ -0,0 +1,800 @@
/* A portable stdint.h
****************************************************************************
* BSD License:
****************************************************************************
*
* Copyright (c) 2005-2011 Paul Hsieh
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************
*
* Version 0.1.12
*
* The ANSI C standard committee, for the C99 standard, specified the
* inclusion of a new standard include file called stdint.h. This is
* a very useful and long desired include file which contains several
* very precise definitions for integer scalar types that is
* critically important for making portable several classes of
* applications including cryptography, hashing, variable length
* integer libraries and so on. But for most developers its likely
* useful just for programming sanity.
*
* The problem is that most compiler vendors have decided not to
* implement the C99 standard, and the next C++ language standard
* (which has a lot more mindshare these days) will be a long time in
* coming and its unknown whether or not it will include stdint.h or
* how much adoption it will have. Either way, it will be a long time
* before all compilers come with a stdint.h and it also does nothing
* for the extremely large number of compilers available today which
* do not include this file, or anything comparable to it.
*
* So that's what this file is all about. Its an attempt to build a
* single universal include file that works on as many platforms as
* possible to deliver what stdint.h is supposed to. A few things
* that should be noted about this file:
*
* 1) It is not guaranteed to be portable and/or present an identical
* interface on all platforms. The extreme variability of the
* ANSI C standard makes this an impossibility right from the
* very get go. Its really only meant to be useful for the vast
* majority of platforms that possess the capability of
* implementing usefully and precisely defined, standard sized
* integer scalars. Systems which are not intrinsically 2s
* complement may produce invalid constants.
*
* 2) There is an unavoidable use of non-reserved symbols.
*
* 3) Other standard include files are invoked.
*
* 4) This file may come in conflict with future platforms that do
* include stdint.h. The hope is that one or the other can be
* used with no real difference.
*
* 5) In the current version, if your platform can't represent
* int32_t, int16_t and int8_t, it just dumps out with a compiler
* error.
*
* 6) 64 bit integers may or may not be defined. Test for their
* presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
* Note that this is different from the C99 specification which
* requires the existence of 64 bit support in the compiler. If
* this is not defined for your platform, yet it is capable of
* dealing with 64 bits then it is because this file has not yet
* been extended to cover all of your system's capabilities.
*
* 7) (u)intptr_t may or may not be defined. Test for its presence
* with the test: #ifdef PTRDIFF_MAX. If this is not defined
* for your platform, then it is because this file has not yet
* been extended to cover all of your system's capabilities, not
* because its optional.
*
* 8) The following might not been defined even if your platform is
* capable of defining it:
*
* WCHAR_MIN
* WCHAR_MAX
* (u)int64_t
* PTRDIFF_MIN
* PTRDIFF_MAX
* (u)intptr_t
*
* 9) The following have not been defined:
*
* WINT_MIN
* WINT_MAX
*
* 10) The criteria for defining (u)int_least(*)_t isn't clear,
* except for systems which don't have a type that precisely
* defined 8, 16, or 32 bit types (which this include file does
* not support anyways). Default definitions have been given.
*
* 11) The criteria for defining (u)int_fast(*)_t isn't something I
* would trust to any particular compiler vendor or the ANSI C
* committee. It is well known that "compatible systems" are
* commonly created that have very different performance
* characteristics from the systems they are compatible with,
* especially those whose vendors make both the compiler and the
* system. Default definitions have been given, but its strongly
* recommended that users never use these definitions for any
* reason (they do *NOT* deliver any serious guarantee of
* improved performance -- not in this file, nor any vendor's
* stdint.h).
*
* 12) The following macros:
*
* PRINTF_INTMAX_MODIFIER
* PRINTF_INT64_MODIFIER
* PRINTF_INT32_MODIFIER
* PRINTF_INT16_MODIFIER
* PRINTF_LEAST64_MODIFIER
* PRINTF_LEAST32_MODIFIER
* PRINTF_LEAST16_MODIFIER
* PRINTF_INTPTR_MODIFIER
*
* are strings which have been defined as the modifiers required
* for the "d", "u" and "x" printf formats to correctly output
* (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
* (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
* PRINTF_INTPTR_MODIFIER is not defined for some systems which
* provide their own stdint.h. PRINTF_INT64_MODIFIER is not
* defined if INT64_MAX is not defined. These are an extension
* beyond what C99 specifies must be in stdint.h.
*
* In addition, the following macros are defined:
*
* PRINTF_INTMAX_HEX_WIDTH
* PRINTF_INT64_HEX_WIDTH
* PRINTF_INT32_HEX_WIDTH
* PRINTF_INT16_HEX_WIDTH
* PRINTF_INT8_HEX_WIDTH
* PRINTF_INTMAX_DEC_WIDTH
* PRINTF_INT64_DEC_WIDTH
* PRINTF_INT32_DEC_WIDTH
* PRINTF_INT16_DEC_WIDTH
* PRINTF_INT8_DEC_WIDTH
*
* Which specifies the maximum number of characters required to
* print the number of that type in either hexadecimal or decimal.
* These are an extension beyond what C99 specifies must be in
* stdint.h.
*
* Compilers tested (all with 0 warnings at their highest respective
* settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
* bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
* .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
*
* This file should be considered a work in progress. Suggestions for
* improvements, especially those which increase coverage are strongly
* encouraged.
*
* Acknowledgements
*
* The following people have made significant contributions to the
* development and testing of this file:
*
* Chris Howie
* John Steele Scott
* Dave Thorup
* John Dill
*
*/
#include <stddef.h>
#include <limits.h>
#include <signal.h>
/*
* For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
*/
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#include <stdint.h>
#define _PSTDINT_H_INCLUDED
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
# endif
# ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
/*
* Something really weird is going on with Open Watcom. Just pull some of
* these duplicated definitions from Open Watcom's stdint.h file for now.
*/
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
# if !defined (INT64_C)
# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
# endif
# if !defined (UINT64_C)
# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
# endif
# if !defined (INT32_C)
# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
# endif
# if !defined (UINT32_C)
# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
# endif
# if !defined (INT16_C)
# define INT16_C(x) (x)
# endif
# if !defined (UINT16_C)
# define UINT16_C(x) (x)
# endif
# if !defined (INT8_C)
# define INT8_C(x) (x)
# endif
# if !defined (UINT8_C)
# define UINT8_C(x) (x)
# endif
# if !defined (UINT64_MAX)
# define UINT64_MAX 18446744073709551615ULL
# endif
# if !defined (INT64_MAX)
# define INT64_MAX 9223372036854775807LL
# endif
# if !defined (UINT32_MAX)
# define UINT32_MAX 4294967295UL
# endif
# if !defined (INT32_MAX)
# define INT32_MAX 2147483647L
# endif
# if !defined (INTMAX_MAX)
# define INTMAX_MAX INT64_MAX
# endif
# if !defined (INTMAX_MIN)
# define INTMAX_MIN INT64_MIN
# endif
# endif
#endif
#ifndef _PSTDINT_H_INCLUDED
#define _PSTDINT_H_INCLUDED
#ifndef SIZE_MAX
# define SIZE_MAX (~(size_t)0)
#endif
/*
* Deduce the type assignments from limits.h under the assumption that
* integer sizes in bits are powers of 2, and follow the ANSI
* definitions.
*/
#ifndef UINT8_MAX
# define UINT8_MAX 0xff
#endif
#ifndef uint8_t
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
typedef unsigned char uint8_t;
# define UINT8_C(v) ((uint8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#ifndef int8_t
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef UINT16_MAX
# define UINT16_MAX 0xffff
#endif
#ifndef uint16_t
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
typedef unsigned int uint16_t;
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
# define UINT16_C(v) ((uint16_t) (v))
#elif (USHRT_MAX == UINT16_MAX)
typedef unsigned short uint16_t;
# define UINT16_C(v) ((uint16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#ifndef int16_t
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffUL)
#endif
#ifndef uint32_t
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
typedef unsigned long uint32_t;
# define UINT32_C(v) v ## UL
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (UINT_MAX == UINT32_MAX)
typedef unsigned int uint32_t;
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# define UINT32_C(v) v ## U
#elif (USHRT_MAX == UINT32_MAX)
typedef unsigned short uint32_t;
# define UINT32_C(v) ((unsigned short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#ifndef int32_t
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
* defined for any 64 integer extensions for new platforms that are
* added.
*/
#undef stdint_int64_defined
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# endif
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__)
# define stdint_int64_defined
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# define UINT64_C(v) v ## UI64
# define INT64_C(v) v ## I64
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "I64"
# endif
# endif
#endif
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
# define LONG_LONG_MAX INT64_C (9223372036854775807)
#endif
#ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
#endif
#if !defined (INT64_MAX) && defined (INT64_C)
# define INT64_MAX INT64_C (9223372036854775807)
#endif
#if !defined (INT64_MIN) && defined (INT64_C)
# define INT64_MIN INT64_C (-9223372036854775808)
#endif
#if !defined (UINT64_MAX) && defined (INT64_C)
# define UINT64_MAX UINT64_C (18446744073709551615)
#endif
/*
* Width of hexadecimal for number field.
*/
#ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
#endif
#ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
#endif
#ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
#endif
#ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
#endif
#ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
#endif
#ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
#endif
/*
* Ok, lets not worry about 128 bit integers for now. Moore's law says
* we don't need to worry about that until about 2040 at which point
* we'll have bigger things to worry about.
*/
#ifdef stdint_int64_defined
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# define INTMAX_MAX INT64_MAX
# define INTMAX_MIN INT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define UINTMAX_C(v) UINT64_C(v)
# define INTMAX_C(v) INT64_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
#else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MAX UINT32_MAX
# define UINTMAX_C(v) UINT32_C(v)
# define INTMAX_C(v) INT32_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
# endif
#endif
/*
* Because this file currently only supports platforms which have
* precise powers of 2 as bit sizes for the default integers, the
* least definitions are all trivial. Its possible that a future
* version of this file could have different definitions.
*/
#ifndef stdint_least_defined
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
# define UINT_LEAST8_MAX UINT8_MAX
# define INT_LEAST8_MAX INT8_MAX
# define UINT_LEAST16_MAX UINT16_MAX
# define INT_LEAST16_MAX INT16_MAX
# define UINT_LEAST32_MAX UINT32_MAX
# define INT_LEAST32_MAX INT32_MAX
# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST32_MIN INT32_MIN
# ifdef stdint_int64_defined
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
# define UINT_LEAST64_MAX UINT64_MAX
# define INT_LEAST64_MAX INT64_MAX
# define INT_LEAST64_MIN INT64_MIN
# endif
#endif
#undef stdint_least_defined
/*
* The ANSI C committee pretending to know or specify anything about
* performance is the epitome of misguided arrogance. The mandate of
* this file is to *ONLY* ever support that absolute minimum
* definition of the fast integer types, for compatibility purposes.
* No extensions, and no attempt to suggest what may or may not be a
* faster integer type will ever be made in this file. Developers are
* warned to stay away from these types when using this or any other
* stdint.h.
*/
typedef int_least8_t int_fast8_t;
typedef uint_least8_t uint_fast8_t;
typedef int_least16_t int_fast16_t;
typedef uint_least16_t uint_fast16_t;
typedef int_least32_t int_fast32_t;
typedef uint_least32_t uint_fast32_t;
#define UINT_FAST8_MAX UINT_LEAST8_MAX
#define INT_FAST8_MAX INT_LEAST8_MAX
#define UINT_FAST16_MAX UINT_LEAST16_MAX
#define INT_FAST16_MAX INT_LEAST16_MAX
#define UINT_FAST32_MAX UINT_LEAST32_MAX
#define INT_FAST32_MAX INT_LEAST32_MAX
#define INT_FAST8_MIN INT_LEAST8_MIN
#define INT_FAST16_MIN INT_LEAST16_MIN
#define INT_FAST32_MIN INT_LEAST32_MIN
#ifdef stdint_int64_defined
typedef int_least64_t int_fast64_t;
typedef uint_least64_t uint_fast64_t;
# define UINT_FAST64_MAX UINT_LEAST64_MAX
# define INT_FAST64_MAX INT_LEAST64_MAX
# define INT_FAST64_MIN INT_LEAST64_MIN
#endif
#undef stdint_int64_defined
/*
* Whatever piecemeal, per compiler thing we can do about the wchar_t
* type limits.
*/
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
# include <wchar.h>
# ifndef WCHAR_MIN
# define WCHAR_MIN 0
# endif
# ifndef WCHAR_MAX
# define WCHAR_MAX ((wchar_t)-1)
# endif
#endif
/*
* Whatever piecemeal, per compiler/platform thing we can do about the
* (u)intptr_t types and limits.
*/
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
# define STDINT_H_UINTPTR_T_DEFINED
#endif
#ifndef STDINT_H_UINTPTR_T_DEFINED
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
# define stdint_intptr_bits 64
# elif defined (__WATCOMC__) || defined (__TURBOC__)
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
# define stdint_intptr_bits 16
# else
# define stdint_intptr_bits 32
# endif
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
# define stdint_intptr_bits 32
# elif defined (__INTEL_COMPILER)
/* TODO -- what did Intel do about x86-64? */
# endif
# ifdef stdint_intptr_bits
# define stdint_intptr_glue3_i(a,b,c) a##b##c
# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
# ifndef PRINTF_INTPTR_MODIFIER
# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
# endif
# ifndef PTRDIFF_MAX
# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef PTRDIFF_MIN
# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef UINTPTR_MAX
# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MAX
# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MIN
# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef INTPTR_C
# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
# endif
# ifndef UINTPTR_C
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
# endif
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# else
/* TODO -- This following is likely wrong for some platforms, and does
nothing for the definition of uintptr_t. */
typedef ptrdiff_t intptr_t;
# endif
# define STDINT_H_UINTPTR_T_DEFINED
#endif
/*
* Assumes sig_atomic_t is signed and we have a 2s complement machine.
*/
#ifndef SIG_ATOMIC_MAX
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
#endif
#endif
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
/*
* Please compile with the maximum warning settings to make sure macros are not
* defined more than once.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define glue3_aux(x,y,z) x ## y ## z
#define glue3(x,y,z) glue3_aux(x,y,z)
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
#define DECL(us,bits) glue3(DECL,us,) (bits)
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
int main () {
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
#ifdef INT64_MAX
DECL(I,64)
DECL(U,64)
#endif
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
#ifdef INT64_MAX
TESTUMAX(64);
#endif
return EXIT_SUCCESS;
}
#endif
+12 -13
View File
@@ -1,12 +1,13 @@
/* /*
* *
* (C) 2008-2024 Anope Team * (C) 2008-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once #ifndef REGCHANNEL_H
#define REGCHANNEL_H
#include "memo.h" #include "memo.h"
#include "modes.h" #include "modes.h"
@@ -21,10 +22,9 @@ typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList; extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
/* AutoKick data. */ /* AutoKick data. */
class CoreExport AutoKick final class CoreExport AutoKick : public Serializable
: public Serializable
{ {
public: public:
/* Channel this autokick is on */ /* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci; Serialize::Reference<ChannelInfo> ci;
@@ -38,26 +38,24 @@ public:
AutoKick(); AutoKick();
~AutoKick(); ~AutoKick();
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
}; };
/* It matters that Base is here before Extensible (it is inherited by Serializable) /* It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport ChannelInfo final class CoreExport ChannelInfo : public Serializable, public Extensible
: public Serializable
, public Extensible
{ {
/* channels who reference this one */ /* channels who reference this one */
Anope::map<int> references; Anope::map<int> references;
private: private:
Serialize::Reference<NickCore> founder; /* Channel founder */ Serialize::Reference<NickCore> founder; /* Channel founder */
Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */ 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<ChanAccess *> > access; /* List of authorized users */
Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */ Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
Anope::map<int16_t> levels; Anope::map<int16_t> levels;
public: public:
friend class ChanAccess; friend class ChanAccess;
friend class AutoKick; friend class AutoKick;
@@ -95,9 +93,8 @@ public:
ChannelInfo(const ChannelInfo &ci); ChannelInfo(const ChannelInfo &ci);
~ChannelInfo(); ~ChannelInfo();
ChannelInfo& operator=(const ChannelInfo &) = default;
void Serialize(Serialize::Data &data) const override; void Serialize(Serialize::Data &data) const anope_override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Change the founder of the channel /** Change the founder of the channel
@@ -251,3 +248,5 @@ public:
* @return true or false * @return true or false
*/ */
extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci); extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci);
#endif // REGCHANNEL_H
+13 -12
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,36 +9,37 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef REGEXPR_H
#define REGEXPR_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
#include "service.h" #include "service.h"
class CoreExport RegexException final class RegexException : public CoreException
: public CoreException
{ {
public: public:
RegexException(const Anope::string &reason = "") : CoreException(reason) { } RegexException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~RegexException() noexcept = default; virtual ~RegexException() throw() { }
}; };
class CoreExport Regex class CoreExport Regex
{ {
Anope::string expression; Anope::string expression;
protected: protected:
Regex(const Anope::string &expr) : expression(expr) { } Regex(const Anope::string &expr) : expression(expr) { }
public: public:
virtual ~Regex() = default; virtual ~Regex() { }
const Anope::string &GetExpression() { return expression; } const Anope::string &GetExpression() { return expression; }
virtual bool Matches(const Anope::string &str) = 0; virtual bool Matches(const Anope::string &str) = 0;
}; };
class CoreExport RegexProvider class CoreExport RegexProvider : public Service
: public Service
{ {
public: public:
RegexProvider(Module *o, const Anope::string &n) : Service(o, "Regex", n) { } RegexProvider(Module *o, const Anope::string &n) : Service(o, "Regex", n) { }
virtual Regex *Compile(const Anope::string &) = 0; virtual Regex *Compile(const Anope::string &) = 0;
}; };
#endif // REGEXPR_H
+28 -26
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2024 Anope Team * (C) 2003-2026 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,7 +9,8 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#pragma once #ifndef SERIALIZE_H
#define SERIALIZE_H
#include <sstream> #include <sstream>
@@ -20,14 +21,14 @@ namespace Serialize
{ {
class Data class Data
{ {
public: public:
enum Type enum Type
{ {
DT_TEXT, DT_TEXT,
DT_INT DT_INT
}; };
virtual ~Data() = default; virtual ~Data() { }
virtual std::iostream& operator[](const Anope::string &key) = 0; virtual std::iostream& operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); } virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
@@ -49,10 +50,9 @@ namespace Serialize
* abstract data types (Serialize::Data), and then reconstructed or * abstract data types (Serialize::Data), and then reconstructed or
* updated later at any time. * updated later at any time.
*/ */
class CoreExport Serializable class CoreExport Serializable : public virtual Base
: public virtual Base
{ {
private: private:
/* A list of every serializable item in Anope. /* A list of every serializable item in Anope.
* Some of these are static and constructed at runtime, * Some of these are static and constructed at runtime,
* so this list must be on the heap, as it is not always * so this list must be on the heap, as it is not always
@@ -65,24 +65,24 @@ private:
/* Iterator into serializable_items */ /* Iterator into serializable_items */
std::list<Serializable *>::iterator s_iter; std::list<Serializable *>::iterator s_iter;
/* The hash of the last serialized form of this object committed to the database */ /* The hash of the last serialized form of this object committed to the database */
size_t last_commit = 0; size_t last_commit;
/* The last time this object was committed to the database */ /* The last time this object was committed to the database */
time_t last_commit_time = 0; time_t last_commit_time;
protected: protected:
Serializable(const Anope::string &serialize_type); Serializable(const Anope::string &serialize_type);
Serializable(const Serializable &); Serializable(const Serializable &);
Serializable &operator=(const Serializable &); Serializable &operator=(const Serializable &);
public: public:
virtual ~Serializable(); virtual ~Serializable();
/* Unique ID (per type, not globally) for this object */ /* Unique ID (per type, not globally) for this object */
uint64_t id = 0; uint64_t id;
/* Only used by redis, to ignore updates */ /* Only used by redis, to ignore updates */
unsigned short redis_ignore = 0; unsigned short redis_ignore;
/** Marks the object as potentially being updated "soon". /** Marks the object as potentially being updated "soon".
*/ */
@@ -108,8 +108,7 @@ public:
* of class that inherits from Serializable. Used for unserializing objects * of class that inherits from Serializable. Used for unserializing objects
* of this type, as it requires a function pointer to a static member function. * of this type, as it requires a function pointer to a static member function.
*/ */
class CoreExport Serialize::Type final class CoreExport Serialize::Type : public Base
: public Base
{ {
typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &); typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &);
@@ -128,9 +127,9 @@ class CoreExport Serialize::Type final
* this timestamp. if curtime == timestamp then we have the most up to date * this timestamp. if curtime == timestamp then we have the most up to date
* version of every object of this type. * version of every object of this type.
*/ */
time_t timestamp = 0; time_t timestamp;
public: public:
/* Map of Serializable::id to Serializable objects */ /* Map of Serializable::id to Serializable objects */
std::map<uint64_t, Serializable *> objects; std::map<uint64_t, Serializable *> objects;
@@ -188,7 +187,7 @@ class Serialize::Checker
{ {
Anope::string name; Anope::string name;
T obj; T obj;
mutable ::Reference<Serialize::Type> type = nullptr; mutable ::Reference<Serialize::Type> type;
inline void Check() const inline void Check() const
{ {
@@ -198,8 +197,8 @@ class Serialize::Checker
type->Check(); type->Check();
} }
public: public:
Checker(const Anope::string &n) : name(n) { } Checker(const Anope::string &n) : name(n), type(NULL) { }
inline const T* operator->() const inline const T* operator->() const
{ {
@@ -242,14 +241,15 @@ public:
* destructed. * destructed.
*/ */
template<typename T> template<typename T>
class Serialize::Reference final class Serialize::Reference : public ReferenceBase
: public ReferenceBase
{ {
protected: protected:
T *ref = nullptr; T *ref;
public: public:
Reference() = default; Reference() : ref(NULL)
{
}
Reference(T *obj) : ref(obj) Reference(T *obj) : ref(obj)
{ {
@@ -331,3 +331,5 @@ public:
return NULL; return NULL;
} }
}; };
#endif // SERIALIZE_H

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