1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 13:13:14 +02:00

Compare commits

...

139 Commits

Author SHA1 Message Date
Sadie Powell e8cd2909a5 Release 2.1.1. 2024-01-04 17:54:06 +00:00
Sadie Powell e7a57aa754 Update the changelog. 2024-01-04 17:53:05 +00:00
Sadie Powell 1c30f69bd0 Fix a typo in GetCommandLineArgument. 2024-01-04 17:52:30 +00:00
k4be 36c43683e5 Remove unused strings from pl_PL 2023-12-27 15:06:30 +00:00
k4be 0b63a4244d Update pl_PL translation for 2.1 2023-12-27 15:06:30 +00:00
Sadie Powell 4a62259695 Move privilege descriptions to the example configs. 2023-12-22 15:58:28 +00:00
Sadie Powell 87e3d5a045 Remove an extraneous space in cs_xop. 2023-12-21 01:27:34 +00:00
Dragone2 2b8384bb39 Updates Italian translations for Anope 2.1 2023-12-21 00:47:47 +00:00
Sadie Powell 6d981960da Merge branch '2.0' into 2.1. 2023-12-20 00:07:51 +00:00
Sadie Powell 6acbd326f3 Add the regex_stdlib regular expression engine.
Unlike other regular expression engines this is available on all
systems.
2023-12-17 15:00:26 +00:00
Sadie Powell cb533b63ac Merge branch '2.0' into 2.1. 2023-12-17 14:33:44 +00:00
Sadie Powell 6538641e87 Remove some unnecessary spaces that break editor indentation. 2023-12-17 13:59:49 +00:00
Sadie Powell eb0e5c89b2 Remove the m_regex_pcre module.
Users should migrate to m_regex_pcre2 instead.
2023-12-17 13:46:34 +00:00
Sadie Powell 84c2f8d3fc Skip checking for chgrp/chmod on Windows. 2023-12-07 15:59:19 +00:00
Dragone2 8d99b3e2d7 Clean-ups old strings 2023-12-05 16:52:02 +00:00
Dragone2 b3ec2a5463 Adds new Italian translations 2023-12-05 16:52:02 +00:00
Sadie Powell 4c67f4393f Update the en_US translation. 2023-12-04 18:49:57 +00:00
Sadie Powell 4e9a2df827 Add the UNBANME privilege to allow users to unban themselves.
This is separate from the existing UNBAN privilege which applies
to all users.

Closes #331.
2023-11-30 14:38:20 +00:00
Sadie Powell 2d2d1972e9 Fix some modules that weren't converted to the new socket ctor.
Closes #330.
2023-11-26 13:26:38 +00:00
Sadie Powell 2b21264fb0 Bump for 2.1.1-git. 2023-11-24 13:37:11 +00:00
Sadie Powell 3f61b52db3 Release 2.1.0. 2023-11-24 13:33:10 +00:00
Sadie Powell f5fa4ff0e9 Remove the 1.9 and 2.0 changes from the change log. 2023-11-24 13:29:15 +00:00
Sadie Powell 251551c8c3 Update the change logs. 2023-11-24 13:29:11 +00:00
Sadie Powell e2d546ad46 Add a note about how to send emails on Windows. 2023-11-24 13:24:42 +00:00
Sadie Powell 949176c3e0 Merge branch '2.0' into 2.1. 2023-11-24 13:04:00 +00:00
Sadie Powell 3371941be5 Allow users to opt-out of being added to channel access lists. 2023-11-23 15:10:03 +00:00
Sadie Powell 70d72b62df Avoid needing to cast CurrentUplink by changing it to a size_t. 2023-11-16 21:49:48 +00:00
Sadie Powell 46209895e3 Merge branch '2.0' into 2.1. 2023-11-16 19:34:37 +00:00
Sadie Powell b28180d680 Implement support for the ANONYMOUS SASL mechanism. 2023-11-14 15:02:04 +00:00
Sadie Powell 0f1f0c5a22 Deduplicate account sending code in the inspircd module. 2023-11-14 13:53:45 +00:00
Sadie Powell 6e16e71fda Remove the two day X-line cap. 2023-11-03 11:01:01 +00:00
Sadie Powell 38d5b93e4a Add support for server-initiated logins and logouts on UnrealIRCd. 2023-10-19 23:22:31 +01:00
Sadie Powell 78398a4481 Add support for server-initiated logouts on InspIRCd. 2023-10-19 22:52:05 +01:00
Sadie Powell 0f32d2e553 Use a more human readable datetime format. 2023-10-12 14:41:07 +01:00
Sadie Powell 8e1c7e1e44 Merge branch '2.0' into 2.1. 2023-10-11 15:51:52 +01:00
Sadie Powell a3241065c5 Start migrating to range-based for loops. 2023-10-11 15:51:52 +01:00
Sadie Powell dc371aad6d Re-add the GHOST and REGAIN commands for compatibility.
These are hidden so they won't be shown in the help.
2023-09-26 12:39:30 +01:00
Sadie Powell adf820c08a Merge branch 2.0 into 2.1. 2023-08-06 13:36:27 +01:00
Sadie Powell 377ba87d52 Remove broken support for MinGW.
This apparently doesn't work and is pointless given we have native
Windows builds now anyway.
2023-07-29 10:01:18 +01:00
Sadie Powell aa619f1eeb Merge branch '2.0' into 2.1. 2023-07-11 12:28:54 +01:00
Sadie Powell b7458c5da1 Allow access list entries to have a description.
This is useful when adding glob matches to the access list as a
reminder of who they actually match.

Resolves https://bugs.anope.org/view.php?id=1613
2023-07-11 12:19:47 +01:00
Sadie Powell 4a6f4bc92f Pull in the upstream changes from InspIRCd's vendoring tool. 2023-06-20 01:06:35 +01:00
Sadie Powell 1c30205af5 Also build the Windows dependencies in the CI. 2023-06-03 22:02:49 +01:00
Sadie Powell 9d0a6ddc67 Merge branch '2.0' into 2.1. 2023-06-03 21:51:07 +01:00
Sadie Powell 29db25dac7 Fix missing override keywords. 2023-03-13 13:52:56 +00:00
Sadie Powell d210cd2695 Modernize finding system tools and remove checks for unused tools. 2023-03-13 13:52:56 +00:00
Sadie Powell fc8e6ee338 Document the protocol module changes from a while ago. 2023-03-13 01:44:37 +00:00
Sadie Powell ebe3fd7e57 Merge branch '2.0' into 2.1. 2023-02-19 11:21:58 +00:00
Sadie Powell 885462d98e Merge branch '2.0' into 2.1. 2022-12-31 22:11:19 +00:00
Sadie Powell 6395107be6 Fix getting the port on non-UNIX socket listeners. 2022-12-27 10:21:40 +00:00
Sadie Powell 24b881c427 Update MODULE_INIT for modern MSVC+ versions. 2022-12-23 15:09:12 +00:00
Sadie Powell 28be881886 Backport anopesmtp removal from the master branch. 2022-12-23 14:21:34 +00:00
Sadie Powell 5bc560a743 Remove some unnecessary dependencies on the Linux CI. 2022-12-23 14:10:33 +00:00
Sadie Powell b235da2e9c Merge branch '2.0' into 2.1. 2022-12-17 16:18:09 +00:00
Sadie Powell 3f3062a077 Use <filesystem> instead of opendir/readdir/closedir. 2022-12-17 16:03:28 +00:00
Sadie Powell 8a8fb7725b Use the native versions of inet_ntop/inet_pton on Windows. 2022-12-17 12:40:58 +00:00
Sadie Powell f6e5e6a2b4 Add sockaddrs::str to stringify a sockaddrs properly.
Also clean up the socket code slightly.
2022-12-17 12:39:48 +00:00
Sadie Powell dfdcd3021a Add support for linking over UNIX sockets. 2022-12-17 11:50:38 +00:00
Sadie Powell 5fa3d8f929 Use emplace() instead of insert(std::make_pair()). 2022-12-09 16:50:29 +00:00
Sadie Powell 1a2da82106 Merge branch '2.0' into 2.1. 2022-12-07 15:59:46 +00:00
Sadie Powell 9d92de1157 Import InspIRCd's vendoring tool and use it to vendor crypt_blowfish. 2022-10-22 20:08:30 +01:00
Sadie Powell 1664689eb7 Merge branch '2.0' into 2.1. 2022-09-15 18:46:51 +01:00
Sadie Powell b96519d85c Build the installer package on Windows CI. 2022-05-01 10:28:18 +01:00
Sadie Powell ac98ed615b Merge branch '2.0' into 2.1. 2022-04-22 10:34:04 +01:00
Sadie Powell f2bcf449cd Use windows-2019 for Windows builds. 2022-03-01 05:21:28 +00:00
Sadie Powell 09c587bed0 Remove TR1 compatibility layer.
This isn't necessary now we use C++17.
2022-03-01 05:09:29 +00:00
Sadie Powell a8724b5f03 Use noexcept instead of an empty exception specifier. 2022-03-01 05:06:19 +00:00
Sadie Powell b7e85f5161 Default synconset and syncongroup to on. 2022-02-05 23:11:39 +00:00
Sadie Powell 773ed39d5d Merge branch '2.0' into 2.1. 2022-02-05 23:10:42 +00:00
Sadie Powell 15d51ff033 Document the sysconf header file. 2022-01-13 13:46:29 +00:00
Sadie Powell 83bf5ba255 Remove checks for obsolete Windows SDK versions.
We can't build against these anyway now as they're too old.
2022-01-13 03:22:12 +00:00
Sadie Powell 2881ba112b Clean up the predefined variables on Windows.
- Use _MSC_VER for detecting MSVC instead of a custom define.
- Remove MINGW as you can use __MINGW32__ to detect this.
- Stop defining _WIN32 as this will always be defined on Windows.
2022-01-13 02:35:23 +00:00
Sadie Powell 1ee81580c6 Add support for Windows CI. 2022-01-13 01:59:13 +00:00
Sadie Powell 4f421db5a9 Fix checking whether localisation is enabled. 2022-01-13 01:59:13 +00:00
Sadie Powell 091c0eea28 Rip out check_functions().
This isn't actually used anywhere and just slows down the build.
2022-01-13 01:42:46 +00:00
Sadie Powell eaaabd8de0 Rip out calculate_depends().
This code is incredibly error prone and it just duplicates behaviour
that CMake already implements with depend.make files.
2022-01-13 01:42:38 +00:00
Sadie Powell 40ce51a1a9 Include cstring instead of string.h in services.h 2022-01-13 01:13:46 +00:00
Sadie Powell 23ac008cc1 Remove NO_CLIENT_LONG_LONG from the mysql module.
This is not necessary now we use C++17.
2022-01-13 01:12:05 +00:00
Sadie Powell 6486956401 Fix some methods that should have been marked as CoreExport. 2022-01-13 00:34:51 +00:00
Sadie Powell 33b42ce86e Use the default CMake modules for finding gettext instead of our own. 2022-01-12 23:05:25 +00:00
Sadie Powell a631028660 Merge branch '2.0' into 2.1. 2022-01-12 22:08:35 +00:00
Sadie Powell 4e5fc9797c Speed up CI by building with Ninja instead of Make. 2022-01-04 18:48:22 +00:00
Sadie Powell 9befb13ea4 Remove various entries from sysconf which are never actually used. 2022-01-04 15:05:33 +00:00
Sadie Powell 8eb6a4da71 Update more IRCServices references to reflect the current project.
- If referring to the specific piece of software use "Anope".
- If referring to services in general use "services".
2022-01-04 14:11:07 +00:00
Sadie Powell ec7dfb3675 Use C++11 header names instead of their deprecated equivalents. 2022-01-04 12:36:35 +00:00
Sadie Powell 106750db77 Replace all uses of push_back with emplace_back. 2022-01-04 12:28:55 +00:00
Sadie Powell 7d1047490e Consistently use #pragma once across all header files.
This replaces a mixture of no include guards, ANOPE_FOO_H, and FOO_H.
2022-01-04 12:10:32 +00:00
Sadie Powell c9f93eeaed Merge branch '2.0' into 2.1. 2022-01-04 00:39:34 +00:00
Sadie Powell db6b2225b1 Use GNU visibility attributes when on non-Windows.
This reduces binary sizes by several megabytes on my system.
2022-01-04 00:39:05 +00:00
Sadie Powell c6c9d9591c Remove some obsolete header and function checks. 2022-01-04 00:39:05 +00:00
Sadie Powell c1f6a79c72 Export a compilation database for debug builds. 2022-01-04 00:39:05 +00:00
Sadie Powell eb81f22a5b Modernize CXXFLAGS on Unix and enable -Werror on CI.
Also clear up warnings that this exposed.
2022-01-04 00:39:05 +00:00
Sadie Powell a31a7f5a6c Use C++11 default initializers and destructors where possible. 2022-01-04 00:17:19 +00:00
Sadie Powell 7531e90499 Use C++11 style class/struct initialisation. 2022-01-04 00:17:13 +00:00
Sadie Powell dfcc025a19 Remove MARK_DEPRECATED as there's an attribute for this now. 2022-01-03 19:02:44 +00:00
Sadie Powell a5f7aac295 Replace anope_{final,override} with their C++11 equivalent. 2022-01-03 19:02:44 +00:00
Sadie Powell d76d747196 Require C++17 to build Anope. 2022-01-03 19:02:44 +00:00
Sadie Powell aee1e53cb3 Remove support for precompiled headers.
This might have been useful two decades ago but on recent hardware
this just makes builds take longer than without them.
2022-01-03 16:27:15 +00:00
Sadie Powell fd1ca96e2c Merge branch '2.0' into 2.1. 2022-01-03 15:50:22 +00:00
Sadie Powell 6a7488edc1 Remove double escaping in CMake regex matching.
This is not needed now we use regex matching directly instead of
via the CMake 2.4 function wrapper.

Fixes building extra modules.
2021-12-14 11:11:22 +00:00
Sadie Powell 4af8dfa549 Update the min version of CMake mentioned in the Config script. 2021-12-14 10:10:03 +00:00
Sadie Powell 4efc2c219b Send mode changes from ChanServ if the channel is not registered.
Avoids calling WhoSends() on a null pointer.
2021-12-03 07:11:37 +00:00
Sadie Powell 84ec0903ee Fix checking if this is null in regchannel.
I can't see any places this might be called on a null pointer.
2021-12-02 10:23:05 +00:00
Sadie Powell 754c82d047 Remove undefined behaviour around checking if this is null. 2021-11-30 11:04:19 +00:00
Sadie Powell 17fa704278 CMake warnings CMP0003 and CMP0007 are not necessary. 2021-11-30 10:11:17 +00:00
Sadie Powell b9ccd4bb0b Fix cmake deprecation warning CMP0026. 2021-11-30 10:03:10 +00:00
Sadie Powell 595bc09ec1 Merge branch '2.0' into 2.1. 2021-11-30 09:50:33 +00:00
Sadie Powell 27cff11e31 Increase the default channel expiry to 30 days. 2021-10-17 19:46:29 +01:00
Sadie Powell b7da27ad3a Increase the default nickname expiry to 90 days. 2021-10-17 19:44:05 +01:00
Sadie Powell e5075d2dc2 Merge branch '2.0' into 2.1 2021-08-28 19:53:17 +01:00
Sadie Powell e7e8447fa3 Deduplicate code for checking if a user is securely connected. 2021-08-01 19:23:48 +01:00
Sadie Powell 561b205c4a Merge branch '2.0' into 2.1. 2021-08-01 18:53:24 +01:00
Sadie Powell 376053e0ac Allow protocol modules to declare that the IRCd supports tags.
This is not being used currently but will be soon.
2021-06-01 00:21:41 +01:00
Sadie Powell cadc6f48e6 Remove nickserv:strictpasswords as it is now obsolete. 2021-05-31 21:44:10 +01:00
Sadie Powell b6665d5eb9 Add the nickserv:minpasslen option. 2021-05-31 21:16:06 +01:00
Sadie Powell 95955ae069 Rename nickserv:passlen to nickserv:maxpasslen. 2021-05-31 21:00:43 +01:00
Sadie Powell df4313f5bb Merge branch '2.0' into 2.1. 2021-05-31 20:57:48 +01:00
Sadie Powell 53cd3f47b5 Use elseif in CMake where possible. 2021-04-27 19:20:39 +01:00
Sadie Powell c21f6eb5a3 Rip out compatibility code for now-unsupported CMake versions. 2021-04-27 19:20:36 +01:00
Sadie Powell e2aeab970b Remove the repeated conditions in cmake endif/else statements. 2021-04-27 17:49:21 +01:00
Sadie Powell ef4fd869ae Bump minimum CMake version to 3.8.
This is the minimum version that supports CMAKE_CXX_STANDARD=17.
2021-04-27 17:48:28 +01:00
Sadie Powell dfc8bd4aa2 Switch SendSVSLogin to take a NickAlias. 2021-04-27 17:31:14 +01:00
Sadie Powell fd774bd52a Remove unnecessary space. 2021-04-21 14:09:07 +01:00
Sadie Powell 16fac79b78 The last parameter of Solanum ECHO is a <trailing>. 2021-04-21 14:06:49 +01:00
Sadie Powell 622a8ea7e9 Implement support for the Solanum ECHO server capability.
https://github.com/solanum-ircd/solanum/commit/4cac091255d972b0131ffbf0cd278f984bd892d4
2021-04-21 14:05:35 +01:00
Sadie Powell 0a518f4bbd Fix the syntax of Solanum identified messages. 2021-03-30 13:56:20 +01:00
Sadie Powell 3f6e694e50 Send the appropriate messages for Solanum's IDENTIFIED feature. 2021-02-19 01:08:08 +00:00
Sadie Powell c2646d67bb Replace the Charybdis protocol module with Solanum (its successor). 2021-02-19 00:33:27 +00:00
Sadie Powell c68b81eac8 Merge branch '2.0' into 2.1. 2021-02-18 23:59:28 +00:00
Sadie Powell 8b2c1548ab Merge tag '2.0.8' into 2.1. 2020-10-07 14:42:33 +01:00
Sadie Powell 5dd5fa4644 Rename unreal4 to unrealircd and inspircd3 to inspircd. 2020-09-28 15:33:16 +01:00
Sadie Powell 9d6dd4af11 Remove the non-tagged version of IRCDMessage::Run. 2020-09-28 15:28:27 +01:00
Sadie Powell f430522b41 Rename things from services to anope. 2020-09-28 15:28:27 +01:00
Sadie Powell 907aa60380 All modern platforms support stdint so remove pstdint. 2020-09-28 15:28:26 +01:00
Sadie Powell c7e26c5f67 Remove nickserv/getpass and Anope::Decrypt.
There is no point having these now plain text passwords are deprecated.
2020-09-28 15:28:26 +01:00
Sadie Powell 8e0e1806a4 Require a secure password hashing algorithm for new accounts.
Insecure algorithms can still be used for existing accounts.
2020-09-28 15:28:26 +01:00
Sadie Powell 7f39fb14f2 Remove operserv/oline and CanSVSO/SendSVSO in IRCDProto.
Now UnrealIRCd 3.2.x support has been removed nothing uses this.
2020-09-28 15:28:26 +01:00
Sadie Powell fb86705d3f Drop support for InspIRCd 1.2, InspIRCd 2.0, and UnrealIRCd 3.2.
None of these are supported by upstream anymore.
2020-09-28 15:28:26 +01:00
Sadie Powell f4fa5b3733 Bump for 2.1.0-git. 2020-09-28 15:28:26 +01:00
367 changed files with 7127 additions and 14188 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.
+5 -11
View File
@@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env: env:
CXX: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }}
CXXFLAGS: -std=${{ matrix.standard }} CXXFLAGS: -Werror
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install dependencies - name: Install dependencies
@@ -17,36 +17,30 @@ jobs:
clang \ clang \
g++ \ g++ \
git \ git \
libc++-dev \
libc++abi-dev \
libgnutls28-dev \ libgnutls28-dev \
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 \
make ninja-build
- name: Enable extras - name: Enable extras
run: | run: |
for MODULE in m_ldap.cpp m_ldap_authentication.cpp m_ldap_oper.cpp m_mysql.cpp m_regex_pcre.cpp m_regex_pcre2.cpp m_regex_posix.cpp m_regex_tre.cpp m_sql_authentication.cpp m_sql_log.cpp m_sql_oper.cpp m_sqlite.cpp m_ssl_gnutls.cpp m_ssl_openssl.cpp stats for MODULE in m_ldap.cpp m_ldap_authentication.cpp m_ldap_oper.cpp m_mysql.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 ${{ github.workspace }}/modules ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules
done done
- name: Run CMake - name: Run CMake
run: | run: |
mkdir build && cd build mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=${{ github.workspace }}/run .. cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=${{ github.workspace }}/run ..
- name: Build Anope - name: Build Anope
run: | run: |
make --directory ${{ github.workspace }}/build --jobs $(nproc) --no-print-directory install ninja -C ${{ github.workspace }}/build install
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
compiler: compiler:
- clang++ - clang++
- g++ - g++
standard:
- c++98
- c++17
+34
View File
@@ -0,0 +1,34 @@
name: Windows CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3
- name: Setup Conan
uses: turtlebrowser/get-conan@v1.2
with:
version: 1.59.0
- name: Install libraries
run: |
conan install ${{ github.workspace }}\src\win32 --build=missing
- name: Run CMake
run: |
mkdir ${{ github.workspace }}\build
cd ${{ github.workspace }}\build
cmake -A "x64" -G "Visual Studio 16 2019" ..
- name: Build Anope
working-directory: ${{ github.workspace }}\build
run: |
msbuild PACKAGE.vcxproj /M:3 /P:Configuration=Release /P:Platform=x64 /VERBOSITY:MINIMAL
+1
View File
@@ -17,3 +17,4 @@ modules/m_ssl_gnutls.cpp
modules/m_ssl_openssl.cpp modules/m_ssl_openssl.cpp
modules/stats modules/stats
run/ run/
*.mo
+104 -233
View File
@@ -1,73 +1,10 @@
# This usage of CMake requires at least version 2.4 (checks are made to determine what to use when certain versions lack functions) # This usage of CMake requires at least version 3.8
cmake_minimum_required(VERSION 2.4 FATAL_ERROR) cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD)
endif(POLICY CMP0026)
if(POLICY CMP0007)
cmake_policy(SET CMP0007 OLD)
endif(POLICY CMP0007)
endif(COMMAND cmake_policy)
# 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)
@@ -80,14 +17,10 @@ set(ENV{LC_ALL} C)
set(DEFAULT_LIBRARY_DIRS) set(DEFAULT_LIBRARY_DIRS)
set(DEFAULT_INCLUDE_DIRS) set(DEFAULT_INCLUDE_DIRS)
# Check that we aren't running on an ancient broken GCC # We require C++17 to build
if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_EXTENSIONS OFF)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_FULL_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) set(CMAKE_CXX_STANDARD 17)
string(REGEX REPLACE "^(\\d+\\.\\d+)" "\\1" GCC_VERSION ${GCC_FULL_VERSION}) set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(GCC_VERSION LESS 4.2)
message(FATAL_ERROR "Your compiler is too old to build Anope. Upgrade to GCC 4.2 or newer!")
endif(GCC_VERSION LESS 4.2)
endif(CMAKE_COMPILER_IS_GNUCXX)
# 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$")
@@ -98,9 +31,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(NOT MINGW) else()
set(LIBRARIES "${LINE}") set(LIBRARIES "${LINE}")
endif(NOT MINGW) endif()
# 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
@@ -108,13 +41,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)
append_to_list(DEFAULT_LIBRARY_DIRS ${LIBRARY}) list(APPEND DEFAULT_LIBRARY_DIRS ${LIBRARY})
endif(NOT FIRST_CHAR STREQUAL "=") endif()
endforeach(LIBRARY) endforeach()
# Remove duplicate entries from the list # Remove duplicate entries from the list
if(DEFAULT_LIBRARY_DIRS) if(DEFAULT_LIBRARY_DIRS)
remove_list_duplicates(DEFAULT_LIBRARY_DIRS) list(REMOVE_DUPLICATES DEFAULT_LIBRARY_DIRS)
endif(DEFAULT_LIBRARY_DIRS) endif()
# 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
@@ -131,11 +64,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(LINE STREQUAL "#include <...> search starts here:") else()
# 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(LINE STREQUAL "End of search list.") else()
# 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
@@ -147,47 +80,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Convert the path to an absolute one, just in case it wasn't # 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
append_to_list(DEFAULT_INCLUDE_DIRS ${INCLUDE}) list(APPEND DEFAULT_INCLUDE_DIRS ${INCLUDE})
endif(IN_SEARCH) endif()
endif(LINE STREQUAL "End of search list.") endif()
endif(LINE STREQUAL "#include <...> search starts here:") endif()
endforeach(LINE) endforeach()
# Remove duplicate entries from the list # Remove duplicate entries from the list
if(DEFAULT_INCLUDE_DIRS) if(DEFAULT_INCLUDE_DIRS)
remove_list_duplicates(DEFAULT_INCLUDE_DIRS) list(REMOVE_DUPLICATES DEFAULT_INCLUDE_DIRS)
endif(DEFAULT_INCLUDE_DIRS) endif()
endif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$") endif()
# 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
@@ -196,38 +98,33 @@ endif(MSVC)
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(CMAKE_BUILD_TYPE) else()
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.") set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif(CMAKE_BUILD_TYPE) endif()
endif(NOT MSVC) endif()
# If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake) # If 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(MINGW) endif()
# 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)
if(CMAKE244_OR_BETTER) include(CheckCXXCompilerFlag)
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(EXTRA_INCLUDE) endif()
# 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(EXTRA_LIBS) endif()
# setup conan # setup conan
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake")
@@ -237,25 +134,31 @@ endif()
# Find gettext # Find gettext
find_package(Gettext) find_package(Gettext)
find_package(Intl)
option(USE_PCH "Use precompiled headers" OFF) if(GETTEXT_FOUND AND Intl_FOUND)
set(HAVE_LOCALIZATION ON)
include_directories(${Intl_INCLUDE_DIRS})
else()
message("Unable to find gettext and libintl; disabling localization")
set(HAVE_LOCALIZATION OFF)
endif()
# Use the following directories as includes # Use the following directories as includes
# Note that it is important the binary include directory comes before the include_directories(
# source include directory so the precompiled headers work correctly. ${Anope_BINARY_DIR}/include
include_directories(${Anope_BINARY_DIR}/include ${Anope_SOURCE_DIR}/include ${Anope_BINARY_DIR}/language ${Anope_SOURCE_DIR}/modules/pseudoclients) ${Anope_SOURCE_DIR}/include
${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(REPRODUCIBLE_BUILD) endif()
# If using Windows, always add the _WIN32 define
if(WIN32) if(WIN32)
add_definitions(-D_WIN32) # If using Windows, include the windows specific folder for anope_windows.h
# 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(WIN32) endif()
# If using Visual Studio, set the C++ flags accordingly # If using Visual Studio, set the C++ flags accordingly
if(MSVC) if(MSVC)
@@ -265,107 +168,76 @@ 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(-DMSVCPP -D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio # Otherwise, we're not using Visual Studio
else(MSVC) else()
# 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} -Wall -Wshadow") set(CXXFLAGS "${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wpedantic -Wno-unused-parameter ${CMAKE_CXX_FLAGS}")
# 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) endif()
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)
append_to_list(LINK_LIBS ${CMAKE_DL_LIBS}) list(APPEND LINK_LIBS ${CMAKE_DL_LIBS})
endif(CMAKE_DL_LIBS) endif()
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries # 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(MINGW) endif()
if(NOT PROGRAM_NAME) if(NOT PROGRAM_NAME)
# Under Windows, we set the executable name for Anope to be anope set(PROGRAM_NAME anope)
if(WIN32) endif()
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
if(CMAKE244_OR_BETTER) check_cxx_compiler_flag(-pipe HAVE_PIPE_FLAG)
# 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(HAVE_PIPE_FLAG) endif()
# 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)
append_to_list(LINK_LIBS socket) list(APPEND LINK_LIBS socket)
endif(HAVE_SOCKET_LIB) endif()
# 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)
append_to_list(LINK_LIBS nsl) list(APPEND LINK_LIBS nsl)
endif(HAVE_NSL_LIB) endif()
# 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(NOT APPLE) endif()
else(HAVE_PTHREAD) else()
message(FATAL_ERROR "The pthread library is required to build Anope") message(FATAL_ERROR "The pthread library is required to build Anope")
endif(HAVE_PTHREAD) endif()
endif(NOT WIN32) endif()
endif(NOT MSVC) endif()
# 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(RUNGROUP) else()
set(DEFUMASK "077") set(DEFUMASK "077")
endif(RUNGROUP) endif()
endif(NOT DEFUMASK) endif()
# 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(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO") endif()
# 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)
@@ -373,63 +245,62 @@ 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)
strip_string(${CXXFLAGS} CXXFLAGS) string(STRIP ${CXXFLAGS} CXXFLAGS)
endif(CXXFLAGS) endif()
# Strip the leading and trailing spaces from the linker flags # Strip the leading and trailing spaces from the linker flags
if(LDFLAGS) if(LDFLAGS)
strip_string(${LDFLAGS} LDFLAGS) string(STRIP ${LDFLAGS} LDFLAGS)
endif(LDFLAGS) endif()
# Search for the following programs # Search for the following programs
find_program(GREP grep) if(NOT WIN32 AND RUNGROUP)
find_program(SH sh) find_program(CHGRP "chgrp" REQUIRED)
find_program(CHGRP chgrp) find_program(CHMOD "chmod" REQUIRED)
find_program(CHMOD chmod) endif()
# If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the services directory under the user's home directory # If a INSTDIR was passed in to CMake, use it as the install prefix, otherwise set the default install prefix to the anope directory under the user's home directory
if(INSTDIR) 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}/services") set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/anope")
endif(INSTDIR) endif()
# 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(NOT BIN_DIR) endif()
if(NOT DB_DIR) if(NOT DB_DIR)
set(DB_DIR "data") set(DB_DIR "data")
endif(NOT DB_DIR) endif()
if(NOT DOC_DIR) if(NOT DOC_DIR)
set(DOC_DIR "doc") set(DOC_DIR "doc")
endif(NOT DOC_DIR) endif()
if(NOT CONF_DIR) if(NOT CONF_DIR)
set(CONF_DIR "conf") set(CONF_DIR "conf")
endif(NOT CONF_DIR) endif()
if(NOT LIB_DIR) if(NOT LIB_DIR)
set(LIB_DIR "lib") set(LIB_DIR "lib")
endif(NOT LIB_DIR) endif()
if(NOT LOCALE_DIR) if(NOT LOCALE_DIR)
set(LOCALE_DIR "locale") set(LOCALE_DIR "locale")
endif(NOT LOCALE_DIR) endif()
if(NOT LOGS_DIR) if(NOT LOGS_DIR)
set(LOGS_DIR "logs") set(LOGS_DIR "logs")
endif(NOT LOGS_DIR) endif()
# 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_
read_from_file(${Anope_SOURCE_DIR}/src/version.sh "^VERSION_" VERSIONS) file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^VERSION_")
# Iterate through the strings found # 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})
# Depends on CMP0007 OLD
list(LENGTH VERSION_OUT VERSION_LEN) list(LENGTH VERSION_OUT VERSION_LEN)
list(GET VERSION_OUT 0 VERSION_TYPE) list(GET VERSION_OUT 0 VERSION_TYPE)
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(${VERSION_LEN} GREATER 1) endif()
endforeach(VERSION_STR ${VERSIONS}) endforeach()
# Default build version to 0 # Default build version to 0
set(VERSION_BUILD 0) set(VERSION_BUILD 0)
@@ -437,7 +308,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
read_from_file(${Anope_SOURCE_DIR}/include/version.h "^#define VERSION_BUILD" VERSIONS) file(STRINGS ${Anope_SOURCE_DIR}/src/version.sh VERSIONS REGEX "^#define VERSION_BUILD")
foreach(VERSION_STR ${VERSIONS}) 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)
@@ -447,8 +318,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(VERSION_STR ${VERSIONS}) endforeach()
endif(EXISTS "${Anope_SOURCE_DIR}/include/version.h") endif()
# 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}")
@@ -461,7 +332,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(WIN32) endif()
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source # Add 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)
@@ -476,8 +347,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(MSVC) endif()
endif(${Anope_SOURCE_DIR} STREQUAL ${Anope_BINARY_DIR}) endif()
# Go into the following directories and run their CMakeLists.txt as well # Go into the following directories and run their CMakeLists.txt as well
add_subdirectory(data) add_subdirectory(data)
@@ -488,7 +359,7 @@ add_subdirectory(modules)
add_subdirectory(include) add_subdirectory(include)
# Get the filename of the Anope binary, to use later # Get the filename of the Anope binary, to use later
get_target_property(SERVICES_BINARY ${PROGRAM_NAME} LOCATION) set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME) get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
# At install time, create the following additional directories # At install time, create the following additional directories
@@ -496,19 +367,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(WIN32) endif()
# On non-Windows platforms, if RUNGROUP is set, change the permissions of the below directories, as well as the group of the data directory # 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(NOT WIN32 AND RUNGROUP) endif()
# 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(WIN32) endif()
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\")")
@@ -549,10 +420,10 @@ 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(WIN32) endif()
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(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") endif()
+10 -52
View File
@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Configuration script for Services. # Configuration script for Anope.
# #
# Anope (C) 2003-2023 Anope Team # Anope (C) 2003-2023 Anope Team
# Contact us at team@anope.org # Contact us at team@anope.org
@@ -62,12 +62,6 @@ 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
@@ -76,12 +70,6 @@ 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
@@ -91,9 +79,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 $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR" echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $PCH $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
if [ $? -ne 0 ]; then 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
@@ -125,11 +113,10 @@ export ECHO2 ECHO2SUF
# Init values # Init values
########################################################################### ###########################################################################
INSTDIR=$HOME/services INSTDIR=$HOME/anope
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=
@@ -176,7 +163,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 2.4 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager." echo "Anope requires CMake 3.8 or newer, which can be downloaded at https://cmake.org/ or through your system's package manager."
echo "If you have installed CMake already, ensure it is in your PATH environment variable." echo "If you have installed CMake already, ensure it is in your PATH environment variable."
exit 0 exit 0
fi fi
@@ -184,24 +171,15 @@ 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@" | $PAGER cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | more
echo "" echo ""
else else
echo "" echo ""
fi fi
echo "Beginning Services configuration." echo "Beginning Anope configuration."
echo "" echo ""
########################################################################### ###########################################################################
@@ -240,7 +218,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 Services source directory as a target directory." echo "You cannot use the Anope source directory as a target directory."
else else
ok=1 ok=1
fi fi
@@ -252,11 +230,11 @@ echo ""
OLD_RUNGROUP="$RUNGROUP" OLD_RUNGROUP="$RUNGROUP"
if [ "$RUNGROUP" ] ; then if [ "$RUNGROUP" ] ; then
echo "Which group should all Services data files be owned by? (If Services" echo "Which group should all Anope data files be owned by? (If Anope"
echo "should not force files to be owned by a particular group, type \"none\"" echo "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 Services data files be owned by? (If Services" echo "Which group should all Anope data files be owned by? (If Anope"
echo "should not force files to be owned by a particular group, just press" echo "should not force files to be owned by a particular group, just press"
echo "Return.)" echo "Return.)"
fi fi
@@ -322,25 +300,6 @@ echo ""
#### ####
TEMP_YN="n"
if [ "$USE_PCH" = "yes" ] ; then
TEMP_YN="y"
fi
echo "Do you want to build using precompiled headers? This can speed up"
echo "the build, but uses more disk space."
echo2 "[$TEMP_YN] "
read YN
if [ "$YN" ] ; then
if [ "$YN" = "y" ] ; then
USE_PCH="yes"
else
USE_PCH="no"
fi
fi
echo ""
####
echo "Are there any extra include directories you wish to use?" echo "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."
@@ -403,7 +362,6 @@ 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"
+7 -7
View File
@@ -1,6 +1,6 @@
## 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)
@@ -19,7 +19,7 @@ $ make
$ make install $ make install
``` ```
Now change to the directory where you installed Anope to, e.g. `$ cd ~/services/` Now change to the directory where you installed Anope to, e.g. `$ cd ~/anope/`
### Windows ### 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/example.conf to conf/services.conf Copy conf/anope.example.conf to conf/anope.conf
``` ```
$ cp conf/example.conf conf/services.conf $ cp conf/anope.example.conf conf/anope.conf
``` ```
Edit services.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the the example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.anope.org](irc://irc.anope.org/#anope). Edit anope.conf, configuring the uplink, serverinfo, and protocol module configurations. Example link blocks for popular IRCds are included in the anope.example.conf documentation. The [Anope wiki](https://wiki.anope.org) is also a good source of information. Our support channel is located at #anope on [irc.anope.org](irc://irc.anope.org/#anope).
Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `services.conf` to include the new file. Note that the example configuration file includes other example configuration files. If you want to modify the other example configuration files, copy them (e.g. `modules.example.conf` to `modules.conf`) and modify the `include` directive in `anope.conf` to include the new file.
## Running ## Running
Run `$ ./bin/services` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/services --support` Run `$ ./bin/anope` to start Anope. If asked to provide logs for support, use the `--support` flag, e.g.: `$ ./bin/anope --support`
## Installing extra modules ## Installing extra modules
+32 -481
View File
@@ -1,421 +1,3 @@
###############################################################################
# strip_string(<input string> <output string>)
#
# A macro to handle stripping the leading and trailing spaces from a string,
# uses string(STRIP) if using CMake 2.6.x or better, otherwise uses
# string(REGEX REPLACE).
###############################################################################
macro(strip_string INPUT_STRING OUTPUT_STRING)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, we can just use the STRIP sub-command of string()
string(STRIP ${INPUT_STRING} ${OUTPUT_STRING})
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we will have to use the REGEX REPLACE sub-command of string() instead
# First check if the input string is empty or not
if (${INPUT_STRING} STREQUAL "")
set(${OUTPUT_STRING} "")
else(${INPUT_STRING} STREQUAL "")
# Determine if the string is entirely empty or not
string(REGEX MATCH "^[ \t]*$" EMPTY_STRING "${INPUT_STRING}")
if(EMPTY_STRING)
set(${OUTPUT_STRING} "")
else(EMPTY_STRING)
# We detect if there is any leading whitespace and remove any if there is
string(SUBSTRING "${INPUT_STRING}" 0 1 FIRST_CHAR)
if(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
string(REGEX REPLACE "^[ \t]+" "" TEMP_STRING "${INPUT_STRING}")
else(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
set(TEMP_STRING "${INPUT_STRING}")
endif(FIRST_CHAR STREQUAL " " OR FIRST_CHAR STREQUAL "\t")
# Next we detect if there is any trailing whitespace and remove any if there is
string(LENGTH "${TEMP_STRING}" STRING_LEN)
math(EXPR STRING_LEN "${STRING_LEN} - 1")
string(SUBSTRING "${TEMP_STRING}" ${STRING_LEN} 1 LAST_CHAR)
if(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
string(REGEX REPLACE "[ \t]+$" "" ${OUTPUT_STRING} "${TEMP_STRING}")
else(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
set(${OUTPUT_STRING} "${TEMP_STRING}")
endif(LAST_CHAR STREQUAL " " OR LAST_CHAR STREQUAL "\t")
endif(EMPTY_STRING)
endif(${INPUT_STRING} STREQUAL "")
endif(CMAKE26_OR_BETTER)
endmacro(strip_string)
###############################################################################
# append_to_list(<list> <args>...)
#
# A macro to handle appending to lists, uses list(APPEND) if using CMake 2.4.2
# or better, otherwise uses set() instead.
###############################################################################
macro(append_to_list LIST)
if(CMAKE242_OR_BETTER)
# For CMake 2.4.2 or better, we can just use the APPEND sub-command of list()
list(APPEND ${LIST} ${ARGN})
else(CMAKE242_OR_BETTER)
# For CMake 2.4.x before 2.4.2, we have to do this manually use set() instead
set(${LIST} ${${LIST}} ${ARGN})
endif(CMAKE242_OR_BETTER)
endmacro(append_to_list)
###############################################################################
# find_in_list(<list> <value> <output variable>)
#
# A macro to handle searching within a list, will store the result in the
# given <output variable>, uses list(FIND) if using CMake 2.6.x or better
# (or CMake 2.4.8 or better), otherwise it iterates through the list to find
# the item.
###############################################################################
macro(find_in_list LIST ITEM_TO_FIND FOUND)
if(CMAKE248_OR_BETTER)
# For CMake 2.4.8 or better, we can use the FIND sub-command of list()
list(FIND ${LIST} ${ITEM_TO_FIND} ITEM_FOUND)
else(CMAKE248_OR_BETTER)
# For CMake 2.4.x before 2.4.8, we have to do this ourselves (NOTE: This is very slow due to a lack of break() as well)
# Firstly we set the position to -1 indicating nothing found, we also use a temporary position
set(ITEM_FOUND -1)
set(POS 0)
# Iterate through the list
foreach(ITEM ${${LIST}})
# If the item we are looking at is the item we are trying to find, set that we've found the item
if(${ITEM} STREQUAL ${ITEM_TO_FIND})
set(ITEM_FOUND ${POS})
endif(${ITEM} STREQUAL ${ITEM_TO_FIND})
# Increase the position value by 1
math(EXPR POS "${POS} + 1")
endforeach(ITEM)
endif(CMAKE248_OR_BETTER)
# Set the given FOUND variable to the result
set(${FOUND} ${ITEM_FOUND})
endmacro(find_in_list)
###############################################################################
# remove_list_duplicates(<list>)
#
# A macro to handle removing duplicates from a list, uses
# list(REMOVE_DUPLICATES) if using CMake 2.6.x or better, otherwise it uses
# a slower method of creating a temporary list and only adding to it when
# a duplicate item hasn't been found.
###############################################################################
macro(remove_list_duplicates LIST)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, this can be done automatically
list(REMOVE_DUPLICATES ${LIST})
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we have to do this ourselves, firstly we'll clear a temporary list
set(NEW_LIST)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# Check if the item is in the new list
find_in_list(NEW_LIST ${ITEM} FOUND_ITEM)
if(FOUND_ITEM EQUAL -1)
# If the item was not found, append it to the list
append_to_list(NEW_LIST ${ITEM})
endif(FOUND_ITEM EQUAL -1)
endforeach(ITEM)
# Replace the old list with the new list
set(${LIST} ${NEW_LIST})
endif(CMAKE26_OR_BETTER)
endmacro(remove_list_duplicates)
###############################################################################
# remove_item_from_list(<list> <value>)
#
# A macro to handle removing a value from a list, uses list(REMOVE_ITEM) in
# both cases, but can remove the value itself using CMake 2.4.2 or better,
# while older versions use a slower method of iterating the list to find the
# index of the value to remove.
###############################################################################
macro(remove_item_from_list LIST VALUE)
if(CMAKE242_OR_BETTER)
# For CMake 2.4.2 or better, this can be done automatically
list(REMOVE_ITEM ${LIST} ${VALUE})
else(CMAKE242_OR_BETTER)
# For CMake 2.4.x before 2.4.2, we have to do this ourselves, firstly we set the index and a variable to indicate if the item was found
set(INDEX 0)
set(FOUND FALSE)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# If the item hasn't been found yet, but the current item is the same, remove it
if(NOT FOUND)
if(ITEM STREQUAL ${VALUE})
set(FOUND TRUE)
list(REMOVE_ITEM ${LIST} ${INDEX})
endif(ITEM STREQUAL ${VALUE})
endif(NOT FOUND)
# Increase the index value by 1
math(EXPR INDEX "${INDEX} + 1")
endforeach(ITEM)
endif(CMAKE242_OR_BETTER)
endmacro(remove_item_from_list)
###############################################################################
# sort_list(<list>)
#
# A macro to handle sorting a list, uses list(SORT) if using CMake 2.4.4 or
# better, otherwise it uses a slower method of creating a temporary list and
# adding elements in alphabetical order.
###############################################################################
macro(sort_list LIST)
if(CMAKE244_OR_BETTER)
# For CMake 2.4.4 or better, this can be done automatically
list(SORT ${LIST})
else(CMAKE244_OR_BETTER)
# For CMake 2.4.x before 2.4.4, we have to do this ourselves, firstly we'll create a temporary list
set(NEW_LIST)
# Iterate through the old list
foreach(ITEM ${${LIST}})
# Temporary index position for the new list, as well as temporary value to store if the item was ever found
set(INDEX 0)
set(FOUND FALSE)
# Iterate through the new list
foreach(NEW_ITEM ${NEW_LIST})
# Compare the items, only if nothing was found before
if(NOT FOUND)
if(NEW_ITEM STRGREATER "${ITEM}")
set(FOUND TRUE)
list(INSERT NEW_LIST ${INDEX} ${ITEM})
endif(NEW_ITEM STRGREATER "${ITEM}")
endif(NOT FOUND)
# Increase the index value by 1
math(EXPR INDEX "${INDEX} + 1")
endforeach(NEW_ITEM)
# If the item was never found, just append it to the end
if(NOT FOUND)
append_to_list(NEW_LIST ${ITEM})
endif(NOT FOUND)
endforeach(ITEM)
# Replace the old list with the new list
set(${LIST} ${NEW_LIST})
endif(CMAKE244_OR_BETTER)
endmacro(sort_list)
###############################################################################
# read_from_file(<filename> <regex> <output variable>)
#
# A macro to handle reading specific lines from a file, uses file(STRINGS) if
# using CMake 2.6.x or better, otherwise we read in the entire file and
# perform a string(REGEX MATCH) on each line of the file instead. This
# macro can also be used to read in all the lines of a file if REGEX is set
# to "".
###############################################################################
macro(read_from_file FILE REGEX STRINGS)
if(CMAKE26_OR_BETTER)
# For CMake 2.6.x or better, we can just use the STRINGS sub-command to get the lines that match the given regular expression (if one is given, otherwise get all lines)
if(REGEX STREQUAL "")
file(STRINGS ${FILE} RESULT)
else(REGEX STREQUAL "")
file(STRINGS ${FILE} RESULT REGEX ${REGEX})
endif(REGEX STREQUAL "")
else(CMAKE26_OR_BETTER)
# For CMake 2.4.x, we need to do this manually, firstly we read the file in
execute_process(COMMAND ${CMAKE_COMMAND} -DFILE:STRING=${FILE} -P ${Anope_SOURCE_DIR}/cmake/ReadFile.cmake ERROR_VARIABLE ALL_STRINGS)
# Next we replace all newlines with semicolons
string(REGEX REPLACE "\n" ";" ALL_STRINGS ${ALL_STRINGS})
if(REGEX STREQUAL "")
# For no regular expression, just set the result to all the lines
set(RESULT ${ALL_STRINGS})
else(REGEX STREQUAL "")
# Clear the result list
set(RESULT)
# Iterate through all the lines of the file
foreach(STRING ${ALL_STRINGS})
# Check for a match against the given regular expression
string(REGEX MATCH ${REGEX} STRING_MATCH ${STRING})
# If we had a match, append the match to the list
if(STRING_MATCH)
append_to_list(RESULT ${STRING})
endif(STRING_MATCH)
endforeach(STRING)
endif(REGEX STREQUAL "")
endif(CMAKE26_OR_BETTER)
# Set the given STRINGS variable to the result
set(${STRINGS} ${RESULT})
endmacro(read_from_file)
###############################################################################
# extract_include_filename(<line> <output variable> [<optional output variable of quote type>])
#
# This macro will take a #include line and extract the filename.
###############################################################################
macro(extract_include_filename INCLUDE FILENAME)
# Strip the leading and trailing spaces from the include line
strip_string(${INCLUDE} INCLUDE_STRIPPED)
# Make sure to only do the following if there is a string
if(INCLUDE_STRIPPED STREQUAL "")
set(FILE "")
else(INCLUDE_STRIPPED STREQUAL "")
# Extract the filename including the quotes or angle brackets
string(REGEX REPLACE "^.*([\"<].*[\">]).*$" "\\1" FILE "${INCLUDE_STRIPPED}")
# If an optional 3rd argument is given, we'll store if the quote style was quoted or angle bracketed
if(${ARGC} GREATER 2)
string(SUBSTRING ${FILE} 0 1 QUOTE)
if(QUOTE STREQUAL "<")
set(${ARGV2} "angle brackets")
else(QUOTE STREQUAL "<")
set(${ARGV2} "quotes")
endif(QUOTE STREQUAL "<")
endif(${ARGC} GREATER 2)
# Now remove the quotes or angle brackets
string(REGEX REPLACE "^[\"<](.*)[\">]$" "\\1" FILE "${FILE}")
endif(INCLUDE_STRIPPED STREQUAL "")
# Set the filename to the the given variable
set(${FILENAME} "${FILE}")
endmacro(extract_include_filename)
###############################################################################
# find_includes(<source filename> <output variable>)
#
# This macro will search through a file for #include lines, regardless of
# whitespace, but only returns the lines that are valid for the current
# platform CMake is running on.
###############################################################################
macro(find_includes SRC INCLUDES)
# Read all lines from the file that start with #, regardless of whitespace before the #
read_from_file(${SRC} "^[ \t]*#.*$" LINES)
# Set that any #include lines found are valid, and create temporary variables for the last found #ifdef/#ifndef
set(VALID_LINE TRUE)
set(LAST_DEF)
set(LAST_CHECK)
# Create an empty include list
set(INCLUDES_LIST)
# Iterate through all the # lines
foreach(LINE ${LINES})
# Search for #ifdef, #ifndef, #else, #endif, and #include
string(REGEX MATCH "^[ \t]*#[ \t]*ifdef[ \t]*.*$" FOUND_IFDEF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*ifndef[ \t]*.*$" FOUND_IFNDEF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*else.*$" FOUND_ELSE ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*endif.*$" FOUND_ENDIF ${LINE})
string(REGEX MATCH "^[ \t]*#[ \t]*include[ \t]*[\"<].*[\">][\ t]*.*$" FOUND_INCLUDE ${LINE})
# If we found a #ifdef on the line, extract the data after the #ifdef and set if the lines after it are valid based on the variables in CMake
if(FOUND_IFDEF)
# Extract the define
string(REGEX REPLACE "^[ \t]*#[ \t]*ifdef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
if(DEFINE STREQUAL "_WIN32")
set(DEFINE WIN32)
endif(DEFINE STREQUAL "_WIN32")
# Set the last define to this one, and set the last check to true, so when #else is encountered, we can do an opposing check
set(LAST_DEF ${DEFINE})
set(LAST_CHECK TRUE)
# If the define is true (it either exists or is a non-false result), the lines following will be checked, otherwise they will be skipped
if(${DEFINE})
set(VALID_LINE TRUE)
else(${DEFINE})
set(VALID_LINE FALSE)
endif(${DEFINE})
else(FOUND_IFDEF)
# If we found a #ifndef on the line, the same thing as #ifdef is done, except with the checks in the opposite direction
if(FOUND_IFNDEF)
# Extract the define
string(REGEX REPLACE "^[ \t]*#[ \t]*ifndef[ \t]*(.*)$" "\\1" DEFINE ${LINE})
# Replace _WIN32 with WIN32, so we can check if the WIN32 variable of CMake is set instead of _WIN32
if(DEFINE STREQUAL "_WIN32")
set(DEFINE WIN32)
endif(DEFINE STREQUAL "_WIN32")
# Set the last define to this one, and set the last check to false, so when #else is encountered, we can do an opposing check
set(LAST_DEF ${DEFINE})
set(LAST_CHECK FALSE)
# If the define is not true (it either doesn't exists or is a false result), the lines following will be checked, otherwise they will be skipped
if(${DEFINE})
set(VALID_LINE FALSE)
else(${DEFINE})
set(VALUE_LINE TRUE)
endif(${DEFINE})
else(FOUND_IFNDEF)
# If we found a #else on the line, we check the last define in the opposite direction
if(FOUND_ELSE)
# When LAST_CHECK is true, we were inside a #ifdef, now act as if we are entering a #ifndef section by doing an opposing check
if(LAST_CHECK)
if(${LAST_DEF})
set(VALID_LINE FALSE)
else(${LAST_DEF})
set(VALID_LINE TRUE)
endif(${LAST_DEF})
# When LAST_CHECK is false, we were inside a #ifndef, now act as if we are entering a #ifdef section by doing an opposing check
else(LAST_CHECK)
if(${LAST_DEF})
set(VALID_LINE TRUE)
else(${LAST_DEF})
set(VALID_LINE FALSE)
endif(${LAST_DEF})
endif(LAST_CHECK)
else(FOUND_ELSE)
# If we found a #endif on the line, we'll assume everything following the line is valid until we meet another one of the above lines
if(FOUND_ENDIF)
set(VALID_LINE TRUE)
else(FOUND_ENDIF)
# If we found a #include on the line, add the entire line to the list of includes unless the line isn't valid
if(FOUND_INCLUDE)
if(VALID_LINE)
append_to_list(INCLUDES_LIST "${LINE}")
endif(VALID_LINE)
endif(FOUND_INCLUDE)
endif(FOUND_ENDIF)
endif(FOUND_ELSE)
endif(FOUND_IFNDEF)
endif(FOUND_IFDEF)
endforeach(LINE)
set(${INCLUDES} ${INCLUDES_LIST})
endmacro(find_includes)
###############################################################################
# calculate_depends(<source filename> [<optional output variable for includes>])
#
# This macro is used in most of the src (sub)directories to calculate the
# header file dependencies for the given source file.
###############################################################################
macro(calculate_depends SRC)
# Temporarily set that we didn't get a 3rd argument before we actually check if we did get one or not
set(CHECK_ANGLE_INCLUDES FALSE)
# Check for a third argument
if(${ARGC} GREATER 1)
set(CHECK_ANGLE_INCLUDES TRUE)
endif(${ARGC} GREATER 1)
# Find all the lines in the given source file that have any form of #include on them, regardless of whitespace, but only if they are valid for the platform we are on
find_includes(${SRC} INCLUDES)
# Reset the list of headers to empty
set(HEADERS)
# Iterate through the strings containing #include (if any)
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE)
if(QUOTE_TYPE STREQUAL "angle brackets")
# The following checks will only be done if there was a request for angle includes to be checked
if(CHECK_ANGLE_INCLUDES)
# Find the path of the include file
if(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} PATHS ${DEFAULT_INCLUDE_DIRS} ${WSDK_PATH}/include $ENV{VCINSTALLDIR}/include ${EXTRA_INCLUDE})
else(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
find_path(FOUND_${FILENAME}_INCLUDE NAMES ${FILENAME} ${EXTRA_INCLUDE})
endif(DEFAULT_INCLUDE_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR})
# If the include file was found, add it's path to the list of include paths, but only if it doesn't already exist and isn't in the defaults for the compiler
if(FOUND_${FILENAME}_INCLUDE)
# This used to be find_in_list, but it was changed to this loop to do a find on each default include directory, this fixes Mac OS X trying to get it's framework directories in here
set(FOUND_IN_DEFAULTS -1)
foreach(DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIRS})
string(REGEX REPLACE "\\+" "\\\\+" DEFAULT_INCLUDE_DIR ${DEFAULT_INCLUDE_DIR})
string(REGEX MATCH ${DEFAULT_INCLUDE_DIR} FOUND_DEFAULT ${FOUND_${FILENAME}_INCLUDE})
if(FOUND_DEFAULT)
set(FOUND_IN_DEFAULTS 0)
endif(FOUND_DEFAULT)
endforeach(DEFAULT_INCLUDE_DIR)
if(FOUND_IN_DEFAULTS EQUAL -1)
find_in_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}" FOUND_IN_INCLUDES)
if(FOUND_IN_INCLUDES EQUAL -1)
append_to_list(${ARGV1} "${FOUND_${FILENAME}_INCLUDE}")
endif(FOUND_IN_INCLUDES EQUAL -1)
endif(FOUND_IN_DEFAULTS EQUAL -1)
else(FOUND_${FILENAME}_INCLUDE)
# XXX
if(NOT ${FILENAME} STREQUAL "libintl.h")
message(FATAL_ERROR "${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
endif(NOT ${FILENAME} STREQUAL "libintl.h")
endif(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
endif(QUOTE_TYPE STREQUAL "angle brackets")
endforeach(INCLUDE)
endmacro(calculate_depends)
############################################################################### ###############################################################################
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>) # calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
# #
@@ -433,10 +15,10 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
set(LIBRARIES) 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)
read_from_file(${SRC} "/\\\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES) file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredWindowsLibraries:[ \t]*.*[ \t]*\\*/")
else(WIN32) else()
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES) file(STRINGS ${SRC} REQUIRED_LIBRARIES REGEX "/\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\*/")
endif(WIN32) endif()
# 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
@@ -450,86 +32,55 @@ 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(${LIBRARY} MATCHES "^.+\\|.+$") endif()
# Locate the library to see if it exists # Locate the library to see if it exists
if(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR}) if(DEFAULT_LIBRARY_DIRS OR DEFINED $ENV{VCINSTALLDIR})
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} ${WSDK_PATH}/lib $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS}) find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${DEFAULT_LIBRARY_DIRS} $ENV{VCINSTALLDIR}/lib ${EXTRA_INCLUDE} ${EXTRA_LIBS})
else(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR}) else()
find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} NO_DEFAULT_PATH) find_library(FOUND_${LIBRARY}_LIBRARY NAMES ${LIBRARY} ${LIBRARY_ALT} PATHS ${EXTRA_INCLUDE} ${EXTRA_LIBS} 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(DEFAULT_LIBRARY_DIRS OR WSDK_PATH OR DEFINED $ENV{VCINSTALLDIR}) endif()
# If the library was found, we will add it to the linker flags # If 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
append_to_list(EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}") list(APPEND EXTRA_DEPENDENCIES "${FOUND_${LIBRARY}_LIBRARY}")
else(MSVC) else()
# 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)
append_to_list(LIBRARY_PATHS "${LIBRARY_PATH}") list(APPEND 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})
append_to_list(LIBRARIES ${LIBRARY_NAME}) list(APPEND LIBRARIES ${LIBRARY_NAME})
endif(MSVC) endif()
else(FOUND_${LIBRARY}_LIBRARY) else()
# 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(FOUND_${LIBRARY}_LIBRARY) endif()
endforeach(LIBRARY) endforeach()
endforeach(REQUIRED_LIBRARY) endforeach()
# Remove duplicates from the library paths # Remove duplicates from the library paths
if(LIBRARY_PATHS) if(LIBRARY_PATHS)
remove_list_duplicates(LIBRARY_PATHS) list(REMOVE_DUPLICATES LIBRARY_PATHS)
endif(LIBRARY_PATHS) endif()
# Remove diplicates from the libraries # Remove diplicates from the libraries
if(LIBRARIES) if(LIBRARIES)
remove_list_duplicates(LIBRARIES) list(REMOVE_DUPLICATES LIBRARIES)
endif(LIBRARIES) endif()
# 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})
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS) if(NOT "${LIBRARY_PATH}" IN_LIST DEFAULT_LIBRARY_DIRS)
if(FOUND_IN_DEFAULTS EQUAL -1)
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}") set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
endif(FOUND_IN_DEFAULTS EQUAL -1) endif()
endforeach(LIBRARY_PATH) endforeach()
# 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})
append_to_list(EXTRA_DEPENDENCIES "${LIBRARY}") list(APPEND EXTRA_DEPENDENCIES "${LIBRARY}")
endforeach(LIBRARY) endforeach()
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}") set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}") set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
endmacro(calculate_libraries) endmacro()
###############################################################################
# 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])
@@ -544,12 +95,12 @@ macro(add_to_cpack_ignored_files ITEM)
# If we have 2+ arguments, assume that the second one was something like TRUE (doesn't matter really) and convert periods so they will be \\. for CPack # If 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(${ARGC} GREATER 1) endif()
# 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(DEFINED ENV{CPACK_IGNORED_FILES}) else()
set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}") set(ENV{CPACK_IGNORED_FILES} "${REAL_ITEM}")
endif(DEFINED ENV{CPACK_IGNORED_FILES}) endif()
endmacro(add_to_cpack_ignored_files) endmacro()
-26
View File
@@ -1,26 +0,0 @@
# Find the header files, libs, and executables for gettext
if(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h /usr/include /usr/local/include ${EXTRA_INCLUDE})
find_library(GETTEXT_LIBRARY intl PATHS /usr/lib /usr/lib64 ${EXTRA_LIBS})
find_program(GETTEXT_MSGFMT msgfmt PATHS /usr/bin/ /usr/local/bin ${EXTRA_INCLUDE})
if(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
if(GETTEXT_LIBRARY)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
endif(GETTEXT_LIBRARY)
endif(GETTEXT_INCLUDE AND GETTEXT_MSGFMT)
else(NOT WIN32)
find_path(GETTEXT_INCLUDE libintl.h)
find_library(GETTEXT_LIBRARY gnuintl)
find_program(GETTEXT_MSGFMT msgfmt)
if(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
set(GETTEXT_FOUND TRUE)
set(GETTEXT_LIBRARIES ${GETTEXT_LIBRARY})
endif(GETTEXT_INCLUDE AND GETTEXT_LIBRARY AND GETTEXT_MSGFMT)
endif(NOT WIN32)
# If we found everything we need set variables correctly for lang/CMakeLists.txt to use
if(GETTEXT_FOUND)
include_directories("${GETTEXT_INCLUDE}")
set(GETTEXT_MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT})
endif(GETTEXT_FOUND)
-5
View File
@@ -1,5 +0,0 @@
# This file is external to the read_from_file macro in Anope.cmake in order to
# get around a possible memory leak in older versions of CMake.
file(READ "${FILE}" RESULT)
message("${RESULT}")
+2 -2
View File
@@ -1,6 +1,6 @@
# Only install example.chk and example.conf from this directory # Only install example.chk and anope.example.conf from this directory
# NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file) # NOTE: I would've had this just find all files in the directory, but that would include files not needed (like this file)
set(DATA example.chk botserv.example.conf example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf) set(DATA example.chk anope.example.conf botserv.example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf)
install(FILES ${DATA} install(FILES ${DATA}
DESTINATION ${CONF_DIR} DESTINATION ${CONF_DIR}
) )
+76 -88
View File
@@ -1,8 +1,8 @@
/* /*
* Example configuration file for Services. After making the appropriate * Example configuration file for Anope. After making the appropriate
* changes to this file, place it in the Services conf directory (as * changes to this file, place it in the Anope conf directory (as
* specified in the "configure" script, default /home/username/services/conf) * specified in the "Config" script, default /home/username/anope/conf)
* under the name "services.conf". * under the name "anope.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, Services will * Indicates a directive which must be given. Without it, Anope will
* not start. * not start.
* *
* [RECOMMENDED] * [RECOMMENDED]
@@ -71,7 +71,7 @@
* *
* [DEPRECATED] * [DEPRECATED]
* Indicates a directive which will disappear in a future version of * Indicates a directive which will disappear in a future version of
* Services, usually because its functionality has been either * Anope, usually because its functionality has been either
* superseded by that of other directives or incorporated into the main * superseded by that of other directives or incorporated into the main
* program. * program.
*/ */
@@ -110,7 +110,7 @@ define
#include #include
{ {
type = "executable" type = "executable"
name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/services.conf" name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/anope.conf"
} }
/* /*
@@ -120,7 +120,7 @@ define
* This section can be included multiple times, and Anope will attempt to * 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 Services * Each uplink IRCd should have a corresponding configuration to allow Anope
* 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,20 +161,22 @@ define
uplink uplink
{ {
/* /*
* The IP or hostname of the IRC server you wish to connect Services to. * The IP address, hostname, or UNIX socket path of the IRC server you wish
* Usually, you will want to connect Services over 127.0.0.1 (aka localhost). * to connect Anope to.
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
* *
* NOTE: On some shell providers, this will not be an option. * NOTE: On some shell providers, this will not be an option.
*/ */
host = "127.0.0.1" host = "127.0.0.1"
/* /*
* Enable if Services should connect using IPv6. * The protocol that Anope should use when connecting to the uplink. Can
* be set to "ipv4" (the default), "ipv6", or "unix".
*/ */
ipv6 = no protocol = "ipv4"
/* /*
* Enable if Services should connect using SSL. * Enable if Anope should connect using SSL.
* You must have an SSL module loaded for this to work. * You must have an SSL module loaded for this to work.
*/ */
ssl = no ssl = no
@@ -200,12 +202,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 Services will be seen as, it must have no conflicts with any * The hostname that Anope will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have * 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.
*/ */
@@ -215,11 +217,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 = "Services for IRC Networks" description = "Anope IRC Services"
/* /*
* The local address that Services will bind to before connecting to the remote * The local address that Anope will bind to before connecting to the remote
* server. This may be useful for multihomed hosts. If omitted, Services will let * server. This may be useful for multihomed hosts. If omitted, Anope 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
@@ -235,16 +237,16 @@ serverinfo
#id = "00A" #id = "00A"
/* /*
* The filename containing the Services process ID. The path is relative to the * The filename containing the Anope process ID. The path is relative to the
* services root directory. * services root directory.
*/ */
pid = "data/services.pid" pid = "data/anope.pid"
/* /*
* The filename containing the Message of the Day. The path is relative to the * The filename containing the Message of the Day. The path is relative to the
* services root directory. * services root directory.
*/ */
motd = "conf/services.motd" motd = "conf/motd.txt"
} }
/* /*
@@ -255,20 +257,17 @@ serverinfo
* *
* Supported: * Supported:
* - bahamut * - bahamut
* - charybdis
* - hybrid * - hybrid
* - inspircd12 * - inspircd
* - inspircd20
* - inspircd3
* - ngircd * - ngircd
* - plexus * - plexus
* - ratbox * - ratbox
* - unreal (for 3.2.x) * - solanum
* - unreal4 (for 4.x or later) * - unrealircd
*/ */
module module
{ {
name = "inspircd3" name = "inspircd"
/* /*
* 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
@@ -290,32 +289,32 @@ module
/* /*
* [REQUIRED] Network Information * [REQUIRED] Network Information
* *
* This section contains information about the IRC network that Services will be * This section contains information about the IRC network that Anope will be
* connecting to. * connecting to.
*/ */
networkinfo networkinfo
{ {
/* /*
* This is the name of the network that Services will be running on. * This is the name of the network that Anope will be running on.
*/ */
networkname = "LocalNet" 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
* Services being disconnected from the network. * Anope 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
* Services being disconnected from the network. * Anope 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
* Services being disconnected from the network. * Anope being disconnected from the network.
*/ */
hostlen = 64 hostlen = 64
@@ -331,7 +330,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 Services * include characters your IRCd doesn't support will cause your IRCd and/or Anope
* to break. Multibyte characters are not supported, nor are escape sequences. * 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.
@@ -343,7 +342,7 @@ 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 Services. * disallows could potentially break the IRCd and/or Anope.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
@@ -368,22 +367,22 @@ networkinfo
} }
/* /*
* [REQUIRED] Services Options * [REQUIRED] Anope Options
* *
* This section contains various options which determine how Services will operate. * This section contains various options which determine how Anope will operate.
*/ */
options 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. Services use this case map to compare, with * installed on your machine. Anope uses this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc. * 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.
@@ -409,23 +408,11 @@ options
#seed = 9866235 #seed = 9866235
/* /*
* If set, Services will perform more stringent checks on passwords. If this * Sets the number of invalid password tries before services removes a user
* 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.
@@ -467,7 +454,7 @@ options
/* /*
* 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.
* *
@@ -480,7 +467,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.
@@ -493,7 +480,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.
* *
@@ -502,14 +489,14 @@ options
#usestrictprivmsg = yes #usestrictprivmsg = yes
/* /*
* If set, Services will only show /stats o to IRC Operators. This directive * If set, Anope will only show /stats o to IRC Operators. This directive
* is optional. * 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 Services will * the servers in this list are allowed to set channel modes and Anope 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.
@@ -524,13 +511,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
@@ -540,7 +527,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/pcre" #regexengine = "regex/stdlib"
/* /*
* 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.
@@ -748,7 +735,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/oline operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop" admin = "global/* operserv/chankill operserv/mode operserv/kick operserv/akill operserv/s*line operserv/noop operserv/jupe operserv/set operserv/svsnick operserv/svsjoin operserv/svspart nickserv/getpass */drop"
servers = "squit" servers = "squit"
users = "oper" users = "oper"
other = "expire/* bados akill/*" other = "expire/* bados akill/*"
@@ -787,7 +774,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
@@ -800,13 +787,12 @@ log
* *
* memoserv/sendall memoserv/staff * memoserv/sendall memoserv/staff
* *
* nickserv/getpass nickserv/getemail nickserv/suspend nickserv/ajoin * nickserv/getemail nickserv/suspend nickserv/ajoin nickserv/list
* 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/keepmodes nickserv/saset/neverop
* *
* hostserv/set hostserv/del hostserv/list * hostserv/set hostserv/del hostserv/list
* *
@@ -818,7 +804,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/oline operserv/kill * operserv/shutdown operserv/svs 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,
@@ -872,7 +858,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/oline operserv/noop operserv/forbid global/*" commands = "botserv/* chanserv/access/list chanserv/drop chanserv/getkey chanserv/saset/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/news operserv/jupe operserv/svs operserv/stats operserv/noop operserv/forbid global/*"
privs = "*" privs = "*"
} }
@@ -890,10 +876,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 Services access). * The default is to comment these out (so NOBODY will have access).
* You probably want to add yourself and a few other people at minimum. * You probably want to add yourself and a few other people at minimum.
* *
* As with all permissions, make sure to only give trustworthy people access to Services. * As with all permissions, make sure to only give trustworthy people access.
*/ */
#oper #oper
@@ -904,7 +890,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 Services /* If set, the user must be an oper on the IRCd to gain their
* oper privileges. * oper privileges.
*/ */
require_oper = yes require_oper = yes
@@ -939,7 +925,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.
* *
@@ -950,7 +936,7 @@ opertype
mail mail
{ {
/* /*
* If set, this option enables the mail commands in Services. You may choose * If set, this option enables the mail commands in Anope. You may choose
* to disable it if you have no Sendmail-compatible mailer installed. Whilst * 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 yes.
@@ -967,6 +953,9 @@ mail
* it. This one usually needs no parameters on the command-line. Most * it. This one usually needs no parameters on the command-line. Most
* sendmail applications (or replacements of it) require the -t option * sendmail applications (or replacements of it) require the -t option
* to be used. * to be used.
*
* If you are running on Windows you should use a Windows sendmail port
* like https://www.glob.com.au/sendmail/ for sending emails.
*/ */
sendmailpath = "/usr/sbin/sendmail -t" sendmailpath = "/usr/sbin/sendmail -t"
@@ -981,7 +970,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.
@@ -989,7 +978,7 @@ mail
delay = 5m delay = 5m
/* /*
* If set, Services will not attempt to put quotes around the TO: fields * If set, Anope will not put quotes around the TO: fields
* in e-mails. * 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
@@ -1126,18 +1115,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, Services won't backup the databases. * or if you set it to 0, Anope won't backup the databases.
* *
* NOTE: Services must run 24 hours a day for this feature to work. * NOTE: Anope must run 24 hours a day for this feature to work.
* *
* This directive is optional, but recommended. * This directive is optional, but recommended.
*/ */
keepbackups = 3 keepbackups = 3
/* /*
* Allows Services to continue file write operations (i.e. database saving) * Allows Anope to continue file write operations (i.e. database saving)
* even if the original file cannot be backed up. Enabling this option may * even if the original file cannot be backed up. Enabling this option may
* allow Services to continue operation under conditions where it might * allow Anope to continue operation under conditions where it might
* otherwise fail, such as a nearly-full disk. * 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
@@ -1257,14 +1246,13 @@ module
#module { name = "enc_bcrypt" } #module { name = "enc_bcrypt" }
module { name = "enc_sha256" } module { name = "enc_sha256" }
/* /*
* When using enc_none, passwords will be stored without encryption. This isn't secure * [DEPRECATED] Deprecated encryption modules. You can only use these for compatibility with
* therefore it is not recommended. * old databases and will need to load one of the above modules as your primary encryption
*/ * module.
#module { name = "enc_none" } */
/* Deprecated encryption modules */
#module { name = "enc_md5" } #module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_sha1" } #module { name = "enc_sha1" }
/* /*
+1
View File
@@ -323,6 +323,7 @@ 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"
+54 -2
View File
@@ -110,9 +110,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, but recommended.
* If not set, the default is 14 days. * If not set, the default is 30 days.
*/ */
expire = 14d expire = 30d
/* /*
* The maximum number of entries on a channel's access list. * The maximum number of entries on a channel's access list.
@@ -216,6 +216,7 @@ 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"
@@ -232,6 +233,7 @@ 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"
@@ -248,6 +250,7 @@ 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"
@@ -264,6 +267,7 @@ 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"
@@ -280,6 +284,7 @@ privilege
privilege privilege
{ {
name = "AUTOHALFOP" name = "AUTOHALFOP"
desc = _("Automatic halfop upon join")
rank = 100 rank = 100
level = 4 level = 4
flag = "H" flag = "H"
@@ -296,6 +301,7 @@ 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"
@@ -312,6 +318,7 @@ privilege
privilege privilege
{ {
name = "AUTOOWNER" name = "AUTOOWNER"
desc = _("Automatic owner upon join")
rank = 330 rank = 330
level = 9999 level = 9999
flag = "Q" flag = "Q"
@@ -328,6 +335,7 @@ privilege
privilege privilege
{ {
name = "AUTOPROTECT" name = "AUTOPROTECT"
desc = _("Automatic protect upon join")
rank = 240 rank = 240
level = 10 level = 10
flag = "A" flag = "A"
@@ -344,6 +352,7 @@ privilege
privilege privilege
{ {
name = "AUTOVOICE" name = "AUTOVOICE"
desc = _("Automatic voice on join")
rank = 50 rank = 50
level = 3 level = 3
flag = "V" flag = "V"
@@ -360,6 +369,7 @@ 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"
@@ -376,6 +386,7 @@ privilege
privilege privilege
{ {
name = "BAN" name = "BAN"
desc = _("Allowed to ban users")
rank = 150 rank = 150
level = 4 level = 4
flag = "b" flag = "b"
@@ -392,6 +403,7 @@ 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"
@@ -411,6 +423,7 @@ 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"
@@ -428,6 +441,7 @@ 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"
@@ -445,6 +459,7 @@ 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"
@@ -462,6 +477,7 @@ 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"
@@ -479,6 +495,7 @@ 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"
@@ -496,6 +513,7 @@ 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"
@@ -512,6 +530,7 @@ 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"
@@ -529,6 +548,7 @@ 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"
@@ -546,6 +566,7 @@ 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"
@@ -562,6 +583,7 @@ 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"
@@ -579,6 +601,7 @@ 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"
@@ -596,6 +619,7 @@ 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"
@@ -613,6 +637,7 @@ 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"
@@ -630,6 +655,7 @@ 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"
@@ -647,6 +673,7 @@ 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"
@@ -664,6 +691,7 @@ 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"
@@ -681,6 +709,7 @@ 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"
@@ -700,6 +729,7 @@ 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"
@@ -717,6 +747,7 @@ 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"
@@ -733,6 +764,7 @@ 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"
@@ -749,12 +781,30 @@ 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.
* *
@@ -766,6 +816,7 @@ 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"
@@ -783,6 +834,7 @@ 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"
+4 -4
View File
@@ -9,16 +9,16 @@
############################################################### ###############################################################
# Anope binary directory # Anope binary directory
ANOPATH=/home/ircd/services/bin ANOPATH=/home/ircd/anope/bin
# Anope data directory # Anope data directory
ANODATA=/home/ircd/services/data ANODATA=/home/ircd/anope/data
# Name of the pid file # Name of the pid file
ANOPIDF=services.pid ANOPIDF=anope.pid
# Name of the executable # Name of the executable
ANOPROG=services ANOPROG=anope
# Parameters to pass to the executable # Parameters to pass to the executable
ANOARGS="" ANOARGS=""
+3 -3
View File
@@ -66,7 +66,7 @@ module
client = "Global" client = "Global"
/* /*
* This is the global message that will be sent when Services are being * This is the global message that will be sent when Anope is being
* shutdown/restarted. * 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 Services (re)join the * This is the global message that will be sent when Anope (re)joins 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, Services will hide the IRC Operator's nick in a global * If set, Anope will hide the IRC Operator's nick in a global
* message/notice. * message/notice.
* *
* This directive is optional. * This directive is optional.
+4 -4
View File
@@ -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 = false syncongroup = true
/* /*
* This makes vhosts act as if they are per account. * This makes vhosts act as if they are per account.
*/ */
synconset = false synconset = true
} }
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, Services will send a memo to the user requesting a vHost when it's been * If set, Anope will send a memo to the user requesting a vHost when it's been
* approved or rejected. * approved or rejected.
*/ */
#memouser = yes #memouser = yes
/* /*
* If set, Services will send a memo to all Services staff when a new vHost is requested. * If set, Anope will send a memo to all services staff when a new vHost is requested.
*/ */
#memooper = yes #memooper = yes
} }
+31 -17
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 Services connecting to your network. * adding a module block. These modules will be loaded prior to Anope connecting to your network.
* *
* Note that some of these modules are labeled EXTRA, and must be enabled prior to compiling by * 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.
@@ -91,14 +91,14 @@ module { name = "help" }
name = "m_dnsbl" name = "m_dnsbl"
/* /*
* If set, Services will check clients against the DNSBLs when services connect to its uplink. * If set, Anope will check clients against the DNSBLs when services connect to its uplink.
* This is not recommended, and on large networks will open a very large amount of DNS queries. * 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, Services will check clients when coming back from a netsplit. This can cause a large number * If set, Anope will check clients when coming back from a netsplit. This can cause a large number
* of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL * of DNS queries open at once. Whilst services are not drastically affected by this, your nameserver/DNSBL
* might care. * might care.
*/ */
@@ -319,7 +319,7 @@ module { name = "help" }
* 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 m_ldap. * via LDAP group membership. Requires m_ldap.
* *
* Note that this doesn't give the user privileges on the IRCd, only in Services. * Note that this doesn't give the user privileges on the IRCd, only in Anope.
*/ */
#module #module
{ {
@@ -400,19 +400,11 @@ module { name = "help" }
} }
} }
/*
* m_regex_pcre [EXTRA]
*
* Provides the regex engine regex/pcre, which uses version 1 of the Perl Compatible Regular
* Expressions library. This can not be loaded at the same time as the m_regex_pcre2 module.
*/
#module { name = "m_regex_pcre" }
/* /*
* m_regex_pcre2 [EXTRA] * m_regex_pcre2 [EXTRA]
* *
* 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. This can not be loaded at the same time as the m_regex_pcre module. * Expressions library.
*/ */
#module { name = "m_regex_pcre2" } #module { name = "m_regex_pcre2" }
@@ -420,10 +412,32 @@ module { name = "help" }
* m_regex_posix [EXTRA] * m_regex_posix [EXTRA]
* *
* 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 = "m_regex_posix" } #module { name = "m_regex_posix" }
/*
* m_regex_stdlib
*
* Provides the regex engine regex/stdlib, which uses the regular expression library that is part of
* the C++ standard library.
*/
module
{
name = "m_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"
}
/* /*
* m_regex_tre [EXTRA] * m_regex_tre [EXTRA]
* *
@@ -546,8 +560,8 @@ module { name = "help" }
/* /*
* m_sasl * m_sasl
* *
* Some IRCds allow "SASL" authentication to let users identify to Services * Some IRCds allow "SASL" authentication to let users identify to services
* during the IRCd user registration process. If this module is loaded, Services will allow * during the IRCd user registration process. If this module is loaded, Anope will allow
* authenticating users through this mechanism. Supported mechanisms are: * authenticating users through this mechanism. Supported mechanisms are:
* PLAIN, EXTERNAL. * PLAIN, EXTERNAL.
*/ */
@@ -710,7 +724,7 @@ module { name = "m_sasl" }
/* 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 services.conf. * The oper types must be configured earlier in anope.conf.
* *
* If a field named modes is returned from this query then those modes are set on the user. * 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.
+32 -31
View File
@@ -107,8 +107,9 @@ 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
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires * - neverop: User can not be added to access lists
* options:useprivmsg to be enabled as well * - msg: Messages will be sent as PRIVMSGs instead of NOTICEs, requires options:useprivmsg
* to be enabled as well
* - ns_keep_modes: Enables keepmodes, which retains user modes across sessions * - ns_keep_modes: Enables keepmodes, which retains user modes across sessions
* - ns_no_expire: Enables no expire. Unconfirmed expire overrules this. * - ns_no_expire: Enables no expire. Unconfirmed expire overrules this.
* *
@@ -126,20 +127,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 21 days. * This directive is optional, but recommended. If not set, the default is 90 days.
*/ */
expire = 21d expire = 90d
/* /*
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND, * Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND
* GETPASS and SET PASSWORD commands by services operators on other services operators. * 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, Services will set the channel modes a user has access to upon identifying, assuming * If set, Anope will set the channel modes a user has access to upon identifying, assuming
* they are not already set. * they are not already set.
* *
* This directive is optional. * This directive is optional.
@@ -147,14 +148,14 @@ module
modeonid = yes modeonid = yes
/* /*
* If set, Services will set these user modes on any user who identifies. * If set, Anope will set these user modes on any user who identifies.
* *
* This directive is optional. * This directive is optional.
*/ */
#modesonid = "+R" #modesonid = "+R"
/* /*
* If set, Services will not show netsplits in the last quit message field * If set, Anope will not show netsplits in the last quit message field
* of NickServ's INFO command. * of NickServ's INFO command.
*/ */
hidenetsplitquit = no hidenetsplitquit = no
@@ -168,7 +169,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 +182,14 @@ module
#restrictopernicks = yes #restrictopernicks = yes
/* /*
* The username, and possibly hostname, used for fake users created when Services needs to * The username, and possibly hostname, used for fake users created when Anope needs to
* hold a nickname. * hold a nickname.
*/ */
enforceruser = "enforcer" enforceruser = "enforcer"
enforcerhost = "services.host" enforcerhost = "services.host"
/* /*
* The length of time Services hold nicknames. * The length of time Anope should hold nicknames for.
* *
* This directive is optional, but recommended. If not set it defaults to 1 minute. * This directive is optional, but recommended. If not set it defaults to 1 minute.
*/ */
@@ -204,16 +205,23 @@ module
guestnickprefix = "Guest" guestnickprefix = "Guest"
/* /*
* If set, Services do not allow ownership of nick names, only ownership of accounts. * If set, Anope does not allow ownership of nick names, only ownership of accounts.
*/ */
nonicknameownership = no 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.
*/ */
passlen = 32 maxpasslen = 32
} }
/* /*
@@ -259,7 +267,7 @@ module
accessmax = 32 accessmax = 32
/* /*
* If set, Services will add the usermask of registering users to the access list of their * If set, Anope will add the usermask of registering users to the access list of their
* newly created account. If not set, users will always have to identify to NickServ before * 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.
@@ -335,18 +343,6 @@ 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"; }
/*
* 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
* *
@@ -457,7 +453,7 @@ module
name = "ns_recover" name = "ns_recover"
/* /*
* If set, Services will svsnick and svsjoin users who use the recover * If set, Anope will svsnick and svsjoin users who use the recover
* command on an identified user to the nick and channels of the recovered user. * command on an identified user to the nick and channels of the recovered user.
* *
* This directive is optional. * This directive is optional.
@@ -465,9 +461,10 @@ 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.
#command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; } # For compatibility with Anope 1.8 and Atheme.
#command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; } command { service = "NickServ"; name = "GHOST"; command = "nickserv/recover"; hide = true; }
command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover"; hide = true; }
/* /*
* ns_register * ns_register
@@ -536,6 +533,7 @@ 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
@@ -580,6 +578,9 @@ 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"; }
+12 -23
View File
@@ -75,7 +75,7 @@ module
sqlineexpiry = 30d sqlineexpiry = 30d
/* /*
* If set, this option will make Services send an AKILL command immediately after it has been * If set, this option will make Anope send an AKILL command immediately after it has been
* added with AKILL ADD. This eliminates the need for killing the user after the AKILL has * 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 Services send an (SVS)KILL command immediately after SNLINE ADD. * If set, this option will make Anope send an (SVS)KILL command immediately after SNLINE ADD.
* This eliminates the need for killing the user after the SNLINE has been added. * This 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 Services send an (SVS)KILL command immediately after SQLINE ADD. * If set, this option will make Anope send an (SVS)KILL command immediately after SQLINE ADD.
* This eliminates the need for killing the user after the SQLINE has been added. * This eliminates the need for killing the user after the SQLINE has been added.
* *
* 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 Services up. Level 5 constitutes normal operation * Default DefCon level (1-5) to use when starting Anope up. Level 5 constitutes normal operation
* while level 1 constitutes the most restrictive operation. If this setting is left out or set to * 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.
*/ */
@@ -184,8 +184,8 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* - forcechanmodes: Forces all channels to have the modes given in the later chanmodes directive * - forcechanmodes: Forces all channels to have the modes given in the later chanmodes directive
* - reducedsessions: Reduces the session limit to the value given in the later sessionlimit directive * - reducedsessions: Reduces the session limit to the value given in the later sessionlimit directive
* - nonewclients: KILL any new clients trying to connect * - nonewclients: KILL any new clients trying to connect
* - operonly: Services will ignore all non-IRCops * - operonly: Ignore all non-IRCops
* - silentoperonly: Services will silently ignore all non-IRCops * - silentoperonly: Silently ignore all non-IRCops
* - akillnewclients: AKILL any new clients trying to connect * - akillnewclients: AKILL any new clients trying to connect
* - nonewmemos: No new memos will be sent to block MemoServ attacks * - nonewmemos: No new memos will be sent to block MemoServ attacks
*/ */
@@ -209,7 +209,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* The channel modes to set on all channels when the DefCon channel mode system is in use. * 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, Services will set the reverse on all channels, e.g. if this setting * the mode setting selected, Anope will set the reverse on all channels, e.g. if this setting
* is +RN when DefCon is used, all channels will be set to +RN, when DefCon is removed, all * 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, Services will send a global message on DefCon level changes. * If set, Anope will send a global message on DefCon level changes.
* *
* This directive is optional. * This directive is optional.
*/ */
#globalondefcon = yes #globalondefcon = yes
/* /*
* If set, Services will send the global message defined in the message directive on DefCon level * If set, Anope will send the global message defined in the message directive on DefCon level
* changes. * changes.
* *
* This directive is optional. * This directive is optional.
@@ -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 Services ignore users. * Used to make Anope 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,17 +506,6 @@ 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"; }
/*
* 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
* *
@@ -532,7 +521,7 @@ command { service = "OperServ"; name = "OPER"; command = "operserv/oper"; permis
* *
* Provides the command operserv/reload. * Provides the command operserv/reload.
* *
* Used to reload the services.conf configuration file. * Used to reload the anope.conf configuration file.
*/ */
module { name = "os_reload" } 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"; }
@@ -595,7 +584,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 Services to add an AKILL if the number of subsequent kills * If set and is not 0, this directive tells Anope to add an AKILL if the number of subsequent kills
* for the same host exceeds this value, preventing the network from experiencing KILL floods. * for the same host exceeds this value, preventing the network from experiencing KILL floods.
* *
* This directive is optional. * This directive is optional.
+38 -39
View File
@@ -1,8 +1,8 @@
/* /*
* Example configuration file for Services. After making the appropriate * Example configuration file for Anope. After making the appropriate
* changes to this file, place it in the Services conf directory (as * changes to this file, place it in the Anope conf directory (as
* specified in the "configure" script, default /home/username/services/conf) * specified in the "Config" script, default /home/username/anope/conf)
* under the name "services.conf". * under the name "anope.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, Services will * Indicates a directive which must be given. Without it, Anope will
* not start. * not start.
* *
* [RECOMMENDED] * [RECOMMENDED]
@@ -71,7 +71,7 @@
* *
* [DEPRECATED] * [DEPRECATED]
* Indicates a directive which will disappear in a future version of * Indicates a directive which will disappear in a future version of
* Services, usually because its functionality has been either * Anope, usually because its functionality has been either
* superseded by that of other directives or incorporated into the main * superseded by that of other directives or incorporated into the main
* program. * program.
*/ */
@@ -120,7 +120,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 Services * Each uplink IRCd should have a corresponding configuration to allow Anope
* 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
@@ -158,20 +158,22 @@ define
uplink uplink
{ {
/* /*
* The IP or hostname of the IRC server you wish to connect Services to. * The IP address, hostname, or UNIX socket path of the IRC server you wish
* Usually, you will want to connect Services over 127.0.0.1 (aka localhost). * to connect Anope to.
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
* *
* NOTE: On some shell providers, this will not be an option. * NOTE: On some shell providers, this will not be an option.
*/ */
host = "127.0.0.1" host = "127.0.0.1"
/* /*
* Enable if Services should connect using IPv6. * The protocol that Anope should use when connecting to the uplink. Can
* be set to "ipv4" (the default), "ipv6", or "unix".
*/ */
ipv6 = no protocol = "ipv4"
/* /*
* Enable if Services should connect using SSL. * Enable if Anope should connect using SSL.
* You must have an SSL module loaded for this to work. * You must have an SSL module loaded for this to work.
*/ */
ssl = no ssl = no
@@ -197,12 +199,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 Services will be seen as, it must have no conflicts with any * The hostname that Anope will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have * 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.
*/ */
@@ -212,11 +214,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 = "Stats for IRC Networks" description = "Anope IRC Statistics"
/* /*
* The local address that Services will bind to before connecting to the remote * The local address that Anope will bind to before connecting to the remote
* server. This may be useful for multihomed hosts. If omitted, Services will let * server. This may be useful for multihomed hosts. If omitted, Anope 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
@@ -232,16 +234,16 @@ serverinfo
#id = "00A" #id = "00A"
/* /*
* The filename containing the Services process ID. The path is relative to the * The filename containing the Anope process ID. The path is relative to the
* services root directory. * services root directory.
*/ */
pid = "data/stats.pid" pid = "data/anope.pid"
/* /*
* The filename containing the Message of the Day. The path is relative to the * The filename containing the Message of the Day. The path is relative to the
* services root directory. * services root directory.
*/ */
motd = "conf/stats.motd" motd = "conf/motd.txt"
} }
/* /*
@@ -252,51 +254,48 @@ serverinfo
* *
* Supported: * Supported:
* - bahamut * - bahamut
* - charybdis
* - hybrid * - hybrid
* - inspircd12 * - inspircd
* - inspircd20
* - inspircd3
* - ngircd * - ngircd
* - plexus * - plexus
* - ratbox * - ratbox
* - unreal (for 3.2.x) * - solanum
* - unreal4 (for 4.x or later) * - unrealircd
*/ */
module module
{ {
name = "inspircd3" name = "inspircd"
} }
/* /*
* [REQUIRED] Network Information * [REQUIRED] Network Information
* *
* This section contains information about the IRC network that Services will be * This section contains information about the IRC network that Anope will be
* connecting to. * connecting to.
*/ */
networkinfo networkinfo
{ {
/* /*
* This is the name of the network that Services will be running on. * This is the name of the network that Anope will be running on.
*/ */
networkname = "LocalNet" 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
* Services being disconnected from the network. * Anope 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
* Services being disconnected from the network. * Anope 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
* Services being disconnected from the network. * Anope being disconnected from the network.
*/ */
hostlen = 64 hostlen = 64
@@ -314,7 +313,7 @@ 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 Services. * disallows could potentially break the IRCd and/or Anope.
* *
* It is recommended you DON'T change this. * It is recommended you DON'T change this.
*/ */
@@ -339,22 +338,22 @@ networkinfo
} }
/* /*
* [REQUIRED] Services Options * [REQUIRED] Anope Options
* *
* This section contains various options which determine how Services will operate. * This section contains various options which determine how Anope will operate.
*/ */
options 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. Services use this case map to compare, with * installed on your machine. Anope uses this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc. * 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.
@@ -378,14 +377,14 @@ options
warningtimeout = 4h warningtimeout = 4h
/* /*
* If set, Services will only show /stats o to IRC Operators. This directive * If set, Anope will only show /stats o to IRC Operators. This directive
* is optional. * 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 Services will * the servers in this list are allowed to set channel modes and Anope 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.
+2 -2
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(IN_SOURCE) endif()
set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt) set(DOCS Changes Changes.conf DEFCON FAQ INSTALL LANGUAGE MODULES 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(WIN32) endif()
+21 -437
View File
@@ -1,440 +1,24 @@
Anope Version 2.0.15-git Anope Version 2.1.1
------------------------
No significant changes.
Anope Version 2.0.14
--------------------
Added support for sqlining channels on UnrealIRCd.
Fixed a crash when trying to access config for non-loaded modules.
Fixed detection of the InspIRCd nopartmsg module.
Fixed not getting memo notifications when authing with SASL.
Fixed not serialising dontkickops/dontkickvoices in botserv/kick.
Fixed sending emails with the wrong kind of line terminator.
Fixed sending log messages from a renamed pseudoclient.
Fixed telling users their passcode is incorrect when they need to authenticate in nickserv/confirm.
Fixed the Config script freezing on some versions of util-linux.
Updated the Windows packaging scripts to use dependencies from Conan.
Anope Version 2.0.13
--------------------
Fixed a crash on some compilers when trying to call methods on a null pointer
Fixed a crash when encountering an unterminated commented config block
Fixed erroneously rejecting spaces in fantasy:name
Fixed marking services pseudoclients as an oper on InspIRCd
Fixed not checking user@ip as well as user@host when logging into an operator account
Fixed setting the vhost/vident during SASL on UnrealIRCd
Updated the German translation
Updated the Italian translation
Anope Version 2.0.12
--------------------
Added account confirmation to the web panel
Added the regex_pcre2 module which provides regex/pcre with PCRE2
Documented the cs_no_expire channel default
Fixed config validation mistakenly allowing spaces in some fields
Fixed the bahamut protocol module not knowing about halfops
Fixed writing a flatfile database not being atomic
Updated the hybrid protocol module for recent protocol changes
Anope Version 2.0.11
--------------------
Fixed ldap on OpenLDAP 2.5+
Fixed not using utf-8 encoding for outgoing email
Fixed ns_resetpass not returning a response for XMLRPC
Fixed some message params being sent as <middle> instead of <trailing>
Fixed unsetting vhosts on unreal4
Fixed username validity checking on ircd-hybrid
Send the oper mode for services pseudoclients on InspIRCd
Updated the pl_PL translation
Updated unreal4 for various protocol changes
Anope Version 2.0.10
--------------------
Add support for channel SQLines on InspIRCd
Change default protocol module from inspircd20 to inspircd3
Change the character set used by chanstats and irc2sql to utf8mb4
Fix a ton of typos in messages
Fix being able to override MAXLIST on InspIRCd
Fix blocking on boot when trying to upgrade SQL databases without account identifiers
Fix not flushing the ERROR message on squit
Fix using an invalidated iterator when deleting bots
Fix various harmless compiler warnings
Fix webcpanel not using the forwarded IP
Show the account name in nickserv/info
Anope Version 2.0.9
------------------- -------------------
Fix a regression from 2.0.8 that prevented serialising to MySQL Added the UNBANME privilege to allow users to unban themselves.
Send account identifiers to InspIRCd on SASL logins too Fixed building on Windows systems without chgrp/chmod.
Fix a query bug in irc2sql Fixed creating sockets in the m_dns, m_httpd, m_proxyscan, and m_redis modules.
Fixed reading the values of command line arguments.
Moved core privilege descriptions to the example configs.
Updated the Italian translation.
Updated the Polish translation.
Anope Version 2.0.8 Anope Version 2.1.0
------------------- -------------------
Add +K channel mode for ircd-hybrid Added support for access list entry descriptions.
Add immutable identifiers to user accounts Added support for linking over a UNIX socket.
Fix build on systems that use musl libc Added support for server-initiated logins and logouts on UnrealIRCd.
Fix help of global/global not showing the correct origin nick Added support for server-initiated logouts on InspIRCd.
Fix not removing vhosts when an nick is dropped Added support for the ANONYMOUS SASL mechanism.
Fix parsing channel metadata on InspIRCd 3+ Allowed users to opt-out of being added to channel access lists.
Fix parsing kicks on InspIRCd 3+ Cleaned up the codebase to use Modern C++17.
Fix parsing topic changes on InspIRCd 3+ Modernized the build system to use a modern version of CMake.
Fix topiclock on InspIRCd Removed support for using insecure encryption methods as the primary method.
Modernize the ircd-hybrid protocol module Removed the Windows-only anopesmtp tool.
Removed the two day X-line cap.
Updated all references to IRCServices to refer to Anope instead.
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.
+15 -229
View File
@@ -1,232 +1,18 @@
Anope Version 2.0.15-git Anope Version 2.1.1
------------------------
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
------------------- -------------------
No significant changes. Added the m_regex_stdlib module.
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
Anope Version 2.0.8 Anope Version 2.1.0
------------------- -------------------
Fix ns_register:unconfirmedexpire not being used Added nickserv:minpasslen for configuring the minimum password length.
Removed nickserv:strictpasswords as it is obsolete now nickserv:minpasslen exists.
Anope Version 2.0.7 Removed the inspircd12 and inspircd20 modules (use inspircd instead).
------------------- Removed the ns_getpass module (no supported encryption modules).
Add nickserv/recover permission Removed the os_oline module (no supported IRCds).
Add inspircd3 protocol module Removed the unreal module (use unrealircd instead).
Add default permission for chanstats saset chanstats command Renamed nickserv:passlen to nickserv:maxpasslen.
Renamed the charybdis module to solanum.
Anope Version 2.0.6 Renamed the inspircd3 module to inspircd.
------------------- Renamed the unreal4 module to unrealircd.
Mark enc_md5 and enc_sha1 as deprecated. Their use has been discouraged for years, and they will be removed in a future release. Replaced uplink:ipv6 with uplink:protocol.
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.
+3 -3
View File
@@ -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 Services, and the ircd on which they It is used to prevent abuse to both Anope, and the IRCd on which they
are running. Also to protect the users, primarily in the event of Clones 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
Services will ignore everyone but opers Ignore everyone but opers
Services will silently ignore everyone but opers 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
+2 -5
View File
@@ -22,13 +22,10 @@ Anope Internal Events
The full list of functions and parameters are in modules.h. In this The full list of functions and parameters are in modules.h. In this
case, you would be overriding OnJoinChannel() and OnPartChannel() like so: case, you would be overriding OnJoinChannel() and OnPartChannel() like so:
void OnJoinChannel(User *u, Channel *c) anope_override { } void OnJoinChannel(User *u, Channel *c) override { }
void OnPartChannel(User *u, Channel *c) anope_override { } void OnPartChannel(User *u, Channel *c) override { }
Some of these event overrides can be used to prevent or allow things to 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 happen that would normally not be allowed or denied. You can also use
ModuleManager (not explained here) to set control which order the modules ModuleManager (not explained here) to set control which order the modules
are queried (when multiple modules hook to the same event). 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.
+11 -11
View File
@@ -52,8 +52,8 @@ Note: You should also read the README and FAQ files!
cause trouble on your network if passwords are not encrypted, or read 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, ~/services/conf). Copy the example Now go into the conf directory (by default, ~/anope/conf). Copy the example
configuration file (example.conf) to services.conf, and open the latter configuration file (anope.example.conf) to anope.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
@@ -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 example.conf. fresh configuration file from anope.example.conf.
3) Setting up the IRCd 3) Setting up the IRCd
Services acts as an IRC server with pseudo-clients on it. To link them to Anope acts as an IRC server with pseudo-clients on it. To link them to
your network, you'll need to configure your IRCd to allow services to link. 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 example.conf for some of the Example link configurations can be found in anope.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
~/services/bin). Type ./services to launch Anope. ~/anope/bin). Type ./anope to launch Anope.
If there are syntax errors in the configuration file they will be 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 Services at least one minute to link to your network, as certain Give Anope at least one minute to link to your network, as certain
IRCds on some OSes may be really slow for the link process. If nothing 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 ./services -debug -nofork to see any errors that it to launch Anope with ./anope -debug -nofork to see any errors that it
encounters, and try to correct them. 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 ~/services/conf) to services.chk and edit it. You'll need to this is ~/anope/conf) to anope.chk and edit it. You'll need to
modify the CONFIGURATION part of the file. Then ensure that the file is modify the CONFIGURATION part of the file. Then ensure that the file is
marked as executable by typing chmod +x services.chk, and try to launch the marked as executable by typing chmod +x anope.chk, and try to launch the
script to see if it works (Anope must not be running when you do this ;)) 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/services/conf/services.chk >/dev/null 2>&1 */5 * * * * /home/ircd/anope/conf/anope.chk >/dev/null 2>&1
The */5 at the beginning means "check every 5 minutes". You may replace The */5 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
+11 -11
View File
@@ -55,9 +55,9 @@ 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, ~/services/conf). Allez maintenant dans le répertoire conf (par défaut, ~/anope/conf).
Copiez l'exemple de fichier de configuration (example.conf) en Copiez l'exemple de fichier de configuration (anope.example.conf) en
services.conf et ouvrez ce dernier avec votre éditeur de texte favori. anope.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
@@ -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 example.conf. fichier anope.example.conf.
3) Configuration de l'IRCd 3) Configuration de l'IRCd
Les Services agissent comme un serveur IRC avec des pseudo-clients. Anope agit comme un serveur IRC avec des pseudo-clients.
Pour les relier à votre réseau, vous aurez besoin de configurer votre 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 example.conf pour certains des IRCd les plus populaires. le fichier anope.example.conf pour certains des IRCd les plus populaires.
Souvenez-vous de /rehash votre IRCd pour appliquer les changements. 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, ~/services/bin). Tapez ./services pour lancer Anope. (par défaut, ~/anope/bin). Tapez ./anope pour lancer Anope.
S'il y a des erreurs de syntaxe dans le fichier de configuration, elles 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 ./services -debug -nofork pour voir de lancer Anope en mode debug avec ./anope -debug -nofork pour voir
toutes les erreurs rencontrées et essayez de les corriger. 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, ~/services/conf) en services.chk et modifiez-le. d'Anope (par défaut, ~/anope/conf) en anope.chk et modifiez-le.
Vous aurez besoin de modifier la partie CONFIGURATION du fichier. 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 services.chk et essayez de lancer le script pour voir tapant chmod +x anope.chk et essayez de lancer le script pour voir
si cela fonctionne (Anope ne doit pas être en marche lorsque vous 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/services/conf/services.chk > /dev/null 2>&1 */5 * * * * /home/ircd/anope/conf/anope.chk > /dev/null 2>&1
Le */5 au début signifie "vérifier toutes les 5 minutes". Vous pouvez 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).
+1 -1
View File
@@ -26,7 +26,7 @@ Anope Multi Language Support
Anope uses gettext (https://www.gnu.org/software/gettext/) to translate messages for users. To add a new language 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 services.conf. translating. Once you are done simply rerun ./Config; make && make install and add the language to your anope.conf.
Note that on Windows it is not quite this simple, windows.cpp must be edited and Anope recompiled and restarted. 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
+2 -2
View File
@@ -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 ~/services/data/modules). be ~/anope/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 ~/services/ 4. Run `make install` to copy the compiled binaries to the ~/anope/
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.
+5 -5
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 1.2 or later * InspIRCd 3 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
* UnrealIRCd 3.2 or later * Solanum (all versions)
* UnrealIRCd 4 or later
Anope could also work with some of the daemons derived by the ones listed 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 Services is running using OperServ's SET DEBUG command.) debugging while Anope is running using OperServ's SET DEBUG command.)
If you repeat use --debug=<level>, the debugging level will be increased, 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,
+2 -2
View File
@@ -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 "Services for IRC Networks" HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "Anope IRC Services"
Note if you are using HSET instead of HMSET you will need to use a transaction, as shown in the above example. 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 (Services for IRC Networks) connected to the network (services.anope.org) USERS: redis!redis@services.anope.org (Anope IRC Services) connected to the network (services.anope.org)
And the bot redis will be in BotServ's bot list. 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
@@ -1,25 +0,0 @@
Anope Bundled Tools
-------------------
1) Anope SMTP Client
Provided with Anope is a simple SMTP client which can be used instead of
programs like SendMail in some cases.
The SMTP client can be used instead of sendmail for use with Anope's mail
options. To use the SMTP client instead of sendmail, find the line in your
services configuration file (services.conf) that defines sendmailpath. On
that line, change the path to your services installation directory, then
followed by "bin/anopesmtp" and the IP address of a valid SMTP server. It
should look like this:
sendmailpath = "/home/anope/services/bin/anopesmtp 127.0.0.1"
If the SMTP client doesn't send mail, or if there's an other problem with
it, you can enable debug mode by passing the --debug flag after the server
address. This should generate a log file of what happened when it tried
to connect to the SMTP server.
Credits:
Originally written by Dominick Meglio <codemastr@unrealircd.com>
Ported to *nix by Trystan Scott Lee <trystan@nomadirc.net>
+2 -2
View File
@@ -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/example.conf" to be "data/services.conf", The only thing you need to do is rename "data/anope.example.conf" to be "data/anope.conf",
and then follow the steps to set up Anope. 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 services.conf, and read through it carefully and adjust the settings Open anope.conf, and read through it carefully and adjust the settings
you think you need to adjust. 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
+3 -45
View File
@@ -3,7 +3,7 @@ set_source_files_properties(version.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "$
# Generate version-bin executable to modify version.h, setting it's linker flags as well # Generate version-bin executable to modify version.h, setting it's linker flags as well
add_executable(version-bin version.cpp) add_executable(version-bin version.cpp)
set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}") set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}")
get_target_property(version_BINARY version-bin LOCATION) set(version_BINARY "$<TARGET_FILE:version-bin>")
# Modify version.h from the above executable, with dependencies to version.cpp # Modify version.h from the above executable, with dependencies to version.cpp
# and all of the source files in the main build # and all of the source files in the main build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h
@@ -16,49 +16,7 @@ add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
if(NOT WIN32) 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(NOT WIN32) endif()
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 ${PCH_SOURCES_GCH}) add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h)
+9 -11
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef ACCESS_H #pragma once
#define ACCESS_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -42,7 +41,7 @@ struct CoreExport Privilege
class CoreExport PrivilegeManager 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);
@@ -55,7 +54,7 @@ class CoreExport PrivilegeManager
*/ */
class CoreExport AccessProvider : public Service class CoreExport AccessProvider : public Service
{ {
public: public:
AccessProvider(Module *owner, const Anope::string &name); AccessProvider(Module *owner, const Anope::string &name);
virtual ~AccessProvider(); virtual ~AccessProvider();
@@ -64,9 +63,9 @@ class CoreExport AccessProvider : public Service
*/ */
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();
}; };
@@ -77,7 +76,7 @@ class CoreExport ChanAccess : public Serializable
/* 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 */
@@ -85,6 +84,7 @@ class CoreExport ChanAccess : public Serializable
/* 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;
@@ -95,7 +95,7 @@ class CoreExport ChanAccess : public Serializable
const Anope::string &Mask() const; const Anope::string &Mask() const;
NickCore *GetAccount() const; NickCore *GetAccount() const;
void Serialize(Serialize::Data &data) const anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static const unsigned int MAX_DEPTH = 4; static const unsigned int MAX_DEPTH = 4;
@@ -135,7 +135,7 @@ class CoreExport ChanAccess : public Serializable
*/ */
class CoreExport AccessGroup 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 */
@@ -170,5 +170,3 @@ class CoreExport AccessGroup
inline bool empty() const { return paths.empty(); } inline bool empty() const { return paths.empty(); }
}; };
#endif
+10 -13
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef ACCOUNT_H #pragma once
#define ACCOUNT_H
#include "extensible.h" #include "extensible.h"
#include "serialize.h" #include "serialize.h"
@@ -20,7 +19,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 TR1NS::unordered_map<uint64_t, NickCore *> nickcoreid_map; typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList; extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
extern CoreExport Serialize::Checker<nickcore_map> NickCoreList; extern CoreExport Serialize::Checker<nickcore_map> NickCoreList;
@@ -34,7 +33,7 @@ class CoreExport NickAlias : 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;
@@ -54,7 +53,7 @@ class CoreExport NickAlias : public Serializable, public Extensible
NickAlias(const Anope::string &nickname, NickCore *nickcore); NickAlias(const Anope::string &nickname, NickCore *nickcore);
~NickAlias(); ~NickAlias();
void Serialize(Serialize::Data &data) const anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Set a vhost for the user /** Set a vhost for the user
@@ -111,7 +110,7 @@ class CoreExport NickCore : public Serializable, public Extensible
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 */
@@ -149,7 +148,7 @@ class CoreExport NickCore : public Serializable, public Extensible
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 anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Changes the display for this account /** Changes the display for this account
@@ -240,16 +239,16 @@ class CoreExport IdentifyRequest
Anope::string password; Anope::string password;
std::set<Module *> holds; std::set<Module *> holds;
bool dispatched; bool dispatched = false;
bool success; bool success = false;
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;
@@ -286,5 +285,3 @@ class CoreExport IdentifyRequest
static void ModuleUnload(Module *m); static void ModuleUnload(Module *m);
}; };
#endif // ACCOUNT_H
+25 -38
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef ANOPE_H #pragma once
#define ANOPE_H
#include <signal.h> #include <signal.h>
@@ -25,13 +24,13 @@ namespace Anope
*/ */
class CoreExport string 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.
*/ */
@@ -54,9 +53,7 @@ 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.
@@ -257,8 +254,8 @@ namespace Anope
inline string lower() const inline string lower() const
{ {
Anope::string new_string = *this; Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i) for (auto &chr : new_string)
new_string[i] = Anope::tolower(new_string[i]); chr = Anope::tolower(chr);
return new_string; return new_string;
} }
@@ -268,8 +265,8 @@ namespace Anope
inline string upper() const inline string upper() const
{ {
Anope::string new_string = *this; Anope::string new_string = *this;
for (size_type i = 0; i < new_string.length(); ++i) for (auto &chr : new_string)
new_string[i] = Anope::toupper(new_string[i]); chr = Anope::toupper(chr);
return new_string; return new_string;
} }
@@ -315,7 +312,7 @@ namespace Anope
{ {
inline size_t operator()(const string &s) const inline size_t operator()(const string &s) const
{ {
return TR1NS::hash<std::string>()(s.lower().str()); return std::hash<std::string>()(s.lower().str());
} }
}; };
@@ -323,7 +320,7 @@ namespace Anope
{ {
inline size_t operator()(const string &s) const inline size_t operator()(const string &s) const
{ {
return TR1NS::hash<std::string>()(s.str()); return std::hash<std::string>()(s.str());
} }
}; };
@@ -337,7 +334,7 @@ namespace Anope
template<typename T> class map : public std::map<string, T, ci::less> { }; template<typename T> class map : public std::map<string, T, ci::less> { };
template<typename T> class multimap : public std::multimap<string, T, ci::less> { }; template<typename T> class 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> class hash_map : public 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__;
@@ -369,11 +366,11 @@ namespace Anope
*/ */
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug; extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
/** The root of the services installation. Usually ~/services /** The root of the Anope installation. Usually ~/anope
*/ */
extern CoreExport Anope::string ServicesDir; extern CoreExport Anope::string ServicesDir;
/** Services binary name (eg services) /** Anope binary name (eg anope)
*/ */
extern CoreExport Anope::string ServicesBin; extern CoreExport Anope::string ServicesBin;
@@ -387,7 +384,7 @@ namespace Anope
/** The uplink we are currently connected to /** The uplink we are currently connected to
*/ */
extern CoreExport int CurrentUplink; extern CoreExport size_t CurrentUplink;
/** Various methods to determine the Anope version running /** Various methods to determine the Anope version running
*/ */
@@ -465,14 +462,6 @@ 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
@@ -568,7 +557,7 @@ namespace Anope
*/ */
class CoreExport sepstream class CoreExport sepstream
{ {
private: private:
/** Original string. /** Original string.
*/ */
Anope::string tokens; Anope::string tokens;
@@ -577,11 +566,11 @@ class CoreExport sepstream
char sep; char sep;
/** Current string position /** Current string position
*/ */
size_t pos; size_t pos = 0;
/** 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);
@@ -637,7 +626,7 @@ class CoreExport sepstream
*/ */
class commasepstream : public sepstream class commasepstream : 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) { }
@@ -647,7 +636,7 @@ class commasepstream : public sepstream
*/ */
class spacesepstream : public sepstream class spacesepstream : 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, ' ') { }
@@ -661,14 +650,14 @@ class spacesepstream : public sepstream
*/ */
class CoreException : public std::exception class CoreException : 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") { }
@@ -683,7 +672,7 @@ class CoreException : public std::exception
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~CoreException() throw() { } virtual ~CoreException() noexcept = default;
/** 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.
*/ */
@@ -700,7 +689,7 @@ class CoreException : public std::exception
class ModuleException : public CoreException class ModuleException : 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") { }
@@ -712,15 +701,15 @@ class ModuleException : public CoreException
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~ModuleException() throw() { } virtual ~ModuleException() noexcept = default;
}; };
class ConvertException : public CoreException class ConvertException : public CoreException
{ {
public: public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { } ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() throw() { } virtual ~ConvertException() noexcept = default;
}; };
/** Convert something to a string /** Convert something to a string
@@ -794,5 +783,3 @@ 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
+12 -18
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef BASE_H #pragma once
#define BASE_H
#include "services.h" #include "services.h"
@@ -16,9 +15,8 @@
class CoreExport Base class CoreExport Base
{ {
/* References to this base class */ /* References to this base class */
std::set<ReferenceBase *> *references; std::set<ReferenceBase *> *references = nullptr;
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
@@ -32,12 +30,12 @@ class CoreExport Base
class ReferenceBase class ReferenceBase
{ {
protected: protected:
bool invalid; bool invalid = false;
public: public:
ReferenceBase() : invalid(false) { } ReferenceBase() = default;
ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { } ReferenceBase(const ReferenceBase &other) : invalid(other.invalid) { }
virtual ~ReferenceBase() { } virtual ~ReferenceBase() = default;
inline void Invalidate() { this->invalid = true; } inline void Invalidate() { this->invalid = true; }
}; };
@@ -47,12 +45,10 @@ class ReferenceBase
template<typename T> template<typename T>
class Reference : public ReferenceBase class Reference : public ReferenceBase
{ {
protected: protected:
T *ref; T *ref = nullptr;
public: public:
Reference() : ref(NULL) Reference() = default;
{
}
Reference(T *obj) : ref(obj) Reference(T *obj) : ref(obj)
{ {
@@ -139,5 +135,3 @@ class Reference : public ReferenceBase
return false; return false;
} }
}; };
#endif // BASE_H
+2 -5
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef BOTS_H #pragma once
#define BOTS_H
#include "users.h" #include "users.h"
#include "anope.h" #include "anope.h"
@@ -24,7 +23,7 @@ class CoreExport BotInfo : 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;
@@ -131,5 +130,3 @@ class CoreExport BotInfo : public User, public Serializable
*/ */
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
+6 -9
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef CHANNELS_H #pragma once
#define CHANNELS_H
#include "anope.h" #include "anope.h"
#include "extensible.h" #include "extensible.h"
@@ -33,14 +32,14 @@ class CoreExport Channel : 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 */
@@ -74,14 +73,14 @@ class CoreExport Channel : public Base, public Extensible
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();
@@ -311,5 +310,3 @@ class CoreExport Channel : public Base, public Extensible
static void DeleteChannels(); static void DeleteChannels();
}; };
#endif // CHANNELS_H
+11 -16
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef COMMAND_H #pragma once
#define COMMAND_H
#include "service.h" #include "service.h"
#include "anope.h" #include "anope.h"
@@ -26,8 +25,6 @@ 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 */
@@ -35,9 +32,9 @@ struct CommandInfo
/* 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; bool hide = false;
/* Only used with fantasy */ /* Only used with fantasy */
bool prepend_channel; bool prepend_channel = false;
}; };
/* Where the replies from commands go to. User inherits from this and is the normal /* Where the replies from commands go to. User inherits from this and is the normal
@@ -45,7 +42,7 @@ struct CommandInfo
*/ */
struct CoreExport CommandReply struct CoreExport CommandReply
{ {
virtual ~CommandReply() { } virtual ~CommandReply() = default;
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0; virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
}; };
@@ -56,7 +53,7 @@ class CoreExport CommandSource
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 */
@@ -100,7 +97,7 @@ class CoreExport Command : public Service
/* 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 */
@@ -109,7 +106,7 @@ class CoreExport Command : public Service
/* 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
@@ -119,10 +116,10 @@ class CoreExport Command : public Service
*/ */
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(); virtual ~Command() = default;
protected: protected:
void SetDesc(const Anope::string &d); void SetDesc(const Anope::string &d);
void ClearSyntax(); void ClearSyntax();
@@ -132,7 +129,7 @@ class CoreExport Command : public Service
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;
@@ -183,5 +180,3 @@ class CoreExport Command : public Service
*/ */
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
+12 -15
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef CONFIG_H #pragma once
#define CONFIG_H
#include "account.h" #include "account.h"
#include "regchannel.h" #include "regchannel.h"
@@ -26,11 +25,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;
@@ -39,7 +38,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;
@@ -66,7 +65,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;
@@ -83,8 +82,8 @@ namespace Configuration
{ {
Anope::string name; Anope::string name;
bool executable; bool executable;
FILE *fp; FILE *fp = nullptr;
public: public:
File(const Anope::string &, bool); File(const Anope::string &, bool);
~File(); ~File();
const Anope::string &GetName() const; const Anope::string &GetName() const;
@@ -158,10 +157,10 @@ namespace Configuration
Anope::string host; Anope::string host;
unsigned port; unsigned port;
Anope::string password; Anope::string password;
bool ipv6; int protocol;
Uplink(const Anope::string &_host, int _port, const Anope::string &_password, bool _ipv6) : host(_host), port(_port), password(_password), ipv6(_ipv6) { } Uplink(const Anope::string &_host, int _port, const Anope::string &_password, int _protocol) : host(_host), port(_port), password(_password), protocol(_protocol) { }
inline bool operator==(const Uplink &other) const { return host == other.host && port == other.port && password == other.password && ipv6 == other.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 !(*this == other); } inline bool operator!=(const Uplink &other) const { return !(*this == other); }
}; };
} }
@@ -174,7 +173,7 @@ namespace Configuration
*/ */
class ConfigException : public CoreException class ConfigException : 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") { }
@@ -185,10 +184,8 @@ class ConfigException : public CoreException
* Actually no, it does nothing. Never mind. * Actually no, it does nothing. Never mind.
* @throws Nothing! * @throws Nothing!
*/ */
virtual ~ConfigException() throw() { } virtual ~ConfigException() noexcept = default;
}; };
extern Configuration::File ServicesConf; extern Configuration::File ServicesConf;
extern CoreExport Configuration::Conf *Config; extern CoreExport Configuration::Conf *Config;
#endif // CONFIG_H
+2
View File
@@ -9,6 +9,8 @@
* 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;
+22 -25
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef EXTENSIBLE_H #pragma once
#define EXTENSIBLE_H
#include "anope.h" #include "anope.h"
#include "serialize.h" #include "serialize.h"
@@ -18,13 +17,13 @@ class Extensible;
class CoreExport ExtensibleBase : public Service class CoreExport ExtensibleBase : 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 +33,7 @@ class CoreExport ExtensibleBase : public Service
class CoreExport Extensible class CoreExport Extensible
{ {
public: public:
std::set<ExtensibleBase *> extension_items; std::set<ExtensibleBase *> extension_items;
virtual ~Extensible(); virtual ~Extensible();
@@ -56,10 +55,10 @@ class CoreExport Extensible
template<typename T> template<typename T>
class BaseExtensibleItem : public ExtensibleBase class BaseExtensibleItem : 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()
@@ -93,7 +92,7 @@ class BaseExtensibleItem : public ExtensibleBase
return t; return t;
} }
void Unset(Extensible *obj) anope_override void Unset(Extensible *obj) override
{ {
T *value = Get(obj); T *value = Get(obj);
items.erase(obj); items.erase(obj);
@@ -127,52 +126,52 @@ class BaseExtensibleItem : public ExtensibleBase
template<typename T> template<typename T>
class ExtensibleItem : public BaseExtensibleItem<T> class ExtensibleItem : public BaseExtensibleItem<T>
{ {
protected: protected:
T* Create(Extensible *obj) anope_override T* Create(Extensible *obj) 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 : public BaseExtensibleItem<T> class PrimitiveExtensibleItem : public BaseExtensibleItem<T>
{ {
protected: protected:
T* Create(Extensible *obj) anope_override T* Create(Extensible *obj) 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 *) anope_override bool* Create(Extensible *) 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 : public PrimitiveExtensibleItem<T> class SerializableExtensibleItem : 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 anope_override void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{ {
T* t = this->Get(e); T* t = this->Get(e);
data[this->name] << *t; data[this->name] << *t;
} }
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
{ {
T t; T t;
if (data[this->name] >> t) if (data[this->name] >> t)
@@ -185,15 +184,15 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem<T>
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 anope_override void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{ {
data[this->name] << true; data[this->name] << true;
} }
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
{ {
bool b = false; bool b = false;
data[this->name] >> b; data[this->name] >> b;
@@ -259,5 +258,3 @@ 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
+10 -20
View File
@@ -6,19 +6,11 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef HASHCOMP_H #pragma once
#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"
@@ -29,16 +21,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 void CaseMapRebuild(); extern CoreExport void CaseMapRebuild();
extern unsigned char tolower(unsigned char); extern CoreExport unsigned char tolower(unsigned char);
extern unsigned char toupper(unsigned char); extern CoreExport unsigned char toupper(unsigned char);
/* ASCII case insensitive ctype. */ /* ASCII case insensitive ctype. */
template<typename char_type> template<typename char_type>
class ascii_ctype : public std::ctype<char_type> class ascii_ctype : public std::ctype<char_type>
{ {
public: public:
char_type do_toupper(char_type c) const anope_override char_type do_toupper(char_type c) const override
{ {
if (c >= 'a' && c <= 'z') if (c >= 'a' && c <= 'z')
return c - 32; return c - 32;
@@ -46,7 +38,7 @@ namespace Anope
return c; return c;
} }
char_type do_tolower(char_type c) const anope_override char_type do_tolower(char_type c) const override
{ {
if (c >= 'A' && c <= 'Z') if (c >= 'A' && c <= 'Z')
return c + 32; return c + 32;
@@ -59,8 +51,8 @@ namespace Anope
template<typename char_type> template<typename char_type>
class rfc1459_ctype : public ascii_ctype<char_type> class rfc1459_ctype : public ascii_ctype<char_type>
{ {
public: public:
char_type do_toupper(char_type c) const anope_override char_type do_toupper(char_type c) const override
{ {
if (c == '{' || c == '}' || c == '|') if (c == '{' || c == '}' || c == '|')
return c - 32; return c - 32;
@@ -68,7 +60,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 anope_override char_type do_tolower(char_type c) const override
{ {
if (c == '[' || c == ']' || c == '\\') if (c == '[' || c == ']' || c == '\\')
return c + 32; return c + 32;
@@ -195,5 +187,3 @@ 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 -5
View File
@@ -6,12 +6,14 @@
* 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 services.conf. They are /* Languages we support as configured in anope.conf. They are
* added to this list if we detect a language exists in the correct * added to this list if we detect a language exists in the correct
* location for each language. * location for each language.
*/ */
@@ -70,10 +72,11 @@ 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 be at least\n" \ #define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should not be\n" \
"five characters long, should not be something easily guessed\n" \ "something that could be easily guessed (e.g. your real name or your nick) and\n" \
"(e.g. your real name or your nick), and cannot contain the space or tab characters.") "cannot contain the space or tab characters.\n")
#define PASSWORD_TOO_LONG _("Your password is too long. It must not exceed %u characters.") #define PASSWORD_TOO_SHORT _("Your password is too short. It must must be longer than %u characters.")
#define PASSWORD_TOO_LONG _("Your password is too long. It must be shorter than %u characters.")
#define NICK_NOT_REGISTERED _("Your nick isn't registered.") #define NICK_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.")
+10 -13
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef LISTS_H #pragma once
#define LISTS_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -24,13 +23,13 @@
*/ */
class CoreExport NumberList class CoreExport NumberList
{ {
private: private:
bool is_valid; bool is_valid = true;
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
@@ -39,7 +38,7 @@ class CoreExport NumberList
/** Destructor, does nothing /** Destructor, does nothing
*/ */
virtual ~NumberList(); virtual ~NumberList() = default;
/** 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.
*/ */
@@ -63,13 +62,13 @@ class CoreExport NumberList
*/ */
class CoreExport ListFormatter 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);
@@ -83,12 +82,10 @@ 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; unsigned longest = 0;
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
+16 -19
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef LOGGER_H #pragma once
#define LOGGER_H
#include "anope.h" #include "anope.h"
#include "defs.h" #include "defs.h"
@@ -51,25 +50,25 @@ struct LogFile
/* Represents a single log message */ /* Represents a single log message */
class CoreExport Log class CoreExport Log
{ {
public: public:
/* Bot that should log this message */ /* Bot that should log this message */
BotInfo *bi; BotInfo *bi = nullptr;
/* 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; User *u = nullptr;
/* 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; NickCore *nc = nullptr;
/* For commands, the command being executed */ /* For commands, the command being executed */
Command *c; Command *c = nullptr;
/* For commands, the command source */ /* For commands, the command source */
CommandSource *source; CommandSource *source = nullptr;
/* Used for LOG_CHANNEL */ /* Used for LOG_CHANNEL */
Channel *chan; Channel *chan = nullptr;
/* 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; const ChannelInfo *ci = nullptr;
/* For LOG_SERVER */ /* For LOG_SERVER */
Server *s; Server *s = nullptr;
/* For LOG_MODULE */ /* For LOG_MODULE */
Module *m; Module *m = nullptr;
LogType type; LogType type;
Anope::string category; Anope::string category;
@@ -95,11 +94,11 @@ class CoreExport Log
~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)
@@ -112,11 +111,11 @@ class CoreExport Log
/* Configured in the configuration file, actually does the message logging */ /* Configured in the configuration file, actually does the message logging */
class CoreExport LogInfo class CoreExport LogInfo
{ {
public: public:
BotInfo *bot; BotInfo *bot = nullptr;
std::vector<Anope::string> targets; std::vector<Anope::string> targets;
std::vector<LogFile *> logfiles; std::vector<LogFile *> logfiles;
int last_day; int last_day = 0;
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;
@@ -140,5 +139,3 @@ class CoreExport LogInfo
/* 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
+5 -8
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef MAIL_H #pragma once
#define MAIL_H
#include "anope.h" #include "anope.h"
#include "threadengine.h" #include "threadengine.h"
@@ -25,7 +24,7 @@ namespace Mail
/* A email message being sent */ /* A email message being sent */
class Message : public Thread class Message : public Thread
{ {
private: private:
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 +34,8 @@ namespace Mail
Anope::string content_type; Anope::string content_type;
bool dont_quote_addresses; bool dont_quote_addresses;
bool success; 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,9 +48,7 @@ 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() anope_override; void Run() override;
}; };
} // namespace Mail } // namespace Mail
#endif // MAIL_H
+4 -7
View File
@@ -9,22 +9,21 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef MEMO_H #pragma once
#define MEMO_H
#include "anope.h" #include "anope.h"
#include "serialize.h" #include "serialize.h"
class CoreExport Memo : public Serializable class CoreExport Memo : 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 anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
Anope::string owner; Anope::string owner;
@@ -39,7 +38,7 @@ class CoreExport Memo : public Serializable
*/ */
struct CoreExport MemoInfo struct CoreExport MemoInfo
{ {
int16_t memomax; int16_t memomax = 0;
Serialize::Checker<std::vector<Memo *> > memos; Serialize::Checker<std::vector<Memo *> > memos;
std::vector<Anope::string> ignores; std::vector<Anope::string> ignores;
@@ -51,5 +50,3 @@ struct CoreExport MemoInfo
static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan); static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
}; };
#endif // MEMO_H
+22 -20
View File
@@ -9,6 +9,8 @@
* 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.
@@ -23,35 +25,35 @@ namespace Message
{ {
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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Capab : IRCDMessage struct CoreExport Capab : IRCDMessage
{ {
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Error : IRCDMessage struct CoreExport Error : IRCDMessage
{ {
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { } Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Invite : IRCDMessage struct CoreExport Invite : IRCDMessage
{ {
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Join : IRCDMessage struct CoreExport Join : IRCDMessage
{ {
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
typedef std::pair<ChannelStatus, User *> SJoinUser; typedef std::pair<ChannelStatus, User *> SJoinUser;
@@ -69,105 +71,105 @@ namespace Message
{ {
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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Kill : IRCDMessage struct CoreExport Kill : IRCDMessage
{ {
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { } Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Mode : IRCDMessage struct CoreExport Mode : IRCDMessage
{ {
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport MOTD : IRCDMessage struct CoreExport MOTD : IRCDMessage
{ {
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { } MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Notice : IRCDMessage struct CoreExport Notice : IRCDMessage
{ {
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Part : IRCDMessage struct CoreExport Part : IRCDMessage
{ {
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Ping : IRCDMessage struct CoreExport Ping : IRCDMessage
{ {
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Privmsg : IRCDMessage struct CoreExport Privmsg : IRCDMessage
{ {
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Quit : IRCDMessage struct CoreExport Quit : IRCDMessage
{ {
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport SQuit : IRCDMessage struct CoreExport SQuit : IRCDMessage
{ {
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { } SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Stats : IRCDMessage struct CoreExport Stats : IRCDMessage
{ {
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Time : IRCDMessage struct CoreExport Time : IRCDMessage
{ {
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Topic : IRCDMessage struct CoreExport Topic : IRCDMessage
{ {
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Version : IRCDMessage struct CoreExport Version : IRCDMessage
{ {
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
struct CoreExport Whois : IRCDMessage struct CoreExport Whois : IRCDMessage
{ {
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } 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) anope_override; void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
}; };
} // namespace Message } // namespace Message
+30 -33
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef MODES_H #pragma once
#define MODES_H
#include "anope.h" #include "anope.h"
#include "base.h" #include "base.h"
@@ -38,7 +37,7 @@ enum ModeClass
*/ */
class CoreExport Mode : public Base class CoreExport Mode : 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 +54,7 @@ class CoreExport Mode : public Base
* @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(); virtual ~Mode() = default;
/** 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
@@ -67,7 +66,7 @@ class CoreExport Mode : public Base
*/ */
class CoreExport UserMode : public Mode class CoreExport UserMode : 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
@@ -77,7 +76,7 @@ class CoreExport UserMode : public Mode
class CoreExport UserModeParam : public UserMode class CoreExport UserModeParam : 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,7 +94,7 @@ class CoreExport UserModeParam : public UserMode
*/ */
class CoreExport ChannelMode : public Mode class CoreExport ChannelMode : 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;
@@ -105,7 +104,7 @@ class CoreExport ChannelMode : public Mode
*/ */
ChannelMode(const Anope::string &name, char mc); ChannelMode(const Anope::string &name, char mc);
bool CanSet(User *u) const anope_override; bool CanSet(User *u) const override;
virtual void Check() { } virtual void Check() { }
@@ -126,7 +125,7 @@ class CoreExport ChannelMode : public Mode
*/ */
class CoreExport ChannelModeList : public ChannelMode class CoreExport ChannelModeList : 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
@@ -164,7 +163,7 @@ class CoreExport ChannelModeList : public ChannelMode
*/ */
class CoreExport ChannelModeParam : public ChannelMode class CoreExport ChannelModeParam : 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
@@ -186,7 +185,7 @@ class CoreExport ChannelModeParam : public ChannelMode
*/ */
class CoreExport ChannelModeStatus : public ChannelMode class CoreExport ChannelModeStatus : 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.
@@ -212,24 +211,24 @@ class CoreExport ChannelModeVirtual : 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() anope_override; void Check() override;
ChannelMode *Wrap(Anope::string &param) anope_override; ChannelMode *Wrap(Anope::string &param) override;
ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) anope_override = 0; ChannelMode *Unwrap(ChannelMode *cm, Anope::string &param) 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 class CoreExport ChannelStatus
{ {
Anope::string modes; Anope::string modes;
public: public:
ChannelStatus(); ChannelStatus() = default;
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);
@@ -242,49 +241,49 @@ class CoreExport ChannelStatus
class CoreExport UserModeOperOnly : public UserMode class CoreExport UserModeOperOnly : 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 anope_override; bool CanSet(User *u) const override;
}; };
class CoreExport UserModeNoone : public UserMode class CoreExport UserModeNoone : public UserMode
{ {
public: public:
UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { } UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { }
bool CanSet(User *u) const anope_override; bool CanSet(User *u) const override;
}; };
/** Channel mode +k (key) /** Channel mode +k (key)
*/ */
class CoreExport ChannelModeKey : public ChannelModeParam class CoreExport ChannelModeKey : public ChannelModeParam
{ {
public: public:
ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { }
bool IsValid(Anope::string &value) const anope_override; bool IsValid(Anope::string &value) const override;
}; };
/** This class is used for oper only channel modes /** This class is used for oper only channel modes
*/ */
class CoreExport ChannelModeOperOnly : public ChannelMode class CoreExport ChannelModeOperOnly : public ChannelMode
{ {
public: public:
ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
/* Opers only */ /* Opers only */
bool CanSet(User *u) const anope_override; bool CanSet(User *u) const override;
}; };
/** This class is used for channel modes only servers may set /** This class is used for channel modes only servers may set
*/ */
class CoreExport ChannelModeNoone : public ChannelMode class CoreExport ChannelModeNoone : public ChannelMode
{ {
public: public:
ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
bool CanSet(User *u) const anope_override; bool CanSet(User *u) const override;
}; };
/** This is the mode manager /** This is the mode manager
@@ -295,7 +294,7 @@ class CoreExport ChannelModeNoone : public ChannelMode
*/ */
class CoreExport ModeManager 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;
@@ -393,9 +392,9 @@ class CoreExport Entry
{ {
Anope::string name; Anope::string name;
Anope::string mask; Anope::string mask;
public: public:
unsigned short cidr_len; unsigned short cidr_len = 0;
int family; int family = 0;
Anope::string nick, user, host, real; Anope::string nick, user, host, real;
/** Constructor /** Constructor
@@ -418,5 +417,3 @@ class CoreExport Entry
*/ */
bool Matches(User *u, bool full = false) const; bool Matches(User *u, bool full = false) const;
}; };
#endif // MODES_H
+1 -4
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef MODULE_H #pragma once
#define MODULE_H
#include "access.h" #include "access.h"
#include "account.h" #include "account.h"
@@ -50,5 +49,3 @@
#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
+11 -41
View File
@@ -9,11 +9,10 @@
* 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"
@@ -25,32 +24,7 @@
* 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.
*/ */
#ifdef _WIN32 #define MODULE_INIT(x) \
# 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); \
@@ -67,7 +41,6 @@
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
@@ -199,12 +172,12 @@ struct ModuleVersionC
*/ */
class ModuleVersion 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
@@ -229,9 +202,9 @@ class NotImplementedException : public CoreException { };
*/ */
class CoreExport Module : public Extensible class CoreExport Module : 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;
@@ -322,7 +295,7 @@ class CoreExport Module : public Extensible
*/ */
virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); } virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); }
/** Called when Services' configuration is being (re)loaded. /** Called when the configuration is being (re)loaded.
* @param conf The config that is being built now and will replace the global Config object * @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.
*/ */
@@ -404,7 +377,6 @@ class CoreExport Module : public Extensible
/** 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
@@ -1139,7 +1111,7 @@ enum Implementation
*/ */
class CoreExport ModuleManager 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];
@@ -1222,7 +1194,7 @@ class CoreExport ModuleManager
*/ */
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
@@ -1234,5 +1206,3 @@ class CoreExport ModuleManager
*/ */
static ModuleVersion GetVersion(void *handle); static ModuleVersion GetVersion(void *handle);
}; };
#endif // MODULES_H
+6 -4
View File
@@ -9,6 +9,8 @@
* 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
@@ -30,14 +32,14 @@ struct BadWord
Anope::string word; Anope::string word;
BadWordType type; BadWordType type;
virtual ~BadWord() { } virtual ~BadWord() = default;
protected: protected:
BadWord() { } BadWord() = default;
}; };
struct BadWords struct BadWords
{ {
virtual ~BadWords() { } virtual ~BadWords() = default;
/** Add a badword to the badword list /** Add a badword to the badword list
* @param word The badword * @param word The badword
+6 -4
View File
@@ -9,6 +9,8 @@
* 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
{ {
@@ -35,10 +37,10 @@ struct KickerData
bool dontkickops, dontkickvoices; bool dontkickops, dontkickvoices;
protected: protected:
KickerData() { } KickerData() = default;
public: public:
virtual ~KickerData() { } virtual ~KickerData() = default;
virtual void Check(ChannelInfo *ci) = 0; virtual void Check(ChannelInfo *ci) = 0;
}; };
+7 -5
View File
@@ -6,6 +6,8 @@
* 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;
@@ -13,17 +15,17 @@ struct EntryMsg
Anope::string message; Anope::string message;
time_t when; time_t when;
virtual ~EntryMsg() { } virtual ~EntryMsg() = default;
protected: protected:
EntryMsg() { } EntryMsg() = default;
}; };
struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> > struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
{ {
protected: protected:
EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { } 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 -6
View File
@@ -9,6 +9,8 @@
* 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;
@@ -22,21 +24,21 @@ struct LogSetting
Anope::string creator; Anope::string creator;
time_t created; time_t created;
virtual ~LogSetting() { } virtual ~LogSetting() = default;
protected: protected:
LogSetting() { } LogSetting() = default;
}; };
struct LogSettings : Serialize::Checker<std::vector<LogSetting *> > struct LogSettings : 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() { } virtual ~LogSettings() = default;
virtual LogSetting *Create() = 0; virtual LogSetting *Create() = 0;
}; };
+6 -4
View File
@@ -9,6 +9,8 @@
* 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;
@@ -18,16 +20,16 @@ struct ModeLock
Anope::string setter; Anope::string setter;
time_t created; time_t created;
virtual ~ModeLock() { } virtual ~ModeLock() = default;
protected: protected:
ModeLock() { } ModeLock() = default;
}; };
struct ModeLocks struct ModeLocks
{ {
typedef std::vector<ModeLock *> ModeList; typedef std::vector<ModeLock *> ModeList;
virtual ~ModeLocks() { } virtual ~ModeLocks() = default;
/** Check if a mode is mlocked /** Check if a mode is mlocked
* @param mode The mode * @param mode The mode
+13 -16
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef DNS_H #pragma once
#define DNS_H
namespace DNS namespace DNS
{ {
@@ -73,10 +72,10 @@ namespace DNS
struct Question struct Question
{ {
Anope::string name; Anope::string name;
QueryType type; QueryType type = QUERY_NONE;
unsigned short qclass; unsigned short qclass = 0;
Question() : type(QUERY_NONE), qclass(0) { } Question() = default;
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { } 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; }
@@ -91,12 +90,12 @@ namespace DNS
struct ResourceRecord : Question struct ResourceRecord : Question
{ {
unsigned int ttl; unsigned int ttl = 0;
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), ttl(0), created(Anope::CurTime) { } ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { }
ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { } ResourceRecord(const Question &q) : Question(q), created(Anope::CurTime) { }
}; };
struct Query struct Query
@@ -116,9 +115,9 @@ namespace DNS
*/ */
class Manager : public Service class Manager : public Service
{ {
public: public:
Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { } Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { }
virtual ~Manager() { } virtual ~Manager() = default;
virtual void Process(Request *req) = 0; virtual void Process(Request *req) = 0;
virtual void RemoveRequest(Request *req) = 0; virtual void RemoveRequest(Request *req) = 0;
@@ -135,16 +134,16 @@ namespace DNS
class Request : public Timer, public Question class Request : 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; unsigned short id = 0;
/* 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) : Timer(0), Question(addr, qt), manager(mgr), Request(Manager *mgr, Module *c, const Anope::string &addr, QueryType qt, bool cache = false) : Timer(0), Question(addr, qt), manager(mgr),
use_cache(cache), id(0), creator(c) { } use_cache(cache), creator(c) { }
virtual ~Request() virtual ~Request()
{ {
@@ -164,7 +163,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(time_t) anope_override void Tick(time_t) 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);
@@ -174,5 +173,3 @@ namespace DNS
}; };
} // namespace DNS } // namespace DNS
#endif // DNS_H
+6 -4
View File
@@ -9,6 +9,8 @@
* 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;
@@ -16,8 +18,8 @@ namespace Encryption
class Context class Context
{ {
public: public:
virtual ~Context() { } virtual ~Context() = default;
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;
@@ -25,9 +27,9 @@ namespace Encryption
class Provider : public Service class Provider : 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() { } virtual ~Provider() = default;
virtual Context *CreateContext(IV * = NULL) = 0; virtual Context *CreateContext(IV * = NULL) = 0;
virtual IV GetDefaultIV() = 0; virtual IV GetDefaultIV() = 0;
+18 -22
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef ANOPE_HTTPD_H #pragma once
#define ANOPE_HTTPD_H
enum HTTPError enum HTTPError
{ {
@@ -21,13 +20,14 @@ enum HTTPError
/* A message to someone */ /* A message to someone */
struct HTTPReply struct HTTPReply
{ {
HTTPError error; HTTPError error = HTTP_ERROR_OK;
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() : error(HTTP_ERROR_OK), length(0) { } HTTPReply() = default;
HTTPReply& operator=(const HTTPReply &) = default;
HTTPReply(const HTTPReply& other) : error(other.error), length(other.length) HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
{ {
@@ -35,14 +35,14 @@ struct HTTPReply
headers = other.headers; headers = other.headers;
cookies = other.cookies; cookies = other.cookies;
for (unsigned i = 0; i < other.out.size(); ++i) for (const auto &datum : other.out)
out.push_back(new Data(other.out[i]->buf, other.out[i]->len)); out.push_back(new Data(datum->buf, datum->len));
} }
~HTTPReply() ~HTTPReply()
{ {
for (unsigned i = 0; i < out.size(); ++i) for (const auto *datum : out)
delete out[i]; delete datum;
out.clear(); out.clear();
} }
@@ -65,7 +65,7 @@ struct HTTPReply
}; };
std::deque<Data *> out; std::deque<Data *> out;
size_t length; size_t length = 0;
void Write(const Anope::string &message) void Write(const Anope::string &message)
{ {
@@ -93,12 +93,12 @@ struct HTTPMessage
class HTTPClient; class HTTPClient;
class HTTPProvider; class HTTPProvider;
class HTTPPage : public Base class HTTPPage : 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; }
@@ -117,13 +117,13 @@ class HTTPPage : public Base
class HTTPClient : public ClientSocket, public BinarySocket, public Base class HTTPClient : 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()
@@ -140,7 +140,7 @@ class HTTPProvider : 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;
@@ -196,10 +196,8 @@ namespace HTTPUtils
{ {
Anope::string encoded; Anope::string encoded;
for (unsigned i = 0; i < url.length(); ++i) for (const auto c : url)
{ {
const char& c = url[i];
if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_') if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_')
encoded += c; encoded += c;
else if (c == ' ') else if (c == ' ')
@@ -215,9 +213,9 @@ namespace HTTPUtils
{ {
Anope::string dst; Anope::string dst;
for (unsigned i = 0; i < src.length(); ++i) for (const auto c : src)
{ {
switch (src[i]) switch (c)
{ {
case '<': case '<':
dst += "&lt;"; dst += "&lt;";
@@ -232,12 +230,10 @@ namespace HTTPUtils
dst += "&amp;"; dst += "&amp;";
break; break;
default: default:
dst += src[i]; dst += c;
} }
} }
return dst; return dst;
} }
} }
#endif // ANOPE_HTTPD_H
+8 -11
View File
@@ -6,15 +6,14 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef ANOPE_LDAP_H #pragma once
#define ANOPE_LDAP_H
class 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() throw() { } virtual ~LDAPException() noexcept = default;
}; };
struct LDAPModification struct LDAPModification
@@ -43,8 +42,8 @@ struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string
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_iterator it = this->begin(), it_end = this->end(); it != it_end; ++it) for (const auto &[key, _] : *this)
k.push_back(it->first); k.push_back(key);
return k; return k;
} }
@@ -112,11 +111,11 @@ struct LDAPResult
class LDAPInterface class LDAPInterface
{ {
public: public:
Module *owner; Module *owner;
LDAPInterface(Module *m) : owner(m) { } LDAPInterface(Module *m) : owner(m) { }
virtual ~LDAPInterface() { } virtual ~LDAPInterface() = default;
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;
@@ -125,7 +124,7 @@ class LDAPInterface
class LDAPProvider : public Service class LDAPProvider : 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,5 +166,3 @@ class LDAPProvider : public Service
*/ */
virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0; virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0;
}; };
#endif // ANOPE_LDAP_H
+7 -5
View File
@@ -9,12 +9,14 @@
* 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() { } NSCertList() = default;
public: public:
virtual ~NSCertList() { } virtual ~NSCertList() = default;
/** Add an entry to the nick's certificate list /** Add an entry to the nick's certificate list
* *
@@ -63,7 +65,7 @@ struct NSCertList
class CertService : public Service class CertService : 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;
+7 -10
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_FORBID_H #pragma once
#define OS_FORBID_H
enum ForbidType enum ForbidType
{ {
@@ -23,18 +22,18 @@ struct ForbidData
Anope::string mask; Anope::string mask;
Anope::string creator; Anope::string creator;
Anope::string reason; Anope::string reason;
time_t created; time_t created = 0;
time_t expires; time_t expires = 0;
ForbidType type; ForbidType type;
virtual ~ForbidData() { } virtual ~ForbidData() = default;
protected: protected:
ForbidData() : created(0), expires(0) { } ForbidData() = default;
}; };
class ForbidService : public Service class ForbidService : 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,5 +50,3 @@ class ForbidService : public Service
}; };
static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
#endif
+8 -6
View File
@@ -9,24 +9,26 @@
* 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; /* When do we stop ignoring them? */ time_t time = 0; /* When do we stop ignoring them? */
virtual ~IgnoreData() { } virtual ~IgnoreData() = default;
protected: protected:
IgnoreData() : time(0) { } IgnoreData() = default;
}; };
class IgnoreService : public Service class IgnoreService : 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;
+2 -5
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_NEWS #pragma once
#define OS_NEWS
enum NewsType enum NewsType
{ {
@@ -35,7 +34,7 @@ struct NewsItem : Serializable
class NewsService : public Service class NewsService : 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;
@@ -48,5 +47,3 @@ class NewsService : public Service
}; };
static ServiceReference<NewsService> news_service("NewsService", "news"); static ServiceReference<NewsService> news_service("NewsService", "news");
#endif // OS_NEWS
+7 -10
View File
@@ -6,16 +6,15 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_SESSION_H #pragma once
#define OS_SESSION_H
struct Session struct Session
{ {
cidr addr; /* A cidr (sockaddrs + len) representing this session */ cidr addr; /* A cidr (sockaddrs + len) representing this session */
unsigned count; /* Number of clients with this host */ unsigned count = 1; /* Number of clients with this host */
unsigned hits; /* Number of subsequent kills for a host */ unsigned hits = 0; /* Number of subsequent kills for a host */
Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { } Session(const sockaddrs &ip, int len) : addr(ip, len) { }
}; };
struct Exception : Serializable struct Exception : Serializable
@@ -28,14 +27,14 @@ struct Exception : Serializable
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 anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
}; };
class SessionService : public Service class SessionService : public Service
{ {
public: public:
typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap; typedef std::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") { }
@@ -90,5 +89,3 @@ Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
session_service->AddException(ex); session_service->AddException(ex);
return ex; return ex;
} }
#endif
+2 -5
View File
@@ -6,12 +6,11 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef CHANSERV_H #pragma once
#define CHANSERV_H
class ChanServService : public Service class ChanServService : public Service
{ {
public: public:
ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ") ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ")
{ {
} }
@@ -21,5 +20,3 @@ class ChanServService : public Service
*/ */
virtual void Hold(Channel *c) = 0; virtual void Hold(Channel *c) = 0;
}; };
#endif // CHANSERV_H
+2 -5
View File
@@ -6,12 +6,11 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef GLOBAL_H #pragma once
#define GLOBAL_H
class GlobalService : public Service class GlobalService : public Service
{ {
public: public:
GlobalService(Module *m) : Service(m, "GlobalService", "Global") GlobalService(Module *m) : Service(m, "GlobalService", "Global")
{ {
} }
@@ -26,5 +25,3 @@ class GlobalService : public Service
*/ */
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
+2 -5
View File
@@ -6,12 +6,11 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef MEMOSERV_H #pragma once
#define MEMOSERV_H
class MemoServService : public Service class MemoServService : public Service
{ {
public: public:
enum MemoResult enum MemoResult
{ {
MEMO_SUCCESS, MEMO_SUCCESS,
@@ -37,5 +36,3 @@ class MemoServService : public Service
*/ */
virtual void Check(User *u) = 0; virtual void Check(User *u) = 0;
}; };
#endif // MEMOSERV_H
+2 -5
View File
@@ -6,12 +6,11 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef NICKSERV_H #pragma once
#define NICKSERV_H
class NickServService : public Service class NickServService : public Service
{ {
public: public:
NickServService(Module *m) : Service(m, "NickServService", "NickServ") NickServService(Module *m) : Service(m, "NickServService", "NickServ")
{ {
} }
@@ -20,5 +19,3 @@ class NickServService : public Service
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
+7 -5
View File
@@ -6,6 +6,8 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace Redis namespace Redis
{ {
struct Reply struct Reply
@@ -30,8 +32,8 @@ namespace Redis
i = 0; i = 0;
bulk.clear(); bulk.clear();
multi_bulk_size = 0; multi_bulk_size = 0;
for (unsigned j = 0; j < multi_bulk.size(); ++j) for (const auto *reply : multi_bulk)
delete multi_bulk[j]; delete reply;
multi_bulk.clear(); multi_bulk.clear();
} }
@@ -43,11 +45,11 @@ namespace Redis
class Interface class Interface
{ {
public: public:
Module *owner; Module *owner;
Interface(Module *m) : owner(m) { } Interface(Module *m) : owner(m) { }
virtual ~Interface() { } virtual ~Interface() = default;
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; }
@@ -55,7 +57,7 @@ namespace Redis
class Provider : public Service class Provider : 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;
+7 -5
View File
@@ -6,6 +6,8 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SASL namespace SASL
{ {
struct Message struct Message
@@ -22,7 +24,7 @@ namespace SASL
class Service : public ::Service class 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;
@@ -60,7 +62,7 @@ namespace SASL
/* PLAIN, EXTERNAL, etc */ /* PLAIN, EXTERNAL, etc */
class Mechanism : public ::Service class Mechanism : public ::Service
{ {
public: public:
Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { } 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); }
@@ -79,10 +81,10 @@ namespace SASL
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() anope_override void OnSuccess() override
{ {
if (!sasl) if (!sasl)
return; return;
@@ -108,7 +110,7 @@ namespace SASL
} }
} }
void OnFail() anope_override void OnFail() override
{ {
if (!sasl) if (!sasl)
return; return;
+5 -2
View File
@@ -6,12 +6,15 @@
* 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;
MiscData() { } virtual ~MiscData() = default;
virtual ~MiscData() { } protected:
MiscData() = default;
}; };
+28 -24
View File
@@ -6,12 +6,14 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SQL namespace SQL
{ {
class Data : public Serialize::Data class 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;
@@ -21,7 +23,7 @@ namespace SQL
Clear(); Clear();
} }
std::iostream& operator[](const Anope::string &key) anope_override std::iostream& operator[](const Anope::string &key) override
{ {
std::stringstream *&ss = data[key]; std::stringstream *&ss = data[key];
if (!ss) if (!ss)
@@ -29,44 +31,46 @@ namespace SQL
return *ss; return *ss;
} }
std::set<Anope::string> KeySet() const anope_override std::set<Anope::string> KeySet() const override
{ {
std::set<Anope::string> keys; std::set<Anope::string> keys;
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) for (const auto &[key, _] : this->data)
keys.insert(it->first); keys.insert(key);
return keys; return keys;
} }
size_t Hash() const anope_override size_t Hash() const override
{ {
size_t hash = 0; size_t hash = 0;
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) for (const auto &[_, value] : this->data)
if (!it->second->str().empty()) {
hash ^= Anope::hash_cs()(it->second->str()); if (!value->str().empty())
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 (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) for (const auto &[key, value] : this->data)
d[it->first] = it->second; d[key] = value;
return d; return d;
} }
void Clear() void Clear()
{ {
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) for (const auto &[_, value] : this->data)
delete it->second; delete value;
this->data.clear(); this->data.clear();
} }
void SetType(const Anope::string &key, Type t) anope_override void SetType(const Anope::string &key, Type t) override
{ {
this->types[key] = t; this->types[key] = t;
} }
Type GetType(const Anope::string &key) const anope_override Type GetType(const Anope::string &key) const override
{ {
std::map<Anope::string, Type>::const_iterator it = this->types.find(key); std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
if (it != this->types.end()) if (it != this->types.end())
@@ -79,10 +83,10 @@ namespace SQL
*/ */
class 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() throw() { } virtual ~Exception() noexcept = default;
}; };
/** A SQL query /** A SQL query
@@ -135,16 +139,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; unsigned int id = 0;
Anope::string finished_query; Anope::string finished_query;
Result() : id(0) { } Result() = default;
Result(unsigned int i, const Query &q, const Anope::string &fq, const Anope::string &err = "") : query(q), error(err), id(i), finished_query(fq) { } 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(); }
@@ -183,11 +187,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() { } virtual ~Interface() = default;
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;
@@ -197,7 +201,7 @@ namespace SQL
*/ */
class Provider : public Service class Provider : 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 -1
View File
@@ -6,9 +6,11 @@
* 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;
+4 -2
View File
@@ -9,11 +9,13 @@
* 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() { } SuspendInfo() = default;
virtual ~SuspendInfo() { } virtual ~SuspendInfo() = default;
}; };
+7 -5
View File
@@ -6,20 +6,22 @@
* 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 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.insert(std::make_pair(dname, ddata)); } inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; } inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
}; };
@@ -27,14 +29,14 @@ class XMLRPCServiceInterface;
class XMLRPCEvent class XMLRPCEvent
{ {
public: public:
virtual ~XMLRPCEvent() { } virtual ~XMLRPCEvent() = default;
virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0; virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
}; };
class XMLRPCServiceInterface : public Service class XMLRPCServiceInterface : public Service
{ {
public: public:
XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { } XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }
virtual void Register(XMLRPCEvent *event) = 0; virtual void Register(XMLRPCEvent *event) = 0;
+4 -7
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OPERTYPE_H #pragma once
#define OPERTYPE_H
#include "services.h" #include "services.h"
#include "account.h" #include "account.h"
@@ -22,7 +21,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; bool require_oper = true;
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 */
@@ -43,7 +42,7 @@ struct CoreExport Oper
class CoreExport OperType 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;
@@ -66,7 +65,7 @@ class CoreExport OperType
/** 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;
@@ -123,5 +122,3 @@ class CoreExport OperType
*/ */
const std::list<Anope::string> GetPrivs() const; const std::list<Anope::string> GetPrivs() const;
}; };
#endif // OPERTYPE_H
+15 -21
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef PROTOCOL_H #pragma once
#define PROTOCOL_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -22,9 +21,9 @@ class CoreExport IRCDProto : 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,10 +60,12 @@ class CoreExport IRCDProto : public Service
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 */
@@ -180,10 +181,6 @@ class CoreExport IRCDProto : public Service
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, ...); 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.
*/ */
virtual void SendNickChange(User *u, const Anope::string &newnick); virtual void SendNickChange(User *u, const Anope::string &newnick);
@@ -230,7 +227,7 @@ class CoreExport IRCDProto : public Service
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, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) { } virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { }
virtual bool IsNickValid(const Anope::string &); virtual bool IsNickValid(const Anope::string &);
virtual bool IsChannelValid(const Anope::string &); virtual bool IsChannelValid(const Anope::string &);
@@ -250,10 +247,10 @@ class CoreExport IRCDProto : public Service
class CoreExport MessageSource class CoreExport MessageSource
{ {
Anope::string source; Anope::string source;
User *u; User *u = nullptr;
Server *s; Server *s = nullptr;
public: public:
MessageSource(const Anope::string &); MessageSource(const Anope::string &);
MessageSource(User *u); MessageSource(User *u);
MessageSource(Server *s); MessageSource(Server *s);
@@ -276,11 +273,10 @@ class CoreExport IRCDMessage : 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) = 0; 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, 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); }
@@ -294,9 +290,9 @@ private:
Anope::string message; Anope::string message;
/** The current position within the message. */ /** The current position within the message. */
Anope::string::size_type position; Anope::string::size_type position = 0;
public: public:
/** Create a tokenstream and fill it with the provided data. */ /** Create a tokenstream and fill it with the provided data. */
MessageTokenizer(const Anope::string &msg); MessageTokenizer(const Anope::string &msg);
@@ -314,5 +310,3 @@ private:
}; };
extern CoreExport IRCDProto *IRCD; extern CoreExport IRCDProto *IRCD;
#endif // PROTOCOL_H
-800
View File
@@ -1,800 +0,0 @@
/* A portable stdint.h
****************************************************************************
* BSD License:
****************************************************************************
*
* Copyright (c) 2005-2011 Paul Hsieh
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************
*
* Version 0.1.12
*
* The ANSI C standard committee, for the C99 standard, specified the
* inclusion of a new standard include file called stdint.h. This is
* a very useful and long desired include file which contains several
* very precise definitions for integer scalar types that is
* critically important for making portable several classes of
* applications including cryptography, hashing, variable length
* integer libraries and so on. But for most developers its likely
* useful just for programming sanity.
*
* The problem is that most compiler vendors have decided not to
* implement the C99 standard, and the next C++ language standard
* (which has a lot more mindshare these days) will be a long time in
* coming and its unknown whether or not it will include stdint.h or
* how much adoption it will have. Either way, it will be a long time
* before all compilers come with a stdint.h and it also does nothing
* for the extremely large number of compilers available today which
* do not include this file, or anything comparable to it.
*
* So that's what this file is all about. Its an attempt to build a
* single universal include file that works on as many platforms as
* possible to deliver what stdint.h is supposed to. A few things
* that should be noted about this file:
*
* 1) It is not guaranteed to be portable and/or present an identical
* interface on all platforms. The extreme variability of the
* ANSI C standard makes this an impossibility right from the
* very get go. Its really only meant to be useful for the vast
* majority of platforms that possess the capability of
* implementing usefully and precisely defined, standard sized
* integer scalars. Systems which are not intrinsically 2s
* complement may produce invalid constants.
*
* 2) There is an unavoidable use of non-reserved symbols.
*
* 3) Other standard include files are invoked.
*
* 4) This file may come in conflict with future platforms that do
* include stdint.h. The hope is that one or the other can be
* used with no real difference.
*
* 5) In the current version, if your platform can't represent
* int32_t, int16_t and int8_t, it just dumps out with a compiler
* error.
*
* 6) 64 bit integers may or may not be defined. Test for their
* presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX.
* Note that this is different from the C99 specification which
* requires the existence of 64 bit support in the compiler. If
* this is not defined for your platform, yet it is capable of
* dealing with 64 bits then it is because this file has not yet
* been extended to cover all of your system's capabilities.
*
* 7) (u)intptr_t may or may not be defined. Test for its presence
* with the test: #ifdef PTRDIFF_MAX. If this is not defined
* for your platform, then it is because this file has not yet
* been extended to cover all of your system's capabilities, not
* because its optional.
*
* 8) The following might not been defined even if your platform is
* capable of defining it:
*
* WCHAR_MIN
* WCHAR_MAX
* (u)int64_t
* PTRDIFF_MIN
* PTRDIFF_MAX
* (u)intptr_t
*
* 9) The following have not been defined:
*
* WINT_MIN
* WINT_MAX
*
* 10) The criteria for defining (u)int_least(*)_t isn't clear,
* except for systems which don't have a type that precisely
* defined 8, 16, or 32 bit types (which this include file does
* not support anyways). Default definitions have been given.
*
* 11) The criteria for defining (u)int_fast(*)_t isn't something I
* would trust to any particular compiler vendor or the ANSI C
* committee. It is well known that "compatible systems" are
* commonly created that have very different performance
* characteristics from the systems they are compatible with,
* especially those whose vendors make both the compiler and the
* system. Default definitions have been given, but its strongly
* recommended that users never use these definitions for any
* reason (they do *NOT* deliver any serious guarantee of
* improved performance -- not in this file, nor any vendor's
* stdint.h).
*
* 12) The following macros:
*
* PRINTF_INTMAX_MODIFIER
* PRINTF_INT64_MODIFIER
* PRINTF_INT32_MODIFIER
* PRINTF_INT16_MODIFIER
* PRINTF_LEAST64_MODIFIER
* PRINTF_LEAST32_MODIFIER
* PRINTF_LEAST16_MODIFIER
* PRINTF_INTPTR_MODIFIER
*
* are strings which have been defined as the modifiers required
* for the "d", "u" and "x" printf formats to correctly output
* (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t,
* (u)least32_t, (u)least16_t and (u)intptr_t types respectively.
* PRINTF_INTPTR_MODIFIER is not defined for some systems which
* provide their own stdint.h. PRINTF_INT64_MODIFIER is not
* defined if INT64_MAX is not defined. These are an extension
* beyond what C99 specifies must be in stdint.h.
*
* In addition, the following macros are defined:
*
* PRINTF_INTMAX_HEX_WIDTH
* PRINTF_INT64_HEX_WIDTH
* PRINTF_INT32_HEX_WIDTH
* PRINTF_INT16_HEX_WIDTH
* PRINTF_INT8_HEX_WIDTH
* PRINTF_INTMAX_DEC_WIDTH
* PRINTF_INT64_DEC_WIDTH
* PRINTF_INT32_DEC_WIDTH
* PRINTF_INT16_DEC_WIDTH
* PRINTF_INT8_DEC_WIDTH
*
* Which specifies the maximum number of characters required to
* print the number of that type in either hexadecimal or decimal.
* These are an extension beyond what C99 specifies must be in
* stdint.h.
*
* Compilers tested (all with 0 warnings at their highest respective
* settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32
* bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio
* .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3
*
* This file should be considered a work in progress. Suggestions for
* improvements, especially those which increase coverage are strongly
* encouraged.
*
* Acknowledgements
*
* The following people have made significant contributions to the
* development and testing of this file:
*
* Chris Howie
* John Steele Scott
* Dave Thorup
* John Dill
*
*/
#include <stddef.h>
#include <limits.h>
#include <signal.h>
/*
* For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_.
*/
#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED)
#include <stdint.h>
#define _PSTDINT_H_INCLUDED
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
# endif
# ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
# endif
# ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
# endif
# ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
# endif
# ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
# endif
# ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
# endif
# ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
# endif
# ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
/*
* Something really weird is going on with Open Watcom. Just pull some of
* these duplicated definitions from Open Watcom's stdint.h file for now.
*/
# if defined (__WATCOMC__) && __WATCOMC__ >= 1250
# if !defined (INT64_C)
# define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
# endif
# if !defined (UINT64_C)
# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
# endif
# if !defined (INT32_C)
# define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
# endif
# if !defined (UINT32_C)
# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
# endif
# if !defined (INT16_C)
# define INT16_C(x) (x)
# endif
# if !defined (UINT16_C)
# define UINT16_C(x) (x)
# endif
# if !defined (INT8_C)
# define INT8_C(x) (x)
# endif
# if !defined (UINT8_C)
# define UINT8_C(x) (x)
# endif
# if !defined (UINT64_MAX)
# define UINT64_MAX 18446744073709551615ULL
# endif
# if !defined (INT64_MAX)
# define INT64_MAX 9223372036854775807LL
# endif
# if !defined (UINT32_MAX)
# define UINT32_MAX 4294967295UL
# endif
# if !defined (INT32_MAX)
# define INT32_MAX 2147483647L
# endif
# if !defined (INTMAX_MAX)
# define INTMAX_MAX INT64_MAX
# endif
# if !defined (INTMAX_MIN)
# define INTMAX_MIN INT64_MIN
# endif
# endif
#endif
#ifndef _PSTDINT_H_INCLUDED
#define _PSTDINT_H_INCLUDED
#ifndef SIZE_MAX
# define SIZE_MAX (~(size_t)0)
#endif
/*
* Deduce the type assignments from limits.h under the assumption that
* integer sizes in bits are powers of 2, and follow the ANSI
* definitions.
*/
#ifndef UINT8_MAX
# define UINT8_MAX 0xff
#endif
#ifndef uint8_t
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
typedef unsigned char uint8_t;
# define UINT8_C(v) ((uint8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef INT8_MAX
# define INT8_MAX 0x7f
#endif
#ifndef INT8_MIN
# define INT8_MIN INT8_C(0x80)
#endif
#ifndef int8_t
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
typedef signed char int8_t;
# define INT8_C(v) ((int8_t) v)
# else
# error "Platform not supported"
# endif
#endif
#ifndef UINT16_MAX
# define UINT16_MAX 0xffff
#endif
#ifndef uint16_t
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
typedef unsigned int uint16_t;
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
# define UINT16_C(v) ((uint16_t) (v))
#elif (USHRT_MAX == UINT16_MAX)
typedef unsigned short uint16_t;
# define UINT16_C(v) ((uint16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT16_MAX
# define INT16_MAX 0x7fff
#endif
#ifndef INT16_MIN
# define INT16_MIN INT16_C(0x8000)
#endif
#ifndef int16_t
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
typedef signed int int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER ""
# endif
#elif (SHRT_MAX == INT16_MAX)
typedef signed short int16_t;
# define INT16_C(v) ((int16_t) (v))
# ifndef PRINTF_INT16_MODIFIER
# define PRINTF_INT16_MODIFIER "h"
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef UINT32_MAX
# define UINT32_MAX (0xffffffffUL)
#endif
#ifndef uint32_t
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
typedef unsigned long uint32_t;
# define UINT32_C(v) v ## UL
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (UINT_MAX == UINT32_MAX)
typedef unsigned int uint32_t;
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
# define UINT32_C(v) v ## U
#elif (USHRT_MAX == UINT32_MAX)
typedef unsigned short uint32_t;
# define UINT32_C(v) ((unsigned short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
#ifndef INT32_MAX
# define INT32_MAX (0x7fffffffL)
#endif
#ifndef INT32_MIN
# define INT32_MIN INT32_C(0x80000000)
#endif
#ifndef int32_t
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
typedef signed long int32_t;
# define INT32_C(v) v ## L
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER "l"
# endif
#elif (INT_MAX == INT32_MAX)
typedef signed int int32_t;
# define INT32_C(v) v
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#elif (SHRT_MAX == INT32_MAX)
typedef signed short int32_t;
# define INT32_C(v) ((short) (v))
# ifndef PRINTF_INT32_MODIFIER
# define PRINTF_INT32_MODIFIER ""
# endif
#else
#error "Platform not supported"
#endif
#endif
/*
* The macro stdint_int64_defined is temporarily used to record
* whether or not 64 integer support is available. It must be
* defined for any 64 integer extensions for new platforms that are
* added.
*/
#undef stdint_int64_defined
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# endif
#endif
#if !defined (stdint_int64_defined)
# if defined(__GNUC__)
# define stdint_int64_defined
__extension__ typedef long long int64_t;
__extension__ typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
# define stdint_int64_defined
typedef long long int64_t;
typedef unsigned long long uint64_t;
# define UINT64_C(v) v ## ULL
# define INT64_C(v) v ## LL
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "ll"
# endif
# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
# define stdint_int64_defined
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
# define UINT64_C(v) v ## UI64
# define INT64_C(v) v ## I64
# ifndef PRINTF_INT64_MODIFIER
# define PRINTF_INT64_MODIFIER "I64"
# endif
# endif
#endif
#if !defined (LONG_LONG_MAX) && defined (INT64_C)
# define LONG_LONG_MAX INT64_C (9223372036854775807)
#endif
#ifndef ULONG_LONG_MAX
# define ULONG_LONG_MAX UINT64_C (18446744073709551615)
#endif
#if !defined (INT64_MAX) && defined (INT64_C)
# define INT64_MAX INT64_C (9223372036854775807)
#endif
#if !defined (INT64_MIN) && defined (INT64_C)
# define INT64_MIN INT64_C (-9223372036854775808)
#endif
#if !defined (UINT64_MAX) && defined (INT64_C)
# define UINT64_MAX UINT64_C (18446744073709551615)
#endif
/*
* Width of hexadecimal for number field.
*/
#ifndef PRINTF_INT64_HEX_WIDTH
# define PRINTF_INT64_HEX_WIDTH "16"
#endif
#ifndef PRINTF_INT32_HEX_WIDTH
# define PRINTF_INT32_HEX_WIDTH "8"
#endif
#ifndef PRINTF_INT16_HEX_WIDTH
# define PRINTF_INT16_HEX_WIDTH "4"
#endif
#ifndef PRINTF_INT8_HEX_WIDTH
# define PRINTF_INT8_HEX_WIDTH "2"
#endif
#ifndef PRINTF_INT64_DEC_WIDTH
# define PRINTF_INT64_DEC_WIDTH "20"
#endif
#ifndef PRINTF_INT32_DEC_WIDTH
# define PRINTF_INT32_DEC_WIDTH "10"
#endif
#ifndef PRINTF_INT16_DEC_WIDTH
# define PRINTF_INT16_DEC_WIDTH "5"
#endif
#ifndef PRINTF_INT8_DEC_WIDTH
# define PRINTF_INT8_DEC_WIDTH "3"
#endif
/*
* Ok, lets not worry about 128 bit integers for now. Moore's law says
* we don't need to worry about that until about 2040 at which point
* we'll have bigger things to worry about.
*/
#ifdef stdint_int64_defined
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
# define INTMAX_MAX INT64_MAX
# define INTMAX_MIN INT64_MIN
# define UINTMAX_MAX UINT64_MAX
# define UINTMAX_C(v) UINT64_C(v)
# define INTMAX_C(v) INT64_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
# endif
#else
typedef int32_t intmax_t;
typedef uint32_t uintmax_t;
# define INTMAX_MAX INT32_MAX
# define UINTMAX_MAX UINT32_MAX
# define UINTMAX_C(v) UINT32_C(v)
# define INTMAX_C(v) INT32_C(v)
# ifndef PRINTF_INTMAX_MODIFIER
# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
# endif
# ifndef PRINTF_INTMAX_HEX_WIDTH
# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
# endif
# ifndef PRINTF_INTMAX_DEC_WIDTH
# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
# endif
#endif
/*
* Because this file currently only supports platforms which have
* precise powers of 2 as bit sizes for the default integers, the
* least definitions are all trivial. Its possible that a future
* version of this file could have different definitions.
*/
#ifndef stdint_least_defined
typedef int8_t int_least8_t;
typedef uint8_t uint_least8_t;
typedef int16_t int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t int_least32_t;
typedef uint32_t uint_least32_t;
# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
# define UINT_LEAST8_MAX UINT8_MAX
# define INT_LEAST8_MAX INT8_MAX
# define UINT_LEAST16_MAX UINT16_MAX
# define INT_LEAST16_MAX INT16_MAX
# define UINT_LEAST32_MAX UINT32_MAX
# define INT_LEAST32_MAX INT32_MAX
# define INT_LEAST8_MIN INT8_MIN
# define INT_LEAST16_MIN INT16_MIN
# define INT_LEAST32_MIN INT32_MIN
# ifdef stdint_int64_defined
typedef int64_t int_least64_t;
typedef uint64_t uint_least64_t;
# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
# define UINT_LEAST64_MAX UINT64_MAX
# define INT_LEAST64_MAX INT64_MAX
# define INT_LEAST64_MIN INT64_MIN
# endif
#endif
#undef stdint_least_defined
/*
* The ANSI C committee pretending to know or specify anything about
* performance is the epitome of misguided arrogance. The mandate of
* this file is to *ONLY* ever support that absolute minimum
* definition of the fast integer types, for compatibility purposes.
* No extensions, and no attempt to suggest what may or may not be a
* faster integer type will ever be made in this file. Developers are
* warned to stay away from these types when using this or any other
* stdint.h.
*/
typedef int_least8_t int_fast8_t;
typedef uint_least8_t uint_fast8_t;
typedef int_least16_t int_fast16_t;
typedef uint_least16_t uint_fast16_t;
typedef int_least32_t int_fast32_t;
typedef uint_least32_t uint_fast32_t;
#define UINT_FAST8_MAX UINT_LEAST8_MAX
#define INT_FAST8_MAX INT_LEAST8_MAX
#define UINT_FAST16_MAX UINT_LEAST16_MAX
#define INT_FAST16_MAX INT_LEAST16_MAX
#define UINT_FAST32_MAX UINT_LEAST32_MAX
#define INT_FAST32_MAX INT_LEAST32_MAX
#define INT_FAST8_MIN INT_LEAST8_MIN
#define INT_FAST16_MIN INT_LEAST16_MIN
#define INT_FAST32_MIN INT_LEAST32_MIN
#ifdef stdint_int64_defined
typedef int_least64_t int_fast64_t;
typedef uint_least64_t uint_fast64_t;
# define UINT_FAST64_MAX UINT_LEAST64_MAX
# define INT_FAST64_MAX INT_LEAST64_MAX
# define INT_FAST64_MIN INT_LEAST64_MIN
#endif
#undef stdint_int64_defined
/*
* Whatever piecemeal, per compiler thing we can do about the wchar_t
* type limits.
*/
#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
# include <wchar.h>
# ifndef WCHAR_MIN
# define WCHAR_MIN 0
# endif
# ifndef WCHAR_MAX
# define WCHAR_MAX ((wchar_t)-1)
# endif
#endif
/*
* Whatever piecemeal, per compiler/platform thing we can do about the
* (u)intptr_t types and limits.
*/
#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
# define STDINT_H_UINTPTR_T_DEFINED
#endif
#ifndef STDINT_H_UINTPTR_T_DEFINED
# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
# define stdint_intptr_bits 64
# elif defined (__WATCOMC__) || defined (__TURBOC__)
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
# define stdint_intptr_bits 16
# else
# define stdint_intptr_bits 32
# endif
# elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
# define stdint_intptr_bits 32
# elif defined (__INTEL_COMPILER)
/* TODO -- what did Intel do about x86-64? */
# endif
# ifdef stdint_intptr_bits
# define stdint_intptr_glue3_i(a,b,c) a##b##c
# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
# ifndef PRINTF_INTPTR_MODIFIER
# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
# endif
# ifndef PTRDIFF_MAX
# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef PTRDIFF_MIN
# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef UINTPTR_MAX
# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MAX
# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
# endif
# ifndef INTPTR_MIN
# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
# endif
# ifndef INTPTR_C
# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
# endif
# ifndef UINTPTR_C
# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
# endif
typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
# else
/* TODO -- This following is likely wrong for some platforms, and does
nothing for the definition of uintptr_t. */
typedef ptrdiff_t intptr_t;
# endif
# define STDINT_H_UINTPTR_T_DEFINED
#endif
/*
* Assumes sig_atomic_t is signed and we have a 2s complement machine.
*/
#ifndef SIG_ATOMIC_MAX
# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
#endif
#endif
#if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
/*
* Please compile with the maximum warning settings to make sure macros are not
* defined more than once.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define glue3_aux(x,y,z) x ## y ## z
#define glue3(x,y,z) glue3_aux(x,y,z)
#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
#define DECL(us,bits) glue3(DECL,us,) (bits)
#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
int main () {
DECL(I,8)
DECL(U,8)
DECL(I,16)
DECL(U,16)
DECL(I,32)
DECL(U,32)
#ifdef INT64_MAX
DECL(I,64)
DECL(U,64)
#endif
intmax_t imax = INTMAX_C(0);
uintmax_t umax = UINTMAX_C(0);
char str0[256], str1[256];
sprintf (str0, "%d %x\n", 0, ~0);
sprintf (str1, "%d %x\n", i8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
sprintf (str1, "%u %x\n", u8, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
sprintf (str1, "%d %x\n", i16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
sprintf (str1, "%u %x\n", u16, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
#ifdef INT64_MAX
sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
#endif
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
TESTUMAX(8);
TESTUMAX(16);
TESTUMAX(32);
#ifdef INT64_MAX
TESTUMAX(64);
#endif
return EXIT_SUCCESS;
}
#endif
+7 -9
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef REGCHANNEL_H #pragma once
#define REGCHANNEL_H
#include "memo.h" #include "memo.h"
#include "modes.h" #include "modes.h"
@@ -24,7 +23,7 @@ extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelLi
/* AutoKick data. */ /* AutoKick data. */
class CoreExport AutoKick : public Serializable class CoreExport AutoKick : public Serializable
{ {
public: public:
/* Channel this autokick is on */ /* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci; Serialize::Reference<ChannelInfo> ci;
@@ -38,7 +37,7 @@ class CoreExport AutoKick : public Serializable
AutoKick(); AutoKick();
~AutoKick(); ~AutoKick();
void Serialize(Serialize::Data &data) const anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
}; };
@@ -48,14 +47,14 @@ class CoreExport ChannelInfo : 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;
@@ -93,8 +92,9 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
ChannelInfo(const ChannelInfo &ci); ChannelInfo(const ChannelInfo &ci);
~ChannelInfo(); ~ChannelInfo();
ChannelInfo& operator=(const ChannelInfo &) = default;
void Serialize(Serialize::Data &data) const anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &); static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
/** Change the founder of the channel /** Change the founder of the channel
@@ -248,5 +248,3 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
* @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
+7 -10
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef REGEXPR_H #pragma once
#define REGEXPR_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -18,28 +17,26 @@
class RegexException : public CoreException class RegexException : public CoreException
{ {
public: public:
RegexException(const Anope::string &reason = "") : CoreException(reason) { } RegexException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~RegexException() throw() { } virtual ~RegexException() noexcept = default;
}; };
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() { } virtual ~Regex() = default;
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 : public Service class CoreExport RegexProvider : 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
+19 -24
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SERIALIZE_H #pragma once
#define SERIALIZE_H
#include <sstream> #include <sstream>
@@ -21,14 +20,14 @@ namespace Serialize
{ {
class Data class Data
{ {
public: public:
enum Type enum Type
{ {
DT_TEXT, DT_TEXT,
DT_INT DT_INT
}; };
virtual ~Data() { } virtual ~Data() = default;
virtual std::iostream& operator[](const Anope::string &key) = 0; virtual std::iostream& operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); } virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
@@ -52,7 +51,7 @@ namespace Serialize
*/ */
class CoreExport Serializable : public virtual Base class CoreExport Serializable : 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 +64,24 @@ class CoreExport Serializable : public virtual Base
/* 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; size_t last_commit = 0;
/* 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; time_t last_commit_time = 0;
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; uint64_t id = 0;
/* Only used by redis, to ignore updates */ /* Only used by redis, to ignore updates */
unsigned short redis_ignore; unsigned short redis_ignore = 0;
/** Marks the object as potentially being updated "soon". /** Marks the object as potentially being updated "soon".
*/ */
@@ -127,9 +126,9 @@ class CoreExport Serialize::Type : public Base
* 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; time_t timestamp = 0;
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;
@@ -187,7 +186,7 @@ class Serialize::Checker
{ {
Anope::string name; Anope::string name;
T obj; T obj;
mutable ::Reference<Serialize::Type> type; mutable ::Reference<Serialize::Type> type = nullptr;
inline void Check() const inline void Check() const
{ {
@@ -197,8 +196,8 @@ class Serialize::Checker
type->Check(); type->Check();
} }
public: public:
Checker(const Anope::string &n) : name(n), type(NULL) { } Checker(const Anope::string &n) : name(n) { }
inline const T* operator->() const inline const T* operator->() const
{ {
@@ -243,13 +242,11 @@ class Serialize::Checker
template<typename T> template<typename T>
class Serialize::Reference : public ReferenceBase class Serialize::Reference : public ReferenceBase
{ {
protected: protected:
T *ref; T *ref = nullptr;
public: public:
Reference() : ref(NULL) Reference() = default;
{
}
Reference(T *obj) : ref(obj) Reference(T *obj) : ref(obj)
{ {
@@ -331,5 +328,3 @@ class Serialize::Reference : public ReferenceBase
return NULL; return NULL;
} }
}; };
#endif // SERIALIZE_H
+6 -9
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SERVERS_H #pragma once
#define SERVERS_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -40,7 +39,7 @@ namespace Servers
*/ */
class CoreExport Server : public Extensible class CoreExport Server : public Extensible
{ {
private: private:
/* Server name */ /* Server name */
Anope::string name; Anope::string name;
/* Hops between services and server */ /* Hops between services and server */
@@ -62,7 +61,7 @@ class CoreExport Server : public Extensible
/* Reason this server was quit */ /* Reason this server was quit */
Anope::string quit_reason; Anope::string quit_reason;
public: public:
/** Constructor /** Constructor
* @param uplink The uplink this server is from, is only NULL when creating Me * @param uplink The uplink this server is from, is only NULL when creating Me
* @param name The server name * @param name The server name
@@ -73,14 +72,14 @@ class CoreExport Server : public Extensible
*/ */
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false); Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false);
private: private:
/** Destructor /** Destructor
*/ */
~Server(); ~Server();
public: public:
/* Number of users on the server */ /* Number of users on the server */
unsigned users; unsigned users = 0;
/** Delete this server with a reason /** Delete this server with a reason
* @param reason The reason * @param reason The reason
@@ -183,5 +182,3 @@ class CoreExport Server : public Extensible
*/ */
static Server *Find(const Anope::string &name, bool name_only = false); static Server *Find(const Anope::string &name, bool name_only = false);
}; };
#endif // SERVERS_H
+7 -10
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SERVICE_H #pragma once
#define SERVICE_H
#include "services.h" #include "services.h"
#include "anope.h" #include "anope.h"
@@ -42,7 +41,7 @@ class CoreExport Service : public virtual Base
return NULL; return NULL;
} }
public: public:
static Service *FindService(const Anope::string &t, const Anope::string &n) static Service *FindService(const Anope::string &t, const Anope::string &n)
{ {
std::map<Anope::string, std::map<Anope::string, Service *> >::const_iterator it = Services.find(t); std::map<Anope::string, std::map<Anope::string, Service *> >::const_iterator it = Services.find(t);
@@ -113,7 +112,7 @@ class CoreExport Service : public virtual Base
} }
}; };
/** Like Reference, but used to refer to Services. /** Like Reference, but used to refer to a Service.
*/ */
template<typename T> template<typename T>
class ServiceReference : public Reference<T> class ServiceReference : public Reference<T>
@@ -121,8 +120,8 @@ class ServiceReference : public Reference<T>
Anope::string type; Anope::string type;
Anope::string name; Anope::string name;
public: public:
ServiceReference() { } ServiceReference() = default;
ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n) ServiceReference(const Anope::string &t, const Anope::string &n) : type(t), name(n)
{ {
@@ -138,7 +137,7 @@ class ServiceReference : public Reference<T>
this->invalid = true; this->invalid = true;
} }
operator bool() anope_override operator bool() override
{ {
if (this->invalid) if (this->invalid)
{ {
@@ -162,7 +161,7 @@ class ServiceReference : public Reference<T>
class ServiceAlias class ServiceAlias
{ {
Anope::string t, f; Anope::string t, f;
public: public:
ServiceAlias(const Anope::string &type, const Anope::string &from, const Anope::string &to) : t(type), f(from) ServiceAlias(const Anope::string &type, const Anope::string &from, const Anope::string &to) : t(type), f(from)
{ {
Service::AddAlias(type, from, to); Service::AddAlias(type, from, to);
@@ -173,5 +172,3 @@ class ServiceAlias
Service::DelAlias(t, f); Service::DelAlias(t, f);
} }
}; };
#endif // SERVICE_H
+6 -19
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SERVICES_H #pragma once
#define SERVICES_H
#include "sysconf.h" #include "sysconf.h"
@@ -21,16 +20,15 @@
#include <cstdarg> #include <cstdarg>
#include <stdexcept> #include <stdexcept>
#include <string.h> #include <cstring>
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
/* Pull in the various bits of STL */ /* Pull in the various bits of STL */
#include <cstdint>
#include <cstddef>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
@@ -48,21 +46,10 @@
#define _(x) x #define _(x) x
#if defined __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
# define anope_override override
# define anope_final final
#else
# define anope_override
# define anope_final
#endif
#ifndef _WIN32 #ifndef _WIN32
# define DllExport # define DllExport __attribute__ ((visibility ("default")))
# define CoreExport # define CoreExport __attribute__ ((visibility ("default")))
# define MARK_DEPRECATED __attribute((deprecated))
# define anope_close close # define anope_close close
#else #else
# include "anope_windows.h" # include "anope_windows.h"
#endif #endif
#endif // SERVICES_H
+2 -5
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SOCKETENGINE_H #pragma once
#define SOCKETENGINE_H
#include "services.h" #include "services.h"
#include "sockets.h" #include "sockets.h"
@@ -18,7 +17,7 @@
class CoreExport SocketEngine class CoreExport SocketEngine
{ {
static const int DefaultSize = 2; // Uplink, mode stacker static const int DefaultSize = 2; // Uplink, mode stacker
public: public:
/* Map of sockets */ /* Map of sockets */
static std::map<int, Socket *> Sockets; static std::map<int, Socket *> Sockets;
@@ -46,5 +45,3 @@ class CoreExport SocketEngine
static bool IgnoreErrno(); static bool IgnoreErrno();
}; };
#endif // SOCKETENGINE_H
+52 -44
View File
@@ -9,17 +9,22 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef SOCKETS_H #pragma once
#define SOCKETS_H
#ifndef _WIN32 #ifndef _WIN32
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h>
#endif #endif
#include "anope.h" #include "anope.h"
// This has to be after anope.h
#ifdef _WIN32
# include <afunix.h>
#endif
#define NET_BUFSIZE 65535 #define NET_BUFSIZE 65535
/** A sockaddr union used to combine IPv4 and IPv6 sockaddrs /** A sockaddr union used to combine IPv4 and IPv6 sockaddrs
@@ -29,6 +34,7 @@ union CoreExport sockaddrs
sockaddr sa; sockaddr sa;
sockaddr_in sa4; sockaddr_in sa4;
sockaddr_in6 sa6; sockaddr_in6 sa6;
sockaddr_un saun;
/** Construct the object, sets everything to 0 /** Construct the object, sets everything to 0
*/ */
@@ -57,6 +63,11 @@ union CoreExport sockaddrs
*/ */
Anope::string addr() const; Anope::string addr() const;
/** Gets the endpoint represented by this addr.
* @return The endpoint.
*/
Anope::string str() const;
/** Get the reverse address represented by this addr /** Get the reverse address represented by this addr
* @return The reverse address * @return The reverse address
*/ */
@@ -97,7 +108,7 @@ class CoreExport cidr
sockaddrs addr; sockaddrs addr;
Anope::string cidr_ip; Anope::string cidr_ip;
unsigned short cidr_len; unsigned short cidr_len;
public: public:
cidr(const Anope::string &ip); cidr(const Anope::string &ip);
cidr(const Anope::string &ip, unsigned char len); cidr(const Anope::string &ip, unsigned char len);
cidr(const sockaddrs &ip, unsigned char len); cidr(const sockaddrs &ip, unsigned char len);
@@ -117,7 +128,7 @@ class CoreExport cidr
class SocketException : public CoreException class SocketException : public CoreException
{ {
public: public:
/** Constructor for socket exceptions /** Constructor for socket exceptions
* @param message Error message * @param message Error message
*/ */
@@ -126,7 +137,7 @@ class SocketException : public CoreException
/** Destructor /** Destructor
* @throws Nothing * @throws Nothing
*/ */
virtual ~SocketException() throw() { } virtual ~SocketException() noexcept = default;
}; };
enum SocketFlag enum SocketFlag
@@ -143,8 +154,8 @@ enum SocketFlag
class CoreExport SocketIO class CoreExport SocketIO
{ {
public: public:
virtual ~SocketIO() { } virtual ~SocketIO() = default;
/** Receive something from the buffer /** Receive something from the buffer
* @param s The socket * @param s The socket
@@ -201,13 +212,14 @@ class CoreExport SocketIO
class CoreExport Socket class CoreExport Socket
{ {
protected: protected:
/* Socket FD */ /* Socket FD */
int sock; int sock;
/* Is this an IPv6 socket? */
bool ipv6;
public: /* The family of this socket FD */
int family;
public:
std::bitset<SF_SIZE> flags; std::bitset<SF_SIZE> flags;
/* Sockaddrs for bind() (if it's bound) */ /* Sockaddrs for bind() (if it's bound) */
@@ -222,25 +234,25 @@ class CoreExport Socket
/** Constructor, possibly creates the socket and adds it to the engine /** Constructor, possibly creates the socket and adds it to the engine
* @param sock The socket to use, -1 if we need to create our own * @param sock The socket to use, -1 if we need to create our own
* @param ipv6 true if using ipv6 * @param family The family of the socket
* @param type The socket type, defaults to SOCK_STREAM * @param type The socket type, defaults to SOCK_STREAM
*/ */
Socket(int sock, bool ipv6 = false, int type = SOCK_STREAM); Socket(int sock, int family = AF_INET, int type = SOCK_STREAM);
/** Destructor, closes the socket and removes it from the engine /** Destructor, closes the socket and removes it from the engine
*/ */
virtual ~Socket(); virtual ~Socket();
/** Get the socket family for this socket
* @return the family
*/
int GetFamily() const;
/** Get the socket FD for this socket /** Get the socket FD for this socket
* @return the fd * @return the fd
*/ */
int GetFD() const; int GetFD() const;
/** Check if this socket is IPv6
* @return true or false
*/
bool IsIPv6() const;
/** Mark a socket as (non)blocking /** Mark a socket as (non)blocking
* @param state true to enable blocking, false to disable blocking * @param state true to enable blocking, false to disable blocking
* @return true if the socket is now blocking * @return true if the socket is now blocking
@@ -276,7 +288,7 @@ class CoreExport Socket
class CoreExport BufferedSocket : public virtual Socket class CoreExport BufferedSocket : public virtual Socket
{ {
protected: protected:
/* Things read from the socket */ /* Things read from the socket */
Anope::string read_buffer; Anope::string read_buffer;
/* Things to be written to the socket */ /* Things to be written to the socket */
@@ -284,19 +296,18 @@ class CoreExport BufferedSocket : public virtual Socket
/* How much data was received from this socket on this recv() */ /* How much data was received from this socket on this recv() */
int recv_len; int recv_len;
public: public:
BufferedSocket(); virtual ~BufferedSocket() = default;
virtual ~BufferedSocket();
/** Called when there is something to be received for this socket /** Called when there is something to be received for this socket
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
bool ProcessRead() anope_override; bool ProcessRead() override;
/** Called when the socket is ready to be written to /** Called when the socket is ready to be written to
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
bool ProcessWrite() anope_override; bool ProcessWrite() override;
/** Gets the new line from the input buffer, if any /** Gets the new line from the input buffer, if any
*/ */
@@ -305,9 +316,9 @@ class CoreExport BufferedSocket : public virtual Socket
/** Write to the socket /** Write to the socket
* @param message The message * @param message The message
*/ */
protected: protected:
virtual void Write(const char *buffer, size_t l); virtual void Write(const char *buffer, size_t l);
public: public:
void Write(const char *message, ...); void Write(const char *message, ...);
void Write(const Anope::string &message); void Write(const Anope::string &message);
@@ -324,7 +335,7 @@ class CoreExport BufferedSocket : public virtual Socket
class CoreExport BinarySocket : public virtual Socket class CoreExport BinarySocket : public virtual Socket
{ {
protected: protected:
struct DataBlock struct DataBlock
{ {
char *orig; char *orig;
@@ -338,19 +349,18 @@ class CoreExport BinarySocket : public virtual Socket
/* Data to be written out */ /* Data to be written out */
std::deque<DataBlock *> write_buffer; std::deque<DataBlock *> write_buffer;
public: public:
BinarySocket(); virtual ~BinarySocket() = default;
virtual ~BinarySocket();
/** Called when there is something to be received for this socket /** Called when there is something to be received for this socket
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
bool ProcessRead() anope_override; bool ProcessRead() override;
/** Called when the socket is ready to be written to /** Called when the socket is ready to be written to
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
bool ProcessWrite() anope_override; bool ProcessWrite() override;
/** Write data to the socket /** Write data to the socket
* @param buffer The data to write * @param buffer The data to write
@@ -370,14 +380,14 @@ class CoreExport BinarySocket : public virtual Socket
class CoreExport ListenSocket : public virtual Socket class CoreExport ListenSocket : public virtual Socket
{ {
public: public:
/** Constructor /** Constructor
* @param bindip The IP to bind to * @param bindip The IP to bind to
* @param port The port to listen on * @param port The port to listen on
* @param ipv6 true for ipv6 * @param ipv6 true for ipv6
*/ */
ListenSocket(const Anope::string &bindip, int port, bool ipv6); ListenSocket(const Anope::string &bindip, int port, bool ipv6);
virtual ~ListenSocket(); virtual ~ListenSocket() = default;
/** Process what has come in from the connection /** Process what has come in from the connection
* @return false to destroy this socket * @return false to destroy this socket
@@ -394,7 +404,7 @@ class CoreExport ListenSocket : public virtual Socket
class CoreExport ConnectionSocket : public virtual Socket class CoreExport ConnectionSocket : public virtual Socket
{ {
public: public:
/* Sockaddrs for connection ip/port */ /* Sockaddrs for connection ip/port */
sockaddrs conaddr; sockaddrs conaddr;
@@ -408,12 +418,12 @@ class CoreExport ConnectionSocket : public virtual Socket
* Used to determine whether or not this socket is connected yet. * Used to determine whether or not this socket is connected yet.
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue * @return true to continue to call ProcessRead/ProcessWrite, false to not continue
*/ */
bool Process() anope_override; bool Process() override;
/** Called when there is an error for this socket /** Called when there is an error for this socket
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
void ProcessError() anope_override; void ProcessError() override;
/** Called on a successful connect /** Called on a successful connect
*/ */
@@ -427,7 +437,7 @@ class CoreExport ConnectionSocket : public virtual Socket
class CoreExport ClientSocket : public virtual Socket class CoreExport ClientSocket : public virtual Socket
{ {
public: public:
/* Listen socket this connection came from */ /* Listen socket this connection came from */
ListenSocket *ls; ListenSocket *ls;
/* Clients address */ /* Clients address */
@@ -443,12 +453,12 @@ class CoreExport ClientSocket : public virtual Socket
* Used to determine whether or not this socket is connected yet. * Used to determine whether or not this socket is connected yet.
* @return true to continue to call ProcessRead/ProcessWrite, false to not continue * @return true to continue to call ProcessRead/ProcessWrite, false to not continue
*/ */
bool Process() anope_override; bool Process() override;
/** Called when there is an error for this socket /** Called when there is an error for this socket
* @return true on success, false to drop this socket * @return true on success, false to drop this socket
*/ */
void ProcessError() anope_override; void ProcessError() override;
/** Called when a client has been accepted() successfully. /** Called when a client has been accepted() successfully.
*/ */
@@ -461,7 +471,7 @@ class CoreExport ClientSocket : public virtual Socket
class CoreExport Pipe : public Socket class CoreExport Pipe : public Socket
{ {
public: public:
/** The FD of the write pipe /** The FD of the write pipe
* this->sock is the readfd * this->sock is the readfd
*/ */
@@ -472,7 +482,7 @@ class CoreExport Pipe : public Socket
/** Called when data is to be read, reads the data then calls OnNotify /** Called when data is to be read, reads the data then calls OnNotify
*/ */
bool ProcessRead() anope_override; bool ProcessRead() override;
/** Write data to this pipe /** Write data to this pipe
* @param data The data to write * @param data The data to write
@@ -507,5 +517,3 @@ class CoreExport Pipe : public Socket
extern CoreExport uint32_t TotalRead; extern CoreExport uint32_t TotalRead;
extern CoreExport uint32_t TotalWritten; extern CoreExport uint32_t TotalWritten;
extern CoreExport SocketIO NormalSocketIO; extern CoreExport SocketIO NormalSocketIO;
#endif // SOCKET_H
+21 -35
View File
@@ -1,47 +1,33 @@
#ifndef _SYSCONF_H_ /*
#define _SYSCONF_H_ *
* (C) 2003-2023 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#cmakedefine DEBUG_BUILD #pragma once
// The default umask to use for files.
#cmakedefine DEFUMASK @DEFUMASK@ #cmakedefine DEFUMASK @DEFUMASK@
#cmakedefine HAVE_CSTDINT 1
#cmakedefine HAVE_STDINT_H 1
#cmakedefine HAVE_STDDEF_H 1
#cmakedefine HAVE_STRCASECMP 1
#cmakedefine HAVE_STRICMP 1
#cmakedefine HAVE_STRINGS_H 1
#cmakedefine HAVE_UMASK 1
#cmakedefine HAVE_EVENTFD 1
#cmakedefine HAVE_EPOLL 1
#cmakedefine HAVE_POLL 1
#cmakedefine GETTEXT_FOUND 1
#ifdef HAVE_CSTDINT // Whether Anope was built in debug mode.
# include <cstdint> #cmakedefine01 DEBUG_BUILD
#else
# ifdef HAVE_STDINT_H // Whether Anope was built with localization support.
# include <stdint.h> #cmakedefine01 HAVE_LOCALIZATION
# else
# include "pstdint.h" // Whether the umask() function is available.
# endif #cmakedefine01 HAVE_UMASK
#endif
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
# define popen _popen # define popen _popen
# define pclose _pclose # define pclose _pclose
# define ftruncate _chsize # ifdef _MSC_VER
# ifdef MSVCPP
# define PATH_MAX MAX_PATH # define PATH_MAX MAX_PATH
# endif # endif
# define MAXPATHLEN MAX_PATH
# define bzero(buf, size) memset(buf, 0, size)
# ifdef MSVCPP
# define strcasecmp stricmp
# endif
# define sleep(x) Sleep(x * 1000) # define sleep(x) Sleep(x * 1000)
#endif #endif
#endif
+9 -16
View File
@@ -9,29 +9,24 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef THREADENGINE_H #pragma once
#define THREADENGINE_H
#include "sockets.h" #include "sockets.h"
#include "extensible.h" #include "extensible.h"
class CoreExport Thread : public Pipe, public Extensible class CoreExport Thread : public Pipe, public Extensible
{ {
private: private:
/* Set to true to tell the thread to finish and we are waiting for it */ /* Set to true to tell the thread to finish and we are waiting for it */
bool exit; bool exit = false;
public: public:
/* Handle for this thread */ /* Handle for this thread */
pthread_t handle; pthread_t handle;
/** Threads constructor
*/
Thread();
/** Threads destructor /** Threads destructor
*/ */
virtual ~Thread(); virtual ~Thread() = default;
/** Join to the thread, sets the exit state to true /** Join to the thread, sets the exit state to true
*/ */
@@ -65,11 +60,11 @@ class CoreExport Thread : public Pipe, public Extensible
class CoreExport Mutex class CoreExport Mutex
{ {
protected: protected:
/* A mutex, used to keep threads in sync */ /* A mutex, used to keep threads in sync */
pthread_mutex_t mutex; pthread_mutex_t mutex;
public: public:
/** Constructor /** Constructor
*/ */
Mutex(); Mutex();
@@ -95,11 +90,11 @@ class CoreExport Mutex
class CoreExport Condition : public Mutex class CoreExport Condition : public Mutex
{ {
private: private:
/* A condition */ /* A condition */
pthread_cond_t cond; pthread_cond_t cond;
public: public:
/** Constructor /** Constructor
*/ */
Condition(); Condition();
@@ -116,5 +111,3 @@ class CoreExport Condition : public Mutex
*/ */
void Wait(); void Wait();
}; };
#endif // THREADENGINE_H
+4 -7
View File
@@ -9,14 +9,13 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef TIMERS_H #pragma once
#define TIMERS_H
#include "anope.h" #include "anope.h"
class CoreExport Timer class CoreExport Timer
{ {
private: private:
/** The owner of the timer, if any /** The owner of the timer, if any
*/ */
Module *owner; Module *owner;
@@ -37,7 +36,7 @@ class CoreExport Timer
*/ */
bool repeat; bool repeat;
public: public:
/** Constructor, initializes the triggering time /** Constructor, initializes the triggering time
* @param time_from_now The number of seconds from now to trigger the timer * @param time_from_now The number of seconds from now to trigger the timer
* @param now The time now * @param now The time now
@@ -107,7 +106,7 @@ class CoreExport TimerManager
/** A list of timers /** A list of timers
*/ */
static std::multimap<time_t, Timer *> Timers; static std::multimap<time_t, Timer *> Timers;
public: public:
/** Add a timer to the list /** Add a timer to the list
* @param t A Timer derived class to add * @param t A Timer derived class to add
*/ */
@@ -127,5 +126,3 @@ class CoreExport TimerManager
*/ */
static void DeleteTimersFor(Module *m); static void DeleteTimersFor(Module *m);
}; };
#endif // TIMERS_H
+6 -9
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef UPLINK_H #pragma once
#define UPLINK_H
#include "sockets.h" #include "sockets.h"
#include "protocol.h" #include "protocol.h"
@@ -23,13 +22,13 @@ namespace Uplink
/* This is the socket to our uplink */ /* This is the socket to our uplink */
class UplinkSocket : public ConnectionSocket, public BufferedSocket class UplinkSocket : public ConnectionSocket, public BufferedSocket
{ {
public: public:
bool error; bool error;
UplinkSocket(); UplinkSocket();
~UplinkSocket(); ~UplinkSocket();
bool ProcessRead() anope_override; bool ProcessRead() override;
void OnConnect() anope_override; void OnConnect() override;
void OnError(const Anope::string &) anope_override; void OnError(const Anope::string &) override;
/* A message sent over the uplink socket */ /* A message sent over the uplink socket */
class CoreExport Message class CoreExport Message
@@ -37,7 +36,7 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
MessageSource source; MessageSource source;
std::stringstream buffer; std::stringstream buffer;
public: public:
Message(); Message();
Message(const MessageSource &); Message(const MessageSource &);
~Message(); ~Message();
@@ -49,5 +48,3 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket
}; };
}; };
extern CoreExport UplinkSocket *UplinkSock; extern CoreExport UplinkSocket *UplinkSock;
#endif // UPLINK_H
+12 -10
View File
@@ -9,8 +9,7 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#ifndef USERS_H #pragma once
#define USERS_H
#include "anope.h" #include "anope.h"
#include "modes.h" #include "modes.h"
@@ -36,9 +35,9 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/* Users that are in the process of quitting */ /* Users that are in the process of quitting */
static std::list<User *> quitting_users; static std::list<User *> quitting_users;
public: public:
typedef std::map<Anope::string, Anope::string> ModeList; typedef std::map<Anope::string, Anope::string> ModeList;
protected: protected:
Anope::string vident; Anope::string vident;
Anope::string ident; Anope::string ident;
Anope::string uid; Anope::string uid;
@@ -55,7 +54,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
time_t invalid_pw_time; time_t invalid_pw_time;
public: // XXX: exposing a tiny bit too much public: // XXX: exposing a tiny bit too much
/* User's current nick */ /* User's current nick */
Anope::string nick; Anope::string nick;
@@ -91,7 +90,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/* Last time this user sent an email */ /* Last time this user sent an email */
time_t lastmail; time_t lastmail;
protected: protected:
/** Create a new user object, initialising necessary fields and /** Create a new user object, initialising necessary fields and
* adds it to the hash * adds it to the hash
* *
@@ -113,7 +112,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/ */
virtual ~User(); virtual ~User();
public: public:
static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc); static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
/** Update the nickname of a user record accordingly, should be /** Update the nickname of a user record accordingly, should be
@@ -190,7 +189,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param ... any number of parameters * @param ... any number of parameters
*/ */
void SendMessage(BotInfo *source, const char *fmt, ...); void SendMessage(BotInfo *source, const char *fmt, ...);
void SendMessage(BotInfo *source, const Anope::string &msg) anope_override; void SendMessage(BotInfo *source, const Anope::string &msg) override;
/** Identify the user to a nick. /** Identify the user to a nick.
* updates last_seen, logs the user in, * updates last_seen, logs the user in,
@@ -226,6 +225,11 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/ */
bool IsRecognized(bool check_secure = true) const; bool IsRecognized(bool check_secure = true) const;
/** Check if the user is connected securely.
* @return True if the user is connected securely; otherwise, false.
*/
bool IsSecurelyConnected() const;
/** Check if the user is a services oper /** Check if the user is a services oper
* @return true if they are an oper * @return true if they are an oper
*/ */
@@ -370,5 +374,3 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/ */
static void QuitUsers(); static void QuitUsers();
}; };
#endif // USERS_H
+6 -4
View File
@@ -105,8 +105,9 @@ static bool write_build_h(const std::string &buildh, const std::string &git_vers
return false; return false;
} }
fd << "/* This file is automatically generated by version.cpp - do not edit it! */" << std::endl; fd << "/* This file is automatically generated by version.cpp - do not edit it! */" << std::endl
fd << build << std::endl; << "#pragma once" << std::endl
<< build << std::endl;
if (!git_version.empty()) if (!git_version.empty())
fd << "#define VERSION_GIT \"" << git_version << "\"" << std::endl; fd << "#define VERSION_GIT \"" << git_version << "\"" << std::endl;
fd.close(); fd.close();
@@ -144,9 +145,10 @@ static bool write_version_h(const std::string &versionh, const std::map<std::str
if (!fd.is_open()) if (!fd.is_open())
return false; return false;
for (std::map<std::string, std::string>::const_iterator it = versions.begin(); it != versions.end(); ++it) fd << "#pragma once" << std::endl;
for (const auto &[key, value] : versions)
{ {
fd << "#define " << it->first << " " << it->second << std::endl; fd << "#define " << key << " " << value << std::endl;
} }
fd.close(); fd.close();
+6 -9
View File
@@ -6,8 +6,7 @@
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef XLINE_H #pragma once
#define XLINE_H
#include "serialize.h" #include "serialize.h"
#include "service.h" #include "service.h"
@@ -18,13 +17,13 @@ class CoreExport XLine : public Serializable
{ {
void Init(); void Init();
Anope::string nick, user, host, real; Anope::string nick, user, host, real;
public: public:
cidr *c; cidr *c;
Anope::string mask; Anope::string mask;
Regex *regex; Regex *regex;
Anope::string by; Anope::string by;
time_t created; time_t created = 0;
time_t expires; time_t expires = 0;
Anope::string reason; Anope::string reason;
XLineManager *manager; XLineManager *manager;
Anope::string id; Anope::string id;
@@ -44,7 +43,7 @@ class CoreExport XLine : public Serializable
bool HasNickOrReal() const; bool HasNickOrReal() const;
bool IsRegex() const; bool IsRegex() const;
void Serialize(Serialize::Data &data) const anope_override; void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
}; };
@@ -56,7 +55,7 @@ class CoreExport XLineManager : public Service
Serialize::Checker<std::vector<XLine *> > xlines; Serialize::Checker<std::vector<XLine *> > xlines;
/* Akills can have the same IDs, sometimes */ /* Akills can have the same IDs, sometimes */
static Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID; static Serialize::Checker<std::multimap<Anope::string, XLine *, ci::less> > XLinesByUID;
public: public:
/* List of XLine managers we check users against in XLineManager::CheckAll */ /* List of XLine managers we check users against in XLineManager::CheckAll */
static std::list<XLineManager *> XLineManagers; static std::list<XLineManager *> XLineManagers;
@@ -180,5 +179,3 @@ class CoreExport XLineManager : public Service
*/ */
virtual void SendDel(XLine *x) = 0; virtual void SendDel(XLine *x) = 0;
}; };
#endif // XLINE_H
+5 -5
View File
@@ -1,8 +1,8 @@
# Only do this if gettext is installed # Only do this if gettext is installed
if(GETTEXT_FOUND) if(HAVE_LOCALIZATION)
# Get all of the .po files # Get all of the .po files
file(GLOB LANG_SRCS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.*.po") file(GLOB LANG_SRCS_PO RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.*.po")
sort_list(LANG_SRCS_PO) list(SORT LANG_SRCS_PO)
foreach(LANG_PO ${LANG_SRCS_PO}) foreach(LANG_PO ${LANG_SRCS_PO})
# Get the domain for this language file # Get the domain for this language file
@@ -26,12 +26,12 @@ if(GETTEXT_FOUND)
# Add to cpack ignored files if not on Windows. # Add to cpack ignored files if not on Windows.
if(NOT WIN32) if(NOT WIN32)
add_to_cpack_ignored_files("${LANG_MO}") add_to_cpack_ignored_files("${LANG_MO}")
endif(NOT WIN32) endif()
# Install the new language file # Install the new language file
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG_MO} DESTINATION ${LOCALE_DIR}/${LANG_LANG}/LC_MESSAGES RENAME ${LANG_DOMAIN}.mo PERMISSIONS ${PERMS})
endforeach(LANG_PO) endforeach()
# Generate languages, depends on the mo files # Generate languages, depends on the mo files
add_custom_target(language DEPENDS ${LANG_SRCS_MO}) add_custom_target(language DEPENDS ${LANG_SRCS_MO})
endif(GETTEXT_FOUND) endif()
+3 -3
View File
@@ -4097,7 +4097,7 @@ msgstr ""
"to them. (However, no more than %d messages will be\n" "to them. (However, no more than %d messages will be\n"
"sent in order to avoid flooding the user. If there are\n" "sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent.)\n" "more news messages, only the most recent will be sent.)\n"
"NewsCount can be configured in services.conf.\n" "NewsCount can be configured in anope.conf.\n"
"\n" "\n"
"LOGONNEWS may only be used by Services Operators." "LOGONNEWS may only be used by Services Operators."
@@ -4118,7 +4118,7 @@ msgstr ""
"be sent to them. (However, no more than %d messages will\n" "be sent to them. (However, no more than %d messages will\n"
"be sent in order to avoid flooding the user. If there are\n" "be sent in order to avoid flooding the user. If there are\n"
"more news messages, only the most recent will be sent.)\n" "more news messages, only the most recent will be sent.)\n"
"NewsCount can be configured in services.conf.\n" "NewsCount can be configured in anope.conf.\n"
"\n" "\n"
"OPERNEWS may only be used by Services Operators." "OPERNEWS may only be used by Services Operators."
@@ -7671,7 +7671,7 @@ msgstr "Sucessor de %s desabilitat."
#, fuzzy #, fuzzy
msgid "" msgid ""
"Super admin can not be set because it is not enabled in the configuration." "Super admin can not be set because it is not enabled in the configuration."
msgstr "SuperAdmin setting not enabled in services.conf" msgstr "SuperAdmin setting not enabled in anope.conf"
#, fuzzy #, fuzzy
msgid "Suspend a given nick" msgid "Suspend a given nick"

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