1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 22:26:39 +02:00

Compare commits

...

199 Commits

Author SHA1 Message Date
Sadie Powell e9424b529c Release 2.1.2. 2024-02-17 18:14:10 +00:00
Sadie Powell a60c796cf6 Update the config changelog. 2024-02-17 18:13:30 +00:00
Sadie Powell fcf16ab20a Merge branch '2.0' into 2.1. 2024-02-11 21:35:31 +00:00
Sadie Powell a25d0aa60e Update the changelog. 2024-02-11 21:14:59 +00:00
Sadie Powell c50d1dc2b5 Remove some outdated development docs. 2024-02-11 21:08:17 +00:00
Sadie Powell 274bb19d03 Switch Thread to use the C++11 equivalent, remove win32/pthread. 2024-02-11 20:35:21 +00:00
Sadie Powell 2c5b84bd1d Replace Condition and Mutex with the C++11 standard equivalents. 2024-02-11 19:53:05 +00:00
Sadie Powell 5c50bcb9c7 Remove the time_t parameter from Tick and TickTimers.
Most uses of Tick do not use the parameter and even when it is used
it is always the same as CurTime.
2024-02-11 18:18:18 +00:00
Sadie Powell cef56abea4 Consistently use time_t for the timer duration. 2024-02-11 18:10:38 +00:00
Sadie Powell 30b9f12711 Remove the now parameter from the Timer class.
This was never actually changed from the default.
2024-02-11 17:56:35 +00:00
Robby 5337326cc9 Update the dutch language file. 2024-01-31 06:17:01 +01:00
Robby 6237245ab7 Remove an extraneous space in cs_xop, part 2. 2024-01-31 03:20:35 +01:00
Robby ae1829e5a8 Fix a typo in the PASSWORD_TOO_SHORT text string. 2024-01-30 19:15:19 +01:00
Sadie Powell 026661c9a2 Fix irc2sql and webcpanel not being put into the modules folder. 2024-01-30 14:53:08 +00:00
Sadie Powell ec7223ace2 Convert map/multimap/hash_map to an alias template. 2024-01-30 14:29:17 +00:00
Sadie Powell 1f31621bbf Remove various references to old versions. 2024-01-30 14:01:07 +00:00
Sadie Powell dfd41b9b94 Fix Clang and GCC disagreeing about whether a move is needed. 2024-01-24 16:12:29 +00:00
Sadie Powell fdd4aade3b Add a CI workflow for Alpine. 2024-01-24 15:14:21 +00:00
Sadie Powell 0a53f4c26e Merge branch '2.0' into 2.1. 2024-01-24 14:48:53 +00:00
Sadie Powell 484160eb4e Shuffle modules around a bit. 2024-01-24 12:34:34 +00:00
Sadie Powell 7ac1fe5847 Rename several modules to remove the m_ prefix. 2024-01-24 12:22:51 +00:00
Sadie Powell 72acef4e15 Mark types that have no inheritors as final. 2024-01-23 16:53:06 +00:00
Sadie Powell a6a0f6c447 Improve the layout of types that inherit from another type. 2024-01-23 15:28:23 +00:00
Sadie Powell 398d674cf4 Fix some CoreExport types that should be DllExport. 2024-01-23 14:06:46 +00:00
Sadie Powell 1467de1c7e Mark all exception types as CoreExport.
From the GCC docs:

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

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

I also made role names gender-neutral using contraction (eg. "fondateur"
-> "fondateurice"), and adapted specifiers accordingly.
2024-01-06 23:22:10 +00:00
Sadie Powell 688ecf1c1d Fix an oversight in the mysql module. 2024-01-06 23:19:18 +00:00
Sadie Powell c0453cfec1 Fix a sign conversion issue in the mysql module. 2024-01-06 13:39:03 +00:00
Sadie Powell a9ab0c72a6 Use auto in places where the type is unambiguous. 2024-01-06 13:23:37 +00:00
Robert Scheck de918ef9cf Add missing whitespace in multi-line comment 2024-01-06 12:41:31 +00:00
Sadie Powell 0ee9874112 Update translations for the recent services case fix. 2024-01-05 21:44:08 +00:00
Val Lorentz 388858aee6 Fix inconsistent capitalization of 'services'. 2024-01-05 21:34:26 +00:00
Sadie Powell f22703df59 Fix a translation string and enable translations on CI. 2024-01-05 21:28:54 +00:00
Val Lorentz 4715b76dbe fr_FR: msgmerge + update fuzzy strings. 2024-01-05 21:21:43 +00:00
Sadie Powell 50bd385ccf Add an alias for chanserv/status for the name used by Atheme.
Closes #336.
2024-01-05 21:21:17 +00:00
Sadie Powell e738da9b11 Merge branch '2.0' into 2.1. 2024-01-05 19:52:56 +00:00
Sadie Powell 4573e1925d Use normal exit codes when exiting the process. 2024-01-05 12:00:28 +00:00
Sadie Powell a40f8e0b9d Update the copyright headers for 2024. 2024-01-04 22:25:48 +00:00
Sadie Powell 9db49ec790 Bump for 2.1.2-git. 2024-01-04 17:55:44 +00:00
Sadie Powell e8cd2909a5 Release 2.1.1. 2024-01-04 17:54:06 +00:00
Sadie Powell e7a57aa754 Update the changelog. 2024-01-04 17:53:05 +00:00
Sadie Powell 1c30f69bd0 Fix a typo in GetCommandLineArgument. 2024-01-04 17:52:30 +00:00
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
412 changed files with 11359 additions and 18048 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.
+58
View File
@@ -0,0 +1,58 @@
name: Alpine CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip alpine ci]')"
container: alpine:edge
runs-on: ubuntu-latest
env:
CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
apk update
apk add \
clang \
cmake \
g++ \
gettext \
git \
gnutls-dev \
mariadb-dev \
openldap-dev \
openssl-dev \
pcre2-dev \
samurai \
sqlite-dev \
tre-dev
- name: Enable extras
run: |
for MODULE in ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
do
ln -s $PWD/modules/extra/$MODULE.cpp $PWD/modules
done
- name: Run CMake
run: |
mkdir build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=$(readlink -f ../run) ..
- name: Build Anope
run: |
ninja -C build install
strategy:
fail-fast: false
matrix:
compiler:
- clang++
- g++
+3 -7
View File
@@ -8,7 +8,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
@@ -24,7 +24,6 @@ jobs:
libldap2-dev \ libldap2-dev \
libmysqlclient-dev \ libmysqlclient-dev \
libpcre2-dev \ libpcre2-dev \
libpcre3-dev \
libsqlite3-dev \ libsqlite3-dev \
libssl-dev \ libssl-dev \
libtre-dev \ libtre-dev \
@@ -32,9 +31,9 @@ jobs:
- 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 ldap ldap_authentication ldap_oper mysql regex_pcre2 regex_posix regex_tre sql_authentication sql_log sql_oper sqlite ssl_gnutls ssl_openssl
do do
ln -s ${{ github.workspace }}/modules/extra/$MODULE ${{ github.workspace }}/modules ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules
done done
- name: Run CMake - name: Run CMake
@@ -52,6 +51,3 @@ jobs:
compiler: compiler:
- clang++ - clang++
- g++ - g++
standard:
- c++98
- c++17
+35
View File
@@ -0,0 +1,35 @@
name: Windows CI
on:
pull_request:
push:
schedule:
- cron: '0 0 * * 0'
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3
- name: Setup Conan
uses: turtlebrowser/get-conan@v1.2
with:
version: 1.59.0
- name: Install libraries
run: |
conan install ${{ github.workspace }}\src\win32 --build=missing
- name: Run CMake
run: |
mkdir ${{ github.workspace }}\build
cd ${{ github.workspace }}\build
cmake -A "x64" -G "Visual Studio 16 2019" ..
- name: Build Anope
working-directory: ${{ github.workspace }}\build
run: |
msbuild PACKAGE.vcxproj /M:3 /P:Configuration=Release /P:Platform=x64 /VERBOSITY:MINIMAL
+14 -14
View File
@@ -1,19 +1,19 @@
build/ build/
config.cache config.cache
include/sysconf.h include/sysconf.h
modules/m_ldap.cpp modules/ldap.cpp
modules/m_ldap_authentication.cpp modules/ldap_authentication.cpp
modules/m_ldap_oper.cpp modules/ldap_oper.cpp
modules/m_mysql.cpp modules/mysql.cpp
modules/m_regex_pcre.cpp modules/regex_pcre2.cpp
modules/m_regex_pcre2.cpp modules/regex_posix.cpp
modules/m_regex_posix.cpp modules/regex_tre.cpp
modules/m_regex_tre.cpp modules/sql_authentication.cpp
modules/m_sql_authentication.cpp modules/sql_log.cpp
modules/m_sql_log.cpp modules/sql_oper.cpp
modules/m_sql_oper.cpp modules/sqlite.cpp
modules/m_sqlite.cpp modules/ssl_gnutls.cpp
modules/m_ssl_gnutls.cpp modules/ssl_openssl.cpp
modules/m_ssl_openssl.cpp
modules/stats modules/stats
run/ run/
*.mo
+107 -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,13 @@ 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!") # Put modules in their own folder
endif(GCC_VERSION LESS 4.2) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
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 +34,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line # 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 +44,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 +67,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# If the line has the following on it, the next lines will contain directory names # If 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 +83,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
# Convert the path to an absolute one, just in case it wasn't # 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 +101,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 +137,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 +171,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 -Wformat=2 -Wmissing-format-attribute -Wpedantic -Wno-format-nonliteral -Wno-format-zero-length -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 +248,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 +311,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 +321,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 +335,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 +350,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 +362,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 +370,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 +423,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()
+11 -53
View File
@@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
# #
# Configuration script for Services. # Configuration script for Anope.
# #
# Anope (C) 2003-2023 Anope Team # Anope (C) 2003-2024 Anope Team
# Contact us at team@anope.org # Contact us at team@anope.org
# #
# This program is free but copyrighted software; see the file COPYING for # This program is free but copyrighted software; see the file COPYING for
@@ -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}
) )
@@ -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
@@ -1210,7 +1199,7 @@ module
* db_redis. * db_redis.
* *
* This module allows using Redis (https://redis.io/) as a database backend. * This module allows using Redis (https://redis.io/) as a database backend.
* This module requires that m_redis is loaded and configured properly. * This module requires that redis is loaded and configured properly.
* *
* Redis 2.8 supports keyspace notifications which allows Redis to push notifications * Redis 2.8 supports keyspace notifications which allows Redis to push notifications
* to Anope about outside modifications to the database. This module supports this and * to Anope about outside modifications to the database. This module supports this and
@@ -1222,7 +1211,7 @@ module
name = "db_redis" name = "db_redis"
/* /*
* Redis database to use. This must be configured with m_redis. * Redis database to use. This must be configured with redis.
*/ */
engine = "redis/main" engine = "redis/main"
} }
@@ -1236,7 +1225,7 @@ module
* *
* Without any encryption modules loaded users will not be able to authenticate unless * Without any encryption modules loaded users will not be able to authenticate unless
* there is another module loaded that provides authentication checking, such as * there is another module loaded that provides authentication checking, such as
* m_ldap_authentication or m_sql_authentication. * ldap_authentication or sql_authentication.
* *
* With enc_none, passwords will be stored in plain text, allowing for passwords * With enc_none, passwords will be stored in plain text, allowing for passwords
* to be recovered later but it isn't secure and therefore is not recommended. * to be recovered later but it isn't secure and therefore is not recommended.
@@ -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"
+55 -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"
@@ -1209,6 +1261,7 @@ command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc
*/ */
module { name = "cs_status" } module { name = "cs_status" }
command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; } command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; }
command { service = "ChanServ"; name = "WHY"; command = "chanserv/status"; hide = true; }
/* /*
* cs_suspend * cs_suspend
+1 -1
View File
@@ -5,7 +5,7 @@
module module
{ {
name = "m_chanstats" name = "chanstats"
/* /*
* The name of this engine. * The name of this engine.
+4 -4
View File
@@ -9,16 +9,16 @@
############################################################### ###############################################################
# Anope binary directory # Anope binary directory
ANOPATH=/home/ircd/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
} }
+104 -89
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.
@@ -19,14 +19,14 @@
module { name = "help" } module { name = "help" }
/* /*
* m_dns * dns
* *
* Adds support for the DNS protocol. By itself this module does nothing useful, * Adds support for the DNS protocol. By itself this module does nothing useful,
* but other modules such as m_dnsbl and os_dns require this. * but other modules such as dnsbl and os_dns require this.
*/ */
#module #module
{ {
name = "m_dns" name = "dns"
/* /*
* The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file. * The nameserver to use for resolving hostnames, must be an IP or a resolver configuration file.
@@ -80,7 +80,7 @@ module { name = "help" }
} }
/* /*
* m_dnsbl * dnsbl
* *
* Allows configurable DNS blacklists to check connecting users against. If a user * Allows configurable DNS blacklists to check connecting users against. If a user
* is found on the blacklist they will be immediately banned. This is a crucial module * is found on the blacklist they will be immediately banned. This is a crucial module
@@ -88,17 +88,17 @@ module { name = "help" }
*/ */
#module #module
{ {
name = "m_dnsbl" name = "dnsbl"
/* /*
* If set, Services will check clients against the DNSBLs when services connect to its uplink. * If set, Anope will check clients against the DNSBLs when services connect to its uplink.
* This is not recommended, and on large networks will open a very large amount of DNS queries. * 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.
*/ */
@@ -179,19 +179,19 @@ module { name = "help" }
} }
/* /*
* m_helpchan * helpchan
* *
* Gives users who are op in the specified help channel usermode +h (helpop). * Gives users who are op in the specified help channel usermode +h (helpop).
*/ */
#module #module
{ {
name = "m_helpchan" name = "helpchan"
helpchannel = "#help" helpchannel = "#help"
} }
/* /*
* m_httpd * httpd
* *
* Allows services to serve web pages. By itself, this module does nothing useful. * Allows services to serve web pages. By itself, this module does nothing useful.
* *
@@ -200,7 +200,7 @@ module { name = "help" }
*/ */
#module #module
{ {
name = "m_httpd" name = "httpd"
httpd httpd
{ {
@@ -233,13 +233,13 @@ module { name = "help" }
} }
/* /*
* m_ldap [EXTRA] * ldap [EXTRA]
* *
* This module allows other modules to use LDAP. By itself, this module does nothing useful. * This module allows other modules to use LDAP. By itself, this module does nothing useful.
*/ */
#module #module
{ {
name = "m_ldap" name = "ldap"
ldap ldap
{ {
@@ -254,14 +254,14 @@ module { name = "help" }
} }
/* /*
* m_ldap_authentication [EXTRA] * ldap_authentication [EXTRA]
* *
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use * This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
* LDAP to authenticate users. Requires m_ldap. * LDAP to authenticate users. Requires ldap.
*/ */
#module #module
{ {
name = "m_ldap_authentication" name = "ldap_authentication"
/* /*
* The distinguished name used for searching for users's accounts. * The distinguished name used for searching for users's accounts.
@@ -314,16 +314,16 @@ module { name = "help" }
} }
/* /*
* m_ldap_oper [EXTRA] * ldap_oper [EXTRA]
* *
* This module dynamically ties users to Anope opertypes when they identify * This module dynamically ties users to Anope opertypes when they identify
* via LDAP group membership. Requires m_ldap. * via LDAP group membership. Requires ldap.
* *
* Note that this doesn't give the user privileges on the IRCd, only in Services. * Note that this doesn't give the user privileges on the IRCd, only in Anope.
*/ */
#module #module
{ {
name = "m_ldap_oper" name = "ldap_oper"
/* /*
* An optional binddn to use when searching for groups. * An optional binddn to use when searching for groups.
@@ -355,13 +355,13 @@ module { name = "help" }
} }
/* /*
* m_mysql [EXTRA] * mysql [EXTRA]
* *
* This module allows other modules to use MySQL. * This module allows other modules to use MySQL.
*/ */
#module #module
{ {
name = "m_mysql" name = "mysql"
mysql mysql
{ {
@@ -376,13 +376,13 @@ module { name = "help" }
} }
/* /*
* m_redis * redis
* *
* This module allows other modules to use Redis. * This module allows other modules to use Redis.
*/ */
#module #module
{ {
name = "m_redis" name = "redis"
/* A redis database */ /* A redis database */
redis redis
@@ -401,47 +401,61 @@ module { name = "help" }
} }
/* /*
* m_regex_pcre [EXTRA] * regex_pcre2 [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]
* *
* 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 = "regex_pcre2" }
/* /*
* m_regex_posix [EXTRA] * 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 = "regex_posix" }
/* /*
* m_regex_tre [EXTRA] * regex_stdlib
*
* Provides the regex engine regex/stdlib, which uses the regular expression library that is part of
* the C++ standard library.
*/
module
{
name = "regex_stdlib"
/*
* The syntax scheme to use. Can be set to awk to use the regular expression grammar used by the
* awk utility in POSIX, basic to use the basic POSIX regular expression grammar, ecmascript to
* use the modified ECMAScript regular expression grammar, egrep to use the regular expression
* grammar used by the grep utility with the -E option in POSIX, extended to use the extended
* POSIX regular expression grammar, or grep to use the regular expression grammar used by the
* grep utility in POSIX.
*
* See https://en.cppreference.com/w/cpp/regex/syntax_option_type for more information.
*/
syntax = "ecmascript"
}
/*
* regex_tre [EXTRA]
* *
* Provides the regex engine regex/tre, which uses the TRE regex library. * Provides the regex engine regex/tre, which uses the TRE regex library.
*/ */
#module { name = "m_regex_tre" } #module { name = "regex_tre" }
/* /*
* m_rewrite * rewrite
* *
* Allows rewriting commands sent to/from clients. * Allows rewriting commands sent to/from clients.
*/ */
#module { name = "m_rewrite" } #module { name = "rewrite" }
#command #command
{ {
service = "ChanServ"; name = "CLEAR"; command = "rewrite" service = "ChanServ"; name = "CLEAR"; command = "rewrite"
/* Enable m_rewrite. */ /* Enable rewrite. */
rewrite = true rewrite = true
/* Source message to match. A $ can be used to match anything. */ /* Source message to match. A $ can be used to match anything. */
@@ -462,7 +476,7 @@ module { name = "help" }
} }
/* /*
* m_proxyscan * proxyscan
* *
* This module allows you to scan connecting clients for open proxies. * This module allows you to scan connecting clients for open proxies.
* Note that using this will allow users to get the IP of your services. * Note that using this will allow users to get the IP of your services.
@@ -476,7 +490,7 @@ module { name = "help" }
*/ */
#module #module
{ {
name = "m_proxyscan" name = "proxyscan"
/* /*
* The target IP services tells the proxy to connect back to. This must be a publicly * The target IP services tells the proxy to connect back to. This must be a publicly
@@ -544,38 +558,38 @@ module { name = "help" }
} }
/* /*
* m_sasl * 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.
*/ */
module { name = "m_sasl" } module { name = "sasl" }
/* /*
* m_ssl_gnutls [EXTRA] * ssl_gnutls [EXTRA]
* *
* This module provides SSL services to Anope using GnuTLS, for example to * This module provides SSL services to Anope using GnuTLS, for example to
* connect to the uplink server(s) via SSL. * connect to the uplink server(s) via SSL.
* *
* You may only load either m_ssl_gnutls or m_ssl_openssl, but not both. * You may only load either ssl_gnutls or ssl_openssl, but not both.
*/ */
#module #module
{ {
name = "m_ssl_gnutls" name = "ssl_gnutls"
/* /*
* An optional certificate and key for m_ssl_gnutls to give to the uplink. * An optional certificate and key for ssl_gnutls to give to the uplink.
* *
* You can generate your own certificate and key pair by using: * You can generate your own certificate and key pair by using:
* *
* certtool --generate-privkey --bits 2048 --outfile anope.key * certtool --generate-privkey --bits 2048 --outfile privkey.pem
* certtool --generate-self-signed --load-privkey anope.key --outfile anope.crt * certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
* *
*/ */
cert = "data/anope.crt" cert = "data/fullchain.pem"
key = "data/anope.key" key = "data/privkey.pem"
/* /*
* Diffie-Hellman parameters to use when acting as a server. This is only * Diffie-Hellman parameters to use when acting as a server. This is only
@@ -592,49 +606,50 @@ module { name = "m_sasl" }
} }
/* /*
* m_ssl_openssl [EXTRA] * ssl_openssl [EXTRA]
* *
* This module provides SSL services to Anope using OpenSSL, for example to * This module provides SSL services to Anope using OpenSSL, for example to
* connect to the uplink server(s) via SSL. * connect to the uplink server(s) via SSL.
* *
* You may only load either m_ssl_openssl or m_ssl_gnutls, but not both. * You may only load either ssl_openssl or ssl_gnutls, but not both.
* *
*/ */
#module #module
{ {
name = "m_ssl_openssl" name = "ssl_openssl"
/* /*
* An optional certificate and key for m_ssl_openssl to give to the uplink. * An optional certificate and key for ssl_openssl to give to the uplink.
* *
* You can generate your own certificate and key pair by using: * You can generate your own certificate and key pair by using:
* *
* openssl genrsa -out anope.key 2048 * openssl genrsa -out privkey.pem 2048
* openssl req -new -x509 -key anope.key -out anope.crt -days 1095 * openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
*/ */
cert = "data/anope.crt" cert = "data/fullchain.pem"
key = "data/anope.key" key = "data/privkey.pem"
/* /*
* As of 2014 SSL 3.0 is considered insecure, but it might be enabled * If you wish to increase security you can disable support for older
* on some systems by default for compatibility reasons. * versions of TLS with no known vulnerabilities but that provide less
* You can use the following option to enable or disable it explicitly. * security. For your security SSLv2 and SSLv3 are always disabled.
* Leaving this option not set defaults to the default system behavior.
*/ */
#sslv3 = no #tlsv10 = no
#tlsv11 = no
#tlsv12 = yes
} }
/* /*
* m_sql_authentication [EXTRA] * sql_authentication [EXTRA]
* *
* This module allows authenticating users against an external SQL database using a custom * This module allows authenticating users against an external SQL database using a custom
* query. * query.
*/ */
#module #module
{ {
name = "m_sql_authentication" name = "sql_authentication"
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */ /* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
engine = "mysql/main" engine = "mysql/main"
/* Query to execute to authenticate. A non empty result from this query is considered a success, /* Query to execute to authenticate. A non empty result from this query is considered a success,
@@ -676,7 +691,7 @@ module { name = "m_sasl" }
} }
/* /*
* m_sql_log [EXTRA] * sql_log [EXTRA]
* *
* This module adds an additional target option to log{} blocks * This module adds an additional target option to log{} blocks
* that allows logging Service's logs to SQL. To log to SQL, add * that allows logging Service's logs to SQL. To log to SQL, add
@@ -693,24 +708,24 @@ module { name = "m_sasl" }
* it if it doesn't exist. This module does not create any indexes (keys) * it if it doesn't exist. This module does not create any indexes (keys)
* on the table and it is recommended you add them yourself as necessary. * on the table and it is recommended you add them yourself as necessary.
*/ */
#module { name = "m_sql_log" } #module { name = "sql_log" }
/* /*
* m_sql_oper [EXTRA] * sql_oper [EXTRA]
* *
* This module allows granting users services operator privileges and possibly IRC Operator * This module allows granting users services operator privileges and possibly IRC Operator
* privileges based on an external SQL database using a custom query. * privileges based on an external SQL database using a custom query.
*/ */
#module #module
{ {
name = "m_sql_oper" name = "sql_oper"
/* SQL engine to use. Should be configured elsewhere with m_mysql, m_sqlite, etc. */ /* SQL engine to use. Should be configured elsewhere with mysql, sqlite, etc. */
engine = "mysql/main" engine = "mysql/main"
/* Query to execute to determine if a user should have operator privileges. /* Query to execute to determine if a user should have operator privileges.
* A field named opertype must be returned in order to link the user to their oper type. * A field named opertype must be returned in order to link the user to their oper type.
* The oper types must be configured earlier in 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.
@@ -722,13 +737,13 @@ module { name = "m_sasl" }
} }
/* /*
* m_sqlite [EXTRA] * sqlite [EXTRA]
* *
* This module allows other modules to use SQLite. * This module allows other modules to use SQLite.
*/ */
#module #module
{ {
name = "m_sqlite" name = "sqlite"
/* A SQLite database */ /* A SQLite database */
sqlite sqlite
@@ -748,7 +763,7 @@ module { name = "m_sasl" }
* as they could over IRC. If you are using the default configuration you should be able to access * as they could over IRC. If you are using the default configuration you should be able to access
* this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on. * this panel by visiting http://127.0.0.1:8080 in your web browser from the machine Anope is running on.
* *
* This module requires m_httpd. * This module requires httpd.
*/ */
#module #module
{ {
@@ -765,23 +780,23 @@ module { name = "m_sasl" }
} }
/* /*
* m_xmlrpc * xmlrpc
* *
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope. * Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries. * By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
*/ */
#module #module
{ {
name = "m_xmlrpc" name = "xmlrpc"
/* Web service to use. Requires m_httpd. */ /* Web service to use. Requires httpd. */
server = "httpd/main" server = "httpd/main"
} }
/* /*
* m_xmlrpc_main * xmlrpc_main
* *
* Adds the main XMLRPC core functions. * Adds the main XMLRPC core functions.
* Requires m_xmlrpc. * Requires xmlrpc.
*/ */
#module { name = "m_xmlrpc_main" } #module { name = "xmlrpc_main" }
+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
* *
* This directive is optional, if left blank, the options will default to ns_secure, memo_signon, and * This directive is optional, if left blank, the options will default to ns_secure, memo_signon, and
@@ -125,20 +126,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.
@@ -146,14 +147,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
@@ -167,7 +168,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.
* *
@@ -180,14 +181,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.
*/ */
@@ -203,16 +204,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
} }
/* /*
@@ -258,7 +266,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.
@@ -334,18 +342,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
* *
@@ -456,7 +452,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.
@@ -464,9 +460,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
@@ -535,6 +532,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
@@ -579,6 +577,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"; }
+13 -24
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.
@@ -267,7 +267,7 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* *
* Provides the command operserv/dns. * Provides the command operserv/dns.
* *
* This module requires that m_dns is loaded. * This module requires that dns is loaded.
* *
* This module allows controlling a DNS zone. This is useful for * This module allows controlling a DNS zone. This is useful for
* controlling what servers users are placed on for load balancing, * controlling what servers users are placed on for load balancing,
@@ -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.
+40 -41
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.
@@ -484,13 +483,13 @@ log
/* /*
* [REQUIRED] MySQL Database configuration. * [REQUIRED] MySQL Database configuration.
* *
* m_mysql * mysql
* *
* This module allows other modules to use MySQL. * This module allows other modules to use MySQL.
*/ */
module module
{ {
name = "m_mysql" name = "mysql"
mysql mysql
{ {
-1
View File
@@ -1 +0,0 @@
astyle --style=java --indent=tab --brackets=break-closing --indent-switches --indent-cases --brackets=break
-1
View File
@@ -1 +0,0 @@
For all bug reports / updates please see https://github.com/anope/anope/issues
-111
View File
@@ -1,111 +0,0 @@
C++-style Casting
=================
In C, you can cast in one of two ways:
(type)var
type(var)
The problem with C-style casting is that it allows a programmer to get away
with too much, and is also not designed to handle C++ classes.
C++ has 4 types of casting in addition to allowing C-style casting. They are:
static_cast
const_cast
dynamic_cast
reinterpret_cast
The syntax is usually *_cast<type>(var).
static_cast
-----------
From my experience, this cast is closest to C-style casting for non-pointer
types as well as between some (but not all) pointer types. This type of cast,
like C-style casting, is performed at compile-time. static_cast can also do
a downcast of a derived class to a base class, but only if the base class is
not a virtual base class. Sometimes the result of this cast can become
undefined. static_cast is a bit more strict that C-style casting, though. It
disallows certain class conversions that would've been allowed with a C-style
cast. static_cast also doesn't allow you to cast to an incomplete type. In
these cases, I would try either dynamic_cast or reinterpret_cast.
const_cast
----------
This cast is mainly to add or remove const-ness or volatile-ness from a
variable. This is safer than using a C-style cast to change the const-ness
of a variable. In most cases if you try to use one of the other casts and it
complains about const-ness, you will want to either use this cast instead or
wrap the other cast around this cast. An example:
const int *a;
static_cast<void *>(a); <-- This will fail.
To remedy the above, you would might try this:
const int *a;
const_cast<void *>(a); <-- But this will still fail.
The real solution is this:
const int *a;
static_cast<void *>(const_cast<int *>(a));
It is not recommended to use const_cast on the this variable within a member
function of a class that is declared const. Instead you should use the mutable
keyword on the variable in the class's definition.
dynamic_cast
------------
This cast can only be used on pointers or references to classes. It can cast a
derived class to a base class, a derived class to another derived class
(provided that both are children of the same base class), or a base class to a
derived class. You can also use this to cast a class to void *. This cast is
done at run-time as opposed to the other casts, and relies on C++'s RTTI to be
enabled. It is meant to be used on polymorphic classes, so use static_cast on
non-polymorphic classes.
derived-to-base conversions are actually done statically, so you use either
dynamic_cast or static_cast on them, regardless of if the classes are
polymorphic or not.
derived-to-derived or base-to-derived conversions, however, rely on run-time
type information, and this cast is used on those classes that are polymorphic.
This is safer than C-style casting in that an invalid pointer conversion will
return a NULL pointer, and an invalid reference conversion will throw a
Bad_cast exception.
Note that in Anope we prefer if Anope::debug_cast is used.
This uses dynamic_cast (and checks for a NULL pointer return) on debug builds
and static_cast on release builds, to speed up the program because of dynamic_cast's
reliance on RTTI.
reinterpret_cast
----------------
This cast I would use only as a last resort if static_cast isn't allowed on a
conversion. It allows for conversions between two unrelated types, such as
going from char * to int *. It can also be used to convert a pointer to an
integral type and vica versa. The sites I've read mention how the result is
non-portable, which I assume means the resulting object code is non-portable,
so since the code is compiled on many systems anyways, I don't see this as
being a huge issue. It is recommended to only use this if necessary, though.
Links
=====
The following links are web sites I've used to get this information, and might
describe some of the above a bit better than I have. :P
https://www.acm.org/crossroads/xrds3-1/ovp3-1.html
http://www.cplusplus.com/doc/tutorial/typecasting.html
http://www.codeguru.com/forum/showthread.php?t=312456
https://web.archive.org/web/20170810222238/http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html
https://www.microsoft.com/en-us/download/details.aspx?id=55984
https://en.wikibooks.org/wiki/C%2B%2B_Programming/Type_Casting
https://web.archive.org/web/20160510114447/http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=134
-- CyberBotX, Nov 23, 2008
+3 -3
View File
@@ -6,10 +6,10 @@ if(WIN32)
if(IN_SOURCE) if(IN_SOURCE)
# Add README.txt to list of files for CPack to ignore # Add README.txt to list of files for CPack to ignore
add_to_cpack_ignored_files("README.txt$" TRUE) add_to_cpack_ignored_files("README.txt$" TRUE)
endif(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 ${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()
-239
View File
@@ -1,239 +0,0 @@
Originally pulled from: https://wiki.inspircd.org/Coding_Guidelines
---
InspIRCd Coding Guidelines
The following are a set of guidelines for writing patches to InspIRCd, or for
creating modules for distribution with the official package. These guidelines
were written a time after InspIRCd development started, and so not all code
yet follows these. This will be rectified with time.
1. Comments
* Multi Line
Multiple line comments should follow the C-style comment, for example:
/*
* This is a multiple line comment, huzzah..
*/
* Single Line
Single line comments should also be in the C style, for example:
/* This is a boring one-line comment */
* Doxygen commenting
If you wish your comment to show in doxygen, the comment should be directly
above the item you are documenting (a class, function, enum, etc) and the
first line should be "/**". For example:
/** This is a doxygen multiline comment.
* Description of thingymebob here.
*/
The first line after the "**" is used as the short description of the item
(up to the full stop) and everything afterwards as the detailed description.
2. Indentation
Tabs. Tabs. ONLY TABS. Use a single tab for each level of indentation,
for example:
int main()
{
<tab>if (condition)
<tab>{
<tab><tab>code
<tab>}
}
3. Separation
Always put a space in between a keyword like if/while and the condition,
for example:
if (foo == bar)
NOT
if(foo == bar)
4. Braces
Always put braces opening and closing blocks on separate lines, see the
indentation example. For example, place braces like this:
if (apples == "green")
{
cout << "Apples are green" << endl;
}
and not:
if (apples == "green") {
cout << "Apples are green" << endl;
}
The one exception to this is if you are declaring a class method which is
only one line long, in that case the following is acceptable in most cases:
class foo : public bar
{
foo() { }
getrandomfoo() { return rand(); }
};
5. Templates
Where possible, use templates rather than #defines. Avoid use of RTTI.
6. Structs
Structs should be declared in the following fashion:
struct BodyPartBasket
{
int arms;
int legs;
int scrotalsacs;
};
and not like this:
typedef struct
{
int arms;
int legs;
int scrotalsacs;
} BodyPartBasket;
The second way is not required in C++ to be able to do this:
BodyPartBasket mybasket;
Plus, placing the name at the bottom of the declaration makes readability
more difficult (as you have to scroll down to the bottom of the struct to
find its name). (where possible, call them classes rather than structs.)
7. Variable naming
Class and struct names should be in camel case with a leading capital letter,
for example "MyBagOfBones" and not "my_bag_of_bones" or "mybagofbones".
Variable names can be in either camel case with a leading capital letter or
alternatively all lower case, so long as the same naming convention is
adhered to throughout the class. No classes or variables should be named in
capitals unless this makes sense for the name (for example "class DNS").
Constants and enum values should always be completely in CAPITALS and
underscores may be used, for example:
enum DecayState
{
DECAYED_MOULDY = 0,
DECAYED_SMELLY = 1,
DECAYED_MAGGOTS = 2
};
All value names in an enum should be started with the same text which should
be related in some way to the enum's use. For example "DNS_CNAME, DNS_A,
DNS_AAAA".
8. Use of references
Wherever possible, when dealing with any complex class, pass a const reference
rather than a copy of the class. For example:
MyThingy::MyThingy(const std::string &thingyvalue)
{
}
Of course, if you intended to change the string you can just omit the 'const'.
9. Use of char pointers
Whenever you use char pointers (char*, char**) try to use const equivalents.
This is much safer and avoids ugly and dangerous casts. For example:
MyThingy::Thingify(const char* const* wotsits)
{
}
If it is possible without performance loss, consider avoiding char pointers
altogether and using std::string instead.
10. Use of STL
For more information on use of STL in InspIRCd, please see the separate
STL FAQ.
11. Making copies of data
Never ever make a copy of a piece of data unless it is absolutely necessary.
For example, don't use strlcpy() to make a copy of the const char* string
returned by std::string::c_str(), if the change can be done to the std::string
itself. The same goes for unnecessary variable assignments, especially those
which assign large classes.
12. namespace std
Avoid the following:
using namespace std;
It might take a bit more typing, but things work better if you don't set
(then later assume) the namespace -- specify it explicitly when you want to
use it.
13. Linefeeds
Unix linefeeds only please. We do not like to see our screens covered in ^M.
14. Portability
Always make sure your code is portable to all supported operating systems,
remember of course that as of 1.1.8 this includes windows. Don't write code
that only works on windows, or only works on Linux. Test your code on all
platforms or ask for help from other developers who have the platforms you
want to test on.
* new() and delete(), malloc() and free()
Apart from the fact that using malloc() and free() is bad practice in C++
code, you must never use malloc() or free() in InspIRCd, within its modules
or within the core. This is because if you use malloc() or free() in windows,
the memory is claimed from the program's local heap.
In windows, each shared object (module, dll) has its own heap, which is
protected from other dlls and executables. To get around this issue and
allow more posix-like memory access from other dlls in the program (other
modules), InspIRCd overrides the operators new and delete to ensure that
memory allocated by them comes from the windows global heap. If you use
malloc() and free() for this, the ircd will segfault when another module
tries to access the memory you have allocated!
* strdup()
As with malloc(), above, strdup() should be avoided. Where strdup() is
absolutely necessary, use strnewdup() which is our strdup() implementation
that calls operator new instead of using malloc().
char arrays allocated by strnewdup() should be deleted with operator delete[].
* CoreExport and DllImport
Prefix all types you want to import or export to other modules with CoreExport
and DllImport macros. These do nothing in POSIX operating systems, however
in windows these are expanded to the instructions __declspec(dllimport) and
__declspec(dllexport) respectively depending on where they are used and how.
15. External Dependencies
If a module is compiled as standard, or the code is part of the core, you must
not use any dependencies that are not available as standard on all supported
operating systems beyond libstdc++, libc, and whatever else is currently
required to build the core. Modules which use nonstandard dependencies belong
in the modules/extra directory.
16. Profiling and Performance
It is one thing to assume that code performs bad, it is another thing to prove
that it actually is. A lot of experienced programmers talk about 'premature
optimisation', and here is what it means: if you have a piece of code called
once on startup that takes 10 seconds instead of one second to run, and a
piece of code that takes 0.05 seconds to run when it should take 0.01, and
it is called once per second, the second piece of code is the priority.
In other words, make sure that what you think is slow, and a performance
problem in Insp actually is.
To do this, use the callgrind tool from Valgrind (valgrind --tool=cachegrind
bin/inspircd -nofork -debug), and kcachegrind (or similar) to view the output
files.
+29 -435
View File
@@ -1,440 +1,34 @@
Anope Version 2.0.15-git Anope Version 2.1.2
------------------------
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 Bumped the minimum OpenSSL version to 1.1.0.
Send account identifiers to InspIRCd on SASL logins too Bumped the minumum GnuTLS version to 3.0.0.
Fix a query bug in irc2sql Disabled SSLv3 support in the m_ssl_openssl module.
Modernized mutex and thread code to use Modern C++.
Normalised the program exit codes.
Updated the Dutch translation.
Updated the French translation.
Anope Version 2.0.8 Anope Version 2.1.1
------------------- -------------------
Add +K channel mode for ircd-hybrid Added the UNBANME privilege to allow users to unban themselves.
Add immutable identifiers to user accounts Fixed building on Windows systems without chgrp/chmod.
Fix build on systems that use musl libc Fixed creating sockets in the m_dns, m_httpd, m_proxyscan, and m_redis modules.
Fix help of global/global not showing the correct origin nick Fixed reading the values of command line arguments.
Fix not removing vhosts when an nick is dropped Moved core privilege descriptions to the example configs.
Fix parsing channel metadata on InspIRCd 3+ Updated the Italian translation.
Fix parsing kicks on InspIRCd 3+ Updated the Polish translation.
Fix parsing topic changes on InspIRCd 3+
Fix topiclock on InspIRCd
Modernize the ircd-hybrid protocol module
Anope Version 2.1.0
Anope Version 2.0.7
------------------- -------------------
Fix not sending login data on successful NickServ GROUP Added support for access list entry descriptions.
Fix m_httpd to not consider headers to be case sensitive Added support for linking over a UNIX socket.
Add InspIRCd 3 protocol support Added support for server-initiated logins and logouts on UnrealIRCd.
Add 'n' email token for use in the email change template Added support for server-initiated logouts on InspIRCd.
Add logging for NickServ UNGROUP Added support for the ANONYMOUS SASL mechanism.
Fix setting swhois on UnrealIRCd Allowed users to opt-out of being added to channel access lists.
Add nickserv/recover permission to allow opers to recover other users Cleaned up the codebase to use Modern C++17.
Fix superadmin not being removed when deopering Modernized the build system to use a modern version of CMake.
Fix setting nickserv access list in webcpanel Removed support for using insecure encryption methods as the primary method.
Add support for post-handshake SASL in Unreal 4.2.2+ Removed the Windows-only anopesmtp tool.
Add logging for channel memo deletionso Removed the two day X-line cap.
Updated all references to IRCServices to refer to Anope instead.
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.
+21 -227
View File
@@ -1,232 +1,26 @@
Anope Version 2.0.15-git Anope Version 2.1.2
------------------------
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 module:tlsv10 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to no).
Added module:tlsv11 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to yes).
Added module:tlsv12 to m_ssl_openssl for configuring whether TLSv1.0 is usable (defaults to yes)
Removed module:sslv3 from m_ssl_openssl.
Removed the m_ prefix from the names of the chanstats, dns, dnsbl, helpchan, httpd, ldap, ldap_oper, mysql, proxyscan, redis, regex_pcre2, regex_posix, regex_stdlib, regex_tre, rewrite, sasl, sql_log, sql_oper, sqlite, ssl_gnutls, ssl_openssl, xmlrpc, and xmlrpc_main modules.
Anope Version 2.0.8 Anope Version 2.1.1
------------------- -------------------
Fix ns_register:unconfirmedexpire not being used Added the m_regex_stdlib module.
Removed the m_regex_pcre module (use m_regex_pcre2 instead).
Anope Version 2.0.7 Anope Version 2.1.0
------------------- -------------------
Add nickserv/recover permission Added nickserv:minpasslen for configuring the minimum password length (defaults to 8).
Add inspircd3 protocol module Removed nickserv:strictpasswords as it is obsolete now nickserv:minpasslen exists.
Add default permission for chanstats saset chanstats command Removed the inspircd12 and inspircd20 modules (use inspircd instead).
Removed the ns_getpass module (no supported encryption modules).
Anope Version 2.0.6 Removed the os_oline module (no supported IRCds).
------------------- Removed the unreal module (use unrealircd instead).
Mark enc_md5 and enc_sha1 as deprecated. Their use has been discouraged for years, and they will be removed in a future release. Renamed nickserv:passlen to nickserv:maxpasslen.
Exempt all of 127.0.0.0/8 from m_dnsbl by default Renamed the charybdis module to solanum.
Load m_sasl by default Renamed the inspircd3 module to inspircd.
Fix documentation for nickserv default option ns_keep_modes Renamed the unreal4 module to unrealircd.
Replaced uplink:ipv6 with uplink:protocol.
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.
+4 -4
View File
@@ -10,7 +10,7 @@ Anope DefCon
1) Introduction 1) Introduction
Anope 1.6 onwards supports a unique protection mechanism based on the Anope supports a unique protection mechanism based on the
military "Defense Readiness Condition" (DefCon) system. It is based on military "Defense Readiness Condition" (DefCon) system. It is based on
5 levels of defense readiness defined as: 5 levels of defense readiness defined as:
@@ -23,7 +23,7 @@ Anope DefCon
These are configurable levels that mandates what actions Anope should These are configurable levels that mandates what actions Anope should
take in case of emergency and change in readiness status. take in case of emergency and change in readiness status.
It is used to prevent abuse to both 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
-34
View File
@@ -1,34 +0,0 @@
Anope Internal Events
---------------------
1) Intro
2) Using Events
1) Introduction to Internal Events
Internal Events are setup to give module developers more information
about what the core is doing at different times. This information can
be as complex as data we are feeding to the uplink, to simple triggered
events such as the databases being saved.
Additionally there is a module included with the core
which can provide some clue as to how to use the code in your modules.
The rest of this document assumes that you are used to writing modules.
2) Using Events
Each Event in Anope calls a function.
You must override these functions in your main modules class.
The full list of functions and parameters are in modules.h. In this
case, you would be overriding OnJoinChannel() and OnPartChannel() like so:
void OnJoinChannel(User *u, Channel *c) anope_override { }
void OnPartChannel(User *u, Channel *c) anope_override { }
Some of these event overrides can be used to prevent or allow things to
happen that would normally not be allowed or denied. You can also use
ModuleManager (not explained here) to set control which order the modules
are queried (when multiple modules hook to the same event).
The "anope_override" identifier is for compatibility with C++11.
Its usage is highly recommended.
+12 -12
View File
@@ -37,7 +37,7 @@ Note: You should also read the README and FAQ files!
Next, unpack the package in your home directory, and go into the created Next, unpack the package in your home directory, and go into the created
directory. directory.
If there are any extra modules you want to enable, such as m_mysql, run If there are any extra modules you want to enable, such as mysql, run
the 'extras' script to enable them. If you do not know you can come back the 'extras' script to enable them. If you do not know you can come back
later and enable them. later and enable them.
@@ -52,8 +52,8 @@ Note: You should also read the README and FAQ files!
cause trouble on your network if passwords are not encrypted, or read 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
+13 -13
View File
@@ -37,7 +37,7 @@ Note : Vous devrez également lire les fichiers README et FAQ !
Ensuite, décompressez le package dans votre répertoire home, et allez Ensuite, décompressez le package dans votre répertoire home, et allez
dans le répértoire qui vient d'être créé. dans le répértoire qui vient d'être créé.
Si il y a des modules facultatifs que vous voulez activer comme m_mysql, Si il y a des modules facultatifs que vous voulez activer comme mysql,
exécuter le script 'extras' pour les activer. Si vous ne savez pas, vous exécuter le script 'extras' pour les activer. Si vous ne savez pas, vous
pouvez les activer plus tard. pouvez les activer plus tard.
@@ -49,15 +49,15 @@ Note : Vous devrez également lire les fichiers README et FAQ !
Allez dans le dossier build (cd build) et tapez make et make install. Allez dans le dossier build (cd build) et tapez make et make install.
Ceci va installer tous les fichiers nécessaires dans les dossiers que Ceci va installer tous les fichiers nécessaires dans les dossiers que
vous avez indiqués avec le script Config et régler les permissions des vous avez indiqués avec le script Config et régler les permissions des
fichiers. Vous devez vous assurer que le répertoire data n'est pas fichiers. Vous devez vous assurer que le répertoire data n'est pas
accessible par les autres utilisateurs, car des utilisateurs accessible par les autres utilisateurs, car des utilisateurs
malveillants pourraient causer des problèmes sur votre réseau, si les malveillants pourraient causer des problèmes sur votre réseau, si les
mots de passe ne sont pas chiffrés, ou lire les mémos de tous les 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
+3 -3
View File
@@ -12,7 +12,7 @@ Anope Modules
1) Introduction 1) Introduction
Anope 1.6 onwards supports external modules. External modules are pieces Anope supports external modules. External modules are pieces
of code that can be attached to a running Anope process dynamically. These of code that can be attached to a running Anope process dynamically. These
modules can serve several purposes, and perform all kind of operations to modules can serve several purposes, and perform all kind of operations to
enhance your network. enhance your network.
@@ -22,7 +22,7 @@ Anope Modules
1. If modules are supported by your system, they will be configured 1. If modules are supported by your system, they will be configured
automatically when you run ./Config. The modules will be installed automatically when you run ./Config. The modules will be installed
to the modules directory in your data path (by default this will to the modules directory in your data path (by default this will
be ~/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.
-6
View File
@@ -1,6 +0,0 @@
Highlighted News in Anope 1.9
=============================
* Added in live updating SQL and the ability to execute commands through SQL
* Re-designed configuration file
* Code refresh / rewrite into C++
+6 -6
View File
@@ -1,7 +1,7 @@
Anope -- a set of IRC services for IRC networks Anope -- a set of IRC services for IRC networks
----------------------------------------------- -----------------------------------------------
Anope is 2003-2023 Anope Team <team@anope.org>. Anope is 2003-2024 Anope Team <team@anope.org>.
Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>. Based on Epona 2000-2002 PegSoft <epona@pegsoft.net>.
Based on Services 1996-1999 Andrew Church <achurch@achurch.org>. Based on Services 1996-1999 Andrew Church <achurch@achurch.org>.
@@ -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,
+3 -3
View File
@@ -1,4 +1,4 @@
Starting in Anope 1.9.9, Anope has Redis database support (https://redis.io/). Anope has Redis database support (https://redis.io/).
This document explains the data structure used by Anope, and explains how This document explains the data structure used by Anope, and explains how
keyspace notification works. keyspace notification works.
@@ -149,12 +149,12 @@ Table of Contents
Which returns a new object ID for me, in this example it will be "8". Which returns a new object ID for me, in this example it will be "8".
Now I can create the object: Now I can create the object:
HMSET hash:BotInfo:8 nick redis user redis host services.anope.org realname "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>
+3 -3
View File
@@ -70,7 +70,7 @@ Anope for Windows
If you cannot find whats causing the error, please visit our forums or If you cannot find whats causing the error, please visit our forums or
our IRC Support channel for assistance. our IRC Support channel for assistance.
Some Anope modules require third party libraries, such as m_mysql and Some Anope modules require third party libraries, such as mysql and
the SSL modules. If these libraries are installed in nonstandard the SSL modules. If these libraries are installed in nonstandard
locations, cmake will probably not find them and should be told where locations, cmake will probably not find them and should be told where
they are by passing their location to Config. they are by passing their location to Config.
@@ -103,7 +103,7 @@ Anope for Windows
INSTALL within the Solution Explorer. Right-click on INSTALL and choose Build. INSTALL within the Solution Explorer. Right-click on INSTALL and choose Build.
When you have done this, all the files will be installed to where they belong. When you have done this, all the files will be installed to where they belong.
The only thing you need to do is rename "data/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
+2 -2
View File
@@ -1,7 +1,7 @@
Starting with Anope 1.9.4 XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported. XMLRPC using PHP's xmlrpc_encode_request and xmlrpc_decode functions is supported.
This allows external applications, such as websites, to execute remote procedure calls to Anope in real time. This allows external applications, such as websites, to execute remote procedure calls to Anope in real time.
Currently there are 5 supported XMLRPC calls, provided by m_xmlrpc_main: Currently there are 5 supported XMLRPC calls, provided by xmlrpc_main:
checkAuthentication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password checkAuthentication - Takes two parameters, an account name and a password. Checks if the account name is valid and the password
is correct for the account name, useful for making login pages on websites. is correct for the account name, useful for making login pages on websites.
+1 -1
View File
@@ -3,7 +3,7 @@
/** /**
* XMLRPC Functions * XMLRPC Functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
*/ */
+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)
+17 -17
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -28,7 +27,7 @@ enum
* backing each ChanAccess determines whether that ChanAccess has a given * backing each ChanAccess determines whether that ChanAccess has a given
* privilege. * privilege.
*/ */
struct CoreExport Privilege struct CoreExport Privilege final
{ {
Anope::string name; Anope::string name;
Anope::string desc; Anope::string desc;
@@ -39,10 +38,10 @@ struct CoreExport Privilege
bool operator==(const Privilege &other) const; bool operator==(const Privilege &other) const;
}; };
class CoreExport PrivilegeManager class CoreExport PrivilegeManager final
{ {
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);
@@ -53,9 +52,10 @@ class CoreExport PrivilegeManager
/* A provider of access. Only used for creating ChanAccesses, as /* A provider of access. Only used for creating ChanAccesses, as
* they contain pure virtual functions. * they contain pure virtual functions.
*/ */
class CoreExport AccessProvider : 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,20 +64,21 @@ 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();
}; };
/* Represents one entry of an access list on a channel. */ /* Represents one entry of an access list on a channel. */
class CoreExport ChanAccess : public Serializable class CoreExport ChanAccess
: public Serializable
{ {
Anope::string mask; Anope::string mask;
/* account this access entry is for, if any */ /* account this access entry is for, if any */
Serialize::Reference<NickCore> nc; Serialize::Reference<NickCore> nc;
public: public:
typedef std::vector<ChanAccess *> Path; typedef std::vector<ChanAccess *> Path;
/* The provider that created this access entry */ /* The provider that created this access entry */
@@ -85,6 +86,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 +97,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;
@@ -133,9 +135,9 @@ class CoreExport ChanAccess : public Serializable
/* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor, /* A group of access entries. This is used commonly, for example with ChannelInfo::AccessFor,
* to show what access a user has on a channel because users can match multiple access entries. * to show what access a user has on a channel because users can match multiple access entries.
*/ */
class CoreExport AccessGroup class CoreExport AccessGroup final
{ {
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 +172,3 @@ class CoreExport AccessGroup
inline bool empty() const { return paths.empty(); } inline bool empty() const { return paths.empty(); }
}; };
#endif
+17 -16
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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;
@@ -29,12 +28,14 @@ extern CoreExport nickcoreid_map NickCoreIdList;
/* A registered nickname. /* A registered nickname.
* It matters that Base is here before Extensible (it is inherited by Serializable) * It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport NickAlias : public Serializable, public Extensible class CoreExport NickAlias final
: 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 +55,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
@@ -105,13 +106,15 @@ class CoreExport NickAlias : public Serializable, public Extensible
* account's display. * account's display.
* It matters that Base is here before Extensible (it is inherited by Serializable) * It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport NickCore : public Serializable, public Extensible class CoreExport NickCore final
: public Serializable
, public Extensible
{ {
/* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */ /* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess; Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
/* Unique identifier for the account. */ /* Unique identifier for the account. */
uint64_t id; uint64_t id;
public: public:
/* Name of the account. Find(display)->nc == this. */ /* Name of the account. Find(display)->nc == this. */
Anope::string display; Anope::string display;
/* User password in form of hashm:data */ /* User password in form of hashm:data */
@@ -149,7 +152,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 +243,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 +289,3 @@ class CoreExport IdentifyRequest
static void ModuleUnload(Module *m); static void ModuleUnload(Module *m);
}; };
#endif // ACCOUNT_H
+53 -52
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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>
@@ -23,15 +22,15 @@ namespace Anope
* allow us to only require one type of string everywhere that can be converted * allow us to only require one type of string everywhere that can be converted
* at any time to a specific type of string. * at any time to a specific type of string.
*/ */
class CoreExport string class CoreExport string final
{ {
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.
@@ -213,6 +210,10 @@ namespace Anope
inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); } inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); }
inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); } inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); }
inline int compare(size_t pos, size_t len, const string& str) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str())); }
inline int compare(size_t pos, size_t len, const string& str, size_t subpos, size_type sublen = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str()), subpos, sublen); }
inline int compare(size_t pos, size_t len, const char* s, size_type n = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, s, n); }
/** /**
* Determine if string consists of only numbers. * Determine if string consists of only numbers.
*/ */
@@ -257,8 +258,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 +269,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;
} }
@@ -311,23 +312,23 @@ namespace Anope
inline const string operator+(const char *_str, const string &str) { string tmp(_str); tmp += str; return tmp; } inline const string operator+(const char *_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
inline const string operator+(const std::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; } inline const string operator+(const std::string &_str, const string &str) { string tmp(_str); tmp += str; return tmp; }
struct hash_ci struct hash_ci final
{ {
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());
} }
}; };
struct hash_cs struct hash_cs final
{ {
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());
} }
}; };
struct compare struct compare final
{ {
inline bool operator()(const string &s1, const string &s2) const inline bool operator()(const string &s1, const string &s2) const
{ {
@@ -335,9 +336,14 @@ namespace Anope
} }
}; };
template<typename T> class map : public std::map<string, T, ci::less> { }; template<typename T>
template<typename T> class multimap : public std::multimap<string, T, ci::less> { }; using map = std::map<string, T, ci::less>;
template<typename T> class hash_map : public TR1NS::unordered_map<string, T, hash_ci, compare> { };
template<typename T>
using multimap = std::multimap<string, T, ci::less>;
template<typename T>
using hash_map = std::unordered_map<string, T, hash_ci, compare>;
#ifndef REPRODUCIBLE_BUILD #ifndef REPRODUCIBLE_BUILD
static const char *const compiled = __TIME__ " " __DATE__; static const char *const compiled = __TIME__ " " __DATE__;
@@ -369,11 +375,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 +393,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
*/ */
@@ -419,7 +425,7 @@ namespace Anope
* initializing language support, loading modules, and loading databases. * initializing language support, loading modules, and loading databases.
* @throws CoreException if something bad went wrong * @throws CoreException if something bad went wrong
*/ */
extern void Init(int ac, char **av); extern bool Init(int ac, char **av);
/** Calls the save database event /** Calls the save database event
*/ */
@@ -465,14 +471,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
@@ -487,7 +485,7 @@ namespace Anope
* @param ... any number of parameters * @param ... any number of parameters
* @return a Anope::string * @return a Anope::string
*/ */
extern CoreExport string printf(const char *fmt, ...); extern CoreExport string printf(const char *fmt, ...) ATTR_FORMAT(1, 2);
/** Return the last error code /** Return the last error code
* @return The error code * @return The error code
@@ -568,7 +566,7 @@ namespace Anope
*/ */
class CoreExport sepstream class CoreExport sepstream
{ {
private: private:
/** Original string. /** Original string.
*/ */
Anope::string tokens; Anope::string tokens;
@@ -577,11 +575,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);
@@ -635,9 +633,10 @@ class CoreExport sepstream
/** A derived form of sepstream, which separates on commas /** A derived form of sepstream, which separates on commas
*/ */
class commasepstream : public sepstream class commasepstream final
: 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) { }
@@ -645,9 +644,10 @@ class commasepstream : public sepstream
/** A derived form of sepstream, which separates on spaces /** A derived form of sepstream, which separates on spaces
*/ */
class spacesepstream : public sepstream class spacesepstream final
: public sepstream
{ {
public: public:
/** Initialize with space separator /** Initialize with space separator
*/ */
spacesepstream(const Anope::string &source) : sepstream(source, ' ') { } spacesepstream(const Anope::string &source) : sepstream(source, ' ') { }
@@ -659,16 +659,17 @@ class spacesepstream : public sepstream
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user * be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time. * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/ */
class CoreException : public std::exception class CoreExport 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 +684,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.
*/ */
@@ -698,9 +699,10 @@ class CoreException : public std::exception
} }
}; };
class ModuleException : public CoreException class CoreExport ModuleException
: public CoreException
{ {
public: public:
/** Default constructor, just uses the error message 'Module threw an exception'. /** 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 +714,16 @@ 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 CoreExport ConvertException final
: 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 +797,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
+15 -20
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2008-2011 Adam <Adam@anope.org> * (C) 2008-2011 Adam <Adam@anope.org>
* (C) 2008-2023 Anope Team <team@anope.org> * (C) 2008-2024 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * 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; }
}; };
@@ -45,14 +43,13 @@ class ReferenceBase
* no longer be valid once the object it refers is destructed. * no longer be valid once the object it refers is destructed.
*/ */
template<typename T> template<typename T>
class Reference : 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 +136,3 @@ class Reference : public ReferenceBase
return false; return false;
} }
}; };
#endif // BASE_H
+6 -7
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org> * (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2008-2023 Anope Team <team@anope.org> * (C) 2008-2024 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * 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"
@@ -20,11 +19,13 @@ typedef Anope::map<BotInfo *> botinfo_map;
extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID; extern CoreExport Serialize::Checker<botinfo_map> BotListByNick, BotListByUID;
/* A service bot (NickServ, ChanServ, a BotServ bot, etc). */ /* A service bot (NickServ, ChanServ, a BotServ bot, etc). */
class CoreExport BotInfo : public User, public Serializable class CoreExport BotInfo final
: 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 +132,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
+16 -14
View File
@@ -1,13 +1,12 @@
/* Channel support /* Channel support
* *
* (C) 2008-2023 Anope Team * (C) 2008-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef CHANNELS_H #pragma once
#define CHANNELS_H
#include "anope.h" #include "anope.h"
#include "extensible.h" #include "extensible.h"
@@ -19,7 +18,8 @@ typedef Anope::hash_map<Channel *> channel_map;
extern CoreExport channel_map ChannelList; extern CoreExport channel_map ChannelList;
/* A user container, there is one of these per user per channel. */ /* A user container, there is one of these per user per channel. */
struct ChanUserContainer : public Extensible struct ChanUserContainer final
: public Extensible
{ {
User *user; User *user;
Channel *chan; Channel *chan;
@@ -29,18 +29,20 @@ struct ChanUserContainer : public Extensible
ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { } ChanUserContainer(User *u, Channel *c) : user(u), chan(c) { }
}; };
class CoreExport Channel : public Base, public Extensible class CoreExport Channel final
: public Base
, public Extensible
{ {
static std::vector<Channel *> deleting; 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 +76,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();
@@ -205,7 +207,8 @@ class CoreExport Channel : public Base, public Extensible
* @param enforce_mlock Should mlock be enforced on this mode change * @param enforce_mlock Should mlock be enforced on this mode change
* @param cmodes The modes to set * @param cmodes The modes to set
*/ */
void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...); void SetModes(BotInfo *bi, bool enforce_mlock, const char *cmodes, ...) ATTR_FORMAT(4, 5);
void SetModes(BotInfo *bi, bool enforce_mlock, const Anope::string &cmodes);
/** Set a string of modes internally on a channel /** Set a string of modes internally on a channel
* @param source The setter * @param source The setter
@@ -234,7 +237,8 @@ class CoreExport Channel : public Base, public Extensible
* @param reason The reason for the kick * @param reason The reason for the kick
* @return true if the kick was successful, false if a module blocked the kick * @return true if the kick was successful, false if a module blocked the kick
*/ */
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...); bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...) ATTR_FORMAT(4, 5);
bool Kick(BotInfo *bi, User *u, const Anope::string &reason);
/** Get all modes set on this channel, excluding status modes. /** Get all modes set on this channel, excluding status modes.
* @return a map of modes and their optional parameters. * @return a map of modes and their optional parameters.
@@ -311,5 +315,3 @@ class CoreExport Channel : public Base, public Extensible
static void DeleteChannels(); static void DeleteChannels();
}; };
#endif // CHANNELS_H
+18 -22
View File
@@ -1,6 +1,6 @@
/* Declarations for command data. /* Declarations for command data.
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,25 +9,22 @@
* 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"
#include "channels.h" #include "channels.h"
struct CommandGroup struct CommandGroup final
{ {
Anope::string name, description; Anope::string name, description;
}; };
/* Used in BotInfo::commands */ /* Used in BotInfo::commands */
struct CommandInfo struct CommandInfo final
{ {
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,18 +42,18 @@ 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;
}; };
/* The source for a command */ /* The source for a command */
class CoreExport CommandSource class CoreExport CommandSource final
{ {
/* The nick executing the command */ /* The nick executing the command */
Anope::string nick; Anope::string nick;
/* User executing the command, may be NULL */ /* User executing the command, may be NULL */
Reference<User> u; Reference<User> u;
public: public:
/* The account executing the command */ /* The account executing the command */
Reference<NickCore> nc; Reference<NickCore> nc;
/* for web clients */ /* for web clients */
@@ -80,7 +77,7 @@ class CoreExport CommandSource
AccessGroup AccessFor(ChannelInfo *ci); AccessGroup AccessFor(ChannelInfo *ci);
bool IsFounder(ChannelInfo *ci); bool IsFounder(ChannelInfo *ci);
void Reply(const char *message, ...); void Reply(const char *message, ...) ATTR_FORMAT(2, 3);
void Reply(const Anope::string &message); void Reply(const Anope::string &message);
bool HasCommand(const Anope::string &cmd); bool HasCommand(const Anope::string &cmd);
@@ -91,7 +88,8 @@ class CoreExport CommandSource
/** Every services command is a class, inheriting from Command. /** Every services command is a class, inheriting from Command.
*/ */
class CoreExport Command : public Service class CoreExport Command
: public Service
{ {
Anope::string desc; Anope::string desc;
std::vector<Anope::string> syntax; std::vector<Anope::string> syntax;
@@ -100,7 +98,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 +107,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 +117,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 +130,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 +181,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
+19 -20
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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;
@@ -79,12 +78,12 @@ namespace Configuration
/** Represents a configuration file /** Represents a configuration file
*/ */
class File class File final
{ {
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;
@@ -99,7 +98,8 @@ namespace Configuration
struct Uplink; struct Uplink;
struct CoreExport Conf : Block struct CoreExport Conf final
: Block
{ {
/* options:readtimeout */ /* options:readtimeout */
time_t ReadTimeout; time_t ReadTimeout;
@@ -153,15 +153,15 @@ namespace Configuration
const Block *GetCommand(CommandSource &); const Block *GetCommand(CommandSource &);
}; };
struct Uplink struct Uplink final
{ {
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); }
}; };
} }
@@ -172,9 +172,10 @@ namespace Configuration
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user * be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time. * attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/ */
class ConfigException : public CoreException class CoreExport ConfigException final
: 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 +186,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
+3 -1
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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;
+35 -32
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef EXTENSIBLE_H #pragma once
#define EXTENSIBLE_H
#include "anope.h" #include "anope.h"
#include "serialize.h" #include "serialize.h"
@@ -16,15 +15,16 @@
class Extensible; 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 +34,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();
@@ -54,12 +54,13 @@ 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 +94,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);
@@ -125,54 +126,57 @@ 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 +189,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;
@@ -205,7 +209,8 @@ class SerializableExtensibleItem<bool> : public PrimitiveExtensibleItem<bool>
}; };
template<typename T> template<typename T>
struct ExtensibleRef : ServiceReference<BaseExtensibleItem<T> > struct ExtensibleRef final
: ServiceReference<BaseExtensibleItem<T> >
{ {
ExtensibleRef(const Anope::string &n) : ServiceReference<BaseExtensibleItem<T> >("Extensible", n) { } ExtensibleRef(const Anope::string &n) : ServiceReference<BaseExtensibleItem<T> >("Extensible", n) { }
}; };
@@ -259,5 +264,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
+18 -25
View File
@@ -1,24 +1,16 @@
/* /*
* *
* (C) 2002-2011 InspIRCd Development Team * (C) 2002-2011 InspIRCd Development Team
* (C) 2009-2023 Anope Team <team@anope.org> * (C) 2009-2024 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * 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,17 @@ 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 +39,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;
@@ -57,10 +50,11 @@ namespace Anope
/* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */ /* rfc1459 case insensitive ctype, { = [, } = ], and | = \ */
template<typename char_type> template<typename char_type>
class rfc1459_ctype : public ascii_ctype<char_type> class rfc1459_ctype final
: public ascii_ctype<char_type>
{ {
public: public:
char_type do_toupper(char_type c) const 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 +62,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;
@@ -86,7 +80,8 @@ namespace ci
* This class is used to implement ci::string, a case-insensitive, ASCII- * This class is used to implement ci::string, a case-insensitive, ASCII-
* comparing string class. * comparing string class.
*/ */
struct CoreExport ci_char_traits : std::char_traits<char> struct CoreExport ci_char_traits final
: std::char_traits<char>
{ {
/** Check if two chars match. /** Check if two chars match.
* @param c1st First character * @param c1st First character
@@ -131,7 +126,7 @@ namespace ci
*/ */
typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string; typedef std::basic_string<char, ci_char_traits, std::allocator<char> > string;
struct CoreExport less struct CoreExport less final
{ {
/** Compare two Anope::strings as ci::strings and find which one is less /** Compare two Anope::strings as ci::strings and find which one is less
* @param s1 The first string * @param s1 The first string
@@ -195,5 +190,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
+11 -8
View File
@@ -1,17 +1,19 @@
/* /*
* *
* (C) 2008-2023 Anope Team * (C) 2008-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
#include "anope.h" #include "anope.h"
namespace Language namespace Language
{ {
/* Languages we support as configured in 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 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.")
@@ -108,9 +111,9 @@ namespace Language
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:") #define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.") #define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \ #define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %d\002 to read it.") "Type \002%s%s READ %s %zu\002 to read it.")
#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \ #define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \
"Type \002%s%s READ %d\002 to read it.") "Type \002%s%s READ %zu\002 to read it.")
#define MEMO_HAVE_NO_MEMOS _("You have no memos.") #define MEMO_HAVE_NO_MEMOS _("You have no memos.")
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.") #define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.") #define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
+13 -16
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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.
*/ */
@@ -61,15 +60,15 @@ class CoreExport NumberList
/** This class handles formatting LIST/VIEW replies. /** This class handles formatting LIST/VIEW replies.
*/ */
class CoreExport ListFormatter class CoreExport ListFormatter final
{ {
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);
@@ -79,16 +78,14 @@ class CoreExport ListFormatter
/** This class handles formatting INFO replies /** This class handles formatting INFO replies
*/ */
class CoreExport InfoFormatter class CoreExport InfoFormatter final
{ {
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
+20 -23
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -38,7 +37,7 @@ enum LogType
LOG_DEBUG_4 LOG_DEBUG_4
}; };
struct LogFile struct LogFile final
{ {
Anope::string filename; Anope::string filename;
std::ofstream stream; std::ofstream stream;
@@ -49,27 +48,27 @@ struct LogFile
}; };
/* Represents a single log message */ /* Represents a single log message */
class CoreExport Log class CoreExport Log final
{ {
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)
@@ -110,13 +109,13 @@ 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 final
{ {
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
+8 -10
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -23,9 +22,10 @@ namespace Mail
extern CoreExport bool Validate(const Anope::string &email); extern CoreExport bool Validate(const Anope::string &email);
/* A email message being sent */ /* A email message being sent */
class Message : public Thread class Message final
: 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 +35,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 +49,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
+8 -10
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,22 +9,22 @@
* Based on the original code of Services by Andy Church. * Based on the original code of Services by Andy Church.
*/ */
#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 final
: 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;
@@ -37,9 +37,9 @@ class CoreExport Memo : public Serializable
/* Memo info structures. Since both nicknames and channels can have memos, /* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoInfo to make it easier to handle. * we encapsulate memo data in a MemoInfo to make it easier to handle.
*/ */
struct CoreExport MemoInfo struct CoreExport MemoInfo final
{ {
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 +51,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
+63 -41
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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.
@@ -19,39 +21,44 @@
namespace Message namespace Message
{ {
struct CoreExport Away : IRCDMessage struct CoreExport Away
: IRCDMessage
{ {
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(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;
@@ -65,109 +72,124 @@ namespace Message
static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users); static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
}; };
struct CoreExport Kick : IRCDMessage struct CoreExport Kick
: IRCDMessage
{ {
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(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
+60 -50
View File
@@ -1,13 +1,12 @@
/* Mode support /* Mode support
* *
* (C) 2008-2011 Adam <Adam@anope.org> * (C) 2008-2011 Adam <Adam@anope.org>
* (C) 2008-2023 Anope Team <team@anope.org> * (C) 2008-2024 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * 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"
@@ -36,9 +35,10 @@ enum ModeClass
/** This class is the basis of all modes in Anope /** This class is the basis of all modes in Anope
*/ */
class CoreExport Mode : 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 +55,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
@@ -65,9 +65,10 @@ class CoreExport Mode : public Base
/** This class is a user mode, all user modes use this/inherit from this /** This class is a user mode, all user modes use this/inherit from this
*/ */
class CoreExport UserMode : 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
@@ -75,9 +76,10 @@ class CoreExport UserMode : public Mode
UserMode(const Anope::string &name, char mc); UserMode(const Anope::string &name, char mc);
}; };
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
@@ -93,9 +95,10 @@ class CoreExport UserModeParam : public UserMode
/** This class is a channel mode, all channel modes use this/inherit from this /** This class is a channel mode, all channel modes use this/inherit from this
*/ */
class CoreExport ChannelMode : 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 +108,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() { }
@@ -124,9 +127,10 @@ class CoreExport ChannelMode : public Mode
/** This is a mode for lists, eg b/e/I. These modes should inherit from this /** This is a mode for lists, eg b/e/I. These modes should inherit from this
*/ */
class CoreExport ChannelModeList : public ChannelMode class CoreExport ChannelModeList
: public ChannelMode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -162,9 +166,10 @@ class CoreExport ChannelModeList : public ChannelMode
/** This is a mode with a parameter, eg +k/l. These modes should use/inherit from this /** This is a mode with a parameter, eg +k/l. These modes should use/inherit from this
*/ */
class CoreExport ChannelModeParam : public ChannelMode class CoreExport ChannelModeParam
: public ChannelMode
{ {
public: public:
/** constructor /** constructor
* @param name The mode name * @param name The mode name
* @param mc The mode char * @param mc The mode char
@@ -184,9 +189,10 @@ class CoreExport ChannelModeParam : public ChannelMode
/** This is a mode that is a channel status, eg +v/h/o/a/q. /** This is a mode that is a channel status, eg +v/h/o/a/q.
*/ */
class CoreExport ChannelModeStatus : public ChannelMode class CoreExport ChannelModeStatus
: public ChannelMode
{ {
public: public:
/* The symbol, eg @ % + */ /* 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.
@@ -207,29 +213,30 @@ class CoreExport ChannelModeStatus : public ChannelMode
* but we still have a representation for it. * but we still have a representation for it.
*/ */
template<typename T> template<typename T>
class CoreExport ChannelModeVirtual : public T 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 final
{ {
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);
@@ -240,51 +247,56 @@ class CoreExport ChannelStatus
Anope::string BuildModePrefixList() const; Anope::string BuildModePrefixList() const;
}; };
class CoreExport UserModeOperOnly : public UserMode class CoreExport UserModeOperOnly
: public UserMode
{ {
public: public:
UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { } 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
@@ -293,9 +305,9 @@ class CoreExport ChannelModeNoone : public ChannelMode
* This also contains a mode stacker that will combine multiple modes and set * This also contains a mode stacker that will combine multiple modes and set
* them on a channel or user at once * them on a channel or user at once
*/ */
class CoreExport ModeManager class CoreExport ModeManager final
{ {
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;
@@ -389,13 +401,13 @@ class CoreExport ModeManager
/** Represents a mask set on a channel (b/e/I) /** Represents a mask set on a channel (b/e/I)
*/ */
class CoreExport Entry class CoreExport Entry final
{ {
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 +430,3 @@ class CoreExport Entry
*/ */
bool Matches(User *u, bool full = false) const; bool Matches(User *u, bool full = false) const;
}; };
#endif // MODES_H
+2 -5
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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
+21 -47
View File
@@ -1,6 +1,6 @@
/* Modular support /* Modular support
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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
@@ -189,7 +162,7 @@ enum
}; };
typedef unsigned short ModType; typedef unsigned short ModType;
struct ModuleVersionC struct ModuleVersionC final
{ {
int version_major, version_minor, version_patch; int version_major, version_minor, version_patch;
}; };
@@ -197,14 +170,14 @@ struct ModuleVersionC
/** Returned by Module::GetVersion, used to see what version of Anope /** Returned by Module::GetVersion, used to see what version of Anope
* a module is compiled against. * a module is compiled against.
*/ */
class ModuleVersion class ModuleVersion final
{ {
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
@@ -223,15 +196,19 @@ class ModuleVersion
int GetPatch() const; int GetPatch() const;
}; };
class NotImplementedException : public CoreException { }; class CoreExport NotImplementedException final
: public CoreException
{
};
/** Every module in Anope is actually a class. /** Every module in Anope is actually a class.
*/ */
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 +299,7 @@ class CoreExport Module : public Extensible
*/ */
virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); } 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 +381,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
@@ -1137,9 +1113,9 @@ enum Implementation
/** Used to manage modules. /** Used to manage modules.
*/ */
class CoreExport ModuleManager class CoreExport ModuleManager final
{ {
public: public:
/** Event handler hooks. /** Event handler hooks.
*/ */
static std::vector<Module *> EventHandlers[I_SIZE]; static std::vector<Module *> EventHandlers[I_SIZE];
@@ -1222,7 +1198,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 +1210,3 @@ class CoreExport ModuleManager
*/ */
static ModuleVersion GetVersion(void *handle); static ModuleVersion GetVersion(void *handle);
}; };
#endif // MODULES_H
+7 -5
View File
@@ -1,6 +1,6 @@
/* BotServ core functions /* BotServ core functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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
+7 -5
View File
@@ -1,6 +1,6 @@
/* BotServ core functions /* BotServ core functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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;
}; };
+10 -7
View File
@@ -1,11 +1,13 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
struct EntryMsg struct EntryMsg
{ {
Anope::string chan; Anope::string chan;
@@ -13,17 +15,18 @@ 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)
+11 -8
View File
@@ -1,6 +1,6 @@
/* ChanServ core functions /* ChanServ core functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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,22 @@ 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;
}; };
+7 -5
View File
@@ -1,6 +1,6 @@
/* ChanServ core functions /* ChanServ core functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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
+29 -22
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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,14 +72,14 @@ 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; }
struct hash struct hash final
{ {
size_t operator()(const Question &q) const size_t operator()(const Question &q) const
{ {
@@ -89,14 +88,15 @@ namespace DNS
}; };
}; };
struct ResourceRecord : Question struct ResourceRecord final
: Question
{ {
unsigned int ttl; unsigned int ttl = 0;
Anope::string rdata; 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
@@ -114,11 +114,12 @@ namespace DNS
/** DNS manager /** DNS manager
*/ */
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;
@@ -132,19 +133,27 @@ namespace DNS
/** A DNS query. /** A DNS query.
*/ */
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)
use_cache(cache), id(0), creator(c) { } : Timer(0)
, Question(addr, qt)
, manager(mgr)
, use_cache(cache)
, creator(c)
{
}
virtual ~Request() virtual ~Request()
{ {
@@ -164,7 +173,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() 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 +183,3 @@ namespace DNS
}; };
} // namespace DNS } // namespace DNS
#endif // DNS_H
+9 -6
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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,18 +18,19 @@ 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;
}; };
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;
+30 -28
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2012-2023 Anope Team * (C) 2012-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef ANOPE_HTTPD_H #pragma once
#define ANOPE_HTTPD_H
enum HTTPError enum HTTPError
{ {
@@ -19,15 +18,16 @@ enum HTTPError
}; };
/* A message to someone */ /* A message to someone */
struct HTTPReply struct HTTPReply final
{ {
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,18 +35,18 @@ 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();
} }
struct Data struct Data final
{ {
char *buf; char *buf;
size_t len; size_t len;
@@ -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)
{ {
@@ -81,7 +81,7 @@ struct HTTPReply
}; };
/* A message from someone */ /* A message from someone */
struct HTTPMessage struct HTTPMessage final
{ {
std::map<Anope::string, Anope::string> headers; std::map<Anope::string, Anope::string> headers;
std::map<Anope::string, Anope::string> cookies; std::map<Anope::string, Anope::string> cookies;
@@ -93,12 +93,13 @@ 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; }
@@ -115,15 +116,18 @@ class HTTPPage : public Base
virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0; virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
}; };
class HTTPClient : public ClientSocket, public BinarySocket, public Base class HTTPClient
: public ClientSocket
, public BinarySocket
, public Base
{ {
protected: protected:
void WriteClient(const Anope::string &message) 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()
@@ -135,12 +139,14 @@ class HTTPClient : public ClientSocket, public BinarySocket, public Base
virtual void SendReply(HTTPReply *) = 0; virtual void SendReply(HTTPReply *) = 0;
}; };
class HTTPProvider : public ListenSocket, public Service 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 +202,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 +219,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 +236,10 @@ namespace HTTPUtils
dst += "&amp;"; dst += "&amp;";
break; break;
default: default:
dst += src[i]; dst += c;
} }
} }
return dst; return dst;
} }
} }
#endif // ANOPE_HTTPD_H
+16 -17
View File
@@ -1,23 +1,22 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef ANOPE_LDAP_H #pragma once
#define ANOPE_LDAP_H
class LDAPException : public ModuleException class DllExport 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 final
{ {
enum LDAPOperation enum LDAPOperation
{ {
@@ -32,7 +31,8 @@ struct LDAPModification
}; };
typedef std::vector<LDAPModification> LDAPMods; typedef std::vector<LDAPModification> LDAPMods;
struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string> > struct LDAPAttributes final
: public std::map<Anope::string, std::vector<Anope::string>>
{ {
size_t size(const Anope::string &attr) const size_t size(const Anope::string &attr) const
{ {
@@ -43,8 +43,8 @@ struct LDAPAttributes : public std::map<Anope::string, std::vector<Anope::string
const std::vector<Anope::string> keys() const 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;
} }
@@ -75,7 +75,7 @@ enum QueryType
QUERY_MODIFY QUERY_MODIFY
}; };
struct LDAPResult struct LDAPResult final
{ {
std::vector<LDAPAttributes> messages; std::vector<LDAPAttributes> messages;
Anope::string error; Anope::string error;
@@ -112,20 +112,21 @@ 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;
virtual void OnDelete() { } virtual void OnDelete() { }
}; };
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 +168,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
+10 -7
View File
@@ -1,6 +1,6 @@
/* NickServ core functions /* NickServ core functions
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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
* *
@@ -61,9 +63,10 @@ struct NSCertList
virtual void Check() = 0; virtual void Check() = 0;
}; };
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;
+10 -12
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_FORBID_H #pragma once
#define OS_FORBID_H
enum ForbidType enum ForbidType
{ {
@@ -23,18 +22,19 @@ 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 +51,3 @@ class ForbidService : public Service
}; };
static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid"); static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
#endif
+11 -8
View File
@@ -1,6 +1,6 @@
/* OperServ ignore interface /* OperServ ignore interface
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,24 +9,27 @@
* 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;
+8 -9
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_NEWS #pragma once
#define OS_NEWS
enum NewsType enum NewsType
{ {
@@ -16,14 +15,15 @@ enum NewsType
NEWS_OPER NEWS_OPER
}; };
struct NewsMessages struct NewsMessages final
{ {
NewsType type; NewsType type;
Anope::string name; Anope::string name;
const char *msgs[10]; const char *msgs[10];
}; };
struct NewsItem : Serializable struct NewsItem
: Serializable
{ {
NewsType type; NewsType type;
Anope::string text; Anope::string text;
@@ -33,9 +33,10 @@ struct NewsItem : Serializable
NewsItem() : Serializable("NewsItem") { } NewsItem() : Serializable("NewsItem") { }
}; };
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 +49,3 @@ class NewsService : public Service
}; };
static ServiceReference<NewsService> news_service("NewsService", "news"); static ServiceReference<NewsService> news_service("NewsService", "news");
#endif // OS_NEWS
+13 -14
View File
@@ -1,24 +1,24 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef OS_SESSION_H #pragma once
#define OS_SESSION_H
struct Session struct Session final
{ {
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 final
: Serializable
{ {
Anope::string mask; /* Hosts to which this exception applies */ Anope::string mask; /* Hosts to which this exception applies */
unsigned limit; /* Session limit for exception */ unsigned limit; /* Session limit for exception */
@@ -28,14 +28,15 @@ 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 +91,3 @@ Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
session_service->AddException(ex); session_service->AddException(ex);
return ex; return ex;
} }
#endif
+5 -7
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#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 +21,3 @@ class ChanServService : public Service
*/ */
virtual void Hold(Channel *c) = 0; virtual void Hold(Channel *c) = 0;
}; };
#endif // CHANSERV_H
+5 -7
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#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 +26,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
+5 -7
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#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 +37,3 @@ class MemoServService : public Service
*/ */
virtual void Check(User *u) = 0; virtual void Check(User *u) = 0;
}; };
#endif // MEMOSERV_H
+5 -7
View File
@@ -1,17 +1,17 @@
/* /*
* *
* (C) 2011-2023 Anope Team * (C) 2011-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#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 +20,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
+11 -8
View File
@@ -1,14 +1,16 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace Redis namespace Redis
{ {
struct Reply struct Reply final
{ {
enum Type enum Type
{ {
@@ -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,19 +45,20 @@ 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; }
}; };
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;
+15 -10
View File
@@ -1,14 +1,16 @@
/* /*
* *
* (C) 2014-2023 Anope Team * (C) 2014-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SASL namespace SASL
{ {
struct Message struct Message final
{ {
Anope::string source; Anope::string source;
Anope::string target; Anope::string target;
@@ -20,9 +22,10 @@ namespace SASL
class Mechanism; class Mechanism;
struct Session; struct Session;
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;
@@ -58,9 +61,10 @@ 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); }
@@ -74,15 +78,16 @@ namespace SASL
} }
}; };
class IdentifyRequest : public ::IdentifyRequest class IdentifyRequest
: public ::IdentifyRequest
{ {
Anope::string uid; Anope::string uid;
Anope::string hostname, ip; Anope::string hostname, ip;
public: public:
IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { } IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { }
void OnSuccess() anope_override void OnSuccess() override
{ {
if (!sasl) if (!sasl)
return; return;
@@ -108,7 +113,7 @@ namespace SASL
} }
} }
void OnFail() anope_override void OnFail() override
{ {
if (!sasl) if (!sasl)
return; return;
+6 -3
View File
@@ -1,17 +1,20 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
struct MiscData struct MiscData
{ {
Anope::string object; Anope::string object;
Anope::string name; Anope::string name;
Anope::string data; Anope::string data;
MiscData() { } virtual ~MiscData() = default;
virtual ~MiscData() { } protected:
MiscData() = default;
}; };
+36 -30
View File
@@ -1,17 +1,20 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
namespace SQL namespace SQL
{ {
class Data : public Serialize::Data class Data final
: 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 +24,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 +32,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())
@@ -77,24 +82,24 @@ namespace SQL
/** A SQL exception, can be thrown at various points /** A SQL exception, can be thrown at various points
*/ */
class Exception : public ModuleException class DllExport Exception : public ModuleException
{ {
public: public:
Exception(const Anope::string &reason) : ModuleException(reason) { } Exception(const Anope::string &reason) : ModuleException(reason) { }
virtual ~Exception() throw() { } virtual ~Exception() noexcept = default;
}; };
/** A SQL query /** A SQL query
*/ */
struct QueryData struct QueryData final
{ {
Anope::string data; Anope::string data;
bool escape; bool escape;
}; };
struct Query struct Query final
{ {
Anope::string query; Anope::string query;
std::map<Anope::string, QueryData> parameters; std::map<Anope::string, QueryData> parameters;
@@ -135,16 +140,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 +188,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;
@@ -195,9 +200,10 @@ namespace SQL
/** Class providing the SQL service, modules call this to execute queries /** Class providing the SQL service, modules call this to execute queries
*/ */
class Provider : 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;
+6 -3
View File
@@ -1,14 +1,17 @@
/* /*
* *
* (C) 2010-2023 Anope Team * (C) 2010-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
class SSLService : public Service #pragma once
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;
+5 -3
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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;
}; };
+11 -8
View File
@@ -1,25 +1,27 @@
/* /*
* *
* (C) 2010-2023 Anope Team * (C) 2010-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#pragma once
#include "httpd.h" #include "httpd.h"
class XMLRPCRequest class XMLRPCRequest final
{ {
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,15 @@ 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;
+6 -9
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2008-2011 Robin Burchell <w00t@inspircd.org> * (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* (C) 2008-2023 Anope Team <team@anope.org> * (C) 2008-2024 Anope Team <team@anope.org>
* *
* Please read COPYING and README for further details. * 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 */
@@ -41,9 +40,9 @@ struct CoreExport Oper
static Oper *Find(const Anope::string &name); static Oper *Find(const Anope::string &name);
}; };
class CoreExport OperType class CoreExport OperType final
{ {
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
+34 -38
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -18,13 +17,14 @@
#include "modes.h" #include "modes.h"
/* Encapsulates the IRCd protocol we are speaking. */ /* Encapsulates the IRCd protocol we are speaking. */
class CoreExport IRCDProto : public Service 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 +61,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 */
@@ -127,27 +129,27 @@ class CoreExport IRCDProto : public Service
* @param user The user to be killed * @param user The user to be killed
* @param fmt Kill reason * @param fmt Kill reason
*/ */
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...); virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...); virtual void SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...); virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...) ATTR_FORMAT(4, 5);
/** Introduces a client to the rest of the network /** Introduces a client to the rest of the network
* @param u The client to introduce * @param u The client to introduce
*/ */
virtual void SendClientIntroduction(User *u) = 0; virtual void SendClientIntroduction(User *u) = 0;
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...); virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...) ATTR_FORMAT(5, 6);
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0; virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0; virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendQuit(User *u, const char *fmt, ...); virtual void SendQuit(User *u, const char *fmt, ...) ATTR_FORMAT(3, 4);
virtual void SendPing(const Anope::string &servname, const Anope::string &who); virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who); virtual void SendPong(const Anope::string &servname, const Anope::string &who);
@@ -159,7 +161,7 @@ class CoreExport IRCDProto : public Service
* stacker to be set "soon". * stacker to be set "soon".
*/ */
virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0; virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0;
virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...); virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...) ATTR_FORMAT(4, 5);
/** Force joins a user that isn't ours to a channel. /** Force joins a user that isn't ours to a channel.
* @param bi The source of the message * @param bi The source of the message
@@ -178,11 +180,7 @@ class CoreExport IRCDProto : public Service
virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { } virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendInvite(const MessageSource &source, const Channel *c, User *u); virtual void SendInvite(const MessageSource &source, const Channel *c, User *u);
virtual void SendGlobops(const MessageSource &source, const char *fmt, ...); virtual void SendGlobops(const MessageSource &source, const char *fmt, ...) ATTR_FORMAT(3, 4);
/** 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.
*/ */
@@ -213,7 +211,7 @@ class CoreExport IRCDProto : public Service
virtual void SendServer(const Server *) = 0; virtual void SendServer(const Server *) = 0;
virtual void SendSquit(Server *, const Anope::string &message); virtual void SendSquit(Server *, const Anope::string &message);
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...); virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendLogin(User *u, NickAlias *na) = 0; virtual void SendLogin(User *u, NickAlias *na) = 0;
virtual void SendLogout(User *u) = 0; virtual void SendLogout(User *u) = 0;
@@ -230,7 +228,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 &);
@@ -247,13 +245,13 @@ class CoreExport IRCDProto : public Service
virtual Anope::string NormalizeMask(const Anope::string &mask); virtual Anope::string NormalizeMask(const Anope::string &mask);
}; };
class CoreExport MessageSource class CoreExport MessageSource final
{ {
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);
@@ -271,32 +269,32 @@ enum IRCDMessageFlag
IRCDMESSAGE_REQUIRE_USER IRCDMESSAGE_REQUIRE_USER
}; };
class CoreExport IRCDMessage : public Service 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); }
}; };
/** MessageTokenizer allows tokens in the IRC wire format to be read from a string */ /** MessageTokenizer allows tokens in the IRC wire format to be read from a string */
class CoreExport MessageTokenizer class CoreExport MessageTokenizer final
{ {
private: private:
/** The message we are parsing tokens from. */ /** The message we are parsing tokens from. */
Anope::string message; Anope::string message;
/** The current position within the message. */ /** The current position within the message. */
Anope::string::size_type position; 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 +312,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
+13 -12
View File
@@ -1,13 +1,12 @@
/* /*
* *
* (C) 2008-2023 Anope Team * (C) 2008-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
*/ */
#ifndef REGCHANNEL_H #pragma once
#define REGCHANNEL_H
#include "memo.h" #include "memo.h"
#include "modes.h" #include "modes.h"
@@ -22,9 +21,10 @@ typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList; extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
/* AutoKick data. */ /* AutoKick data. */
class CoreExport AutoKick : public Serializable class CoreExport AutoKick final
: public Serializable
{ {
public: public:
/* Channel this autokick is on */ /* Channel this autokick is on */
Serialize::Reference<ChannelInfo> ci; Serialize::Reference<ChannelInfo> ci;
@@ -38,24 +38,26 @@ 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 &);
}; };
/* It matters that Base is here before Extensible (it is inherited by Serializable) /* It matters that Base is here before Extensible (it is inherited by Serializable)
*/ */
class CoreExport ChannelInfo : public Serializable, public Extensible class CoreExport ChannelInfo final
: 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 +95,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 +251,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
+12 -13
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,37 +9,36 @@
* 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"
#include "service.h" #include "service.h"
class RegexException : public CoreException class CoreExport RegexException final
: 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
+26 -28
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"); }
@@ -50,9 +49,10 @@ namespace Serialize
* abstract data types (Serialize::Data), and then reconstructed or * abstract data types (Serialize::Data), and then reconstructed or
* updated later at any time. * updated later at any time.
*/ */
class CoreExport Serializable : 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 +65,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".
*/ */
@@ -108,7 +108,8 @@ class CoreExport Serializable : public virtual Base
* of class that inherits from Serializable. Used for unserializing objects * of class that inherits from Serializable. Used for unserializing objects
* of this type, as it requires a function pointer to a static member function. * of this type, as it requires a function pointer to a static member function.
*/ */
class CoreExport Serialize::Type : public Base class CoreExport Serialize::Type final
: public Base
{ {
typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &); typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &);
@@ -127,9 +128,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 +188,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 +198,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
{ {
@@ -241,15 +242,14 @@ class Serialize::Checker
* destructed. * destructed.
*/ */
template<typename T> template<typename T>
class Serialize::Reference : public ReferenceBase class Serialize::Reference final
: 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 +331,3 @@ class Serialize::Reference : public ReferenceBase
return NULL; return NULL;
} }
}; };
#endif // SERIALIZE_H
+9 -11
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -38,9 +37,10 @@ namespace Servers
/** Class representing a server /** Class representing a server
*/ */
class CoreExport Server : public Extensible class CoreExport Server final
: 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 +62,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 +73,14 @@ class CoreExport Server : public Extensible
*/ */
Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", bool jupe = false); 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 +183,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
+13 -14
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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"
@@ -21,7 +20,8 @@
* such as commands, use this. This is also used for modules * such as commands, use this. This is also used for modules
* that publish a service (m_ssl_openssl, etc). * that publish a service (m_ssl_openssl, etc).
*/ */
class CoreExport Service : public virtual Base class CoreExport Service
: public virtual Base
{ {
static std::map<Anope::string, std::map<Anope::string, Service *> > Services; static std::map<Anope::string, std::map<Anope::string, Service *> > Services;
static std::map<Anope::string, std::map<Anope::string, Anope::string> > Aliases; static std::map<Anope::string, std::map<Anope::string, Anope::string> > Aliases;
@@ -42,7 +42,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,16 +113,17 @@ class CoreExport Service : public virtual Base
} }
}; };
/** Like Reference, but used to refer to Services. /** Like Reference, but used to refer to a Service.
*/ */
template<typename T> template<typename T>
class ServiceReference : public Reference<T> 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 +139,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)
{ {
@@ -159,10 +160,10 @@ class ServiceReference : public Reference<T>
} }
}; };
class ServiceAlias class ServiceAlias final
{ {
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 +174,3 @@ class ServiceAlias
Service::DelAlias(t, f); Service::DelAlias(t, f);
} }
}; };
#endif // SERVICE_H
+7 -20
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,8 +9,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
+4 -7
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,16 +9,15 @@
* 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"
class CoreExport SocketEngine class CoreExport SocketEngine final
{ {
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
+72 -57
View File
@@ -1,6 +1,6 @@
/* /*
* *
* (C) 2003-2023 Anope Team * (C) 2003-2024 Anope Team
* Contact us at team@anope.org * Contact us at team@anope.org
* *
* Please read COPYING and README for further details. * Please read COPYING and README for further details.
@@ -9,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
*/ */
@@ -92,12 +103,12 @@ union CoreExport sockaddrs
void ntop(int type, const void *src); void ntop(int type, const void *src);
}; };
class CoreExport cidr class CoreExport cidr final
{ {
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);
@@ -109,15 +120,16 @@ class CoreExport cidr
bool operator==(const cidr &other) const; bool operator==(const cidr &other) const;
bool operator!=(const cidr &other) const; bool operator!=(const cidr &other) const;
struct CoreExport hash struct CoreExport hash final
{ {
size_t operator()(const cidr &s) const; size_t operator()(const cidr &s) const;
}; };
}; };
class SocketException : public CoreException class CoreExport SocketException final
: public CoreException
{ {
public: public:
/** Constructor for socket exceptions /** Constructor for socket exceptions
* @param message Error message * @param message Error message
*/ */
@@ -126,7 +138,7 @@ class SocketException : public CoreException
/** Destructor /** Destructor
* @throws Nothing * @throws Nothing
*/ */
virtual ~SocketException() throw() { } virtual ~SocketException() noexcept = default;
}; };
enum SocketFlag enum SocketFlag
@@ -143,8 +155,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 +213,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 +235,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
@@ -274,9 +287,10 @@ class CoreExport Socket
virtual void ProcessError(); virtual void ProcessError();
}; };
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 +298,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,10 +318,10 @@ 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, ...) ATTR_FORMAT(2, 3);
void Write(const Anope::string &message); void Write(const Anope::string &message);
/** Get the length of the read buffer /** Get the length of the read buffer
@@ -322,10 +335,11 @@ class CoreExport BufferedSocket : public virtual Socket
int WriteBufferLen() const; int WriteBufferLen() const;
}; };
class CoreExport BinarySocket : public virtual Socket class CoreExport BinarySocket
: public virtual Socket
{ {
protected: protected:
struct DataBlock struct DataBlock final
{ {
char *orig; char *orig;
char *buf; char *buf;
@@ -338,26 +352,25 @@ 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
* @param l The length of the data; if 0 then this function returns without doing anything * @param l The length of the data; if 0 then this function returns without doing anything
*/ */
virtual void Write(const char *buffer, size_t l); virtual void Write(const char *buffer, size_t l);
void Write(const char *message, ...); void Write(const char *message, ...) ATTR_FORMAT(2, 3);
void Write(const Anope::string &message); void Write(const Anope::string &message);
/** Called with data from the socket /** Called with data from the socket
@@ -368,16 +381,17 @@ class CoreExport BinarySocket : public virtual Socket
virtual bool Read(const char *buffer, size_t l); virtual bool Read(const char *buffer, size_t l);
}; };
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
@@ -392,9 +406,10 @@ class CoreExport ListenSocket : public virtual Socket
virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) = 0; virtual ClientSocket *OnAccept(int fd, const sockaddrs &addr) = 0;
}; };
class CoreExport ConnectionSocket : public virtual Socket class CoreExport ConnectionSocket
: public virtual Socket
{ {
public: public:
/* Sockaddrs for connection ip/port */ /* Sockaddrs for connection ip/port */
sockaddrs conaddr; sockaddrs conaddr;
@@ -408,12 +423,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
*/ */
@@ -425,9 +440,10 @@ class CoreExport ConnectionSocket : public virtual Socket
virtual void OnError(const Anope::string &error); virtual void OnError(const Anope::string &error);
}; };
class CoreExport ClientSocket : public virtual Socket class CoreExport ClientSocket
: public virtual Socket
{ {
public: public:
/* Listen socket this connection came from */ /* Listen socket this connection came from */
ListenSocket *ls; ListenSocket *ls;
/* Clients address */ /* Clients address */
@@ -443,12 +459,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.
*/ */
@@ -459,9 +475,10 @@ class CoreExport ClientSocket : public virtual Socket
virtual void OnError(const Anope::string &error); virtual void OnError(const Anope::string &error);
}; };
class CoreExport Pipe : public Socket class CoreExport Pipe
: public Socket
{ {
public: public:
/** The FD of the write pipe /** The FD of the write pipe
* this->sock is the readfd * this->sock is the readfd
*/ */
@@ -472,7 +489,7 @@ class CoreExport Pipe : public Socket
/** Called when data is to be read, reads the data then calls OnNotify /** 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 +524,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

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