1
0
mirror of https://github.com/anope/anope.git synced 2026-06-14 02:34:48 +02:00

Compare commits

...

334 Commits

Author SHA1 Message Date
Sadie Powell 6037f63ae5 Release 2.1.9. 2024-10-01 11:46:13 +01:00
Sadie Powell 5cdb65ca52 Update the change log. 2024-10-01 11:42:25 +01:00
Sadie Powell f9e4ca4d06 Raise the default nickname expiry time to one year. 2024-10-01 11:31:50 +01:00
Sadie Powell 66c9be8627 Respect nonicknameownership on InspIRCd v4. 2024-09-26 19:38:44 +01:00
Sadie Powell 546f65c38e Fix some messages not being marked as translatable. 2024-09-26 13:26:02 +01:00
Sadie Powell 9fcb022d5e Allow sending an oper account on InspIRCd. 2024-09-26 12:51:54 +01:00
Sadie Powell 5a0c6b1f18 Fix setting +o on opers on login. 2024-09-26 12:51:54 +01:00
Sadie Powell ade8db023e Bump minimum UnrealIRCd version to 6.0. 2024-09-24 19:56:13 +01:00
Sadie Powell 2ae733bcd1 Merge branch '2.0' into 2.1. 2024-09-17 12:32:33 +01:00
Sadie Powell cc37e6d69a Remove config option for options:warningtimeout.
This hasn't done anything since the early 1.9 releases I'm not sure
why it hasn't been removed already.
2024-09-17 12:27:13 +01:00
Sadie Powell 101c68f786 Fix the Argon2 module not having test vectors. 2024-09-04 23:50:01 +01:00
Sadie Powell ec0cd9e7f9 Bump for 2.1.9-git. 2024-09-01 09:50:24 +01:00
Sadie Powell ab0b851d28 Release 2.1.8. 2024-09-01 09:46:17 +01:00
Sadie Powell 4e3720b810 Merge branch '2.0' into 2.1. 2024-09-01 09:43:38 +01:00
TehPeGaSuS 4b48fc98d3 Fix the documentation of mail:usemail.
`nickserv:registration` only has as options: none, admin, mail.

I assume that `mail` is the word that should replace `yes`
2024-09-01 09:41:32 +01:00
Sadie Powell 82993c8d1e Update the changelogs. 2024-08-30 14:49:43 +01:00
Sadie Powell d352718a39 Fix parsing named extbans on InspIRCd. 2024-08-30 14:49:39 +01:00
Sadie Powell d44632e57d Use CMake's -B option instead of cding to the build directory. 2024-08-30 14:48:31 +01:00
Sadie Powell 80451011dd Remove pointless semicolons in the config for the webcpanel module. 2024-08-29 13:40:39 +01:00
Sadie Powell b4e673b2f4 Refactor ns_getemail slightly. 2024-08-29 13:21:18 +01:00
Sadie Powell 58a78e9aa5 Allow server admins to require that a display nick drops last.
Closes #348.
2024-08-29 13:14:39 +01:00
Sadie Powell 6da4a148fa Fix translating mail:memo_message. 2024-08-24 12:27:05 +01:00
Sadie Powell a3edb09eda Use CanClearBans/SendClearBans when enforcing smartjoin. 2024-08-22 00:29:30 +01:00
Sadie Powell 27beb8f877 Improve the CTCP version output. 2024-08-21 15:38:35 +01:00
Sadie Powell 136680f917 Fix the grammar of some info messages. 2024-08-18 03:17:33 +01:00
Sadie Powell 378ae21ac7 Add account identifier to nickserv/info output. 2024-08-18 01:19:39 +01:00
Sadie Powell e35a86661d Remove support for MinGW.
All of our builds are fully native on Windows so there's no need
for this anymore.
2024-08-15 12:14:06 +01:00
Sadie Powell 528b5938ec Automatically determine SQL column type from the field.
Also add more column types to ensure we are storing data in the
best format in the database.
2024-08-14 05:47:55 +01:00
Sadie Powell 03bee17063 Remove the unused KeySet method in Serialize::Data. 2024-08-14 00:10:12 +01:00
Sadie Powell fe18050c49 Fix parsing SVSMODE and SVS2MODE messages on UnrealIRCd.
At some point UnrealIRCd made an undocumented change to the protocol
where the last parameter on a server-source message would not be a
timestamp. This behaviour is preserved for MODE.
2024-08-09 20:39:46 +01:00
Wilson Birney aa0496f69b Add <cstring> include to services.h to fix build on some musl systems.
Co-authored-by: blackbeard420 <blackbeard@blackbeard420.me>
2024-08-06 11:00:47 +01:00
Sadie Powell 4ee22ab05e Merge branch '2.0' into 2.1. 2024-07-28 22:50:30 +01:00
Sadie Powell 63ad540e55 Add a note to LANGUAGE about rebuilding from scratch. 2024-07-20 19:25:58 +01:00
Sadie Powell a1165eea94 Fix the type of the InspIRCd IJOIN chants when converting. 2024-07-20 19:25:58 +01:00
Sadie Powell bfca74f6b3 Bump for 2.0.17-git. 2024-07-19 13:24:41 +01:00
Sadie Powell 3acf74483c Release 2.0.16. 2024-07-19 12:49:56 +01:00
Sadie Powell a3ec8329f4 Document the previous commit. 2024-07-19 12:48:44 +01:00
Sadie Powell 7d0184ca34 Merge branch '2.0' into 2.1. 2024-07-19 01:43:41 +01:00
Sadie Powell 31bc597c81 Send the vhost/vident before the account name on InspIRCd.
This fixes IRCd-side account cloaks causing CHGHOST spam.
2024-07-19 01:11:32 +01:00
Sadie Powell e0b687f289 Merge branch '2.0' into 2.1. 2024-07-14 16:42:26 +01:00
Sadie Powell 2de0dddb1c Fix joining channels with keys on InspIRCd v3. 2024-07-14 16:39:37 +01:00
Sadie Powell ff65b68dfa Fix the name of the key parameter in SendSVSJoin. 2024-07-14 15:21:00 +01:00
Sadie Powell 94456a6063 Fix sending global messages to remotely linked servers. 2024-07-14 11:44:22 +01:00
Sadie Powell 41ea346551 Update the change log. 2024-07-11 01:13:59 +01:00
Sadie Powell 439ad3e736 Make it clear that inspircd3 also works with InspIRCd 4. 2024-07-11 01:13:59 +01:00
Sadie Powell 347d82f59b Qualify a use of auto in db_atheme. 2024-07-08 00:53:47 +01:00
Sadie Powell fe68f40634 Remove some obsolete echo compatibility wrappers. 2024-07-08 00:53:47 +01:00
ItsOnlyBinary 08b1344056 Add UNIX socket support to mysql module.
Ref: #419
2024-07-04 13:13:56 +01:00
Sadie Powell ff67a80a71 Bump for 2.1.8-git. 2024-07-01 10:08:16 +01:00
Sadie Powell 230e85798d Release 2.1.7. 2024-07-01 10:06:17 +01:00
Sadie Powell 9604690e9d Update the change logs. 2024-06-29 16:25:17 +01:00
Sadie Powell 01e0cf4868 Add support for sending tag messages. 2024-06-24 14:46:41 +01:00
Sadie Powell 693eeed762 Rework how CTCP messages are sent and received. 2024-06-24 14:29:55 +01:00
Sadie Powell 6e5713d64a Remove the formatting overloads of SendNotice/SendPrivmsg. 2024-06-24 13:30:17 +01:00
Sadie Powell 249ad3dfea Update the Turkish translation.
Co-authored-by: CaPa CuL <capacul@gmail.com>
2024-06-23 18:36:00 +01:00
Sadie Powell b94c3740b9 Make the language around fantasy commands less weird. 2024-06-23 14:36:03 +01:00
Sadie Powell 59ec42f0e6 Rename suspend in cs_expire to suspendexpire to match ns_expire. 2024-06-23 13:55:25 +01:00
Sadie Powell 8a65f116b6 Merge branch '2.0' into 2.1. 2024-06-23 13:52:46 +01:00
Sadie Powell 8105607257 Fix the default config for channel suspensions. 2024-06-23 13:51:53 +01:00
Sadie Powell 601da1141e Fix the default config for channel suspensions. 2024-06-23 13:50:50 +01:00
Sadie Powell 8c0edef714 Split nickserv/{sa,}set/language out to its own module. 2024-06-22 17:46:42 +01:00
Sadie Powell c3efd9426d Update the change log. 2024-06-20 17:16:16 +01:00
Sadie Powell a386439f86 Misc improvements to db_atheme. 2024-06-20 17:16:16 +01:00
Sadie Powell 016a5b3903 Fix importing Atheme mode locks. 2024-06-20 17:16:16 +01:00
Sadie Powell 60aeb2a71a Silently ignore some Atheme metadata that we know we can't import. 2024-06-19 22:45:43 +01:00
Sadie Powell 54ea63df66 Avoid creating extra service references in db_atheme. 2024-06-19 22:44:31 +01:00
Sadie Powell 01fc3ea22e Fix importing Atheme opers. 2024-06-19 22:44:31 +01:00
Sadie Powell 3388736fab Use auto in more places in db_atheme. 2024-06-19 22:44:31 +01:00
Sadie Powell 0065a0f405 Only import clones from Atheme if we recognise the database version. 2024-06-19 22:44:16 +01:00
Sadie Powell 490f832dc0 Fix importing Atheme session limits. 2024-06-19 21:12:28 +01:00
Sadie Powell a44acb6de5 Fix importing Atheme forbid reasons. 2024-06-19 20:31:55 +01:00
Sadie Powell 13e5ddf807 Fix importing Atheme akick reasons. 2024-06-19 20:22:57 +01:00
Sadie Powell e42c728ab8 Log the channel that a mode lock was unable to be imported for. 2024-06-19 19:41:16 +01:00
Sadie Powell 4eec5c5435 Save the databases directly after importing. 2024-06-19 19:30:24 +01:00
Sadie Powell 2667d9e90c Update the databases more regularly. 2024-06-19 11:28:21 +01:00
Sadie Powell f2b66278aa Fix a string that should be marked as translatable in ns_info. 2024-06-12 17:53:15 +01:00
Sadie Powell 5b7d952626 Remove the broken Catalan, Hungarian, and Russian translations. 2024-06-12 17:50:00 +01:00
Sadie Powell 24375d53e6 Add support for looking up account information from a nick.
Closes #407.
2024-06-12 17:46:07 +01:00
Sadie Powell 88ac47e217 The sender can be null in OnBotUnAssign. 2024-06-10 12:51:56 +01:00
Sadie Powell 8a1bffba9b Fix a crash in ns_cert. 2024-06-10 11:16:05 +01:00
TehPeGaSuS 01eef7a392 Rename example.chk to cron.example.sh. 2024-06-07 23:23:44 +01:00
Sadie Powell 67b76fadca Fix a memory leak in os_akill and os_sxline. 2024-06-07 22:39:08 +01:00
Sadie Powell 7861712437 Add nullability attributes to the module events. 2024-06-07 22:15:58 +01:00
Sadie Powell ccc088d946 Log a user out fully when their nick gets suspended.
Closes #409.
2024-06-04 22:41:32 +01:00
Sadie Powell 4468fe77fa Fix an inverted if in the global odule. 2024-06-03 20:02:03 +01:00
Sadie Powell e71a9e2894 Avoid NickAlias lookups by storing a pointer in the NickCore. 2024-06-03 16:04:53 +01:00
Sadie Powell f80bdf06ba Fix a null pointer dereference in the sasl module. 2024-06-03 14:39:08 +01:00
Sadie Powell 2d6033c73f Bump for 2.1.7-git. 2024-06-01 09:44:43 +01:00
Sadie Powell 756dc49813 Release 2.1.6. 2024-06-01 09:43:36 +01:00
Sadie Powell aa92559aa0 Document the previous commit. 2024-06-01 09:43:20 +01:00
Sadie Powell eb12a89b8e Fix creating the runtime directory on Windows. 2024-05-28 01:07:27 +01:00
Sadie Powell d4a34308e5 Update the change logs. 2024-05-23 16:02:54 +01:00
Sadie Powell aab3a8e5b6 Clarify that one non-deprecated protocol module must be loaded. 2024-05-23 15:40:56 +01:00
Sadie Powell c72e12d0a6 Fix setting the history mode on UnrealIRCd.
Closes #406.
2024-05-22 15:08:13 +01:00
Sadie Powell bce0d629fd Fix another iterator invalidation issue. 2024-05-22 14:30:18 +01:00
Sadie Powell 7d0dacc86c Change --modulesdir to be singular like the other config options. 2024-05-22 10:30:03 +01:00
Sadie Powell 729aa4ab4a Fix parsing the flood mode on UnrealIRCd. 2024-05-18 18:36:17 +01:00
Sadie Powell 18e9e12261 Fix an iterator invalidation issue in cs_set and ns_set. 2024-05-18 16:35:35 +01:00
TehPeGaSuS 9d68b29c9e Initial Portuguese retranslation. 2024-05-17 17:24:24 +01:00
Sadie Powell a4792412ba Merge branch '2.0' into 2.1. 2024-05-16 18:00:13 +01:00
Sadie Powell 8bb83f6b1a Explicitly specify ROW_FORMAT=DYNAMIC when creating tables.
Resolves the issues some people were having with extremely wide rows.
2024-05-16 17:29:25 +01:00
Sadie Powell da99a53dfa Don't specify a width for DT_INT columns.
This isn't actually used by MySQL for the column width.
2024-05-16 17:28:15 +01:00
Sadie Powell a9e9ac32a0 Store boolean extension items as DT_INT. 2024-05-16 17:28:15 +01:00
Sadie Powell 05e6df23a2 Mark boolean columns as DT_INT in bs_kick. 2024-05-16 16:50:41 +01:00
Sadie Powell 3f9fc23270 Remove some unnecessary advice. 2024-05-16 16:44:38 +01:00
Sadie Powell cb21c7c1fa Fix some untranslated strings in the Turkish translation. 2024-05-11 18:35:17 +01:00
Sadie Powell 4008e64f26 Store when the account name was registered in the NickCore. 2024-05-11 17:40:38 +01:00
Sadie Powell 1cf5918574 Merge branch '2.0' into 2.1. 2024-05-11 14:24:37 +01:00
Sadie Powell afe87bf693 Ensure we are connected to MySQL before trying to escape data. 2024-05-11 11:36:29 +01:00
Sadie Powell ff1c5adb8b Always use server-side topic and mode locks where available. 2024-05-10 19:03:50 +01:00
Sadie Powell c36030c826 Remove CanSVSLogout and implement logout support on Plexus. 2024-05-09 18:54:40 +01:00
Sadie Powell 33a02b1223 Require a reason when throwing an exception. 2024-05-09 18:37:16 +01:00
Sadie Powell 68f4556609 Store an IP in CommandSource for IRC messages too. 2024-05-06 17:08:37 +01:00
Sadie Powell 23db58a303 Change badpasslimit from int to unsigned int. 2024-05-06 16:42:13 +01:00
Sadie Powell ee69dc3105 Fix parsing backup client certificate fingerprints on InspIRCd. 2024-05-01 21:21:19 +01:00
Sadie Powell e9243c3fde Add the ReplaceCert method to CertService. 2024-05-01 21:20:31 +01:00
Sadie Powell 4cfee23303 Simplify InspIRCd user metadata handler slightly. 2024-05-01 20:20:47 +01:00
Sadie Powell be3822523b Automatically add client certificates to the cert list on register. 2024-05-01 17:23:10 +01:00
dependabot[bot] 111f81aa95 Bump microsoft/setup-msbuild from 1.3 to 2
Bumps [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) from 1.3 to 2.
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Changelog](https://github.com/microsoft/setup-msbuild/blob/main/building-release.md)
- [Commits](https://github.com/microsoft/setup-msbuild/compare/v1.3...v2)

---
updated-dependencies:
- dependency-name: microsoft/setup-msbuild
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 17:20:06 +01:00
Sadie Powell f12e1ad222 Bump for 2.1.6-git. 2024-05-01 14:37:06 +01:00
Sadie Powell 72318a6bf0 Release 2.1.5. 2024-05-01 14:16:09 +01:00
Sadie Powell 2f77cb38e2 Update the changelogs. 2024-05-01 14:15:17 +01:00
Sadie Powell 84ca4c0d27 Update the inspircd module for recent 1206 protocol changes. 2024-05-01 14:03:11 +01:00
Sadie Powell 1f9a197b18 Merge branch '2.0' into 2.1. 2024-04-29 08:36:23 +01:00
Sadie Powell 0c5bf51378 Skip serializing data without a type in db_flatfile. 2024-04-29 08:16:45 +01:00
Sadie Powell 1647968c50 Fix message truncation in global/global and global/server. 2024-04-28 08:52:16 +01:00
Sadie Powell 5473311bd7 Only enable os_noop on IRCDs that actually have a SendSVSNOOP impl. 2024-04-15 21:08:40 +01:00
Sadie Powell f3ebb67469 Make SendChannel abstract. 2024-04-15 21:00:10 +01:00
Sadie Powell 0d149ce195 Install a systemd service file on Linux. 2024-04-15 20:29:57 +01:00
Sadie Powell d68ba1b570 Implement support for BIGLINES on UnrealIRCd. 2024-04-15 20:05:43 +01:00
Sadie Powell 1877833e73 Bump Bahamut support to require 2.0 or newer. 2024-04-15 18:29:36 +01:00
Sadie Powell 63c3710785 Fix some missing translations in the tr_TR translation. 2024-04-15 15:32:19 +01:00
Sadie Powell 0043d137e5 Update the Turkish translation for the changes in 2.1.4.
Co-authored-by: CaPa CuL <capacul@gmail.com>
2024-04-15 15:26:55 +01:00
Sadie Powell 3e5d3c5bdc Avoid packaging unnecessary .lib files on Windows.
[skip alpine ci]
[skip ubuntu ci]
2024-04-15 12:41:56 +01:00
Sadie Powell 62deedfa75 Automatically upload the Windows package on release.
[skip alpine ci]
[skip ubuntu ci]
2024-04-15 11:57:40 +01:00
Sadie Powell 44af4eac6b Update the Windows CI to the latest Conan. 2024-04-15 11:11:40 +01:00
Sadie Powell 5fdc637327 Expand relative paths when installing. 2024-04-14 12:23:19 +01:00
Sadie Powell 7c93007aa6 Avoid duplicate entries in ReplaceCert. 2024-04-14 12:23:19 +01:00
Robert Scheck e8fee93a7e Fix a typo in the example configs. 2024-04-14 09:21:50 +01:00
Sadie Powell 260539e987 Add more documentation for overriding confirmation codes. 2024-04-07 15:52:24 +01:00
Sadie Powell 4603cd467b Add an operator privilege to allow overriding drop codes.
Closes #392
2024-04-05 14:14:10 +01:00
Sadie Powell 00549bc9b2 Merge branch '2.0' into 2.1. 2024-04-04 19:59:19 +01:00
Sadie Powell e0a6f7456b Fix extracting timestamps from UnrealIRCd MODE messages.
Oversight from commit 04e1a4f5c8.
2024-04-04 19:48:34 +01:00
Sadie Powell 5a54b37aeb Remove the g prefix from git hashes. 2024-04-04 14:16:21 +01:00
Sadie Powell 2e43665266 Log the services directory when chdiring to it. 2024-04-04 14:02:57 +01:00
Sadie Powell 8b4cd65e2a Fix erroring out when sendmailpath is empty.
This has a default now.
2024-04-02 16:52:41 +01:00
Sadie Powell c08aaa86d1 Sync the build system directory names with the core. 2024-04-02 16:52:41 +01:00
Sadie Powell 87a8af0ad7 Use the paths from the build system instead of hardcoding them. 2024-04-02 16:45:49 +01:00
Sadie Powell 4691dfa3f0 Bump for 2.1.5-git. 2024-04-01 11:26:07 +01:00
Sadie Powell 507eefc820 Release 2.1.4. 2024-04-01 11:24:48 +01:00
Sadie Powell 72af764861 Fix some typos in the changelog. 2024-03-31 15:21:18 +01:00
Sadie Powell 1b631e96bd Add a default value for sendmailpath. 2024-03-31 15:17:03 +01:00
Sadie Powell 3b4a4da52d Update the changelogs. 2024-03-29 14:24:17 +00:00
Sadie Powell 2e59aac025 Fix the default value of accessmax in cs_access. 2024-03-29 14:21:51 +00:00
Sadie Powell 3de6da80c6 Alias ACCESS to ALIST now the former is unused. 2024-03-27 23:32:16 +00:00
Sadie Powell 2829c83118 Add more nick options to webcpanel's nickserv/info page. 2024-03-26 14:27:52 +00:00
Sadie Powell f58012ea0e Remove some leftover references to nickserv/access. 2024-03-26 13:40:53 +00:00
Sadie Powell f8605ec188 Allow specifying the webcpanel template directory directly.
There's no need to hardcode a base path here.
2024-03-26 12:59:03 +00:00
Sadie Powell 5a12beff15 Fix some spelling issues in the webcpanel that were missed earlier. 2024-03-26 12:33:59 +00:00
Sadie Powell 6b1f8de885 Use consistent headers and footers on all webcpanel templates. 2024-03-26 11:52:04 +00:00
Sadie Powell 33be5de66e Flatten the webcpanel hierarchy slightly. 2024-03-26 11:22:43 +00:00
Sadie Powell 4399eeaa58 Add the --nopid option to disable writing a pidfile.
This is useful for init scripts that don't fork.
2024-03-20 21:34:28 +00:00
Sadie Powell 38cfb0603a Fix deleting pidfiles. 2024-03-20 21:34:18 +00:00
Sadie Powell 1a3844e74e Fix the Windows build. 2024-03-19 15:58:41 +00:00
Sadie Powell bfed2e1bf5 Use paths relative to data/conf in the config file.
This was done in some places already but not consistently.

Closes #349.
2024-03-19 15:51:55 +00:00
Sadie Powell e488f294a1 Put the webcpanel directory in the data directory not a subdir. 2024-03-19 15:19:15 +00:00
Sadie Powell fde3438ef2 Allow using absolute paths in more places. 2024-03-19 15:11:40 +00:00
Sadie Powell 1575dea5b9 Redocument deprecated encryption modules. 2024-03-19 12:40:01 +00:00
Sadie Powell a1972ba9b6 Prevent using enc_posix as a primary encryption module. 2024-03-19 11:54:39 +00:00
Sadie Powell 5a72d8783e Add verify-only support for POSIX crypt() hashes from Atheme. 2024-03-18 22:17:14 +00:00
Sadie Powell e6770bc2fd Fix an off by one error in enc_sha2. 2024-03-18 22:04:57 +00:00
Sadie Powell 413fed474e Fix unnecessary uses of std::string. 2024-03-18 12:47:43 +00:00
Sadie Powell 60083834f8 Improve sending email.
- Use consistent line endings as expected by the email spec.
- Don't require admins to escape . at the start of lines.
- Log the reason why sending email fails.
2024-03-18 12:34:34 +00:00
Sadie Powell 9ac4da0489 Fix not storing the start time after calling UpdateTime. 2024-03-18 11:45:33 +00:00
Sadie Powell cb3848b7db Use clock_gettime if it is available. 2024-03-18 11:27:10 +00:00
Sadie Powell d41764bfd6 Fix sending emails to nicks ending with a backslash. 2024-03-15 18:52:12 +00:00
Sadie Powell 753119c4a1 Use consistent casing when referring to vhosts and vidents. 2024-03-15 12:42:13 +00:00
Sadie Powell d996c3aa8f Fix a format-extra-args warning on some versions on GCC. 2024-03-15 12:22:22 +00:00
dependabot[bot] ac6e8c617d Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-15 12:19:07 +00:00
Sadie Powell 3b09f4aa54 Merge branch '2.0' into 2.1. 2024-03-15 12:17:49 +00:00
Sadie Powell 10f4724b6b Dependabot requires that the target-branch is a string. 2024-03-15 12:17:15 +00:00
Sadie Powell ad86535024 Consistently use READ_ONLY_MODE everywhere. 2024-03-15 12:09:58 +00:00
Sadie Powell 628f4d2a7e Merge branch '2.0' into 2.1. 2024-03-15 11:58:09 +00:00
Sadie Powell 8d5be77c93 Send dependabot pull requests to the 2.1 branch. 2024-03-15 11:56:56 +00:00
Sadie Powell 13a556df89 Initialize timer members with constructor initialization. 2024-03-14 23:19:32 +00:00
Sadie Powell 4e9d183523 Restore some functionality that was removed in an earlier commit. 2024-03-14 23:10:53 +00:00
Sadie Powell 074dfb63a7 Fix a warning when building with Clang. 2024-03-14 21:37:18 +00:00
Sadie Powell beaf09de7b Rework sending global notices.
Admins can now queue multiple messages and send them when they are
ready. This is fully compatible with the previous global behaviour.

Admins can now also send messages to individual servers. This is
useful for informing users of maintenance due to downtime.
2024-03-14 21:35:17 +00:00
Sadie Powell c8d8978cd0 Require that at least one encryption module is loaded. 2024-03-12 21:57:38 +00:00
Sadie Powell 11edba04fe Add command handlers for encap commands on InspIRCd. 2024-03-12 21:57:06 +00:00
Sadie Powell 22ba54b00d Show the full command in CONFIRM_DROP. 2024-03-12 19:24:31 +00:00
Sadie Powell 6fd7ca39e2 Fix the reason when kicking users from suspended channels.
Closes #372.
2024-03-12 17:00:42 +00:00
Sadie Powell b8cd00b412 Merge branch '2.0' into 2.1. 2024-03-12 16:50:30 +00:00
Sadie Powell f4bd43e898 Add a workaround for users matching expired sqlines.
I'll fix this properly in 2.1 because I don't want to make big
changes to 2.0.

Closes #384.
2024-03-12 16:47:57 +00:00
Sadie Powell 7d7664444a Fix expiring forbids. 2024-03-12 16:26:33 +00:00
Sadie Powell 1a8bbd6004 Respect --noexpire in cs_suspend and ns_suspend. 2024-03-12 14:43:12 +00:00
Sadie Powell e725c880a9 Fix expiring channel suspensions.
Closes #386.
2024-03-12 14:12:37 +00:00
Sadie Powell f5abcd1c4c Fix expiring nick suspensions.
Closes #376.
2024-03-12 14:02:16 +00:00
Sadie Powell 1986aa6581 Fix duplicate messages when synconset/syncongroup is set.
Closes #366.
2024-03-12 13:26:25 +00:00
Sadie Powell b52e1b2b02 Implement support for challenge authentication on InspIRCd. 2024-03-12 13:19:20 +00:00
Sadie Powell 54719fbfc6 Allow protocol modules to declare that they have no line/mode limit.
InspIRCd allows us to send infinite length lines and mode changes
and will restack before sending to users.
2024-03-12 12:39:33 +00:00
Sadie Powell 06add0e5fc Simplify limit extraction code. 2024-03-12 12:24:02 +00:00
Sadie Powell 63d682314b Merge branch '2.0' into 2.1. 2024-03-12 11:53:14 +00:00
Sadie Powell 1a6060ac5b Fix sending SVSTOPIC when topiclock is loaded on InspIRCd. 2024-03-12 11:46:41 +00:00
Sadie Powell a302f8f1be Refactor sending vhosts in the InspIRCd protocol module. 2024-03-12 11:43:21 +00:00
Sadie Powell 04e1a4f5c8 Add a protocol module function for extracting timestamps. 2024-03-12 11:02:08 +00:00
Sadie Powell 1538909ac0 Add ProtocolException and use it to send fatal errors. 2024-03-12 00:17:49 +00:00
Sadie Powell a15f165a1d Fix an inverted condition in enc_bcrypt. 2024-03-12 00:17:49 +00:00
Sadie Powell 77435dd0d9 Merge branch '2.0' into 2.1. 2024-03-11 22:43:29 +00:00
Sadie Powell 6f57907416 Fix the TIME message on InspIRCd. 2024-03-11 22:38:15 +00:00
Sadie Powell 7c1cfd2849 Fix comparing passwords in enc_sha256. 2024-03-11 21:07:39 +00:00
Sadie Powell 259b10b83a Fix some InspIRCd 1206 protocol compatibility issues. 2024-03-11 20:27:30 +00:00
Sadie Powell 02355546ff Reject registrations and password changes if password encryption fails. 2024-03-11 19:39:47 +00:00
Sadie Powell 6ad3430ac4 Clean up some dead code in ns_register. 2024-03-11 19:30:57 +00:00
Sadie Powell 29e7674e56 Replace convertTo/stringify with non-throwing alternatives.
Having these throw is terrible for ergonomics and there are loads
of places where the exception was either silently ignored or not
handled at all. Having a function which returns an optional and
another that returns a default works a lot better imo.
2024-03-11 19:17:29 +00:00
Bram Matthys b09632d1c3 Fix OS SQLINE expiry with UnrealIRCd 2024-03-11 18:30:55 +00:00
Sadie Powell e2df7d4d01 Ensure that verify-only encryption modules can never encrypt passwords.
If another module was loaded first and then later unloaded it was
possible for a deprecated module to encrypt passwords.
2024-03-10 20:46:03 +00:00
Sadie Powell 9a984a8148 Implement verify-only support for raw SHA-2 passwords. 2024-03-10 20:46:03 +00:00
Sadie Powell fb9c8950ed Refactor the enc_bcrypt module and expose an encryption provider. 2024-03-10 20:46:03 +00:00
Sadie Powell a849a81ac3 Refactor the enc_old module. 2024-03-10 20:28:00 +00:00
Sadie Powell f919bb0748 Add self-tests to the encryption providers. 2024-03-10 20:20:24 +00:00
Sadie Powell 3b85a8071f Add some missing documentation comments. 2024-03-10 15:58:58 +00:00
Sadie Powell 9a8cac060d Add support for encrypting passwords with the Argon2 algorithm.
Closes #369.
2024-03-10 15:09:38 +00:00
Sadie Powell 0353338436 Replace the custom SHA-2 implementation in enc_sha256. 2024-03-10 12:27:49 +00:00
Sadie Powell defb8348a7 Move the HMAC function to the encryption header.
This will be useful for doing challenge authentication on InspIRCd.
2024-03-09 22:51:23 +00:00
Sadie Powell 1b86665d81 Add a stats category for password encryption algorithms. 2024-03-09 22:22:56 +00:00
Sadie Powell 2f52fa723c Redocument the encryption module config. 2024-03-09 22:22:56 +00:00
Sadie Powell 6e0f0b8896 Add the enc_sha2 module which hashes passwords with HMAC-SHA-2.
Using HMAC instead of changing the IV is a lot safer.
2024-03-09 22:22:56 +00:00
Sadie Powell 2c5b2c649e Convert enc_md5 to use a vendored MD5 library. 2024-03-09 22:22:56 +00:00
Sadie Powell a6bc4cab9d Misc improvements to the encryption API. 2024-03-09 22:22:56 +00:00
Sadie Powell ef37daf44a Clean up the services.h includes. 2024-03-09 22:22:56 +00:00
Sadie Powell 39d288f99f Rename hash_map to unordered_map to match the underlying container. 2024-03-09 22:22:56 +00:00
Sadie Powell 9ead3f15c3 Save the last email time for accounts. 2024-03-09 22:22:55 +00:00
Sadie Powell 272104af95 Modernize the initialisation of NickAlias and NickCore. 2024-03-09 22:22:55 +00:00
Bram Matthys 51e95d72e3 Enable message-tags support for UnrealIRCd 2024-03-09 14:53:38 +00:00
Sadie Powell 12486f6cee Tweak the config default limits slightly. 2024-03-09 11:43:38 +00:00
Sadie Powell 891375baca Use a separate CAPAB handler on InspIRCd to avoid pollution. 2024-03-08 19:05:12 +00:00
Sadie Powell 41a295202e Only enable InspIRCd parser logging when using --protocoldebug. 2024-03-08 18:17:17 +00:00
Sadie Powell 722c5b7d61 Implement support for the InspIRCd 1206 protocol. 2024-03-08 17:12:44 +00:00
Sadie Powell 52216b56a1 Merge branch '2.0' into 2.1. 2024-03-08 17:05:49 +00:00
Sadie Powell cd614831de Fix feature detection on InspIRCd. 2024-03-08 16:49:55 +00:00
Sadie Powell 1d0a836a2e Improve protocol debug messages. 2024-03-08 12:24:44 +00:00
Sadie Powell 46b7064834 Keep the InspIRCd protocol version around for later use. 2024-03-08 11:07:30 +00:00
Sadie Powell bb8df01e25 Move some modules which can be built by default out of extra. 2024-03-07 23:18:08 +00:00
Sadie Powell 16700b0e30 Remove a guarantee that may not necessarily be correct. 2024-03-07 23:09:25 +00:00
Sadie Powell 4e04a11995 Consistently use email instead of e-mail. 2024-03-07 22:52:41 +00:00
Sadie Powell 76e5480be9 Update the changelogs. 2024-03-07 22:52:41 +00:00
Sadie Powell 464e6b8010 Use the C++11 random number generator instead of rand().
This is safer, faster, and doesn't require seeding.
2024-03-07 22:52:41 +00:00
Sadie Powell 3272c1bbc6 Require new accounts to have email addresses. 2024-03-07 22:25:32 +00:00
Sadie Powell 307ffea951 Update the English translation for the previous commit.
y
2024-03-07 21:19:47 +00:00
Sadie Powell bb94f286f5 Also use drop confirmation codes for nicknames. 2024-03-07 21:18:06 +00:00
Sadie Powell 86e3556438 Fix some misc bugs in the InspIRCd protocol module.
Closes #373.
2024-03-07 20:55:22 +00:00
Sadie Powell 12214bee72 Add the initial version of the Atheme database importer. 2024-03-07 18:50:36 +00:00
Sadie Powell 08a35231ef Merge branch '2.0' into 2.1. 2024-03-04 12:10:22 +00:00
Sadie Powell 9649dc78a1 When using ldap/sql auth prevent displays expiring before their group.
This prevents zombie accounts from being left around that can't be
authenticated to.

Closes #355.
2024-03-04 12:08:28 +00:00
Sadie Powell 9970b4e37b Bump for 2.1.4-git. 2024-03-04 11:09:51 +00:00
Sadie Powell a5a615d5c7 Release 2.1.3. 2024-03-04 11:09:51 +00:00
Sadie Powell ce97fdd1c6 Update the changelogs. 2024-03-04 11:09:51 +00:00
Sadie Powell 1a8ae513b4 Add NickAlias::GetVhostMask for getting the vident@vhost. 2024-03-04 11:09:50 +00:00
Sadie Powell d15ac93a8f Clean up some more CMake flags. 2024-02-29 23:50:10 +00:00
Sadie Powell 4e0f94bcce Fix some oversights from previous commits. 2024-02-29 23:18:46 +00:00
Sadie Powell 1c1645096f If a user runs an invalid command try to suggest a valid one. 2024-02-29 21:56:14 +00:00
Sadie Powell e0ac5509b4 Consolidate some header files. 2024-02-29 19:32:44 +00:00
Sadie Powell 190c37a68b Rework some platform compatibility code. 2024-02-29 19:11:37 +00:00
Sadie Powell a67bef2dee Update the changelogs. 2024-02-29 17:15:15 +00:00
Sadie Powell 893bbf9251 Fix some oversights. 2024-02-29 17:15:15 +00:00
Sadie Powell 5441093211 Merge branch '2.0' into 2.1. 2024-02-29 16:32:14 +00:00
Sadie Powell ee7455daa8 Fix a copy/paste error in webcpanel. 2024-02-29 16:27:24 +00:00
Sadie Powell 579af3c442 Rip out ns_access and related code.
This is wildly insecure and has been disabled by default for at
least a decade.
2024-02-29 16:14:15 +00:00
Sadie Powell 25bdcfcbc4 Add names for the numerics used by the core. 2024-02-29 13:07:14 +00:00
Sadie Powell 26919f41d2 If a PRIVMSG or NOTICE is empty then send a single space instead.
Currently a bunch of code does source.Reply(" ") to ensure that an
empty line gets rendered but this is a much better way to handle
this problem.

The code that does this already will be updated in a future commit
to avoid breaking translations in progress.
2024-02-29 12:31:19 +00:00
Sadie Powell 5f735b2570 Fix matching extbans on InspIRCd and implement missing matchers. 2024-02-27 20:33:43 +00:00
Sadie Powell 9c80f9e34e Replace OnChannelUnban with an IRCDProto function.
This was added for (and is only used for) for unbanning users on
UnrealIRCd which is an IRCd protocol function so it should be in
IRCDProto.
2024-02-27 13:40:47 +00:00
Sadie Powell b5b3c74477 Make functions that don't use this static. 2024-02-27 10:48:55 +00:00
Sadie Powell 73d4ac6de0 Remove redundant uses of const. 2024-02-27 10:34:27 +00:00
Sadie Powell 7640fad30c Simplify several boolean expressions. 2024-02-27 10:19:44 +00:00
Sadie Powell 9f6d378755 Fix write_pidfile on Windows.
Microsoft's documentation lies again.
2024-02-27 10:19:36 +00:00
Sadie Powell 642e68f53a Fix sending numerics on InspIRCd. 2024-02-26 23:57:55 +00:00
Sadie Powell eb658f87a3 Use fstream for accessing files where possible. 2024-02-26 23:57:55 +00:00
Sadie Powell 1e87849e5c Rework IRCDMessage/IRCDMessageFlag. 2024-02-26 23:56:07 +00:00
Sadie Powell 5fa4acb195 Refactor User::IsServicesOper. 2024-02-26 22:00:21 +00:00
Sadie Powell 79f215606d Allow using more than one fingerprint in an oper block.
Closes #362.
2024-02-26 21:55:59 +00:00
Sadie Powell 2fd4b45f81 Deduplicate InspIRCd CAPAB parsing. 2024-02-26 19:26:21 +00:00
Sadie Powell d3b4a4bd05 Update translator names. 2024-02-26 18:56:11 +00:00
Sadie Powell d914febbec Fix a typo in UnrealIRCd's SendGlobops. 2024-02-26 17:23:15 +00:00
Sadie Powell 2962a0be8c Fix bs_kick not using the correct kick message for automatic kicks.
Closes #354.
2024-02-26 16:45:28 +00:00
Sadie Powell 6be4df3b39 Remove several string format IRCDProto function overloads. 2024-02-26 16:45:28 +00:00
Sadie Powell 4789751e50 Fix a missing override keyword. 2024-02-26 16:45:28 +00:00
Sadie Powell 57674f5869 Replace IRCDProto::CanSendTags with IsTagValid.
Not every IRC server accepts arbitrary tags so this is a better
way to handle tag filtering.
2024-02-26 15:50:35 +00:00
Sadie Powell c6cb4ba159 Fix some coding style issues. 2024-02-26 15:34:17 +00:00
Sadie Powell e341cac8d6 Implement support for the IRCv3 +draft/channel-context tag.
Closes #358.
2024-02-26 15:34:17 +00:00
Sadie Powell 83dd96b9f2 Extract should privmsg logic to its own function. 2024-02-26 14:41:50 +00:00
Sadie Powell cabaa079df Kill checks for obsolete versions of Windows.
Because of the required system functionality Anope will not build
or run on these systems anyway.
2024-02-25 23:56:46 +00:00
Sadie Powell 273e7f249c Remove duplicate suffix from socketengine file names. 2024-02-25 23:54:12 +00:00
Sadie Powell 8c9ca23900 Remove a function which exists for compat with old versions of VS. 2024-02-25 23:49:07 +00:00
Sadie Powell 8e3da86283 Remove a reference to 1.8. 2024-02-25 23:42:14 +00:00
Sadie Powell 97b65b2255 Use unique_ptr for managing std::thread ownership. 2024-02-25 21:54:40 +00:00
Sadie Powell b26f198489 Fix formatting messages on ngircd. 2024-02-22 19:54:09 +00:00
Sadie Powell a99a00d7c5 Fix sending the ngircd PASS handler. 2024-02-22 19:07:11 +00:00
Sadie Powell 283137841f Refactor the InspIRCd module static variables and method. 2024-02-22 17:47:14 +00:00
Sadie Powell 3290ebd36a GetMaxListFor: use size_t and add a default like the other fields. 2024-02-22 17:25:47 +00:00
Sadie Powell c4e9c0bf85 If the IRCd sends a field limit then use it over that of the config. 2024-02-22 17:05:30 +00:00
Sadie Powell 84ad85ee85 Fix a bug in the unrealircd protocol module. 2024-02-22 15:58:23 +00:00
Sadie Powell 9789c3bd8c Deduplicate User::SendMessage. 2024-02-22 14:14:23 +00:00
Sadie Powell a75afb597b Add the IRCv3 reply tag to messages sent as responses to a user. 2024-02-22 13:23:18 +00:00
Sadie Powell f93d9e7698 Store the source message identifier in CommandSource. 2024-02-22 13:19:36 +00:00
Sadie Powell 7423fa9998 Route message tags into more message functions. 2024-02-22 13:03:53 +00:00
Sadie Powell 7cba665270 Fix some oversights in commit 82fa7e1467. 2024-02-22 11:18:05 +00:00
Sadie Powell 9502567453 Fix the NickServ help message showing a wrong min password length.
Closes #357.
2024-02-22 11:01:41 +00:00
Sadie Powell 14472c5a95 Increase minpasslen and maxpasslen slightly. 2024-02-22 10:46:30 +00:00
Sadie Powell d4f4bcf23c Remove UplinkSocket::Message now nothing uses it. 2024-02-22 00:14:08 +00:00
Sadie Powell 82fa7e1467 Convert protocol modules over to Uplink::Send. 2024-02-22 00:14:08 +00:00
Sadie Powell aefbb4fbda Rework SendModeInternal to be usable with Uplink::Send. 2024-02-22 00:14:08 +00:00
Sadie Powell 9b77fdf5b6 Rework SendNumericInternal to be usable with Uplink::Send. 2024-02-22 00:14:08 +00:00
Sadie Powell 7a6979c814 Convert most core protocol handlers to use Uplink::Send. 2024-02-22 00:14:08 +00:00
Sadie Powell c4ab550ec7 Add Uplink::Send, rework message formatting.
This is the new way of sending messages to the uplink inspired by
the work done in the old git master. This will allow us to do new
things involving tags in the future.
2024-02-22 00:14:08 +00:00
Sadie Powell 3ecf6b495b Document IRCDProto::Parse. 2024-02-22 00:14:08 +00:00
Sadie Powell 8475697e3b Inline, constify, and document GetProtocolName. 2024-02-22 00:14:08 +00:00
Sadie Powell 85687781d1 Include tags in OnMessage. 2024-02-22 00:14:08 +00:00
TehPeGaSuS ccfaca32a2 Fix a typo in cs_drop. 2024-02-21 23:09:09 +00:00
Sadie Powell 07373c8cf2 Move IRCDProto member initializers to the header. 2024-02-21 13:55:48 +00:00
Sadie Powell 89594d4557 Add a method to the ns_cert API for replacing a certificate.
This will be used for upgrading certificate fingerprints when the
InspIRCd 1206 protocol support is added.
2024-02-21 13:30:16 +00:00
Sadie Powell b478a1cb53 Make ModuleManager::SetPriority more readable. 2024-02-20 18:38:52 +00:00
Sadie Powell 1fb77e414d Increase the size of the random codes in ns_register and ns_set. 2024-02-19 22:31:07 +00:00
Sadie Powell 22fe5bb724 Require users to use a confirmation code when dropping channels. 2024-02-19 22:20:36 +00:00
Robert Scheck 909b9b2679 Remove a leftover use of the m_ module prefix. 2024-02-17 21:34:03 +00:00
Sadie Powell 49ea709027 Merge branch '2.0' into 2.1. 2024-02-17 20:50:31 +00:00
Sadie Powell 4ea2bc5e46 Mark as 2.0.16-git. 2024-02-17 20:08:10 +00:00
Sadie Powell eabc8b641e Release 2.0.15. 2024-02-17 20:07:09 +00:00
Sadie Powell 2f1ed186d1 Update the change log. 2024-02-17 20:06:08 +00:00
Sadie Powell 4cc68397dc Update the copyright headers for 2024. 2024-02-17 19:58:17 +00:00
Sadie Powell 2b7872139c Prevent resetting the password of suspended accounts.
Closes #351.
2024-02-17 19:52:39 +00:00
TehPeGaSuS e47ad6ed3f Fix some typos in the config change log. 2024-02-17 18:59:17 +00:00
Sadie Powell f3b14694c6 Bump for 2.1.3-git. 2024-02-17 18:15:38 +00:00
325 changed files with 13466 additions and 42371 deletions
+1
View File
@@ -4,3 +4,4 @@ updates:
directory: /
schedule:
interval: monthly
target-branch: "2.1"
+2 -1
View File
@@ -20,6 +20,7 @@ jobs:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
apk update
apk add \
argon2-dev \
clang \
cmake \
g++ \
@@ -36,7 +37,7 @@ jobs:
- 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
for MODULE in enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre sqlite ssl_gnutls ssl_openssl
do
ln -s $PWD/modules/extra/$MODULE.cpp $PWD/modules
done
+2 -1
View File
@@ -20,6 +20,7 @@ jobs:
g++ \
gettext \
git \
libargon2-dev \
libgnutls28-dev \
libldap2-dev \
libmysqlclient-dev \
@@ -31,7 +32,7 @@ jobs:
- 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
for MODULE in enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre sqlite ssl_gnutls ssl_openssl
do
ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules
done
+16 -5
View File
@@ -2,6 +2,9 @@ name: Windows CI
on:
pull_request:
push:
release:
types:
- published
schedule:
- cron: '0 0 * * 0'
jobs:
@@ -9,15 +12,15 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3
uses: microsoft/setup-msbuild@v2
- name: Setup Conan
uses: turtlebrowser/get-conan@v1.2
with:
version: 1.59.0
version: 1.64.0
- name: Install libraries
run: |
@@ -27,9 +30,17 @@ jobs:
run: |
mkdir ${{ github.workspace }}\build
cd ${{ github.workspace }}\build
cmake -A "x64" -G "Visual Studio 16 2019" ..
cmake -A "x64" -D "CMAKE_BUILD_TYPE=${{ github.event_name == 'release' && 'Release' || 'Debug' }}" -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
msbuild PACKAGE.vcxproj /M:3 /P:Configuration=${{ github.event_name == 'release' && 'Release' || 'Debug' }} /P:Platform=x64 /VERBOSITY:MINIMAL
- name: Upload installer
if: "${{ github.event_name == 'release' }}"
working-directory: ${{ github.workspace }}\build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} $(Get-ChildItem anope-*.exe)
+2 -5
View File
@@ -1,16 +1,13 @@
build/
config.cache
include/sysconf.h
modules/enc_argon2.cpp
modules/enc_posix.cpp
modules/ldap.cpp
modules/ldap_authentication.cpp
modules/ldap_oper.cpp
modules/mysql.cpp
modules/regex_pcre2.cpp
modules/regex_posix.cpp
modules/regex_tre.cpp
modules/sql_authentication.cpp
modules/sql_log.cpp
modules/sql_oper.cpp
modules/sqlite.cpp
modules/ssl_gnutls.cpp
modules/ssl_openssl.cpp
+23 -52
View File
@@ -31,12 +31,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs OUTPUT_VARIABLE LINES OUTPUT_STRIP_TRAILING_WHITESPACE)
# Find only the part after "libraries: "
string(REGEX REPLACE ".*\nlibraries: (.*)$" "\\1" LINE "${LINES}")
# 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)
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
else()
set(LIBRARIES "${LINE}")
endif()
# Replace the colons in the list with semicolons
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
# Iterate through the 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
@@ -106,13 +102,6 @@ if(NOT MSVC)
endif()
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(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
endif()
# Include the checking functions used later in this CMakeLists.txt
include(CheckFunctionExists)
include(CheckTypeSize)
@@ -170,7 +159,7 @@ if(MSVC)
string(REPLACE "/GX " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/W3 " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Set the compile flags to have warnings on the max setting (but disable a few annoying ones), exception handling turned on, the proper defines
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
set(CXXFLAGS "${CXXFLAGS} /W4 /wd4100 /wd4127 /wd4250 /wd4251 /wd4267 /wd4275 /wd4355 /wd4706 /wd4800 /wd4996 /EHs")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
# Otherwise, we're not using Visual Studio
else()
@@ -183,9 +172,10 @@ if(CMAKE_DL_LIBS)
list(APPEND LINK_LIBS ${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
if(MINGW)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
# Find the linker flags required for using threads.
find_package("Threads" REQUIRED)
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
endif()
if(NOT PROGRAM_NAME)
@@ -200,29 +190,6 @@ if(NOT MSVC)
if(HAVE_PIPE_FLAG)
set(CXXFLAGS "${CXXFLAGS} -pipe")
endif()
# The following are additional library checks, they are not required for Windows
if(NOT WIN32)
# Check if socket is within the socket library (if the library exists), and add it to the linker flags if needed
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
if(HAVE_SOCKET_LIB)
list(APPEND LINK_LIBS socket)
endif()
# Check if inet_addr is within the nsl library (if the library exists), and add it to the linker flags if needed
check_library_exists(nsl inet_addr "" HAVE_NSL_LIB)
if(HAVE_NSL_LIB)
list(APPEND LINK_LIBS nsl)
endif()
# Check if pthread_create is within the pthread library (if the library exists), and add it to the linker flags if needed
check_library_exists(pthread pthread_create "" HAVE_PTHREAD)
if(HAVE_PTHREAD)
if(NOT APPLE)
set(LDFLAGS "${LDFLAGS} -pthread")
endif()
else()
message(FATAL_ERROR "The pthread library is required to build Anope")
endif()
endif()
endif()
# If DEFUMASK wasn't passed to CMake, set a default depending on if RUNGROUP was passed in or not
@@ -241,6 +208,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINF
endif()
# Check for the existence of the following functions
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
check_function_exists(umask HAVE_UMASK)
check_function_exists(epoll_wait HAVE_EPOLL)
check_function_exists(poll HAVE_POLL)
@@ -272,8 +240,8 @@ endif()
if(NOT BIN_DIR)
set(BIN_DIR "bin")
endif()
if(NOT DB_DIR)
set(DB_DIR "data")
if(NOT DATA_DIR)
set(DATA_DIR "data")
endif()
if(NOT DOC_DIR)
set(DOC_DIR "doc")
@@ -281,14 +249,14 @@ endif()
if(NOT CONF_DIR)
set(CONF_DIR "conf")
endif()
if(NOT LIB_DIR)
set(LIB_DIR "lib")
if(NOT MODULE_DIR)
set(MODULE_DIR "modules")
endif()
if(NOT LOCALE_DIR)
set(LOCALE_DIR "locale")
endif()
if(NOT LOGS_DIR)
set(LOGS_DIR "logs")
if(NOT LOG_DIR)
set(LOG_DIR "logs")
endif()
# Version number processing
@@ -366,15 +334,17 @@ set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
# At install time, create the following additional directories
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/backups\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${LOGS_DIR}\")")
get_filename_component(ABSOLUTE_DATA_DIR ${DATA_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
get_filename_component(ABSOLUTE_LOG_DIR ${LOG_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ABSOLUTE_DATA_DIR}/backups\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ABSOLUTE_LOG_DIR}\")")
if(WIN32)
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${DB_DIR}/runtime\")")
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ABSOLUTE_DATA_DIR}/runtime\")")
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
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}/\${LOGS_DIR}\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${ABSOLUTE_DATA_DIR}/backups\")")
install(CODE "execute_process(COMMAND ${CHMOD} 2775 \"\$ENV{DESTDIR}${ABSOLUTE_LOG_DIR}\")")
install(CODE "execute_process(COMMAND ${CHGRP} -R ${RUNGROUP} \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}\")")
endif()
# On Windows platforms, install extra files
@@ -384,7 +354,8 @@ if(WIN32)
)
endif()
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
get_filename_component(ABSOLUTE_MODULE_DIR ${MODULE_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${ABSOLUTE_MODULE_DIR}\")")
# Only process the CPack section if we have CPack
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
+18 -43
View File
@@ -13,10 +13,6 @@
#
###########################################################################
echo2 () {
$ECHO2 "$*$ECHO2SUF" # these are defined later
}
exists () { # because some shells don't have test -e
if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
return 0
@@ -42,7 +38,6 @@ Run_Build_System () {
WITH_PERM=""
EXTRA_INCLUDE=""
EXTRA_LIBS=""
GEN_TYPE=""
if [ "$INSTDIR" != "" ] ; then
WITH_INST="-DINSTDIR:STRING=$INSTDIR"
@@ -70,45 +65,25 @@ Run_Build_System () {
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
fi
if [ "$SOURCE_DIR" = "." ] ; then
pwdsave=`pwd`
test -d build || mkdir build
cd "build"
REAL_SOURCE_DIR=".."
else
REAL_SOURCE_DIR="$SOURCE_DIR"
fi
BUILD_PATHS="-B ${SOURCE_DIR}/build ${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="cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $BUILD_PATHS"
echo $CMAKE
$CMAKE
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
echo "You should fix these issues and then run ./Config -quick to rerun CMake."
exit 1
fi
echo ""
if [ "$SOURCE_DIR" = "." ] ; then
echo "Now cd build, then run make to build Anope."
cd "$pwdsave"
else
if [ "$PWD" = "${SOURCE_DIR}/build" ]; then
echo "Now run make to build Anope."
else
echo "Now cd build, then run make to build Anope."
fi
}
ECHO2SUF=''
if [ "`echo -n a ; echo -n b`" = "ab" ] ; then
ECHO2='echo -n'
elif [ "`echo 'a\c' ; echo 'b\c'`" = "ab" ] ; then
ECHO2='echo' ; ECHO2SUF='\c'
elif [ "`printf 'a' 2>&1 ; printf 'b' 2>&1`" = "ab" ] ; then
ECHO2='printf "%s"'
else
# oh well...
ECHO2='echo'
fi
export ECHO2 ECHO2SUF
###########################################################################
# Init values
###########################################################################
@@ -121,7 +96,7 @@ EXTRA_INCLUDE_DIRS=
EXTRA_LIB_DIRS=
EXTRA_CONFIG_ARGS=
CAN_QUICK="no"
SOURCE_DIR=`dirname $0`
SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)"
###########################################################################
# Check out the options
@@ -138,7 +113,7 @@ while [ $# -ge 1 ] ; do
exit 0
elif [ $1 = "-devel" ] ; then
DEBUG="yes"
INSTDIR="$PWD/run"
INSTDIR="$SOURCE_DIR/run"
elif [ $1 = "-nocache" ] ; then
IGNORE_CACHE="1"
elif [ $1 = "-nointro" ] ; then
@@ -199,7 +174,7 @@ export ok INPUT
ok=0
echo "In what directory should Anope be installed?"
while [ $ok -eq 0 ] ; do
echo2 "[$INSTDIR] "
echo -n "[$INSTDIR] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
INPUT=$INSTDIR
@@ -209,7 +184,7 @@ while [ $ok -eq 0 ] ; do
echo "$INPUT exists, but is not a directory!"
else
echo "$INPUT does not exist. Create it?"
echo2 "[y] "
echo -n "[y] "
read YN
if [ "$YN" != "n" ] ; then
if mkdir -p $INPUT ; then
@@ -238,7 +213,7 @@ else
echo "should not force files to be owned by a particular group, just press"
echo "Return.)"
fi
echo2 "[$RUNGROUP] "
echo -n "[$RUNGROUP] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "none" ] ; then
@@ -263,7 +238,7 @@ ok=0
echo "What should the default umask for data files be (in octal)?"
echo "(077 = only accessible by owner; 007 = accessible by owner and group)"
while [ $ok -eq 0 ] ; do
echo2 "[$UMASK] "
echo -n "[$UMASK] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
INPUT=$UMASK
@@ -287,7 +262,7 @@ if [ "$DEBUG" = "yes" ] ; then
TEMP_YN="y"
fi
echo "Would you like to build a debug version of Anope?"
echo2 "[$TEMP_YN] "
echo -n "[$TEMP_YN] "
read YN
if [ "$YN" ] ; then
if [ "$YN" = "y" ] ; then
@@ -305,7 +280,7 @@ echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "Separate directories with semicolons."
echo "If you need no extra include directories, enter NONE in all caps."
echo2 "[$EXTRA_INCLUDE_DIRS] "
echo -n "[$EXTRA_INCLUDE_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -323,7 +298,7 @@ echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "Separate directories with semicolons."
echo "If you need no extra library directories, enter NONE in all caps."
echo2 "[$EXTRA_LIB_DIRS] "
echo -n "[$EXTRA_LIB_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -338,7 +313,7 @@ echo ""
echo "Are there any extra arguments you wish to pass to CMake?"
echo "If you need no extra arguments to CMake, enter NONE in all caps."
echo2 "[$EXTRA_CONFIG_ARGS] "
echo -n "[$EXTRA_CONFIG_ARGS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -355,7 +330,7 @@ echo ""
# Store values
################################################################################
echo2 "Saving configuration results in config.cache... "
echo -n "Saving configuration results in config.cache... "
cat <<EOT >$SOURCE_DIR/config.cache
INSTDIR="$INSTDIR"
+1 -1
View File
@@ -1,6 +1,6 @@
# 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)
set(DATA example.chk anope.example.conf botserv.example.conf hostserv.example.conf modules.example.conf operserv.example.conf chanserv.example.conf global.example.conf memoserv.example.conf nickserv.example.conf chanstats.example.conf irc2sql.example.conf stats.standalone.example.conf)
set(DATA cron.example.sh 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}
DESTINATION ${CONF_DIR}
)
+167 -115
View File
@@ -238,15 +238,15 @@ serverinfo
/*
* The filename containing the Anope process ID. The path is relative to the
* services root directory.
* data directory.
*/
pid = "data/anope.pid"
pid = "anope.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
* services root directory.
* config directory.
*/
motd = "conf/motd.txt"
motd = "motd.txt"
}
/*
@@ -265,26 +265,7 @@ serverinfo
* - solanum
* - unrealircd
*/
module
{
name = "inspircd"
/*
* Some protocol modules can enforce mode locks server-side. This reduces the spam caused by
* services immediately reversing mode changes for locked modes.
*
* If the protocol module you have loaded does not support this, this setting will have no effect.
*/
use_server_side_mlock = yes
/*
* Some protocol modules can enforce topic locks server-side. This reduces the spam caused by
* services immediately reversing topic changes.
*
* If the protocol module you have loaded does not support this, this setting will have no effect.
*/
use_server_side_topiclock = yes
}
module { name = "inspircd" }
/*
* [REQUIRED] Network Information
@@ -302,30 +283,31 @@ networkinfo
/*
* Set this to the maximum allowed nick length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 31.
*/
nicklen = 31
#nicklen = 31
/* Set this to the maximum allowed ident length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 10.
*/
userlen = 10
#userlen = 10
/* Set this to the maximum allowed hostname length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 64.
*/
hostlen = 64
#hostlen = 64
/* Set this to the maximum allowed channel length on your network.
* Defaults to 32.
*/
chanlen = 32
#chanlen = 32
/* The maximum number of list modes settable on a channel (such as b, e, I).
* Comment out or set to 0 to disable.
* Set to 0 to disable. Defaults to 100.
*/
modelistsize = 100
#modelistsize = 100
/*
* Characters allowed in nicknames. This always includes the characters described
@@ -394,19 +376,6 @@ options
*/
casemap = "ascii"
/*
* This key is used to initiate the random number generator. This number
* MUST be random as you want your passcodes to be random. Don't give this
* key to anyone! Keep it private!
*
* NOTE: If you don't uncomment this or keep the default values, any talented
* programmer would be able to easily "guess" random strings used to mask
* information. Be safe, and come up with a 7-digit number.
*
* This directive is optional, but highly recommended.
*/
#seed = 9866235
/*
* Sets the number of invalid password tries before services removes a user
* from the network. If a user enters a number of invalid passwords equal to
@@ -433,7 +402,7 @@ options
/*
* Sets the delay between automatic database updates.
*/
updatetimeout = 5m
updatetimeout = 2m
/*
* Sets the delay between checks for expired nicknames and channels.
@@ -445,12 +414,6 @@ options
*/
readtimeout = 5s
/*
* Sets the interval between sending warning messages for program errors via
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/*
* Sets the (maximum) frequency at which the timeout list is checked. This,
* combined with readtimeout above, determines how accurately timed events,
@@ -522,6 +485,12 @@ options
*/
hideregisteredcommands = yes
/*
* If set, the maximum difference between an invalid and valid command name to allow
* as a suggestion. Defaults to 4.
*/
didyoumeandifference = 4
/* The regex engine to use, as provided by the regex modules.
* Leave commented to disable regex matching.
*
@@ -536,7 +505,7 @@ options
*
* Removing .UTF-8 will instead use the default encoding for the language, e.g. iso-8859-1 for western European languages.
*/
languages = "ca_ES.UTF-8 de_DE.UTF-8 el_GR.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 hu_HU.UTF-8 it_IT.UTF-8 nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 ru_RU.UTF-8 tr_TR.UTF-8"
languages = "de_DE.UTF-8 el_GR.UTF-8 es_ES.UTF-8 fr_FR.UTF-8 it_IT.UTF-8 nl_NL.UTF-8 pl_PL.UTF-8 pt_PT.UTF-8 tr_TR.UTF-8"
/*
* Default language that non- and newly-registered nicks will receive messages in.
@@ -748,7 +717,6 @@ log
* You may define groups of commands and privileges, as well as who may use them.
*
* This block is recommended, as without it you will be unable to access most oper commands.
* It replaces the old ServicesRoot directive amongst others.
*
* The command names below are defaults and are configured in the *serv.conf's. If you configure
* additional commands with permissions, such as commands from third party modules, the permissions
@@ -756,21 +724,24 @@ log
*
* Available privileges:
* botserv/administration - Can view and assign private BotServ bots
* botserv/fantasy - Can use fantasy commands without the FANTASIA privilege
* botserv/fantasy - Can use fantasy commands without the FANTASY privilege
* chanserv/administration - Can modify the settings of any channel (including changing of the owner!)
* chanserv/access/list - Can view channel access and akick lists, but not modify them
* chanserv/access/modify - Can modify channel access and akick lists, and use /chanserv enforce
* chanserv/auspex - Can see any information with /CHANSERV INFO
* chanserv/no-register-limit - May register an unlimited number of channels and nicknames
* chanserv/kick - Can kick and ban users from channels through ChanServ
* chanserv/drop/override - Allows dropping channels without using a confirmation code
* memoserv/info - Can see any information with /MEMOSERV INFO
* memoserv/set-limit - Can set the limit of max stored memos on any user and channel
* memoserv/no-limit - Can send memos through limits and throttles
* nickserv/access - Can modify other users access and certificate lists
* nickserv/alist - Can see the channel access list of other users
* nickserv/auspex - Can see any information with /NICKSERV INFO
* nickserv/cert - Can modify other users certificate lists
* nickserv/confirm - Can confirm other users nicknames
* nickserv/drop - Can drop other users nicks
* nickserv/drop/display - Allows dropping display nicks when preservedisplay is enabled
* nickserv/drop/override - Allows dropping nicks without using a confirmation code
* nickserv/recover - Can recover other users nicks
* operserv/config - Can modify services's configuration
* operserv/oper/modify - Can add and remove operators with at most the same privileges
@@ -789,14 +760,14 @@ log
*
* nickserv/getemail nickserv/suspend nickserv/ajoin nickserv/list
*
* nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password
* nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message
* nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire
* nickserv/saset/keepmodes nickserv/saset/neverop
* nickserv/saset/autoop nickserv/saset/display nickserv/saset/email nickserv/saset/greet
* nickserv/saset/kill nickserv/saset/keepmodes nickserv/saset/language nickserv/saset/message
* nickserv/saset/neverop nickserv/saset/noexpire nickserv/saset/password nickserv/saset/private
* nickserv/saset/url
*
* hostserv/set hostserv/del hostserv/list
*
* global/global
* global/global global/queue global/server
*
* operserv/news operserv/stats operserv/kick operserv/exception operserv/seen
* operserv/mode operserv/session operserv/modinfo operserv/ignore operserv/chanlist
@@ -846,8 +817,6 @@ opertype
*
* This can be used to automatically oper users who identify for services operator accounts, and is
* useful for setting modes such as Plexus's user mode +N.
*
* Note that some IRCds, such as InspIRCd, do not allow directly setting +o, and this will not work.
*/
#modes = "+o"
}
@@ -925,7 +894,7 @@ opertype
/*
* [OPTIONAL] Mail Config
*
* This section contains settings related to the use of e-mail from services.
* This section contains settings related to the use of email from services.
* If the usemail directive is set to yes, unless specified otherwise, all other
* directives are required.
*
@@ -939,13 +908,13 @@ mail
* 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
* this directive (and entire block) is optional, it is required if
* nickserv:registration is set to yes.
* nickserv:registration is set to mail.
*/
usemail = yes
/*
* This is the command-line that will be used to call the mailer to send an
* e-mail. It must be called with all the parameters needed to make it
* email. It must be called with all the parameters needed to make it
* scan the mail input to find the mail recipient; consult your mailer
* documentation.
*
@@ -957,18 +926,18 @@ mail
* If you are running on Windows you should use a Windows sendmail port
* like https://www.glob.com.au/sendmail/ for sending emails.
*/
sendmailpath = "/usr/sbin/sendmail -t"
#sendmailpath = "/usr/sbin/sendmail -it"
/*
* This is the e-mail address from which all the e-mails are to be sent from.
* This is the email address from which all the emails are to be sent from.
* It should really exist.
*/
sendfrom = "services@example.com"
/*
* This controls the minimum amount of time a user must wait before sending
* another e-mail after they have sent one. It also controls the minimum time
* a user must wait before they can receive another e-mail.
* another email after they have sent one. It also controls the minimum time
* a user must wait before they can receive another email.
*
* This feature prevents users from being mail bombed using services and
* it is highly recommended that it be used.
@@ -979,10 +948,10 @@ mail
/*
* If set, Anope will not put quotes around the TO: fields
* in e-mails.
* in emails.
*
* This directive is optional, and as far as we know, it's only needed
* if you are using ESMTP or QMail to send out e-mails.
* if you are using ESMTP or QMail to send out emails.
*/
#dontquoteaddresses = yes
@@ -1099,6 +1068,22 @@ mail
#hash = "md5"
}
/*
* db_atheme
*
* This allows importing databases from Atheme. You should load another database module as
* well as this as it can only read Atheme databases not write them.
*/
#module
{
name = "db_atheme"
/*
* The database name db_atheme should use.
*/
database = "atheme.db"
}
/*
* [RECOMMENDED] db_flatfile
*
@@ -1142,11 +1127,6 @@ module
* This is only useful with very large databases, with hundreds
* of thousands of objects, that have a noticeable delay from
* writing databases.
*
* If your database is large enough cause a noticeable delay when
* saving you should consider a more powerful alternative such
* as db_sql or db_redis, which incrementally update their
* databases asynchronously in real time.
*/
fork = no
}
@@ -1219,49 +1199,121 @@ module
/*
* [RECOMMENDED] Encryption modules.
*
* The encryption modules are used when dealing with passwords. This determines how
* the passwords are stored in the databases, and does not add any security as
* far as transmitting passwords over the network goes.
*
* Without any encryption modules loaded users will not be able to authenticate unless
* there is another module loaded that provides authentication checking, such as
* ldap_authentication or sql_authentication.
*
* With enc_none, passwords will be stored in plain text, allowing for passwords
* to be recovered later but it isn't secure and therefore is not recommended.
*
* The other encryption modules use one-way encryption, so the passwords can not
* be recovered later if those are used.
*
* The first encryption module loaded is the primary encryption module. All new passwords are
* encrypted by this module. Old passwords stored in another encryption method are
* automatically re-encrypted by the primary encryption module on next identify.
*
* enc_md5, enc_sha1, and enc_old are deprecated, and are provided for users
* to upgrade to a newer encryption module. Do not use them as the primary
* encryption module. They will be removed in a future release.
* The encryption modules are used when dealing with passwords. This determines
* how the passwords are stored in the databases.
*
* The first encryption module loaded is the primary encryption module. All new
* passwords are encrypted by this module. Old passwords encrypted with another
* encryption method are automatically re-encrypted with the primary encryption
* module the next time the user identifies.
*/
#module { name = "enc_bcrypt" }
module { name = "enc_sha256" }
/*
* [DEPRECATED] Deprecated encryption modules. You can only use these for compatibility with
* old databases and will need to load one of the above modules as your primary encryption
* module.
*/
#module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_sha1" }
/*
* enc_old is Anope's previous (broken) MD5 implementation used from 1.4.x to 1.7.16.
* If your databases were made using that module, load it here to allow conversion to the primary
* encryption method.
* enc_sha2
*
* Provides support for encrypting passwords using the HMAC-SHA-2 algorithm. See
* https://en.wikipedia.org/wiki/SHA-2 and https://en.wikipedia.org/wiki/HMAC
* for more information.
*/
#module { name = "enc_old" }
module
{
name = "enc_sha2"
/** The sub-algorithm to use. Can be set to sha224 for SHA-224, sha256 for
* SHA-256, sha284 for SHA-384 or sha512 to SHA-512. Defaults to sha256.
*/
#algorithm = "sha256"
}
/*
* [EXTRA] enc_argon2
*
* Provides support for encrypting passwords using the Argon2 algorithm. See
* https://en.wikipedia.org/wiki/Argon2 for more information.
*/
#module
{
name = "enc_argon2"
/** The sub-algorithm to use. Can be set to argon2d for Argon2d, argon2i for
* Argon2i, or argon2id for Argon2id. Defaults to argon2id.
*/
#algorithm = "argon2id"
/** The memory hardness in kibibytes of the Argon2 algorithm. Defaults to
* 128 mebibytes.
*/
#memory_cost = 121072
/** The time hardness (iterations) of the Argon2 algorithm. Defaults to 3.
*/
#time_cost = 3
/** The amount of parallel threads to use when encrypting passwords.
* Defaults to 1.
*/
#parallelism = 1
/** The length in bytes of an Argon2 hash. Defaults to 32. */
#hash_length = 32
/** The length in bytes of an Argon2 salt. Defaults to 32. */
#salt_length = 32
}
/*
* enc_bcrypt
*
* Provides support for encrypting passwords using the Bcrypt algorithm. See
* https://en.wikipedia.org/wiki/Bcrypt for more information.
*/
#module
{
name = "enc_bcrypt"
/** The number of Bcrypt rounds to perform on passwords. Can be set to any
* number between 10 and 32 but higher numbers are more CPU intensive and
* may impact performance.
*/
#rounds = 10
}
/*
* [EXTRA] enc_posix
*
* Provides verify-only support for passwords encrypted using the POSIX crypt()
* function. Load this if you are migrating from another services packages such
* as Atheme. See https://en.wikipedia.org/wiki/Crypt_(C) for more information.
*
* You must load another encryption method before this to re-encrypt passwords
* with when a user logs in.
*/
#module { name = "enc_posix" }
/*
* [DEPRECATED] enc_md5, enc_none, enc_old, enc_sha1, enc_sha256
*
* Provides verify-only support for passwords encrypted using encryption methods
* from older versions of Anope. These methods are no longer considered secure
* and will be removed in a future version of Anope. Only load them if you are
* upgrading from a previous version of Anope that used them.
*
* enc_md5: Verifies passwords encrypted with the MD5 algorithm
* enc_none: Verifies passwords that are not encrypted
* enc_sha1: Verifies passwords encrypted with the SHA1 algorithm
* enc_old: Verifies passwords encrypted with the broken MD5 algorithm used
* before 1.7.17.
* enc_sha256: Verifies passwords encrypted with the SHA256 algorithm using a
* custom initialisation vector as a salt.
*
* You must load another encryption method before this to re-encrypt passwords
* with when a user logs in.
*/
#module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_old" }
#module { name = "enc_sha1" }
#module { name = "enc_sha256" }
/* Extra (optional) modules. */
include
+1 -1
View File
@@ -183,7 +183,7 @@ module
/*
* The maximum number of entries a single bad words list can have.
*/
badwordsmax = 32
badwordsmax = 50
/*
* If set, BotServ will use case sensitive checking for badwords.
+13 -16
View File
@@ -76,8 +76,6 @@ module
* access level or superior
* - cs_private: Hide the channel from ChanServ's LIST command
* - restricted: Kick/ban users who are restricted from the channel
* - cs_secure: Enable channel security, requiring the user to be identified with NickServ in
* order to be considered for being on the access list of the channel
* - secureops: Only allow operator status to be given if the user is on the access list
* - securefounder: Only allow the real founder of the channel to drop the channel, change its
* password, or change the founder or successor
@@ -93,10 +91,10 @@ module
* to be a registered nick, otherwise the channel will be dropped.
* - none: No defaults
*
* This directive is optional, if left blank, the options will default to keeptopic, peace, cs_secure,
* This directive is optional, if left blank, the options will default to keeptopic, peace,
* securefounder, and signkick. If you really want no defaults, use "none" by itself as the option.
*/
defaults = "keeptopic peace cs_secure securefounder signkick"
defaults = "keeptopic peace securefounder signkick"
/*
* The maximum number of channels which may be registered to a single nickname.
@@ -109,22 +107,21 @@ module
/*
* The length of time before a channel registration expires.
*
* This directive is optional, but recommended.
* If not set, the default is 30 days.
* This directive is optional. If not set, the default is never.
*/
expire = 30d
#expire = 90d
/*
* The maximum number of entries on a channel's access list.
* If not set, the default is 1024. This can be set to 0 for unlimited.
* If not set, the default is 1000. This can be set to 0 for unlimited.
*/
accessmax = 1024
accessmax = 1000
/*
* The length of time ChanServ stays in a channel after kicking a user from a channel they are not
* permitted to be in. This only occurs when the user is the only one in the channel.
*/
inhabit = 15s
inhabit = 1m
/*
* Allow only IRC Operators to use ChanServ.
@@ -394,7 +391,7 @@ privilege
}
/*
* FANTASIA privilege.
* FANTASY privilege.
*
* Used by botserv/main and chanserv/xop.
*
@@ -402,7 +399,7 @@ privilege
*/
privilege
{
name = "FANTASIA"
name = "FANTASY"
desc = _("Allowed to use fantasy commands")
rank = 30
level = 3
@@ -915,7 +912,7 @@ module
/*
* The maximum number of entries on a channel's autokick list.
*/
autokickmax = 32
autokickmax = 50
/*
* The default reason for an autokick if none is given.
@@ -1128,7 +1125,7 @@ module
*
* This directive is optional.
*/
max = 32
max = 50
}
command { service = "ChanServ"; name = "MODE"; command = "chanserv/mode"; group = "chanserv/management"; }
@@ -1249,7 +1246,7 @@ command { service = "ChanServ"; name = "SET NOEXPIRE"; command = "chanserv/saset
*/
module { name = "cs_set_misc" }
command { service = "ChanServ"; name = "SET URL"; command = "chanserv/set/misc"; misc_description = _("Associate a URL with the channel"); }
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; misc_description = _("Associate an E-mail address with the channel"); }
command { service = "ChanServ"; name = "SET EMAIL"; command = "chanserv/set/misc"; misc_description = _("Associate an email address with the channel"); }
/*
* cs_status
@@ -1280,7 +1277,7 @@ module
* This directive is optional.
* If not set, the default is never.
*/
expire = 90d
suspendexpire = 90d
/*
* Settings to show to non-opers in ChanServ's INFO output.
+26
View File
@@ -113,3 +113,29 @@ command { service = "Global"; name = "HELP"; command = "generic/help"; }
*/
module { name = "gl_global" }
command { service = "Global"; name = "GLOBAL"; command = "global/global"; permission = "global/global"; }
/*
* gl_queue
*
* Provides the command global/queue.
*
* Used for queuing messages to send to every online user.
*/
module
{
name = "gl_queue"
/* The maximum number of messages in a message queue. Defaults to 10. */
maxqueue = 10
}
command { service = "Global"; name = "QUEUE"; command = "global/queue"; permission = "global/queue"; }
/*
* gl_server
*
* Provides the command global/server.
*
* Used for sending a message to every online user on a server.
*/
module { name = "gl_server" }
command { service = "Global"; name = "SERVER"; command = "global/server"; permission = "global/server"; }
+2 -2
View File
@@ -83,7 +83,7 @@ module
*
* This directive is optional, but recommended.
*/
senddelay = 3s
senddelay = 30s
}
/*
@@ -146,7 +146,7 @@ module
*
* This directive is optional.
*/
max = 32
max = 50
}
command { service = "MemoServ"; name = "IGNORE"; command = "memoserv/ignore"; }
+24 -18
View File
@@ -59,7 +59,7 @@ module { name = "help" }
* SOA record information.
*/
/* E-mail address of the DNS administrator. */
/* Email address of the DNS administrator. */
admin = "admin@example.com"
/* This should be the names of the public facing nameservers serving the records. */
@@ -254,7 +254,7 @@ module { name = "help" }
}
/*
* ldap_authentication [EXTRA]
* ldap_authentication
*
* This module allows many commands such as IDENTIFY, RELEASE, RECOVER, GHOST, etc. use
* LDAP to authenticate users. Requires ldap.
@@ -314,7 +314,7 @@ module { name = "help" }
}
/*
* ldap_oper [EXTRA]
* ldap_oper
*
* This module dynamically ties users to Anope opertypes when they identify
* via LDAP group membership. Requires ldap.
@@ -372,6 +372,7 @@ module { name = "help" }
username = "anope"
password = "mypassword"
port = 3306
socket = ""
}
}
@@ -580,7 +581,8 @@ module { name = "sasl" }
name = "ssl_gnutls"
/*
* An optional certificate and key for ssl_gnutls to give to the uplink.
* An optional certificate and key for ssl_gnutls to give to the uplink. All
* paths are relative to the config directory.
*
* You can generate your own certificate and key pair by using:
*
@@ -588,8 +590,8 @@ module { name = "sasl" }
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
*
*/
cert = "data/fullchain.pem"
key = "data/privkey.pem"
cert = "fullchain.pem"
key = "privkey.pem"
/*
* Diffie-Hellman parameters to use when acting as a server. This is only
@@ -602,7 +604,7 @@ module { name = "sasl" }
* certtool --generate-dh-params --bits 2048 --outfile dhparams.pem
*
*/
# dhparams = "data/dhparams.pem"
#dhparams = "dhparams.pem"
}
/*
@@ -620,14 +622,15 @@ module { name = "sasl" }
/*
* An optional certificate and key for ssl_openssl to give to the uplink.
* All paths are relative to the config directory.
*
* You can generate your own certificate and key pair by using:
*
* openssl genrsa -out privkey.pem 2048
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
*/
cert = "data/fullchain.pem"
key = "data/privkey.pem"
cert = "fullchain.pem"
key = "privkey.pem"
/*
* If you wish to increase security you can disable support for older
@@ -640,7 +643,7 @@ module { name = "sasl" }
}
/*
* sql_authentication [EXTRA]
* sql_authentication
*
* This module allows authenticating users against an external SQL database using a custom
* query.
@@ -691,7 +694,7 @@ module { name = "sasl" }
}
/*
* sql_log [EXTRA]
* sql_log
*
* This module adds an additional target option to log{} blocks
* that allows logging Service's logs to SQL. To log to SQL, add
@@ -711,7 +714,7 @@ module { name = "sasl" }
#module { name = "sql_log" }
/*
* sql_oper [EXTRA]
* sql_oper
*
* This module allows granting users services operator privileges and possibly IRC Operator
* privileges based on an external SQL database using a custom query.
@@ -752,7 +755,7 @@ module { name = "sasl" }
name = "sqlite/main"
/* The database name, it will be created if it does not exist. */
database = "anope.db"
database = "anope.sqlite"
}
}
@@ -770,20 +773,23 @@ module { name = "sasl" }
name = "webcpanel"
/* Web server to use. */
server = "httpd/main";
server = "httpd/main"
/* Template to use. */
template = "default";
/*
* The directory containing the webcpanel templates. This is relative to the
* data directory.
*/
template_dir = "webcpanel/templates/default"
/* Page title. */
title = "Anope IRC Services";
title = "Anope IRC Services"
}
/*
* xmlrpc
*
* Allows remote applications (websites) to execute queries in real time to retrieve data from Anope.
* By itself this module does nothing, but allows other modules (m_xmlrpc_main) to receive and send XMLRPC queries.
* By itself this module does nothing, but allows other modules (xmlrpc_main) to receive and send XMLRPC queries.
*/
#module
{
+39 -64
View File
@@ -66,9 +66,9 @@ module
client = "NickServ"
/*
* Force users to give an e-mail address when they register a nick.
* Requires users to give an email address when they register a nick.
*
* This directive defaults to "yes" and is recommended to be enabled. This is required if e-mail registration is enabled.
* This directive defaults to "yes" and is recommended to be enabled.
*/
forceemail = yes
@@ -96,10 +96,8 @@ module
* option and the killprotect option must be specified with this one
* - kill_immed: Kill nick immediately if not identified, this one overrides both the killprotect
* and kill_quick options and the killprotect option must be specified with this one
* - ns_secure: Enable nickname security, requiring the nick's password before any operations
* can be done on it
* - ns_private: Hide the nick from NickServ's LIST command
* - hide_email: Hide the nick's e-mail address from NickServ's INFO command
* - hide_email: Hide the nick's email address from NickServ's INFO command
* - hide_mask: Hide the nick's last or current user@host from NickServ's INFO command
* - hide_status: Hide the nick's services operator access status from NickServ's INFO command
* - hide_quit: Hide the nick's last quit message from NickServ's INFO command
@@ -112,23 +110,23 @@ module
* to be enabled as well
* - 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 memo_signon, and
* memo_receive. If you really want no defaults, use "none" by itself as the option.
*/
defaults = "killprotect ns_secure ns_private hide_email hide_mask memo_signon memo_receive autoop"
defaults = "killprotect ns_private hide_email hide_mask memo_signon memo_receive autoop"
/*
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
* directive is optional, but recommended. If not set, this restriction will be disabled.
*/
regdelay = 30s
regdelay = 5m
/*
* The length of time before a nick's registration expires.
*
* This directive is optional, but recommended. If not set, the default is 90 days.
* This directive is optional, but recommended. If not set, the default is one year.
*/
expire = 90d
expire = 1y
/*
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND
@@ -211,16 +209,22 @@ module
/*
* The minimum length of passwords
*
* This directive is optional. If not set it defaults to 8.
* This directive is optional. If not set it defaults to 10.
*/
minpasslen = 8
minpasslen = 10
/*
* The maximum length of passwords
*
* This directive is optional. If not set it defaults to 32.
* This directive is optional. If not set it defaults to 50.
*/
maxpasslen = 32
maxpasslen = 50
/*
* Whether all of the secondary nicks of a nick group have to expire or be
dropped before the display nick can expire or be dropped.
*/
preservedisplay = no
}
/*
@@ -248,33 +252,6 @@ command_group
/* Give it a help command. */
command { service = "NickServ"; name = "HELP"; command = "generic/help"; }
/*
* ns_access
*
* Provides the command nickserv/access.
*
* Used for configuring what hosts have access to your account.
*/
module
{
name = "ns_access"
/*
* The maximum number of entries allowed on a nickname's access list.
* If not set, the default is 32. This number cannot be set to 0.
*/
accessmax = 32
/*
* If set, Anope will add the usermask of registering users to the access list of their
* newly created account. If not set, users will always have to identify to NickServ before
* being recognized, unless they manually add an address to the access list of their account.
* This directive is optional.
*/
addaccessonreg = no
}
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/access"; }
/*
* ns_ajoin
*
@@ -302,6 +279,7 @@ command { service = "NickServ"; name = "AJOIN"; command = "nickserv/ajoin"; }
*/
module { name = "ns_alist" }
command { service = "NickServ"; name = "ALIST"; command = "nickserv/alist"; }
command { service = "NickServ"; name = "ACCESS"; command = "nickserv/alist"; hide = true; }
/*
* ns_cert
@@ -314,6 +292,12 @@ module
{
name = "ns_cert"
/*
* Should users who are connected with a SSL client certificate have its fingerprint be added to
* their account when they register. Defaults to yes.
*/
automatic = yes
/*
* The maximum number of entries allowed on a nickname's certificate fingerprint list.
* The default is 5. This number cannot be set to 0.
@@ -358,7 +342,7 @@ module
*
* This directive is optional, but recommended. If not set or set to 0, no limits will be applied.
*/
maxaliases = 16
maxaliases = 10
/*
* If set, the NickServ GROUP command won't allow any group changes. This is recommended to
@@ -496,7 +480,7 @@ module
*
* This directive is optional.
*/
#nickregdelay = 30s
nickregdelay = 15s
/*
* The length of time a user using an unconfirmed account has
@@ -528,12 +512,10 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas
* nickserv/set/email, nickserv/saset/email - Used for setting a users email address.
* nickserv/set/keepmodes, nickserv/saset/keepmodes - Configure whether or not services should retain a user's modes across sessions.
* nickserv/set/kill, nickserv/saset/kill - Used for configuring nickname protection.
* nickserv/set/language, nickserv/saset/language - Used for configuring what language services use.
* nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you.
* nickserv/set/password, nickserv/saset/password - Used for changing a users password.
* nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access.
* nickserv/set/neverop, nickserv/saset/neverop - Used to configure whether a user can be added to access lists
* nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring.
* nickserv/set/password, nickserv/saset/password - Used for changing a users password.
*/
module
{
@@ -565,23 +547,27 @@ command { service = "NickServ"; name = "SASET KEEPMODES"; command = "nickserv/sa
command { service = "NickServ"; name = "SET KILL"; command = "nickserv/set/kill"; }
command { service = "NickServ"; name = "SASET KILL"; command = "nickserv/saset/kill"; permission = "nickserv/saset/kill"; }
command { service = "NickServ"; name = "SET LANGUAGE"; command = "nickserv/set/language"; }
command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; }
command { service = "NickServ"; name = "SET MESSAGE"; command = "nickserv/set/message"; }
command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/saset/message"; permission = "nickserv/saset/message"; }
command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; }
command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; permission = "nickserv/saset/password"; }
command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; }
command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; }
command { service = "NickServ"; name = "SET NEVEROP"; command = "nickserv/set/neverop"; }
command { service = "NickServ"; name = "SASET NEVEROP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; }
command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; }
/*
* ns_set_language
*
* Provides the command nickserv/set/language and nickserv/saset/language.
*
* Allows configuring the language that services uses.
*/
module { name = "ns_set_language" }
command { service = "NickServ"; name = "SET LANGUAGE"; command = "nickserv/set/language"; }
command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/saset/language"; permission = "nickserv/saset/language"; }
/*
* ns_set_misc
@@ -601,17 +587,6 @@ command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/mi
#command { service = "NickServ"; name = "SET MASTODON"; command = "nickserv/set/misc"; misc_description = _("Associate a Mastodon account with your account"); }
#command { service = "NickServ"; name = "SASET MASTODON"; command = "nickserv/saset/misc"; misc_description = _("Associate a Mastodon account with this account"); permission = "nickserv/saset/mastodon"; group = "nickserv/admin"; }
/*
* ns_status
*
* Provides the nickserv/status command.
*
* Used to determine if a user is recognized or identified by services.
*/
module { name = "ns_status" }
command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; }
/*
* ns_suspend
*
@@ -666,7 +641,7 @@ command { service = "NickServ"; name = "UPDATE"; command = "nickserv/update"; }
name = "ns_maxemail"
/*
* The limit to how many registered nicks can use the same e-mail address. If set to 0 or left
* The limit to how many registered nicks can use the same email address. If set to 0 or left
* commented, there will be no limit enforced when registering new accounts or using
* /msg NickServ SET EMAIL.
*/
+1 -1
View File
@@ -503,7 +503,7 @@ command { service = "OperServ"; name = "RANDOMNEWS"; command = "operserv/randomn
*
* Used to NOOP a server, which prevents users from opering on that server.
*/
module { name = "os_noop" }
#module { name = "os_noop" }
command { service = "OperServ"; name = "NOOP"; command = "operserv/noop"; permission = "operserv/noop"; }
/*
+12 -17
View File
@@ -235,15 +235,15 @@ serverinfo
/*
* The filename containing the Anope process ID. The path is relative to the
* services root directory.
* data directory.
*/
pid = "data/anope.pid"
pid = "anope.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
* services root directory.
* config directory.
*/
motd = "conf/motd.txt"
motd = "motd.txt"
}
/*
@@ -283,25 +283,26 @@ networkinfo
/*
* Set this to the maximum allowed nick length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 31.
*/
nicklen = 31
#nicklen = 31
/* Set this to the maximum allowed ident length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 10.
*/
userlen = 10
#userlen = 10
/* Set this to the maximum allowed hostname length on your network.
* Be sure to set this correctly, as setting this wrong can result in
* Anope being disconnected from the network.
* Anope being disconnected from the network. Defaults to 64.
*/
hostlen = 64
#hostlen = 64
/* Set this to the maximum allowed channel length on your network.
* Defaults to 64.
*/
chanlen = 32
#chanlen = 32
/* The maximum number of list modes settable on a channel (such as b, e, I).
* Comment out or set to 0 to disable.
@@ -370,12 +371,6 @@ options
*/
readtimeout = 5s
/*
* Sets the interval between sending warning messages for program errors via
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/*
* If set, Anope will only show /stats o to IRC Operators. This directive
* is optional.
+115 -1
View File
@@ -1,7 +1,121 @@
Anope Version 2.1.9
-------------------
Bumped the minimum supported version of UnrealIRCd to 6.
Fixed granting IRC operator status to services operators.
Fixed making users an IRC operator on InspIRCd.
Fixed nonicknameownership on InspIRCd v4.
Fixed some messages not being translatable.
Fixed the Argon2 module not having test vectors.
Increased the default nickname expiry period to one year.
Anope Version 2.1.8
-------------------
Added account identifiers to the nickserv/info output.
Added support for bool, float, and uint SQL columns.
Added the ability to automatically determine SQL column types based on the native type.
Added UNIX socket support to mysql module.
Changed smartjoin to use SendClearBans where available.
Dropped support for MinGW in favour of native builds.
Fixed parsing named extbans on InspIRCd.
Fixed parsing SVSMODE and SVS2MODE from UnrealIRCd.
Fixed sending global messages to remotely linked servers.
Removed the services server name from the CTCP version response.
Anope Version 2.1.7
-------------------
Added importing of akick reasons, forbid reasons, opers and session exceptions to db_atheme.
Added support for sending tag messages.
Added the ability to look up account information of an authenticated user.
Fixed a crash in ns_cert when an IRC user is not present during a nick registration.
Fixed a null pointer dereference in the global module.
Fixed a rare memory leak in os_akill and os_sxline.
Improved the performance of some code that looks up the primary nick from an account.
Removed the broken Catalan, Hungarian, and Russian translations.
Reworked the protocol interface for sending messages.
Updated the Turkish translation.
Anope Version 2.1.6
-------------------
Added opportunistic upgrading of TLS fingerprints to more secure algorithms on InspIRCd.
Added support for logging out partially connected users on Plexus.
Added the account registration time to nickserv/info.
Changed ns_cert to automatically add a TLS fingerprint to new accounts if available.
Clarified that a non-deprecated encryption module must be loaded.
Fixed creating the runtime directory on Windows.
Fixed mistakenly allowing badpasslimit to be set to a negative value.
Fixed parsing backup TLS fingerprints on InspIRCd.
Fixed parsing the flood mode on UnrealIRCd.
Fixed parsing the history mode on UnrealIRCd.
Fixed various iterator invalidation issues.
Partially rewrote the Portuguese translation.
Removed some incorrect strings from the Turkish translation.
Renamed the --modulesdir option to --moduledir to match the name of other path options.
Anope Version 2.1.5
-------------------
Added an example systemd unit file.
Added support for BIGLINES on UnrealIRCd.
Bumped the minimum supported version of Bahamut to 2.0.
Fixed truncating messages in global/global and global/server.
Improved building Anope for use as a system package.
Updated the Turkish translation.
Anope Version 2.1.4
-------------------
Added a check for a non-deprecated encryption module on start.
Added a way for protocol modules to report an error to the uplink.
Added more account settings to the webcpanel.
Added self-test functionality for all encryption modules.
Added support for challenge authentication on InspIRCd.
Added support for importing databases from Atheme.
Added support for sending client tags on UnrealIRCd.
Added support for the InspIRCd 1206 (v4) protocol.
Added the --nopid option to disable writing a pid file.
Added the enc_argon2 module to encrypt passwords with Argon2.
Added the enc_sha2 module to encrypt passwords with HMAC-SHA-2.
Added the global/queue command for queueing multi-line messages.
Added the global/server command for sending messages to an individual server.
Added the PASSWORD category to operserv/stats to view password encryption methods.
Added the verify-only enc_posix module to validate passwords from Atheme that were encrypted with Argon2.
Changed nickserv/drop to use confirmation codes to confirm a nickname drop.
Changed various paths to be relative to the data and config directories.
Converted some IRCDProto member functions to variables.
Converted the enc_md5, enc_none, enc_old, enc_sha1, and enc_sha256 modules to be verify-only.
Deduplicated page headers and footers in the webcpanel templates.
Deprecated the enc_sha256 module.
Fixed inconsistent spelling/casing of email, vhost, and vident.
Fixed various bugs in the inspircd module.
Improved portability of email sending.
Improved protocol debug messages.
Improved the performance and reliability of internal conversion logic.
Improved the randomness of randomly generated numbers.
Refactored the enc_bcrypt module and exposed it as an encryption context.
Removed several duplicate translation strings.
Replaced the custom MD5 implementation in enc_md5 with a vendored one.
Replaced the custom SHA256 implementation in enc_sha256 with a vendored one.
The ldap_authentication, ldap_oper, sql_authentication, sql_log, and sql_oper modules are now always enabled.
Anope Version 2.1.3
-------------------
Added alternate command suggestions when a user runs an invalid command.
Added support for the IRCv3 +draft/channel-context tag.
Added support for the IRCv3 +draft/reply tag.
Allow using more than one fingerprint in an oper block.
Changed chanserv/drop to use confirmation codes to confirm a channel drop.
Cleaned up more of the codebase to use Modern C++17.
Enabled using more field limits sent by the IRC server instead of requiring the user to configure them.
Fixed NickServ lying about the minimum password length.
Fixed a crash when sending emails.
Fixed bs_kick not using the correct kick message for automatic kicks.
Increased the security of randomly generated confirmation codes.
Removed the ns_access module and associated cs_secure and ns_secure options.
Removed the ns_status module.
Reworked how messages are sent in protocol modules to allow sending message tags.
Anope Version 2.1.2
-------------------
Bumped the minimum OpenSSL version to 1.1.0.
Bumped the minumum GnuTLS version to 3.0.0.
Bumped the minimum GnuTLS version to 3.0.0.
Disabled SSLv3 support in the m_ssl_openssl module.
Modernized mutex and thread code to use Modern C++.
Normalised the program exit codes.
+70 -4
View File
@@ -1,9 +1,75 @@
Anope Version 2.1.9
-------------------
No significant changes.
Anope Version 2.1.8
-------------------
Added module:preservedisplay to the nickserv module.
Added the nickserv/drop/display oper privilege.
Anope Version 2.1.7
-------------------
Moved nickserv/set/language and nickserv/saset/language to the ns_set_language module.
Renamed module:expire for the cs_suspend module to suspendexpire.
Renamed the FANTASIA privilege to FANTASY.
Anope Version 2.1.6
-------------------
Added module:automatic to the ns_cert module (defaults to yes).
Removed module:use_server_side_mlock for the protocol modules (now always enabled).
Removed module:use_server_side_topiclock for the protocol modules (now always enabled).
Anope Version 2.1.5
-------------------
Added the nickserv/drop/override and chanserv/drop/override oper privileges.
Anope Version 2.1.4
-------------------
Added the db_atheme module.
Added the enc_argon2 module.
Added the enc_posix module.
Added the enc_sha2 module.
Added the gl_queue module.
Added the gl_server module.
Added the global/queue operator privilege.
Added the global/server operator privilege.
Changed serverinfo:motd to be relative to the config directory.
Changed serverinfo:pid to be relative to the data directory.
Changed the default value of mail:sendmailpath to "/usr/sbin/sendmail -it".
Changed the default value of module:accessmax for the chanserv module to 1000.
Changed the default value of module:inhabit for the chanserv module to 1 minute.
Changed the default value of module:max for the cs_mode module to 50.
Changed the default value of module:max for the ms_ignore module to 50.
Removed options:seed.
Replaced module:template for the webcpanel module with module:template_dir.
Anope Version 2.1.3
-------------------
Added options:didyoumeandifference.
Added support for multiple SSL fingerprints in oper:certfp.
Added the chanserv/cert oper privilege for modifying other user's certificate lists.
Changed networkinfo:chanlen to default to 32 if not set.
Changed networkinfo:hostlen to default to 64 if not set.
Changed networkinfo:modelistsize to default to 100 if not set.
Changed networkinfo:nicklen to default to 31 if not set.
Changed networkinfo:userlen to default to 10 if not set.
Increased the default maximum password length to 50 characters.
Increased the default minimum password length to 10 characters.
Removed the cs_secure option in module:defaults from the chanserv module (now always enabled).
Removed the nickserv/saset/secure command.
Removed the nickserv/saset/secure oper privilege.
Removed the nickserv/set/secure command.
Removed the nickserv/status command.
Removed the ns_access module.
Removed the ns_secure option in module:defaults from the nickserv module (now always enabled).
Anope Version 2.1.2
-------------------
Added module:tlsv10 to 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.
Added module:tlsv10 to the ssl_openssl module for configuring whether TLSv1.0 is usable (defaults to no).
Added module:tlsv11 to the ssl_openssl module for configuring whether TLSv1.1 is usable (defaults to yes).
Added module:tlsv12 to the ssl_openssl module for configuring whether TLSv1.2 is usable (defaults to yes).
Removed module:sslv3 from the ssl_openssl module (now always disabled).
Removed the m_ prefix from the names of the chanstats, dns, dnsbl, helpchan, httpd, ldap, ldap_oper, mysql, proxyscan, redis, regex_pcre2, regex_posix, regex_stdlib, regex_tre, rewrite, sasl, sql_log, sql_oper, sqlite, ssl_gnutls, ssl_openssl, xmlrpc, and xmlrpc_main modules.
Anope Version 2.1.1
+3 -1
View File
@@ -19,6 +19,8 @@ Anope Multi Language Support
Then execute:
dpkg-reconfigure locales
If you have already built Anope you will need to delete the build directory and rebuild from scratch.
Building Anope on Windows with gettext support is explained in docs/WIN32.txt
2) Adding a new language
@@ -33,7 +35,7 @@ Anope Multi Language Support
po files (especially on Windows).
If you have finished a language file translation and you want others to use it, please send it to team@anope.org
(don't forget to mention clearly your (nick)name, your e-mail and the language name). You'll of course get full credit for it.
(don't forget to mention clearly your (nick)name, your email and the language name). You'll of course get full credit for it.
NOTE: There is no guarantee we will use your work so please do not be offended if we say no thanks.
+2 -2
View File
@@ -166,14 +166,14 @@ Table of Contents
Anope currently works with:
* Bahamut 1.4.27 or later (including 1.8)
* Bahamut 2.0 or later
* ircd-hybrid 8.2.23 or later
* InspIRCd 3 or later
* ngIRCd 19.2 or later
* Plexus 3 or later
* Ratbox 2.0.6 or later
* Solanum (all versions)
* UnrealIRCd 4 or later
* UnrealIRCd 6 or later
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.
+2 -2
View File
@@ -98,7 +98,7 @@ public:
NickCore *GetAccount() const;
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
static const unsigned int MAX_DEPTH = 4;
@@ -107,7 +107,7 @@ public:
* @param nc The account
* @param next Next channel to check if any
*/
virtual bool Matches(const User *u, const NickCore *nc, ChannelInfo* &next) const;
virtual bool Matches(const User *u, const NickCore *nc, ChannelInfo *&next) const;
/** Check if this access entry has the given privilege.
* @param name The privilege name
+30 -75
View File
@@ -17,8 +17,8 @@
#include "memo.h"
#include "base.h"
typedef Anope::hash_map<NickAlias *> nickalias_map;
typedef Anope::hash_map<NickCore *> nickcore_map;
typedef Anope::unordered_map<NickAlias *> nickalias_map;
typedef Anope::unordered_map<NickCore *> nickcore_map;
typedef std::unordered_map<uint64_t, NickCore *> nickcoreid_map;
extern CoreExport Serialize::Checker<nickalias_map> NickAliasList;
@@ -33,7 +33,7 @@ class CoreExport NickAlias final
, public Extensible
{
Anope::string vhost_ident, vhost_host, vhost_creator;
time_t vhost_created;
time_t vhost_created = 0;
public:
Anope::string nick;
@@ -43,8 +43,9 @@ public:
Anope::string last_usermask;
/* Last uncloaked usermask, requires nickserv/auspex to see */
Anope::string last_realhost;
time_t time_registered;
time_t last_seen;
time_t time_registered = Anope::CurTime;
time_t last_seen = Anope::CurTime;
/* Account this nick is tied to. Multiple nicks can be tied to a single account. */
Serialize::Reference<NickCore> nc;
@@ -56,7 +57,7 @@ public:
~NickAlias();
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
/** Set a vhost for the user
* @param ident The ident
@@ -64,36 +65,41 @@ public:
* @param creator Who created the vhost
* @param time When the vhost was created
*/
void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
void SetVHost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime);
/** Remove a users vhost
**/
void RemoveVhost();
void RemoveVHost();
/** Check if the user has a vhost
* @return true or false
*/
bool HasVhost() const;
bool HasVHost() const;
/** Retrieve the vhost ident
* @return the ident
*/
const Anope::string &GetVhostIdent() const;
const Anope::string &GetVHostIdent() const;
/** Retrieve the vhost host
* @return the host
*/
const Anope::string &GetVhostHost() const;
const Anope::string &GetVHostHost() const;
/** Retrieve the vhost mask
* @param the mask
*/
Anope::string GetVHostMask() const;
/** Retrieve the vhost creator
* @return the creator
*/
const Anope::string &GetVhostCreator() const;
const Anope::string &GetVHostCreator() const;
/** Retrieve when the vhost was created
* @return the time it was created
*/
time_t GetVhostCreated() const;
time_t GetVHostCreated() const;
/** Finds a registered nick
* @param nick The nick to lookup
@@ -122,9 +128,10 @@ public:
Anope::string email;
/* Locale name of the language of the user. Empty means default language */
Anope::string language;
/* Access list, contains user@host masks of users who get certain privileges based
* on if NI_SECURE is set and what (if any) kill protection is enabled. */
std::vector<Anope::string> access;
/* Last time an email was sent to this user */
time_t lastmail = 0;
/* The time this account was registered */
time_t time_registered = Anope::CurTime;
MemoInfo memos;
std::map<Anope::string, Anope::string> last_modes;
@@ -134,14 +141,14 @@ public:
Serialize::Checker<std::vector<NickAlias *> > aliases;
/* Set if this user is a services operator. o->ot must exist. */
Oper *o;
Oper *o = nullptr;
/* Unsaved data */
/** The display nick for this account. */
NickAlias *na = nullptr;
/* Number of channels registered by this account */
uint16_t channelcount;
/* Last time an email was sent to this user */
time_t lastmail;
uint16_t channelcount = 0;
/* Users online now logged into this account */
std::list<User *> users;
@@ -153,78 +160,26 @@ public:
~NickCore();
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
/** Changes the display for this account
* @param na The new display, must be grouped to this account.
*/
void SetDisplay(const NickAlias *na);
void SetDisplay(NickAlias *na);
/** Checks whether this account is a services oper or not.
* @return True if this account is a services oper, false otherwise.
*/
virtual bool IsServicesOper() const;
/** Add an entry to the nick's access list
*
* @param entry The nick!ident@host entry to add to the access list
*
* Adds a new entry into the access list.
*/
void AddAccess(const Anope::string &entry);
/** Get an entry from the nick's access list by index
*
* @param entry Index in the access list vector to retrieve
* @return The access list entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
*
* Retrieves an entry from the access list corresponding to the given index.
*/
Anope::string GetAccess(unsigned entry) const;
/** Get the number of entries on the access list for this account.
*/
unsigned GetAccessCount() const;
/** Retrieves the account id for this user */
uint64_t GetId();
/** Find an entry in the nick's access list
*
* @param entry The nick!ident@host entry to search for
* @return True if the entry is found in the access list, false otherwise
*
* Search for an entry within the access list.
*/
bool FindAccess(const Anope::string &entry);
/** Erase an entry from the nick's access list
*
* @param entry The nick!ident@host entry to remove
*
* Removes the specified access list entry from the access list.
*/
void EraseAccess(const Anope::string &entry);
/** Clears the entire nick's access list
*
* Deletes all the memory allocated in the access list vector and then clears the vector.
*/
void ClearAccess();
/** Is the given user on this accounts access list?
*
* @param u The user
*
* @return true if the user is on the access list
*/
bool IsOnAccess(const User *u) const;
/** Finds an account
* @param nick The account name to find
* @return The account, if it exists
*/
static NickCore* Find(const Anope::string &nick);
static NickCore *Find(const Anope::string &nick);
void AddChannelReference(ChannelInfo *ci);
void RemoveChannelReference(ChannelInfo *ci);
+80 -85
View File
@@ -39,6 +39,7 @@ namespace Anope
typedef std::string::reverse_iterator reverse_iterator;
typedef std::string::const_reverse_iterator const_reverse_iterator;
typedef std::string::size_type size_type;
typedef std::string::value_type value_type;
static const size_type npos = static_cast<size_type>(-1);
/**
@@ -140,8 +141,8 @@ namespace Anope
*/
inline void push_back(char c) { return this->_string.push_back(c); }
inline string& append(const string &s) { this->_string.append(s.str()); return *this; }
inline string& append(const char *s, size_t n) { this->_string.append(s, n); return *this; }
inline string &append(const string &s) { this->_string.append(s.str()); return *this; }
inline string &append(const char *s, size_t n) { this->_string.append(s, n); return *this; }
/**
* Resizes the string content to n characters.
@@ -159,21 +160,21 @@ namespace Anope
* Trim leading and trailing white spaces from the string.
*/
inline string& ltrim(const Anope::string &what = " \t\r\n")
inline string &ltrim(const Anope::string &what = " \t\r\n")
{
while (!this->_string.empty() && what.find(this->_string[0]) != Anope::string::npos)
this->_string.erase(this->_string.begin());
return *this;
}
inline string& rtrim(const Anope::string &what = " \t\r\n")
inline string &rtrim(const Anope::string &what = " \t\r\n")
{
while (!this->_string.empty() && what.find(this->_string[this->_string.length() - 1]) != Anope::string::npos)
this->_string.erase(this->_string.length() - 1);
return *this;
}
inline string& trim(const Anope::string &what = " \t\r\n")
inline string &trim(const Anope::string &what = " \t\r\n")
{
this->ltrim(what);
this->rtrim(what);
@@ -210,9 +211,9 @@ namespace Anope
inline size_type find_last_not_of(const string &_str, size_type pos = npos) const { return this->_string.find_last_not_of(_str._string, pos); }
inline size_type find_last_not_of_ci(const string &_str, size_type pos = npos) const { return ci::string(this->_string.c_str()).find_last_not_of(ci::string(_str._string.c_str()), pos); }
inline int compare(size_t pos, size_t len, const string& str) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str())); }
inline int compare(size_t pos, size_t len, const string& str, size_t subpos, size_type sublen = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, ci::string(str.c_str()), subpos, sublen); }
inline int compare(size_t pos, size_t len, const char* s, size_type n = npos) const { return ci::string(this->_string.c_str()).compare(pos, len, s, n); }
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.
@@ -343,7 +344,7 @@ namespace Anope
using multimap = std::multimap<string, T, ci::less>;
template<typename T>
using hash_map = std::unordered_map<string, T, hash_ci, compare>;
using unordered_map = std::unordered_map<string, T, hash_ci, compare>;
#ifndef REPRODUCIBLE_BUILD
static const char *const compiled = __TIME__ " " __DATE__;
@@ -366,6 +367,7 @@ namespace Anope
* Use this unless you need very specific time checks
*/
extern CoreExport time_t CurTime;
extern CoreExport long long CurTimeNs;
/** The debug level we are running at.
*/
@@ -373,7 +375,7 @@ namespace Anope
/** Other command line options.
*/
extern CoreExport bool ReadOnly, NoFork, NoThird, NoExpire, ProtocolDebug;
extern CoreExport bool ReadOnly, NoFork, NoThird, NoPID, NoExpire, ProtocolDebug;
/** The root of the Anope installation. Usually ~/anope
*/
@@ -469,7 +471,7 @@ namespace Anope
* @param src The source string to encrypt
* @param dest The destination where the encrypted string is placed
*/
extern CoreExport void Encrypt(const Anope::string &src, Anope::string &dest);
extern CoreExport bool Encrypt(const Anope::string &src, Anope::string &dest);
/** Hashes a buffer with SipHash-2-4
* @param src The start of the buffer to hash
@@ -495,7 +497,7 @@ namespace Anope
/** Return the last error, uses errno/GetLastError() to determine this
* @return An error message
*/
extern CoreExport const string LastError();
extern CoreExport string LastError();
/** Determines if a path is a file
*/
@@ -534,10 +536,18 @@ namespace Anope
*/
extern CoreExport Anope::string NormalizeBuffer(const Anope::string &);
/** Main processing routine. Parses the message and takes the appropriate action.
* @param Raw message from the uplink
/** Parses a raw message from the uplink and calls its command handler.
* @param message Raw message from the uplink
*/
extern void Process(const Anope::string &);
extern void Process(const Anope::string &message);
/** Calls the command handler for an already parsed message.
* @param source Source of the message.
* @param command Command name.
* @param params Any extra parameters.
* @param tags IRCv3 message tags.
*/
extern CoreExport void ProcessInternal(MessageSource &src, const Anope::string &command, const std::vector<Anope::string> &params, const Anope::map<Anope::string> & tags);
/** Does a blocking dns query and returns the first IP.
* @param host host to look up
@@ -557,6 +567,54 @@ namespace Anope
* @param len The length of the string returned
*/
extern CoreExport Anope::string Random(size_t len);
/** Generate a random number. */
extern CoreExport int RandomNumber();
/** Calculates the levenshtein distance between two strings.
* @param s1 The first string.
* @param s2 The second string.
*/
extern CoreExport size_t Distance(const Anope::string &s1, const Anope::string &s2);
/** Update the current time. */
extern CoreExport void UpdateTime();
/** Expands a path fragment that is relative to the base directory.
* @param base The base directory that it is relative to.
* @param fragment The fragment to expand.
*/
extern CoreExport Anope::string Expand(const Anope::string &base, const Anope::string &fragment);
/** Expands a config path. */
inline auto ExpandConfig(const Anope::string &path) { return Expand(ConfigDir, path); }
/** Expands a data path. */
inline auto ExpandData(const Anope::string &path) { return Expand(DataDir, path); }
/** Expands a locale path. */
inline auto ExpandLocale(const Anope::string &path) { return Expand(LocaleDir, path); }
/** Expands a log path. */
inline auto ExpandLog(const Anope::string &path) { return Expand(LogDir, path); }
/** Expands a module path. */
inline auto ExpandModule(const Anope::string &path) { return Expand(ModuleDir, path); }
/** Formats a CTCP message for sending to a client.
* @param name The name of the CTCP.
* @param body If present then the body of the CTCP.
* @return A formatted CTCP ready to send to a client.
*/
extern CoreExport Anope::string FormatCTCP(const Anope::string &name, const Anope::string &body = "");
/** Parses a CTCP message received from a client.
* @param text The raw message to parse.
* @param name The location to store the name of the CTCP.
* @param body The location to store body of the CTCP if one is present.
* @return True if the message was a well formed CTCP; otherwise, false.
*/
extern CoreExport bool ParseCTCP(const Anope::string &text, Anope::string &name, Anope::string &body);
}
/** sepstream allows for splitting token separated lists.
@@ -584,6 +642,9 @@ public:
*/
sepstream(const Anope::string &source, char separator, bool allowempty = false);
/** Retrieves the underlying string. */
const auto &GetString() const { return tokens; }
/** Fetch the next token from the stream
* @param token The next token from the stream is placed here
* @return True if tokens still remain, false if there are none left
@@ -600,7 +661,7 @@ public:
/** Gets every token from this stream
* @param token Tokens are pushed back here
*/
template<typename T> void GetTokens(T& token)
template<typename T> void GetTokens(T &token)
{
token.clear();
Anope::string t;
@@ -623,7 +684,7 @@ public:
/** Fetch the entire remaining stream, without tokenizing
* @return The remaining part of the stream
*/
const Anope::string GetRemaining();
Anope::string GetRemaining();
/** Returns true if the end of the stream has been reached
* @return True if the end of the stream has been reached, otherwise false
@@ -670,9 +731,6 @@ protected:
*/
Anope::string source;
public:
/** Default constructor, just uses the error message 'Core threw an exception'.
*/
CoreException() : err("Core threw an exception"), source("The core") { }
/** This constructor can be used to specify an error message before throwing.
*/
CoreException(const Anope::string &message) : err(message), source("The core") { }
@@ -703,10 +761,6 @@ class CoreExport ModuleException
: public CoreException
{
public:
/** Default constructor, just uses the error message 'Module threw an exception'.
*/
ModuleException() : CoreException("Module threw an exception", "A Module") { }
/** This constructor can be used to specify an error message before throwing.
*/
ModuleException(const Anope::string &message) : CoreException(message, "A Module") { }
@@ -717,67 +771,6 @@ public:
virtual ~ModuleException() noexcept = default;
};
class CoreExport ConvertException final
: public CoreException
{
public:
ConvertException(const Anope::string &reason = "") : CoreException(reason) { }
virtual ~ConvertException() noexcept = default;
};
/** Convert something to a string
*/
template<typename T> inline Anope::string stringify(const T &x)
{
std::ostringstream stream;
if (!(stream << x))
throw ConvertException("Stringify fail");
return stream.str();
}
template<typename T> inline void convert(const Anope::string &s, T &x, Anope::string &leftover, bool failIfLeftoverChars = true)
{
leftover.clear();
std::istringstream i(s.str());
char c;
if (!(i >> x))
throw ConvertException("Convert fail");
if (failIfLeftoverChars)
{
if (i.get(c))
throw ConvertException("Convert fail");
}
else
{
std::string left;
getline(i, left);
leftover = left;
}
}
template<typename T> inline void convert(const Anope::string &s, T &x, bool failIfLeftoverChars = true)
{
Anope::string Unused;
convert(s, x, Unused, failIfLeftoverChars);
}
template<typename T> inline T convertTo(const Anope::string &s, Anope::string &leftover, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, leftover, failIfLeftoverChars);
return x;
}
template<typename T> inline T convertTo(const Anope::string &s, bool failIfLeftoverChars = true)
{
T x;
convert(s, x, failIfLeftoverChars);
return x;
}
/** Casts to be used instead of dynamic_cast, this uses dynamic_cast
* for debug builds and static_cast on release builds
* to speed up the program because dynamic_cast relies on RTTI.
@@ -797,3 +790,5 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr)
return static_cast<T>(ptr);
}
#endif
#include "convert.h"
+2 -2
View File
@@ -103,14 +103,14 @@ public:
return NULL;
}
inline T* operator->()
inline T *operator->()
{
if (operator bool())
return this->ref;
return NULL;
}
inline T* operator*()
inline T *operator*()
{
if (operator bool())
return this->ref;
+5 -4
View File
@@ -56,7 +56,7 @@ public:
virtual ~BotInfo();
void Serialize(Serialize::Data &data) const;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
void GenerateUID();
@@ -108,8 +108,9 @@ public:
/** Called when a user messages this bot
* @param u The user
* @param message The users' message
* @params tags Message tags
*/
virtual void OnMessage(User *u, const Anope::string &message);
virtual void OnMessage(User *u, const Anope::string &message, const Anope::map<Anope::string> &tags);
/** Link a command name to a command in services
* @param cname The command name
@@ -117,7 +118,7 @@ public:
* @param permission Permission required to execute the command, if any
* @return The commandinfo for the newly created command
*/
CommandInfo& SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
CommandInfo &SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
/** Get command info for a command
* @param cname The command name
@@ -130,5 +131,5 @@ public:
* @param nick_only True to only look by nick, and not by UID
* @return The bot, if it exists
*/
static BotInfo* Find(const Anope::string &nick, bool nick_only = false);
static BotInfo *Find(const Anope::string &nick, bool nick_only = false);
};
+3 -3
View File
@@ -13,7 +13,7 @@
#include "modes.h"
#include "serialize.h"
typedef Anope::hash_map<Channel *> channel_map;
typedef Anope::unordered_map<Channel *> channel_map;
extern CoreExport channel_map ChannelList;
@@ -110,7 +110,7 @@ public:
* @param status The status to give the user, if any
* @return The UserContainer for the user
*/
ChanUserContainer* JoinUser(User *u, const ChannelStatus *status);
ChanUserContainer *JoinUser(User *u, const ChannelStatus *status);
/** Remove a user internally from the channel
* @param u The user
@@ -302,7 +302,7 @@ public:
* @param name The channel to find
* @return The channel, if found
*/
static Channel* Find(const Anope::string &name);
static Channel *Find(const Anope::string &name);
/** Finds or creates a channel
* @param name The channel name
+6 -3
View File
@@ -44,6 +44,7 @@ struct CoreExport CommandReply
{
virtual ~CommandReply() = default;
virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0;
virtual void SendMessage(CommandSource &source, const Anope::string &msg);
};
/* The source for a command */
@@ -61,15 +62,17 @@ public:
/* Where the reply should go */
CommandReply *reply;
/* Channel the command was executed on (fantasy) */
Reference<Channel> c;
Reference<Channel> c = nullptr;
/* The service this command is on */
Reference<BotInfo> service;
/* The actual name of the command being executed */
Anope::string command;
/* The permission of the command being executed */
Anope::string permission;
/* The unique identifier of the executing message. */
Anope::string msgid;
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi);
CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *reply, BotInfo *bi, const Anope::string &m = "");
const Anope::string &GetNick() const;
User *GetUser();
@@ -179,5 +182,5 @@ public:
* @param name If found, is set to the command name, eg REGISTER
* @return true if the given command service exists
*/
static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name);
static bool FindCommandFromService(const Anope::string &command_service, BotInfo *&bi, Anope::string &name);
};
+5 -20
View File
@@ -15,7 +15,6 @@
#include "regchannel.h"
#include "users.h"
#include "opertype.h"
#include <stack>
namespace Configuration
{
@@ -42,33 +41,19 @@ namespace Configuration
Block(const Anope::string &);
const Anope::string &GetName() const;
int CountBlock(const Anope::string &name) const;
const Block* GetBlock(const Anope::string &name, int num = 0) const;
Block* GetMutableBlock(const Anope::string &name, int num = 0);
const Block *GetBlock(const Anope::string &name, int num = 0) const;
Block *GetMutableBlock(const Anope::string &name, int num = 0);
template<typename T> inline T Get(const Anope::string &tag) const
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
{
return this->Get<T>(tag, "");
}
/* VS 2008 has an issue with having a default argument here (def = ""), which is why the above
* function exists.
*/
template<typename T> T Get(const Anope::string &tag, const Anope::string &def) const
{
const Anope::string &value = this->Get<const Anope::string>(tag, def);
if (!value.empty())
try
{
return convertTo<T>(value);
}
catch (const ConvertException &) { }
return T();
return Anope::TryConvert<T>(this->Get<const Anope::string>(tag, def)).value_or(T());
}
bool Set(const Anope::string &tag, const Anope::string &value);
const item_map &GetItems() const;
};
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const;
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string &def) const;
template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const;
template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const;
} // namespace Internal
+132
View File
@@ -0,0 +1,132 @@
/*
*
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#pragma once
#include <optional>
namespace Anope
{
/** Attempts to convert a string to any type.
* @param in The value to convert.
* @param leftover If non-nullptr then the location to store leftover data.
*/
template<typename T>
inline std::optional<T> TryConvert(const Anope::string &in, Anope::string *leftover = nullptr)
{
std::istringstream tmp(in.str());
T out;
if (!(tmp >> out))
return std::nullopt;
if (leftover)
{
leftover->clear();
std::getline(tmp, leftover->str());
}
else
{
char extra;
if (tmp >> extra)
return std::nullopt;
}
return out;
}
/** Converts a string to any type.
* @param in The value to convert.
* @param def The default to use if the conversion failed.
* @param leftover If non-nullptr then the location to store leftover data.
*/
template<typename T>
inline T Convert(const Anope::string &in, T def, Anope::string *leftover = nullptr)
{
return TryConvert<T>(in, leftover).value_or(def);
}
/** Attempts to convert any type to a string.
* @param in The value to convert.
*/
template <class T>
inline std::optional<Anope::string> TryString(const T &in)
{
std::ostringstream tmp;
if (!(tmp << in))
return std::nullopt;
return tmp.str();
}
/** No-op function that returns the string that was passed to it.
* @param in The string to return.
*/
inline const string &ToString(const string &in)
{
return in;
}
/** Converts a std::string to a string.
* @param in The value to convert.
*/
inline string ToString(const std::string &in)
{
return in;
}
/** Converts a char array to a string.
* @param in The value to convert.
*/
inline string ToString(const char *in)
{
return string(in);
}
/** Converts a char to a string.
* @param in The value to convert.
*/
inline string ToString(char in)
{
return string(1, static_cast<string::value_type>(in));
}
/** Converts an unsigned char to a string.
* @param in The value to convert.
*/
inline string ToString(unsigned char in)
{
return string(1, static_cast<string::value_type>(in));
}
/** Converts a bool to a string.
* @param in The value to convert.
*/
inline string ToString(bool in)
{
return (in ? "1" : "0");
}
/** Converts a type that std::to_string is implemented for to a string.
* @param in The value to convert.
*/
template<typename Stringable>
inline std::enable_if_t<std::is_arithmetic_v<Stringable>, string> ToString(const Stringable &in)
{
return std::to_string(in);
}
/** Converts any type to a string.
* @param in The value to convert.
*/
template <class T>
inline std::enable_if_t<!std::is_arithmetic_v<T>, string> ToString(const T &in)
{
return TryString(in).value_or(Anope::string());
}
}
+22 -22
View File
@@ -41,12 +41,12 @@ public:
void UnsetExtensibles();
template<typename T> T* GetExt(const Anope::string &name) const;
template<typename T> T *GetExt(const Anope::string &name) const;
bool HasExt(const Anope::string &name) const;
template<typename T> T* Extend(const Anope::string &name, const T &what);
template<typename T> T* Extend(const Anope::string &name);
template<typename T> T* Require(const Anope::string &name);
template<typename T> T *Extend(const Anope::string &name, const T &what);
template<typename T> T *Extend(const Anope::string &name);
template<typename T> T *Require(const Anope::string &name);
template<typename T> void Shrink(const Anope::string &name);
static void ExtensibleSerialize(const Extensible *, const Serializable *, Serialize::Data &data);
@@ -77,17 +77,17 @@ public:
}
}
T* Set(Extensible *obj, const T &value)
T *Set(Extensible *obj, const T &value)
{
T* t = Set(obj);
T *t = Set(obj);
if (t)
*t = value;
return t;
}
T* Set(Extensible *obj)
T *Set(Extensible *obj)
{
T* t = Create(obj);
T *t = Create(obj);
Unset(obj);
items[obj] = t;
obj->extension_items.insert(this);
@@ -102,7 +102,7 @@ public:
delete value;
}
T* Get(const Extensible *obj) const
T *Get(const Extensible *obj) const
{
std::map<Extensible *, void *>::const_iterator it = items.find(const_cast<Extensible *>(obj));
if (it != items.end())
@@ -115,9 +115,9 @@ public:
return items.find(const_cast<Extensible *>(obj)) != items.end();
}
T* Require(Extensible *obj)
T *Require(Extensible *obj)
{
T* t = Get(obj);
T *t = Get(obj);
if (t)
return t;
@@ -130,7 +130,7 @@ class ExtensibleItem
: public BaseExtensibleItem<T>
{
protected:
T* Create(Extensible *obj) override
T *Create(Extensible *obj) override
{
return new T(obj);
}
@@ -143,7 +143,7 @@ class PrimitiveExtensibleItem
: public BaseExtensibleItem<T>
{
protected:
T* Create(Extensible *obj) override
T *Create(Extensible *obj) override
{
return new T();
}
@@ -155,7 +155,7 @@ template<>
class PrimitiveExtensibleItem<bool> : public BaseExtensibleItem<bool>
{
protected:
bool* Create(Extensible *) override
bool *Create(Extensible *) override
{
return NULL;
}
@@ -172,8 +172,8 @@ public:
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
T* t = this->Get(e);
data[this->name] << *t;
T *t = this->Get(e);
data.Store(this->name, *t);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
@@ -194,7 +194,7 @@ public:
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
data[this->name] << true;
data.Store(this->name, true);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
@@ -216,7 +216,7 @@ struct ExtensibleRef final
};
template<typename T>
T* Extensible::GetExt(const Anope::string &name) const
T *Extensible::GetExt(const Anope::string &name) const
{
ExtensibleRef<T> ref(name);
if (ref)
@@ -227,16 +227,16 @@ T* Extensible::GetExt(const Anope::string &name) const
}
template<typename T>
T* Extensible::Extend(const Anope::string &name, const T &what)
T *Extensible::Extend(const Anope::string &name, const T &what)
{
T* t = Extend<T>(name);
T *t = Extend<T>(name);
if (t)
*t = what;
return t;
}
template<typename T>
T* Extensible::Extend(const Anope::string &name)
T *Extensible::Extend(const Anope::string &name)
{
ExtensibleRef<T> ref(name);
if (ref)
@@ -247,7 +247,7 @@ T* Extensible::Extend(const Anope::string &name)
}
template<typename T>
T* Extensible::Require(const Anope::string &name)
T *Extensible::Require(const Anope::string &name)
{
if (HasExt(name))
return GetExt<T>(name);
+12 -13
View File
@@ -65,11 +65,13 @@ namespace Language
} // namespace Language
/* Commonly used language strings */
#define CONFIRM_DROP _("Please confirm that you want to drop \002%s\002 with \002%s%s DROP %s %s\002")
#define SERVICE_UNAVAILABLE _("Sorry, %s is temporarily unavailable.")
#define MORE_INFO _("\002%s%s HELP %s\002 for more information.")
#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.")
#define BAD_EXPIRY_TIME _("Invalid expiry time.")
#define USERHOST_MASK_TOO_WIDE _("%s coverage is too wide; Please use a more specific mask.")
#define READ_ONLY_MODE _("Services are in read-only mode!")
#define READ_ONLY_MODE _("Services are temporarily in read-only mode.")
#define PASSWORD_INCORRECT _("Password incorrect.")
#define ACCESS_DENIED _("Access denied.")
#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should not be\n" \
@@ -86,12 +88,10 @@ namespace Language
#define CHAN_X_NOT_REGISTERED _("Channel \002%s\002 isn't registered.")
#define CHAN_X_NOT_IN_USE _("Channel \002%s\002 doesn't exist.")
#define NICK_IDENTIFY_REQUIRED _("You must be logged into an account to use that command.")
#define MAIL_X_INVALID _("\002%s\002 is not a valid e-mail address.")
#define MAIL_X_INVALID _("\002%s\002 is not a valid email address.")
#define UNKNOWN _("<unknown>")
#define NO_EXPIRE _("does not expire")
#define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")
#define NICK_IS_REGISTERED _("This nick is owned by someone else. Please choose another.\n" \
"(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)")
#define NICK_IS_SECURE _("This nickname is registered and protected. If it is your\n" \
"nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \
"please choose a different nick.")
@@ -99,7 +99,7 @@ namespace Language
#define NICK_CANNOT_BE_REGISTERED _("Nickname \002%s\002 may not be registered.")
#define NICK_ALREADY_REGISTERED _("Nickname \002%s\002 is already registered!")
#define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.")
#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the e-mail again, and retry.")
#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the email again, and retry.")
#define CHAN_NOT_ALLOWED_TO_JOIN _("You are not permitted to be on this channel.")
#define CHAN_X_INVALID _("Channel %s is not a valid channel.")
#define CHAN_REACHED_CHANNEL_LIMIT _("Sorry, you have already reached your limit of \002%d\002 channels.")
@@ -108,7 +108,7 @@ namespace Language
#define CHAN_SETTING_CHANGED _("%s for %s set to %s.")
#define CHAN_SETTING_UNSET _("%s for %s unset.")
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_INFO_HEADER _("Information about channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %zu\002 to read it.")
@@ -116,15 +116,14 @@ namespace Language
"Type \002%s%s READ %zu\002 to read it.")
#define MEMO_HAVE_NO_MEMOS _("You have no memos.")
#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.")
#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.")
#define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.")
#define MEMO_X_HAS_NO_NEW_MEMOS _("%s has no new memos.")
#define BOT_DOES_NOT_EXIST _("Bot \002%s\002 does not exist.")
#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.")
#define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.")
#define HOST_SET_ERROR _("A vHost must be in the format of a valid hostname.")
#define HOST_SET_IDENT_ERROR _("A vHost ident must be in the format of a valid ident.")
#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %d characters.")
#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %d characters.")
#define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vHost assigned to this nick.")
#define HOST_NO_VIDENT _("Your IRCd does not support vIdent's, if this is incorrect, please report this as a possible bug")
#define HOST_SET_ERROR _("A vhost must be in the format of a valid hostname.")
#define HOST_SET_IDENT_ERROR _("A vident must be in the format of a valid ident.")
#define HOST_SET_TOOLONG _("Error! The vhost is too long, please use a hostname shorter than %zu characters.")
#define HOST_SET_IDENTTOOLONG _("Error! The vident is too long, please use an ident shorter than %zu characters.")
#define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vhost assigned to this nick.")
#define HOST_NO_VIDENT _("Your IRCd does not support vidents. If this is incorrect please report this as a possible bug.")
+1 -1
View File
@@ -26,6 +26,7 @@ namespace Mail
: public Thread
{
private:
Anope::string error;
Anope::string sendmail_path;
Anope::string send_from;
Anope::string mail_to;
@@ -35,7 +36,6 @@ namespace Mail
Anope::string content_type;
bool dont_quote_addresses;
bool success = false;
public:
/** Construct this message. Once constructed call Thread::Start to launch the mail sending.
* @param sf Config->SendFrom
+1 -1
View File
@@ -25,7 +25,7 @@ public:
~Memo();
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
Anope::string owner;
/* When it was sent */
+16 -16
View File
@@ -24,7 +24,7 @@ namespace Message
struct CoreExport Away
: IRCDMessage
{
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -32,7 +32,7 @@ namespace Message
struct CoreExport Capab
: IRCDMessage
{
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -48,7 +48,7 @@ namespace Message
struct CoreExport Invite
: IRCDMessage
{
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -56,7 +56,7 @@ namespace Message
struct CoreExport Join
: IRCDMessage
{
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
@@ -75,7 +75,7 @@ namespace Message
struct CoreExport Kick
: IRCDMessage
{
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -91,7 +91,7 @@ namespace Message
struct CoreExport Mode
: IRCDMessage
{
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -107,7 +107,7 @@ namespace Message
struct CoreExport Notice
: IRCDMessage
{
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -115,7 +115,7 @@ namespace Message
struct CoreExport Part
: IRCDMessage
{
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -123,7 +123,7 @@ namespace Message
struct CoreExport Ping
: IRCDMessage
{
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -131,7 +131,7 @@ namespace Message
struct CoreExport Privmsg
: IRCDMessage
{
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -139,7 +139,7 @@ namespace Message
struct CoreExport Quit
: IRCDMessage
{
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -155,7 +155,7 @@ namespace Message
struct CoreExport Stats
: IRCDMessage
{
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -163,7 +163,7 @@ namespace Message
struct CoreExport Time
: IRCDMessage
{
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -171,7 +171,7 @@ namespace Message
struct CoreExport Topic
: IRCDMessage
{
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -179,7 +179,7 @@ namespace Message
struct CoreExport Version
: IRCDMessage
{
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
@@ -187,7 +187,7 @@ namespace Message
struct CoreExport Whois
: IRCDMessage
{
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override;
};
+2 -2
View File
@@ -419,9 +419,9 @@ public:
/** Get the banned mask for this entry
* @return The mask
*/
const Anope::string GetMask() const;
Anope::string GetMask() const;
const Anope::string GetNUHMask() const;
Anope::string GetNUHMask() const;
/** Check if this entry matches a user
* @param u The user
+128 -146
View File
@@ -199,6 +199,8 @@ public:
class CoreExport NotImplementedException final
: public CoreException
{
public:
NotImplementedException() : CoreException("") { }
};
/** Every module in Anope is actually a class.
@@ -288,7 +290,7 @@ public:
* @param cu The user, channel, and status of the user being kicked
* @param kickmsg The reason for the kick.
*/
virtual void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) { throw NotImplementedException(); }
virtual void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a user has been kicked from a channel.
* @param source The kicker
@@ -297,13 +299,13 @@ public:
* @param status The status the kicked user had on the channel before they were kicked
* @param kickmsg The reason for the kick.
*/
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) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when the configuration is being (re)loaded.
* @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.
*/
virtual void OnReload(Configuration::Conf *conf) { throw NotImplementedException(); }
virtual void OnReload(Configuration::Conf *conf) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called before a bot is assigned to a channel.
* @param sender The user assigning the bot
@@ -311,35 +313,35 @@ public:
* @param bi The bot being assigned.
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the assign.
*/
virtual EventReturn OnPreBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) { throw NotImplementedException(); }
virtual EventReturn OnPreBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) ATTR_NOT_NULL(2, 3, 4) { throw NotImplementedException(); }
/** Called when a bot is assigned ot a channel
*/
virtual void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) { throw NotImplementedException(); }
virtual void OnBotAssign(User *sender, ChannelInfo *ci, BotInfo *bi) ATTR_NOT_NULL(2, 3, 4) { throw NotImplementedException(); }
/** Called before a bot is unassigned from a channel.
* @param sender The user unassigning the bot
* @param ci The channel the bot is being removed from
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the unassign.
*/
virtual EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci) { throw NotImplementedException(); }
virtual EventReturn OnBotUnAssign(User *sender, ChannelInfo *ci) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a new user connects to the network.
* @param u The connecting user.
* @param exempt set to true/is true if the user should be excepted from bans etc
*/
virtual void OnUserConnect(User *u, bool &exempt) { throw NotImplementedException(); }
virtual void OnUserConnect(User *u, bool &exempt) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a new server connects to the network.
* @param s The server that has connected to the network
*/
virtual void OnNewServer(Server *s) { throw NotImplementedException(); }
virtual void OnNewServer(Server *s) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called after a user changed the nick
* @param u The user.
* @param oldnick The old nick of the user
*/
virtual void OnUserNickChange(User *u, const Anope::string &oldnick) { throw NotImplementedException(); }
virtual void OnUserNickChange(User *u, const Anope::string &oldnick) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when someone uses the generic/help command
* @param source Command source
@@ -360,14 +362,14 @@ public:
* @param params The parameters the user is sending
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) { throw NotImplementedException(); }
virtual EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called after a command has been executed.
* @param source The source of the command
* @param command The command the user executed
* @param params The parameters the user sent
*/
virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params) { throw NotImplementedException(); }
virtual void OnPostCommand(CommandSource &source, Command *command, const std::vector<Anope::string> &params) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when the databases are saved
*/
@@ -389,7 +391,7 @@ public:
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) { throw NotImplementedException(); }
virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called on fantasy command without access
* @param source The source of the command
@@ -398,31 +400,31 @@ public:
* @param params The params
* @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
*/
virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) { throw NotImplementedException(); }
virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChannelInfo *ci, const std::vector<Anope::string> &params) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called when a bot places a ban
* @param u User being banned
* @param ci Channel the ban is placed on
* @param mask The mask being banned
*/
virtual void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) { throw NotImplementedException(); }
virtual void OnBotBan(User *u, ChannelInfo *ci, const Anope::string &mask) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called before a badword is added to the badword list
* @param ci The channel
* @param bw The badword
*/
virtual void OnBadWordAdd(ChannelInfo *ci, const BadWord *bw) { throw NotImplementedException(); }
virtual void OnBadWordAdd(ChannelInfo *ci, const BadWord *bw) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called before a badword is deleted from a channel
* @param ci The channel
* @param bw The badword
*/
virtual void OnBadWordDel(ChannelInfo *ci, const BadWord *bw) { throw NotImplementedException(); }
virtual void OnBadWordDel(ChannelInfo *ci, const BadWord *bw) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a bot is created or destroyed
*/
virtual void OnCreateBot(BotInfo *bi) { throw NotImplementedException(); }
virtual void OnDelBot(BotInfo *bi) { throw NotImplementedException(); }
virtual void OnCreateBot(BotInfo *bi) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnDelBot(BotInfo *bi) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called before a bot kicks a user
* @param bi The bot sending the kick
@@ -431,13 +433,13 @@ public:
* @param reason The reason
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnBotKick(BotInfo *bi, Channel *c, User *u, const Anope::string &reason) { throw NotImplementedException(); }
virtual EventReturn OnBotKick(BotInfo *bi, Channel *c, User *u, const Anope::string &reason) ATTR_NOT_NULL(2, 3, 4) { throw NotImplementedException(); }
/** Called before a user parts a channel
* @param u The user
* @param c The channel
*/
virtual void OnPrePartChannel(User *u, Channel *c) {}
virtual void OnPrePartChannel(User *u, Channel *c) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a user parts a channel
* @param u The user
@@ -445,14 +447,14 @@ public:
* @param channel The channel name
* @param msg The part reason
*/
virtual void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) { throw NotImplementedException(); }
virtual void OnPartChannel(User *u, Channel *c, const Anope::string &channel, const Anope::string &msg) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a user leaves a channel.
* From either parting, being kicked, or quitting/killed!
* @param u The user
* @param c The channel
*/
virtual void OnLeaveChannel(User *u, Channel *c) { throw NotImplementedException(); }
virtual void OnLeaveChannel(User *u, Channel *c) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called after a user joins a channel
* If this event triggers the user is allowed to be in the channel, and will
@@ -461,7 +463,7 @@ public:
* @param u The user
* @param channel The channel
*/
virtual void OnJoinChannel(User *u, Channel *c) { throw NotImplementedException(); }
virtual void OnJoinChannel(User *u, Channel *c) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a new topic is set
* @param source The user changing the topic, if any
@@ -469,18 +471,18 @@ public:
* @param setter The user who set the new topic, if there is no source
* @param topic The new topic
*/
virtual void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) { throw NotImplementedException(); }
virtual void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called before a channel expires
* @param ci The channel
* @param expire Set to true to allow the chan to expire
*/
virtual void OnPreChanExpire(ChannelInfo *ci, bool &expire) { throw NotImplementedException(); }
virtual void OnPreChanExpire(ChannelInfo *ci, bool &expire) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called before a channel expires
* @param ci The channel
*/
virtual void OnChanExpire(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnChanExpire(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called before Anope connects to its uplink
*/
@@ -492,7 +494,7 @@ public:
/** Called when we are almost done synching with the uplink, just before we send the EOB
*/
virtual void OnPreUplinkSync(Server *serv) { throw NotImplementedException(); }
virtual void OnPreUplinkSync(Server *serv) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when Anope disconnects from its uplink, before it tries to reconnect
*/
@@ -510,12 +512,12 @@ public:
* @param na The nick
* @param expire Set to true to allow the nick to expire
*/
virtual void OnPreNickExpire(NickAlias *na, bool &expire) { throw NotImplementedException(); }
virtual void OnPreNickExpire(NickAlias *na, bool &expire) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nick drops
* @param na The nick
*/
virtual void OnNickExpire(NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickExpire(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when defcon level changes
* @param level The level
@@ -526,13 +528,13 @@ public:
* @param ex The exception
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnExceptionAdd(Exception *ex) { throw NotImplementedException(); }
virtual EventReturn OnExceptionAdd(Exception *ex) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called before an exception is deleted
* @param source The source deleting it
* @param ex The exception
*/
virtual void OnExceptionDel(CommandSource &source, Exception *ex) { throw NotImplementedException(); }
virtual void OnExceptionDel(CommandSource &source, Exception *ex) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called before a XLine is added
* @param source The source of the XLine
@@ -540,31 +542,31 @@ public:
* @param xlm The xline manager it was added to
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it
*/
virtual EventReturn OnAddXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { throw NotImplementedException(); }
virtual EventReturn OnAddXLine(CommandSource &source, const XLine *x, XLineManager *xlm) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called before a XLine is deleted
* @param source The source of the XLine
* @param x The XLine
* @param xlm The xline manager it was deleted from
*/
virtual void OnDelXLine(CommandSource &source, const XLine *x, XLineManager *xlm) { throw NotImplementedException(); }
virtual void OnDelXLine(CommandSource &source, const XLine *x, XLineManager *xlm) ATTR_NOT_NULL(4) { throw NotImplementedException(); }
/** Called when a user is checked for whether they are a services oper
* @param u The user
* @return EVENT_ALLOW to allow, anything else to deny
*/
virtual EventReturn IsServicesOper(User *u) { throw NotImplementedException(); }
virtual EventReturn IsServicesOper(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a server quits
* @param server The server
*/
virtual void OnServerQuit(Server *server) { throw NotImplementedException(); }
virtual void OnServerQuit(Server *server) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user quits, or is killed
* @param u The user
* @param msg The quit message
*/
virtual void OnUserQuit(User *u, const Anope::string &msg) { throw NotImplementedException(); }
virtual void OnUserQuit(User *u, const Anope::string &msg) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user is quit, before and after being internally removed from
* This is different from OnUserQuit, which takes place at the time of the quit.
@@ -572,43 +574,43 @@ public:
* all lists (channels, user list, etc)
* @param u The user
*/
virtual void OnPreUserLogoff(User *u) { throw NotImplementedException(); }
virtual void OnPostUserLogoff(User *u) { throw NotImplementedException(); }
virtual void OnPreUserLogoff(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnPostUserLogoff(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a new bot is made
* @param bi The bot
*/
virtual void OnBotCreate(BotInfo *bi) { throw NotImplementedException(); }
virtual void OnBotCreate(BotInfo *bi) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a bot is changed
* @param bi The bot
*/
virtual void OnBotChange(BotInfo *bi) { throw NotImplementedException(); }
virtual void OnBotChange(BotInfo *bi) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a bot is deleted
* @param bi The bot
*/
virtual void OnBotDelete(BotInfo *bi) { throw NotImplementedException(); }
virtual void OnBotDelete(BotInfo *bi) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called after an access entry is deleted from a channel
* @param ci The channel
* @param source The source of the command
* @param access The access entry that was removed
*/
virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { throw NotImplementedException(); }
virtual void OnAccessDel(ChannelInfo *ci, CommandSource &source, ChanAccess *access) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
/** Called when access is added
* @param ci The channel
* @param source The source of the command
* @param access The access changed
*/
virtual void OnAccessAdd(ChannelInfo *ci, CommandSource &source, ChanAccess *access) { throw NotImplementedException(); }
virtual void OnAccessAdd(ChannelInfo *ci, CommandSource &source, ChanAccess *access) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
/** Called when the access list is cleared
* @param ci The channel
* @param u The user who cleared the access
*/
virtual void OnAccessClear(ChannelInfo *ci, CommandSource &source) { throw NotImplementedException(); }
virtual void OnAccessClear(ChannelInfo *ci, CommandSource &source) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a level for a channel is changed
* @param source The source of the command
@@ -616,63 +618,63 @@ public:
* @param priv The privilege changed
* @param what The new level
*/
virtual void OnLevelChange(CommandSource &source, ChannelInfo *ci, const Anope::string &priv, int16_t what) { throw NotImplementedException(); }
virtual void OnLevelChange(CommandSource &source, ChannelInfo *ci, const Anope::string &priv, int16_t what) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called right before a channel is dropped
* @param source The user dropping the channel
* @param ci The channel
*/
virtual EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) { throw NotImplementedException(); }
virtual EventReturn OnChanDrop(CommandSource &source, ChannelInfo *ci) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a channel is registered
* @param ci The channel
*/
virtual void OnChanRegistered(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnChanRegistered(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a channel is suspended
* @param ci The channel
*/
virtual void OnChanSuspend(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnChanSuspend(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a channel is unsuspended
* @param ci The channel
*/
virtual void OnChanUnsuspend(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnChanUnsuspend(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a channel is being created, for any reason
* @param ci The channel
*/
virtual void OnCreateChan(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnCreateChan(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a channel is being deleted, for any reason
* @param ci The channel
*/
virtual void OnDelChan(ChannelInfo *ci) { throw NotImplementedException(); }
virtual void OnDelChan(ChannelInfo *ci) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a new channel is created
* Note that this channel may not be introduced to the uplink at this point.
* @param c The channel
*/
virtual void OnChannelCreate(Channel *c) { throw NotImplementedException(); }
virtual void OnChannelCreate(Channel *c) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a channel is deleted
* @param c The channel
*/
virtual void OnChannelDelete(Channel *c) { throw NotImplementedException(); }
virtual void OnChannelDelete(Channel *c) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called after adding an akick to a channel
* @param source The source of the command
* @param ci The channel
* @param ak The akick
*/
virtual void OnAkickAdd(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { throw NotImplementedException(); }
virtual void OnAkickAdd(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called before removing an akick from a channel
* @param source The source of the command
* @param ci The channel
* @param ak The akick
*/
virtual void OnAkickDel(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) { throw NotImplementedException(); }
virtual void OnAkickDel(CommandSource &source, ChannelInfo *ci, const AutoKick *ak) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called after a user join a channel when we decide whether to kick them or not
* @param u The user
@@ -682,7 +684,7 @@ public:
* @param reason The reason for the kick
* @return EVENT_STOP to prevent the user from joining by kicking/banning the user
*/
virtual EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) { throw NotImplementedException(); }
virtual EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a user requests info for a channel
* @param source The user requesting info
@@ -690,126 +692,109 @@ public:
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
virtual void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) { throw NotImplementedException(); }
virtual void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Checks if access has the channel privilege 'priv'.
* @param access THe access struct
* @param priv The privilege being checked for
* @return EVENT_ALLOW for yes, EVENT_STOP to stop all processing
*/
virtual EventReturn OnCheckPriv(const ChanAccess *access, const Anope::string &priv) { throw NotImplementedException(); }
virtual EventReturn OnCheckPriv(const ChanAccess *access, const Anope::string &priv) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Check whether an access group has a privilege
* @param group The group
* @param priv The privilege
* @return MOD_ALLOW to allow, MOD_STOP to stop
*/
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) { throw NotImplementedException(); }
virtual EventReturn OnGroupCheckPriv(const AccessGroup *group, const Anope::string &priv) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nick is dropped
* @param source The source of the command
* @param na The nick
*/
virtual void OnNickDrop(CommandSource &source, NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickDrop(CommandSource &source, NickAlias *na) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a user groups their nick
* @param u The user grouping
* @param target The target they're grouping to
*/
virtual void OnNickGroup(User *u, NickAlias *target) { throw NotImplementedException(); }
virtual void OnNickGroup(User *u, NickAlias *target) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a user identifies to a nick
* @param u The user
*/
virtual void OnNickIdentify(User *u) { throw NotImplementedException(); }
virtual void OnNickIdentify(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user is logged into an account
* @param u The user
*/
virtual void OnUserLogin(User *u) { throw NotImplementedException(); }
virtual void OnUserLogin(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nick logs out
* @param u The nick
*/
virtual void OnNickLogout(User *u) { throw NotImplementedException(); }
virtual void OnNickLogout(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nick is registered
* @param user The user registering the nick, of any
* @param The nick
* @param pass The password of the newly registered nick
*/
virtual void OnNickRegister(User *user, NickAlias *na, const Anope::string &pass) { throw NotImplementedException(); }
virtual void OnNickRegister(User *user, NickAlias *na, const Anope::string &pass) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a nick is confirmed. This will never be called if registration confirmation is not enabled.
* @param user The user confirming the nick
* @param The account being confirmed
* @param nc The account being confirmed
*/
virtual void OnNickConfirm(User *user, NickCore *) { throw NotImplementedException(); }
virtual void OnNickConfirm(User *user, NickCore *nc) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a nick is suspended
* @param na The nick alias
*/
virtual void OnNickSuspend(NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickSuspend(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nick is unsuspended
* @param na The nick alias
*/
virtual void OnNickUnsuspended(NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickUnsuspended(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called on delnick()
* @ param na pointer to the nickalias
*/
virtual void OnDelNick(NickAlias *na) { throw NotImplementedException(); }
virtual void OnDelNick(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a nickcore is created
* @param nc The nickcore
*/
virtual void OnNickCoreCreate(NickCore *nc) { throw NotImplementedException(); }
virtual void OnNickCoreCreate(NickCore *nc) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called on delcore()
* @param nc pointer to the NickCore
*/
virtual void OnDelCore(NickCore *nc) { throw NotImplementedException(); }
virtual void OnDelCore(NickCore *nc) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called on change_core_display()
* @param nc pointer to the NickCore
* @param newdisplay the new display
*/
virtual void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) { throw NotImplementedException(); }
/** called from NickCore::ClearAccess()
* @param nc pointer to the NickCore
*/
virtual void OnNickClearAccess(NickCore *nc) { throw NotImplementedException(); }
/** Called when a user adds an entry to their access list
* @param nc The nick
* @param entry The entry
*/
virtual void OnNickAddAccess(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
/** Called from NickCore::EraseAccess()
* @param nc pointer to the NickCore
* @param entry The access mask
*/
virtual void OnNickEraseAccess(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
virtual void OnChangeCoreDisplay(NickCore *nc, const Anope::string &newdisplay) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** called from NickCore::ClearCert()
* @param nc pointer to the NickCore
*/
virtual void OnNickClearCert(NickCore *nc) { throw NotImplementedException(); }
virtual void OnNickClearCert(NickCore *nc) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user adds an entry to their cert list
* @param nc The nick
* @param entry The entry
*/
virtual void OnNickAddCert(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
virtual void OnNickAddCert(NickCore *nc, const Anope::string &entry) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called from NickCore::EraseCert()
* @param nc pointer to the NickCore
* @param entry The fingerprint
*/
virtual void OnNickEraseCert(NickCore *nc, const Anope::string &entry) { throw NotImplementedException(); }
virtual void OnNickEraseCert(NickCore *nc, const Anope::string &entry) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user requests info for a nick
* @param source The user requesting info
@@ -817,55 +802,55 @@ public:
* @param info Data to show the user requesting information
* @param show_hidden true if we should show the user everything
*/
virtual void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) { throw NotImplementedException(); }
virtual void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a user uses botserv/info on a bot or channel.
*/
virtual void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) { throw NotImplementedException(); }
virtual void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info) ATTR_NOT_NULL(4) { throw NotImplementedException(); }
/** Check whether a username and password is correct
* @param u The user trying to identify, if applicable.
* @param req The login request
*/
virtual void OnCheckAuthentication(User *u, IdentifyRequest *req) { throw NotImplementedException(); }
virtual void OnCheckAuthentication(User *u, IdentifyRequest *req) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a user does /ns update
* @param u The user
*/
virtual void OnNickUpdate(User *u) { throw NotImplementedException(); }
virtual void OnNickUpdate(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when we get informed about a users SSL fingerprint
* when we call this, the fingerprint should already be stored in the user struct
* @param u pointer to the user
*/
virtual void OnFingerprint(User *u) { throw NotImplementedException(); }
virtual void OnFingerprint(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user becomes (un)away
* @param message The message, is .empty() if unaway
*/
virtual void OnUserAway(User *u, const Anope::string &message) { throw NotImplementedException(); }
virtual void OnUserAway(User *u, const Anope::string &message) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user invites one of our users to a channel
* @param source The user doing the inviting
* @param c The channel the user is inviting to
* @param targ The user being invited
*/
virtual void OnInvite(User *source, Channel *c, User *targ) { throw NotImplementedException(); }
virtual void OnInvite(User *source, Channel *c, User *targ) ATTR_NOT_NULL(2, 3, 4) { throw NotImplementedException(); }
/** Called when a vhost is deleted
* @param na The nickalias of the vhost
*/
virtual void OnDeleteVhost(NickAlias *na) { throw NotImplementedException(); }
virtual void OnDeleteVHost(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a vhost is set
* @param na The nickalias of the vhost
*/
virtual void OnSetVhost(NickAlias *na) { throw NotImplementedException(); }
virtual void OnSetVHost(NickAlias *na) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a users host changes
* @param u The user
*/
virtual void OnSetDisplayedHost(User *) { throw NotImplementedException(); }
virtual void OnSetDisplayedHost(User *u) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a memo is sent
* @param source The source of the memo
@@ -873,14 +858,14 @@ public:
* @param mi Memo info for target
* @param m The memo
*/
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) { throw NotImplementedException(); }
virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) ATTR_NOT_NULL(4, 5) { throw NotImplementedException(); }
/** Called when a memo is deleted
* @param target The target the memo is being deleted from (nick or channel)
* @param mi The memo info
* @param m The memo
*/
virtual void OnMemoDel(const Anope::string &target, MemoInfo *mi, const Memo *m) { throw NotImplementedException(); }
virtual void OnMemoDel(const Anope::string &target, MemoInfo *mi, const Memo *m) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called when a mode is set on a channel
* @param c The channel
@@ -889,7 +874,7 @@ public:
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) { throw NotImplementedException(); }
virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
/** Called when a mode is unset on a channel
* @param c The channel
@@ -898,94 +883,97 @@ public:
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) { throw NotImplementedException(); }
virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
/** Called when a mode is set on a user
* @param setter who/what is setting the mode
* @param u The user
* @param mname The mode name
*/
virtual void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) { throw NotImplementedException(); }
virtual void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a mode is unset from a user
* @param setter who/what is setting the mode
* @param u The user
* @param mname The mode name
*/
virtual void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) { throw NotImplementedException(); }
virtual void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a channel mode is introduced into Anope
* @param cm The mode
*/
virtual void OnChannelModeAdd(ChannelMode *cm) { throw NotImplementedException(); }
virtual void OnChannelModeAdd(ChannelMode *cm) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a user mode is introduced into Anope
* @param um The mode
*/
virtual void OnUserModeAdd(UserMode *um) { throw NotImplementedException(); }
virtual void OnUserModeAdd(UserMode *um) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a mode is about to be mlocked
* @param ci The channel the mode is being locked on
* @param lock The mode lock
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
*/
virtual EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) { throw NotImplementedException(); }
virtual EventReturn OnMLock(ChannelInfo *ci, ModeLock *lock) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a mode is about to be unlocked
* @param ci The channel the mode is being unlocked from
* @param lock The mode lock
* @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
*/
virtual EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) { throw NotImplementedException(); }
virtual EventReturn OnUnMLock(ChannelInfo *ci, ModeLock *lock) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called after a module is loaded
* @param u The user loading the module, can be NULL
* @param m The module
*/
virtual void OnModuleLoad(User *u, Module *m) { throw NotImplementedException(); }
virtual void OnModuleLoad(User *u, Module *m) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called before a module is unloaded
* @param u The user, can be NULL
* @param m The module
*/
virtual void OnModuleUnload(User *u, Module *m) { throw NotImplementedException(); }
virtual void OnModuleUnload(User *u, Module *m) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a server is synced
* @param s The server, can be our uplink server
*/
virtual void OnServerSync(Server *s) { throw NotImplementedException(); }
virtual void OnServerSync(Server *s) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when we sync with our uplink
* @param s Our uplink
*/
virtual void OnUplinkSync(Server *s) { throw NotImplementedException(); }
virtual void OnUplinkSync(Server *s) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when we receive a PRIVMSG for one of our clients
* @param u The user sending the PRIVMSG
* @param bi The target of the PRIVMSG
* @param message The message
* @param tags Message tags
* @return EVENT_STOP to halt processing
*/
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when we receive a NOTICE for one of our clients
* @param u The user sending the NOTICE
* @param bi The target of the NOTICE
* @param tags Message tags
* @param message The message
*/
virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when we receive a PRIVMSG for a registered channel we are in
* @param u The source of the message
* @param c The channel
* @param msg The message
* @param tags Message tags
*/
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg) { throw NotImplementedException(); }
virtual void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a message is logged
* @param l The log message
*/
virtual void OnLog(Log *l) { throw NotImplementedException(); }
virtual void OnLog(Log *l) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a log message is actually logged to a given log info
* The message has already passed validation checks by the LogInfo
@@ -993,13 +981,13 @@ public:
* @param l The log message
* @param msg The final formatted message, derived from 'l'
*/
virtual void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) { throw NotImplementedException(); }
virtual void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
/** Called when a DNS request (question) is received.
* @param req The dns request
* @param reply The reply that will be sent
*/
virtual void OnDnsRequest(DNS::Query &req, DNS::Query *reply) { throw NotImplementedException(); }
virtual void OnDnsRequest(DNS::Query &req, DNS::Query *reply) ATTR_NOT_NULL(3) { throw NotImplementedException(); }
/** Called when a channels modes are being checked to see if they are allowed,
* mostly to ensure mlock/+r are set.
@@ -1012,7 +1000,7 @@ public:
* for a newly created channel to set the correct modes, topic,
* set.
*/
virtual void OnChannelSync(Channel *c) { throw NotImplementedException(); }
virtual void OnChannelSync(Channel *c) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called to set the correct modes on the user on the given channel
* @param user The user
@@ -1021,13 +1009,13 @@ public:
* @param give_modes If giving modes is desired
* @param take_modes If taking modes is desired
*/
virtual void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) { throw NotImplementedException(); }
virtual void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
virtual void OnSerializeCheck(Serialize::Type *) { throw NotImplementedException(); }
virtual void OnSerializableConstruct(Serializable *) { throw NotImplementedException(); }
virtual void OnSerializableDestruct(Serializable *) { throw NotImplementedException(); }
virtual void OnSerializableUpdate(Serializable *) { throw NotImplementedException(); }
virtual void OnSerializeTypeCreate(Serialize::Type *) { throw NotImplementedException(); }
virtual void OnSerializeCheck(Serialize::Type *st) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnSerializableConstruct(Serializable *st) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnSerializableDestruct(Serializable *st) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnSerializableUpdate(Serializable *st) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
virtual void OnSerializeTypeCreate(Serialize::Type *st) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called when a chanserv/set command is used
* @param source The source of the command
@@ -1036,7 +1024,7 @@ public:
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_ALLOW to bypass access checks, EVENT_STOP to halt immediately.
*/
virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) { throw NotImplementedException(); }
virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChannelInfo *ci, const Anope::string &setting) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called when a nickserv/set command is used.
* @param source The source of the command
@@ -1045,23 +1033,24 @@ public:
* @param setting The setting passed to the command. Probably ON/OFF.
* @return EVENT_STOP to halt immediately
*/
virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) { throw NotImplementedException(); }
virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) ATTR_NOT_NULL(3, 4) { throw NotImplementedException(); }
/** Called whenever a message is received from the uplink
* @param source The source of the message
* @param command The command being executed
* @param params Parameters
* @param tags Tags
* @return EVENT_STOP to prevent the protocol module from processing this message
*/
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> &param) { throw NotImplementedException(); }
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> &params, Anope::map<Anope::string> &tagss) { throw NotImplementedException(); }
/** Called to determine if a channel mode can be set by a user
* @param u The user
* @param cm The mode
*/
virtual EventReturn OnCanSet(User *u, const ChannelMode *cm) { throw NotImplementedException(); }
virtual EventReturn OnCanSet(User *u, const ChannelMode *cm) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
virtual EventReturn OnCheckDelete(Channel *) { throw NotImplementedException(); }
virtual EventReturn OnCheckDelete(Channel *c) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
/** Called every options:expiretimeout seconds. Should be used to expire nicks,
* channels, etc.
@@ -1074,14 +1063,7 @@ public:
* @param na The nick they are on
* @return EVENT_STOP to force the user off of the nick
*/
virtual EventReturn OnNickValidate(User *u, NickAlias *na) { throw NotImplementedException(); }
/** Called when a certain user has to be unbanned on a certain channel.
* May be used to send protocol-specific messages.
* @param u The user to be unbanned
* @param c The channel that user has to be unbanned on
*/
virtual void OnChannelUnban(User *u, ChannelInfo *ci) { throw NotImplementedException(); }
virtual EventReturn OnNickValidate(User *u, NickAlias *na) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
};
enum Implementation
@@ -1099,15 +1081,15 @@ enum Implementation
I_OnCreateChan, I_OnDelChan, I_OnChannelCreate, I_OnChannelDelete, I_OnAkickAdd, I_OnAkickDel, I_OnCheckKick,
I_OnChanInfo, I_OnCheckPriv, I_OnGroupCheckPriv, I_OnNickDrop, I_OnNickGroup, I_OnNickIdentify,
I_OnUserLogin, I_OnNickLogout, I_OnNickRegister, I_OnNickConfirm, I_OnNickSuspend, I_OnNickUnsuspended, I_OnDelNick, I_OnNickCoreCreate,
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearAccess, I_OnNickAddAccess, I_OnNickEraseAccess, I_OnNickClearCert,
I_OnDelCore, I_OnChangeCoreDisplay, I_OnNickClearCert,
I_OnNickAddCert, I_OnNickEraseCert, I_OnNickInfo, I_OnBotInfo, I_OnCheckAuthentication, I_OnNickUpdate,
I_OnFingerprint, I_OnUserAway, I_OnInvite, I_OnDeleteVhost, I_OnSetVhost, I_OnSetDisplayedHost, I_OnMemoSend, I_OnMemoDel,
I_OnFingerprint, I_OnUserAway, I_OnInvite, I_OnDeleteVHost, I_OnSetVHost, I_OnSetDisplayedHost, I_OnMemoSend, I_OnMemoDel,
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
I_OnMLock, I_OnUnMLock, I_OnModuleLoad, I_OnModuleUnload, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnBotNotice,
I_OnPrivmsg, I_OnLog, I_OnLogMessage, I_OnDnsRequest, I_OnCheckModes, I_OnChannelSync, I_OnSetCorrectModes,
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate,
I_OnSerializeTypeCreate, I_OnSetChannelOption, I_OnSetNickOption, I_OnMessage, I_OnCanSet, I_OnCheckDelete,
I_OnExpireTick, I_OnNickValidate, I_OnChannelUnban,
I_OnExpireTick, I_OnNickValidate,
I_SIZE
};
+2 -2
View File
@@ -46,13 +46,13 @@ struct BadWords
* @param type The type (SINGLE START END)
* @return The badword
*/
virtual BadWord* AddBadWord(const Anope::string &word, BadWordType type) = 0;
virtual BadWord *AddBadWord(const Anope::string &word, BadWordType type) = 0;
/** Get a badword structure by index
* @param index The index
* @return The badword
*/
virtual BadWord* GetBadWord(unsigned index) const = 0;
virtual BadWord *GetBadWord(unsigned index) const = 0;
/** Get how many badwords are on this channel
* @return The number of badwords in the vector
+1 -1
View File
@@ -33,5 +33,5 @@ public:
delete (*this)->at(i - 1);
}
virtual EntryMsg* Create() = 0;
virtual EntryMsg *Create() = 0;
};
+117 -8
View File
@@ -13,26 +13,135 @@
namespace Encryption
{
typedef std::pair<const unsigned char *, size_t> Hash;
typedef std::pair<const uint32_t *, size_t> IV;
/** Base class for encryption contexts. */
class Context
{
public:
virtual ~Context() = default;
/** Updates the encryption context with the specified data.
* @param str The data to update the context with.
*/
inline void Update(const Anope::string &str)
{
Update(reinterpret_cast<const unsigned char *>(str.c_str()), str.length());
}
/** Updates the encryption context with the specified data.
* @param data The data to update the context with.
* @param len The length of the data.
*/
virtual void Update(const unsigned char *data, size_t len) = 0;
virtual void Finalize() = 0;
virtual Hash GetFinalizedHash() = 0;
/** Finalises the encryption context and returns the digest. */
virtual Anope::string Finalize() = 0;
};
/** Provider of encryption contexts. */
class Provider
: public Service
{
public:
Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
/** The byte size of the block cipher. */
const size_t block_size;
/** The byte size of the resulting digest. */
const size_t digest_size;
/** Creates a provider of encryption contexts.
* @param creator The module that created this provider.
* @param algorithm The name of the encryption algorithm.
* @param bs The byte size of the block cipher.
* @param ds The byte size of the resulting digest.
*/
Provider(Module *creator, const Anope::string &algorithm, size_t bs, size_t ds)
: Service(creator, "Encryption::Provider", algorithm)
, block_size(bs)
, digest_size(ds)
{
}
virtual ~Provider() = default;
virtual Context *CreateContext(IV * = NULL) = 0;
virtual IV GetDefaultIV() = 0;
/** Checks whether a plain text value matches a hash created by this provider. */
virtual bool Compare(const Anope::string &hash, const Anope::string &plain)
{
return !hash.empty() && hash.equals_cs(ToPrintable(Encrypt(plain)));
}
/** Called on initialising a encryption provider to check it works properly. */
void Check(const Anope::map<Anope::string> &checks)
{
for (const auto &[hash, plain] : checks)
{
if (!Compare(hash, plain))
throw ModuleException("BUG: unable to generate " + this->name + " hashes safely! Please report this!");
}
Log(LOG_DEBUG) << "The " << this->name << " encryption provider appears to be working correctly.";
}
/** Creates a new encryption context. */
virtual std::unique_ptr<Context> CreateContext() = 0;
/** Quickly encrypts the specified values and returns the digest. */
template<typename... Args>
Anope::string Encrypt(Args &&...args)
{
auto context = CreateContext();
context->Update(std::forward<Args>(args)...);
return context->Finalize();
}
/** Calculates the RFC 2104 hash-based message authentication code for the specified data. */
inline Anope::string HMAC(const Anope::string &key, const Anope::string &data)
{
if (!block_size)
return {};
auto keybuf = key.length() > block_size ? Encrypt(key) : key;
keybuf.resize(block_size);
Anope::string hmac1;
Anope::string hmac2;
for (size_t i = 0; i < block_size; ++i)
{
hmac1.push_back(static_cast<char>(keybuf[i] ^ 0x5C));
hmac2.push_back(static_cast<char>(keybuf[i] ^ 0x36));
}
hmac2.append(data);
hmac1.append(Encrypt(hmac2));
return Encrypt(hmac1);
}
/** Converts a hash to its printable form. */
virtual Anope::string ToPrintable(const Anope::string &hash)
{
return Anope::Hex(hash);
}
};
/** Helper template for creating simple providers of encryption contexts. */
template <typename T>
class SimpleProvider final
: public Provider
{
public:
/** Creates a simple provider of encryption contexts.
* @param creator The module that created this provider.
* @param algorithm The name of the encryption algorithm.
* @param bs The byte size of the block cipher.
* @param ds The byte size of the resulting digest.
*/
SimpleProvider(Module *creator, const Anope::string &algorithm, size_t bs, size_t ds)
: Provider(creator, algorithm, bs, ds)
{
}
/** @copydoc Encryption::Provider::CreateContext. */
std::unique_ptr<Context> CreateContext() override
{
return std::make_unique<T>();
}
};
}
+23
View File
@@ -0,0 +1,23 @@
/*
*
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#pragma once
class HostRequest
{
protected:
HostRequest() = default;
public:
Anope::string nick;
Anope::string ident;
Anope::string host;
time_t time = 0;
virtual ~HostRequest() = default;
};
+4 -4
View File
@@ -27,9 +27,9 @@ struct HTTPReply final
std::vector<cookie> cookies;
HTTPReply() = default;
HTTPReply& operator=(const HTTPReply &) = default;
HTTPReply &operator=(const HTTPReply &) = default;
HTTPReply(const HTTPReply& other) : error(other.error), length(other.length)
HTTPReply(const HTTPReply &other) : error(other.error), length(other.length)
{
content_type = other.content_type;
headers = other.headers;
@@ -169,7 +169,7 @@ public:
virtual bool RegisterPage(HTTPPage *page) = 0;
virtual void UnregisterPage(HTTPPage *page) = 0;
virtual HTTPPage* FindPage(const Anope::string &name) = 0;
virtual HTTPPage *FindPage(const Anope::string &name) = 0;
};
namespace HTTPUtils
@@ -180,7 +180,7 @@ namespace HTTPUtils
for (unsigned i = 0; i < url.length(); ++i)
{
const char& c = url[i];
const char &c = url[i];
if (c == '%' && i + 2 < url.length())
{
+49
View File
@@ -0,0 +1,49 @@
/*
*
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#pragma once
class OperInfo
{
protected:
OperInfo() = default;
OperInfo(const Anope::string &t, const Anope::string &i, const Anope::string &a, time_t c)
: target(t)
, info(i)
, adder(a)
, created(c)
{
}
public:
Anope::string target;
Anope::string info;
Anope::string adder;
time_t created = 0;
virtual ~OperInfo() = default;
};
class OperInfoList
: public Serialize::Checker<std::vector<OperInfo *>>
{
public:
OperInfoList()
: Serialize::Checker<std::vector<OperInfo *>>("OperInfo")
{
}
virtual ~OperInfoList()
{
for (auto *info : *(*this))
delete info;
}
virtual OperInfo *Create() = 0;
};
+11 -1
View File
@@ -54,6 +54,15 @@ public:
*/
virtual void EraseCert(const Anope::string &entry) = 0;
/** Replaces a fingerprint in the nick's certificate list
*
* @param oldentry The old fingerprint to remove
* @param newentry The new fingerprint to add
*
* Replaces the specified fingerprint in the cert list.
*/
virtual void ReplaceCert(const Anope::string &oldentry, const Anope::string &newentry) = 0;
/** Clears the entire nick's cert list
*
* Deletes all the memory allocated in the certificate list vector and then clears the vector.
@@ -69,5 +78,6 @@ class CertService
public:
CertService(Module *c) : Service(c, "CertService", "certs") { }
virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
virtual NickCore *FindAccountFromCert(const Anope::string &cert) = 0;
virtual void ReplaceCert(const Anope::string &oldcert, const Anope::string &newcert) = 0;
};
+1 -1
View File
@@ -41,7 +41,7 @@ public:
virtual void RemoveForbid(ForbidData *d) = 0;
virtual ForbidData* CreateForbid() = 0;
virtual ForbidData *CreateForbid() = 0;
virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
+46
View File
@@ -0,0 +1,46 @@
/*
*
* (C) 2011-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#pragma once
struct MyOper final
: Oper
, Serializable
{
MyOper(const Anope::string &n, OperType *o) : Oper(n, o), Serializable("Oper") { }
void Serialize(Serialize::Data &data) const override
{
data.Store("name", this->name);
data.Store("type", this->ot->GetName());
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string stype, sname;
data["type"] >> stype;
data["name"] >> sname;
OperType *ot = OperType::Find(stype);
if (ot == NULL)
return NULL;
NickCore *nc = NickCore::Find(sname);
if (nc == NULL)
return NULL;
MyOper *myo;
if (obj)
myo = anope_dynamic_static_cast<MyOper *>(obj);
else
myo = new MyOper(nc->display, ot);
nc->o = myo;
Log(LOG_NORMAL, "operserv/oper") << "Tied oper " << nc->display << " to type " << ot->GetName();
return myo;
}
};
+8 -8
View File
@@ -29,7 +29,7 @@ struct Exception final
Exception() : Serializable("Exception") { }
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
class SessionService
@@ -62,15 +62,15 @@ static ServiceReference<SessionService> session_service("SessionService", "sessi
void Exception::Serialize(Serialize::Data &data) const
{
data["mask"] << this->mask;
data["limit"] << this->limit;
data["who"] << this->who;
data["reason"] << this->reason;
data["time"] << this->time;
data["expires"] << this->expires;
data.Store("mask", this->mask);
data.Store("limit", this->limit);
data.Store("who", this->who);
data.Store("reason", this->reason);
data.Store("time", this->time);
data.Store("expires", this->expires);
}
Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
Serializable *Exception::Unserialize(Serializable *obj, Serialize::Data &data)
{
if (!session_service)
return NULL;
+54 -7
View File
@@ -8,21 +8,68 @@
#pragma once
#define GLOBAL_NO_MESSAGE _("You do not have any messages queued and did not specify a message to send.")
#define GLOBAL_QUEUE_CONFLICT _("You can not send a single message while you have messages queued.")
class GlobalService
: public Service
{
public:
GlobalService(Module *m) : Service(m, "GlobalService", "Global")
GlobalService(Module *m)
: Service(m, "GlobalService", "Global")
{
}
/** Retrieves the bot which sends global messages unless otherwise specified. */
virtual Reference<BotInfo> GetDefaultSender() = 0;
virtual Reference<BotInfo> GetDefaultSender() const = 0;
/** Send out a global message to all users
* @param sender Our client which should send the global
* @param source The sender of the global
* @param message The message
/** Clears any queued messages for the specified account.
* @param nc The account to clear queued messages for.
*/
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
virtual void ClearQueue(NickCore *nc) = 0;
/** Retrieves the size of the messages queue for the specified user.
* @param nc The account to count queued messages for.
*/
inline size_t CountQueue(NickCore* nc) const
{
auto *q = GetQueue(nc);
return q ? q->size() : 0;
}
/** Retrieves the messages queue for the specified user.
* @param nc The account to retrieve queued messages for.
*/
virtual const std::vector<Anope::string> *GetQueue(NickCore* nc) const = 0;
/** Queues a message to be sent later.
* @param nc The account to queue the message for.
* @param message The message to queue.
* @return The new number of messages in the queue.
*/
virtual size_t Queue(NickCore *nc, const Anope::string &message) = 0;
/** Sends a single message to all users on the network.
* @param message The message to send.
* @param source If non-nullptr then the source of the message.
* @param sender If non-nullptr then the bot to send the message from.
* @param server If non-nullptr then the server to send messages to.
* @return If the message was sent then true; otherwise, false.
*/
virtual bool SendSingle(const Anope::string &message, CommandSource *source = nullptr, BotInfo *sender = nullptr, Server *server = nullptr) = 0;
/** Sends a message queue to all users on the network.
* @param source The source of the message.
* @param sender If non-nullptr then the bot to send the message from.
* @param server If non-nullptr then the server to send messages to.
* @return If the message queue was sent then true; otherwise, false.
*/
virtual bool SendQueue(CommandSource &source, BotInfo *sender = nullptr, Server *server = nullptr) = 0;
/** Unqueues a message from the message queue.
* @param nc The account to unqueue the message from.
* @param idx The index of the item to remove.
* @return Whether the message was removed from the queue.
*/
virtual bool Unqueue(NickCore *nc, size_t idx) = 0;
};
+2 -2
View File
@@ -32,7 +32,7 @@ namespace SASL
virtual Anope::string GetAgent() = 0;
virtual Session* GetSession(const Anope::string &uid) = 0;
virtual Session *GetSession(const Anope::string &uid) = 0;
virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) = 0;
@@ -67,7 +67,7 @@ namespace SASL
public:
Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { }
virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); }
virtual Session *CreateSession(const Anope::string &uid) { return new Session(this, uid); }
virtual void ProcessMessage(Session *session, const Message &) = 0;
+17 -24
View File
@@ -8,6 +8,8 @@
#pragma once
#include <stdexcept>
namespace SQL
{
@@ -17,14 +19,14 @@ namespace SQL
public:
typedef std::map<Anope::string, std::stringstream *> Map;
Map data;
std::map<Anope::string, Type> types;
std::map<Anope::string, Serialize::DataType> types;
~Data()
{
Clear();
}
std::iostream& operator[](const Anope::string &key) override
std::iostream &operator[](const Anope::string &key) override
{
std::stringstream *&ss = data[key];
if (!ss)
@@ -32,14 +34,6 @@ namespace SQL
return *ss;
}
std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (const auto &[key, _] : this->data)
keys.insert(key);
return keys;
}
size_t Hash() const override
{
size_t hash = 0;
@@ -66,17 +60,17 @@ namespace SQL
this->data.clear();
}
void SetType(const Anope::string &key, Type t) override
void SetType(const Anope::string &key, Serialize::DataType dt) override
{
this->types[key] = t;
this->types[key] = dt;
}
Type GetType(const Anope::string &key) const override
Serialize::DataType GetType(const Anope::string &key) const override
{
std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
auto it = this->types.find(key);
if (it != this->types.end())
return it->second;
return DT_TEXT;
return Serialize::DataType::TEXT;
}
};
@@ -107,7 +101,7 @@ namespace SQL
Query() { }
Query(const Anope::string &q) : query(q) { }
Query& operator=(const Anope::string &q)
Query &operator=(const Anope::string &q)
{
this->query = q;
this->parameters.clear();
@@ -124,15 +118,14 @@ namespace SQL
return !(*this == other);
}
template<typename T> void SetValue(const Anope::string &key, const T& value, bool escape = true)
template<typename T> void SetValue(const Anope::string &key, const T &value, bool escape = true)
{
try
{
Anope::string string_value = stringify(value);
this->parameters[key].data = string_value;
this->parameters[key].escape = escape;
}
catch (const ConvertException &ex) { }
auto str = Anope::TryString(value);
if (!str.has_value())
return;
this->parameters[key].data = str.value();
this->parameters[key].escape = escape;
}
};
+1 -1
View File
@@ -18,7 +18,7 @@ public:
Anope::string name;
Anope::string id;
std::deque<Anope::string> data;
HTTPReply& r;
HTTPReply &r;
XMLRPCRequest(HTTPReply &_r) : r(_r) { }
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.emplace(dname, ddata); }
+35
View File
@@ -0,0 +1,35 @@
/*
*
* (C) 2003-2024 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*/
#pragma once
enum
{
RPL_STATSLINKINFO = 211,
RPL_ENDOFSTATS = 219,
RPL_STATSUPTIME = 242,
RPL_STATSOLINE = 243,
RPL_STATSCONN = 250,
RPL_WHOISREGNICK = 307,
RPL_WHOISUSER = 311,
RPL_WHOISSERVER = 312,
RPL_WHOISOPERATOR = 313,
RPL_WHOISIDLE = 317,
RPL_ENDOFWHOIS = 318,
RPL_VERSION = 351,
RPL_MOTD = 372,
RPL_MOTDSTART = 375,
RPL_ENDOFMOTD = 376,
RPL_YOUREOPER = 381,
RPL_TIME = 391,
ERR_NOSUCHNICK = 401,
ERR_NOMOTD = 422,
};
+3 -3
View File
@@ -23,7 +23,7 @@ struct CoreExport Oper
/* Whether the user must be an IRC operator (umode +o) to be considered a services operator */
bool require_oper = true;
Anope::string password;
Anope::string certfp;
std::vector<Anope::string> certfp;
/* Hosts allowed to use this operator block */
std::vector<Anope::string> hosts;
Anope::string vhost;
@@ -115,10 +115,10 @@ public:
/** Gets the icommands for this opertype
* @return A list of commands
*/
const std::list<Anope::string> GetCommands() const;
std::list<Anope::string> GetCommands() const;
/** Gets the privileges for this opertype
* @return A list of privileges
*/
const std::list<Anope::string> GetPrivs() const;
std::list<Anope::string> GetPrivs() const;
};
+182 -70
View File
@@ -16,6 +16,17 @@
#include "service.h"
#include "modes.h"
/** Thrown when a protocol error happens. */
class CoreExport ProtocolException final
: public ModuleException
{
public:
ProtocolException(const Anope::string &message)
: ModuleException(message)
{
}
};
/* Encapsulates the IRCd protocol we are speaking. */
class CoreExport IRCDProto
: public Service
@@ -25,61 +36,114 @@ class CoreExport IRCDProto
protected:
IRCDProto(Module *creator, const Anope::string &proto_name);
public:
/** Retrieves the protocol name. */
const Anope::string &GetProtocolName() const { return proto_name; }
virtual ~IRCDProto();
virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &);
virtual void SendModeInternal(const MessageSource &, const Channel *, const Anope::string &);
virtual void SendModeInternal(const MessageSource &, User *, const Anope::string &);
virtual void SendKickInternal(const MessageSource &, const Channel *, User *, const Anope::string &);
virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg);
virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
virtual void SendQuitInternal(User *, const Anope::string &buf);
virtual void SendPartInternal(User *, const Channel *chan, const Anope::string &buf);
virtual void SendGlobopsInternal(const MessageSource &, const Anope::string &buf);
virtual void SendCTCPInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf);
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const Anope::string &msg, const Anope::map<Anope::string> &tags = {});
virtual void SendTagmsg(const MessageSource &source, const Anope::string &dest, const Anope::map<Anope::string> &tags);
const Anope::string &GetProtocolName();
virtual bool Parse(const Anope::string &, Anope::map<Anope::string> &, Anope::string &, Anope::string &, std::vector<Anope::string> &);
virtual Anope::string Format(const Anope::string &source, const Anope::string &message);
/** Parses an incoming message from the IRC server.
* @param message The message to parse.
* @param tags The location to store tags.
* @param source The location to store the source.
* @param command The location to store the command name.
* @param params The location to store the parameters.
* @return If the message was well formed then true; otherwise, false.
*/
virtual bool Parse(const Anope::string &message, Anope::map<Anope::string> &tags, Anope::string &source, Anope::string &command, std::vector<Anope::string> &params);
/* Formats an outgoing message so it can be sent to the IRC server.
* @param message The location to store the formatted message.
* @param tags IRCv3 message tags.
* @param source Source of the message.
* @param command Command name.
* @param params Any extra parameters.
* @return If the message was formatted then true; otherwise, false.
*/
virtual bool Format(Anope::string &message, const Anope::map<Anope::string> &tags, const MessageSource &source, const Anope::string &command, const std::vector<Anope::string> &params);
/* Modes used by default by our clients */
Anope::string DefaultPseudoclientModes;
Anope::string DefaultPseudoclientModes = "+io";
/* Can we force change a users's nick? */
bool CanSVSNick;
bool CanSVSNick = false;
/* Can we force join or part users? */
bool CanSVSJoin;
/* Can we set vhosts/vidents on users? */
bool CanSetVHost, CanSetVIdent;
bool CanSVSJoin = false;
/** Can we force servers to remove opers? */
bool CanSVSNOOP = false;
/* Can we set vhosts on users? */
bool CanSetVHost = false;
/* Can we set vidents on users? */
bool CanSetVIdent = false;
/* Can we ban specific gecos from being used? */
bool CanSNLine;
bool CanSNLine = false;
/* Can we ban specific nicknames from being used? */
bool CanSQLine;
bool CanSQLine = false;
/* Can we ban specific channel names from being used? */
bool CanSQLineChannel;
bool CanSQLineChannel = false;
/* Can we ban by IP? */
bool CanSZLine;
bool CanSZLine = false;
/* Can we place temporary holds on specific nicknames? */
bool CanSVSHold;
bool CanSVSHold = false;
/* See ns_cert */
bool CanCertFP;
/* Can we send arbitrary message tags? */
bool CanSendTags;
/* Can users log out before being fully connected? */
bool CanSVSLogout;
bool CanCertFP = false;
/* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
bool RequiresID;
bool RequiresID = false;
/* If this IRCd has unique ids, whether the IDs and nicknames are ambiguous */
bool AmbiguousID;
/* The maximum number of modes we are allowed to set with one MODE command */
unsigned MaxModes;
bool AmbiguousID = false;
/** Can we ask the server to unban a user? */
bool CanClearBans = false;
/** Can we send tag messages? */
bool CanTagMessage = false;
/* The maximum length of a channel name. */
size_t MaxChannel = 0;
/* The maximum length of a hostname. */
size_t MaxHost = 0;
/* The maximum number of bytes a line may have */
unsigned MaxLine;
size_t MaxLine = 512;
/* The maximum number of modes we are allowed to set with one MODE command */
size_t MaxModes = 3;
/* The maximum length of a nickname. */
size_t MaxNick = 0;
/* The maximum length of a username. */
size_t MaxUser = 0;
/* Retrieves the next free UID or SID */
virtual Anope::string UID_Retrieve();
virtual Anope::string SID_Retrieve();
/** Extracts a timestamp from a string. */
virtual time_t ExtractTimestamp(const Anope::string &str);
/** Sends an error to the uplink before disconnecting.
* @param reason The error message.
*/
virtual void SendError(const Anope::string &reason);
/** Sets the server in NOOP mode. If NOOP mode is enabled, no users
* will be able to oper on the server.
* @param s The server
@@ -98,8 +162,8 @@ public:
* @param vident The ident to set
* @param vhost The vhost to set
*/
virtual void SendVhost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
virtual void SendVhostDel(User *) { }
virtual void SendVHost(User *u, const Anope::string &vident, const Anope::string &vhost) { }
virtual void SendVHostDel(User *) { }
/** Sets an akill. This is a recursive function that can be called multiple times
* for the same xline, but for different users, if the xline is not one that can be
@@ -127,29 +191,38 @@ public:
/** Kills a user
* @param source Who is doing the kill
* @param user The user to be killed
* @param fmt Kill reason
* @param msg Kill reason
*/
virtual void SendSVSKill(const MessageSource &source, User *user, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendSVSKill(const MessageSource &source, User *user, const Anope::string &msg);
virtual void SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values);
template <typename... Args>
void SendMode(const MessageSource &source, Channel *chan, const Anope::string &modes, Args &&...args)
{
SendModeInternal(source, chan, modes, { Anope::ToString(args)... });
}
virtual void SendModeInternal(const MessageSource &source, User *u, const Anope::string &modes, const std::vector<Anope::string> &values);
template <typename... Args>
void SendMode(const MessageSource &source, User *u, const Anope::string &modes, Args &&...args)
{
SendModeInternal(source, u, modes, { Anope::ToString(args)... });
}
/** Introduces a client to the rest of the network
* @param u The client to introduce
*/
virtual void SendClientIntroduction(User *u) = 0;
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...) ATTR_FORMAT(5, 6);
virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const Anope::string &msg);
virtual void SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendQuit(User *u, const char *fmt, ...) ATTR_FORMAT(3, 4);
virtual void SendContextNotice(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
virtual void SendContextPrivmsg(BotInfo *bi, User *target, Channel *context, const Anope::string &msg);
virtual void SendQuit(User *u, const Anope::string &msg);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
@@ -161,15 +234,15 @@ public:
* stacker to be set "soon".
*/
virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0;
virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendPart(User *u, const Channel *chan, const Anope::string &msg);
/** Force joins a user that isn't ours to a channel.
* @param bi The source of the message
* @param u The user to join
* @param chan The channel to join the user to
* @param param Channel key?
* @param key Channel key
*/
virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) { }
/** Force parts a user that isn't ours from a channel.
* @param source The source of the message
@@ -180,7 +253,7 @@ public:
virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendInvite(const MessageSource &source, const Channel *c, User *u);
virtual void SendGlobops(const MessageSource &source, const char *fmt, ...) ATTR_FORMAT(3, 4);
virtual void SendGlobops(const MessageSource &source, const Anope::string &msg);
/** Sends a nick change of one of our clients.
*/
@@ -211,7 +284,12 @@ public:
virtual void SendServer(const Server *) = 0;
virtual void SendSquit(Server *, const Anope::string &message);
virtual void SendNumeric(int numeric, const Anope::string &dest, const char *fmt, ...) ATTR_FORMAT(4, 5);
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const std::vector<Anope::string> &params);
template <typename... Args>
void SendNumeric(int numeric, const Anope::string &dest, Args &&...args)
{
SendNumericInternal(numeric, dest, { Anope::ToString(args)... });
}
virtual void SendLogin(User *u, NickAlias *na) = 0;
virtual void SendLogout(User *u) = 0;
@@ -219,13 +297,15 @@ public:
/** Send a channel creation message to the uplink.
* On most TS6 IRCds this is a SJOIN with no nick
*/
virtual void SendChannel(Channel *c) { }
virtual void SendChannel(Channel *c) = 0;
/** Make the user an IRC operator
* Normally this is a simple +o, though some IRCds require us to send the oper type
*/
virtual void SendOper(User *u);
virtual void SendClearBans(const MessageSource &user, Channel *c, User* u) { }
virtual void SendSASLMechanisms(std::vector<Anope::string> &) { }
virtual void SendSASLMessage(const SASL::Message &) { }
virtual void SendSVSLogin(const Anope::string &uid, NickAlias *na) { }
@@ -235,14 +315,15 @@ public:
virtual bool IsIdentValid(const Anope::string &);
virtual bool IsHostValid(const Anope::string &);
virtual bool IsExtbanValid(const Anope::string &) { return false; }
virtual bool IsTagValid(const Anope::string &, const Anope::string &) { return false; }
/** Retrieve the maximum number of list modes settable on this channel
* Defaults to Config->ListSize
*/
virtual unsigned GetMaxListFor(Channel *c);
virtual unsigned GetMaxListFor(Channel *c, ChannelMode *cm);
virtual size_t GetMaxListFor(Channel *c, ChannelMode *cm);
virtual Anope::string NormalizeMask(const Anope::string &mask);
};
class CoreExport MessageSource final
@@ -252,7 +333,7 @@ class CoreExport MessageSource final
Server *s = nullptr;
public:
MessageSource(const Anope::string &);
explicit MessageSource(const Anope::string &);
MessageSource(User *u);
MessageSource(Server *s);
const Anope::string &GetName() const;
@@ -262,26 +343,57 @@ public:
Server *GetServer() const;
};
enum IRCDMessageFlag
{
IRCDMESSAGE_SOFT_LIMIT,
IRCDMESSAGE_REQUIRE_SERVER,
IRCDMESSAGE_REQUIRE_USER
};
/** Base class for protocol module message handlers. */
class CoreExport IRCDMessage
: public Service
{
Anope::string name;
unsigned param_count;
std::set<IRCDMessageFlag> flags;
public:
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
unsigned GetParamCount() const;
virtual void Run(MessageSource &, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) = 0;
/** An enumeration of potential flags a command can have. */
enum Flag
: uint8_t
{
/** The parameter count is a minimum instead of an exact limit. */
FLAG_SOFT_LIMIT,
void SetFlag(IRCDMessageFlag f) { flags.insert(f); }
bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); }
/** The message must come from a server. */
FLAG_REQUIRE_SERVER,
/** The message must come from a user. */
FLAG_REQUIRE_USER,
/** The highest flag possible. */
FLAG_MAX,
};
private:
/** The name of the message (e.g. PRIVMSG). */
const Anope::string name;
/** The number of parameters this command takes. */
const size_t param_count;
/** The flags that are set on the command. */
std::bitset<FLAG_MAX> flags;
public:
IRCDMessage(Module *o, const Anope::string &n, size_t pc = 0);
/** Retrieves the parameter count. */
inline size_t GetParamCount() const { return param_count; }
/** Runs the handler for this message.
* @param source Entity that sent the message.
* @param params Message parameters
* @param tags Message tags
*/
virtual void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) = 0;
/** Sets the flags for this message. */
inline void SetFlag(Flag flag, bool value = true) { flags.set(flag, value); }
/** Determines if a flag is set. */
inline bool HasFlag(Flag flag) const { return flags[flag]; }
};
/** MessageTokenizer allows tokens in the IRC wire format to be read from a string */
+8 -8
View File
@@ -16,7 +16,7 @@
#include "serialize.h"
#include "bots.h"
typedef Anope::hash_map<ChannelInfo *> registered_channel_map;
typedef Anope::unordered_map<ChannelInfo *> registered_channel_map;
extern CoreExport Serialize::Checker<registered_channel_map> RegisteredChannelList;
@@ -39,7 +39,7 @@ public:
AutoKick();
~AutoKick();
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
};
/* It matters that Base is here before Extensible (it is inherited by Serializable)
@@ -95,10 +95,10 @@ public:
ChannelInfo(const ChannelInfo &ci);
~ChannelInfo();
ChannelInfo& operator=(const ChannelInfo &) = default;
ChannelInfo &operator=(const ChannelInfo &) = default;
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
/** Change the founder of the channel
* @params nc The new founder
@@ -169,7 +169,7 @@ public:
* @param t The time the akick was added, defaults to now
* @param lu The time the akick was last used, defaults to never
*/
AutoKick* AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
AutoKick *AddAkick(const Anope::string &user, NickCore *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
/** Add an akick entry to the channel by reason
* @param user The user who added the akick
@@ -178,13 +178,13 @@ public:
* @param t The time the akick was added, defaults to now
* @param lu The time the akick was last used, defaults to never
*/
AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
AutoKick *AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0);
/** Get an entry from the channel akick list
* @param index The index in the akick vector
* @return The akick structure, or NULL if not found
*/
AutoKick* GetAkick(unsigned index) const;
AutoKick *GetAkick(unsigned index) const;
/** Get the size of the akick vector for this channel
* @return The akick vector size
@@ -238,7 +238,7 @@ public:
* @param name channel name to lookup
* @return the ChannelInfo associated with the channel
*/
static ChannelInfo* Find(const Anope::string &name);
static ChannelInfo *Find(const Anope::string &name);
void AddChannelReference(const Anope::string &what);
void RemoveChannelReference(const Anope::string &what);
+40 -19
View File
@@ -18,23 +18,44 @@
namespace Serialize
{
enum class DataType
: uint8_t
{
BOOL,
FLOAT,
INT,
TEXT,
UINT,
};
class Data
{
public:
enum Type
{
DT_TEXT,
DT_INT
};
virtual ~Data() = default;
virtual std::iostream& operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
virtual std::iostream &operator[](const Anope::string &key) = 0;
template <typename T>
void Store(const Anope::string &key, const T &value)
{
using Type = std::remove_cv_t<std::remove_reference_t<T>>;
if constexpr (std::is_same_v<Type, bool>)
SetType(key, DataType::BOOL);
else if constexpr (std::is_floating_point_v<Type>)
SetType(key, DataType::FLOAT);
else if constexpr (std::is_integral_v<Type> && std::is_signed_v<Type>)
SetType(key, DataType::INT);
else if constexpr (std::is_integral_v<Type> && std::is_unsigned_v<Type>)
SetType(key, DataType::UINT);
this->operator[](key) << value;
}
virtual size_t Hash() const { throw CoreException("Not supported"); }
virtual void SetType(const Anope::string &key, Type t) { }
virtual Type GetType(const Anope::string &key) const { return DT_TEXT; }
virtual void SetType(const Anope::string &key, DataType dt) { }
virtual DataType GetType(const Anope::string &key) const { return DataType::TEXT; }
};
extern void RegisterTypes();
@@ -97,7 +118,7 @@ public:
/** Get the type of serializable object this is
* @return The serializable object type
*/
Serialize::Type* GetSerializableType() const { return this->s_type; }
Serialize::Type *GetSerializableType() const { return this->s_type; }
virtual void Serialize(Serialize::Data &data) const = 0;
@@ -111,7 +132,7 @@ public:
class CoreExport Serialize::Type final
: public Base
{
typedef Serializable* (*unserialize_func)(Serializable *obj, Serialize::Data &);
typedef Serializable *(*unserialize_func)(Serializable *obj, Serialize::Data &);
static std::vector<Anope::string> TypeOrder;
static std::map<Anope::string, Serialize::Type *> Types;
@@ -168,7 +189,7 @@ public:
*/
void UpdateTimestamp();
Module* GetOwner() const { return this->owner; }
Module *GetOwner() const { return this->owner; }
static Serialize::Type *Find(const Anope::string &name);
@@ -201,23 +222,23 @@ class Serialize::Checker
public:
Checker(const Anope::string &n) : name(n) { }
inline const T* operator->() const
inline const T *operator->() const
{
this->Check();
return &this->obj;
}
inline T* operator->()
inline T *operator->()
{
this->Check();
return &this->obj;
}
inline const T& operator*() const
inline const T &operator*() const
{
this->Check();
return this->obj;
}
inline T& operator*()
inline T &operator*()
{
this->Check();
return this->obj;
@@ -305,7 +326,7 @@ public:
return NULL;
}
inline T* operator*() const
inline T *operator*() const
{
if (!this->invalid)
{
@@ -318,7 +339,7 @@ public:
return NULL;
}
inline T* operator->() const
inline T *operator->() const
{
if (!this->invalid)
{
+1 -1
View File
@@ -25,7 +25,7 @@ namespace Servers
* the only server whose uplink *is* Me that is not a juped server.
* @return Our uplink, or NULL if not uplinked to anything
*/
extern CoreExport Server* GetUplink();
extern CoreExport Server *GetUplink();
/* Server maps by name and id */
extern CoreExport Anope::map<Server *> ByName;
+24 -29
View File
@@ -11,39 +11,34 @@
#pragma once
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <exception>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <vector>
#ifndef _WIN32
# include <unistd.h>
#endif
#include "defs.h"
#include "sysconf.h"
#define BUFSIZE 1024
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <stdexcept>
#include <cstring>
#ifndef _WIN32
#include <unistd.h>
#endif
/* Pull in the various bits of STL */
#include <cstdint>
#include <cstddef>
#include <iostream>
#include <fstream>
#include <sstream>
#include <map>
#include <exception>
#include <list>
#include <vector>
#include <deque>
#include <bitset>
#include <set>
#include <algorithm>
#include <iterator>
#include "defs.h"
#define _(x) x
#ifndef _WIN32
+1 -1
View File
@@ -313,7 +313,7 @@ public:
/** Gets the new line from the input buffer, if any
*/
const Anope::string GetLine();
Anope::string GetLine();
/** Write to the socket
* @param message The message
+20 -4
View File
@@ -20,6 +20,24 @@
// Whether Anope was built in debug mode.
#cmakedefine01 DEBUG_BUILD
// The default config directory.
#define DEFAULT_CONF_DIR "@CONF_DIR@"
// The default data directory.
#define DEFAULT_DATA_DIR "@DATA_DIR@"
// The default locale directory.
#define DEFAULT_LOCALE_DIR "@LOCALE_DIR@"
// The default log directory.
#define DEFAULT_LOG_DIR "@LOG_DIR@"
// The default module directory.
#define DEFAULT_MODULE_DIR "@MODULE_DIR@"
// Whether the clock_gettime() function is available.
#cmakedefine01 HAVE_CLOCK_GETTIME
// Whether Anope was built with localization support.
#cmakedefine01 HAVE_LOCALIZATION
@@ -29,14 +47,12 @@
#ifdef _WIN32
# define popen _popen
# define pclose _pclose
# ifdef _MSC_VER
# define PATH_MAX MAX_PATH
# endif
# define sleep(x) Sleep(x * 1000)
#endif
#if defined __GNUC__
# define ATTR_FORMAT(STRINGPOS, FIRSTPOS) __attribute__((format(printf, STRINGPOS, FIRSTPOS)))
# define ATTR_NOT_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
#else
# define ATTR_FORMAT(STRINGPOS, FIRSTPOS)
# define ATTR_NOT_NULL(...)
#endif
+1 -1
View File
@@ -26,7 +26,7 @@ private:
public:
/* Handle for this thread */
std::thread *handle = nullptr;
std::unique_ptr<std::thread> handle;
/** Threads destructor
*/
+1 -1
View File
@@ -18,7 +18,7 @@ class CoreExport Timer
private:
/** The owner of the timer, if any
*/
Module *owner;
Module *owner = nullptr;
/** The triggering time
*/
+26 -17
View File
@@ -13,10 +13,36 @@
#include "sockets.h"
#include "protocol.h"
#include "servers.h"
namespace Uplink
{
extern void Connect();
extern CoreExport void SendInternal(const Anope::map<Anope::string> &, const MessageSource &, const Anope::string &, const std::vector<Anope::string> &);
template<typename... Args>
void Send(const Anope::map<Anope::string> &tags, const MessageSource &source, const Anope::string &command, Args &&...args)
{
SendInternal(tags, source, command, { Anope::ToString(args)... });
}
template<typename... Args>
void Send(const Anope::map<Anope::string> &tags, const Anope::string &command, Args &&...args)
{
SendInternal(tags, Me, command, { Anope::ToString(args)... });
}
template<typename... Args>
void Send(const MessageSource &source, const Anope::string &command, Args &&...args)
{
SendInternal({}, source, command, { Anope::ToString(args)... });
}
template<typename... Args>
void Send(const Anope::string &command, Args &&...args)
{
SendInternal({}, Me, command, { Anope::ToString(args)... });
}
}
/* This is the socket to our uplink */
@@ -31,22 +57,5 @@ public:
bool ProcessRead() override;
void OnConnect() override;
void OnError(const Anope::string &) override;
/* A message sent over the uplink socket */
class CoreExport Message final
{
MessageSource source;
std::stringstream buffer;
public:
Message();
Message(const MessageSource &);
~Message();
template<typename T> Message &operator<<(const T &val)
{
this->buffer << val;
return *this;
}
};
};
extern CoreExport UplinkSocket *UplinkSock;
+13 -13
View File
@@ -19,7 +19,7 @@
#include "account.h"
#include "sockets.h"
typedef Anope::hash_map<User *> user_map;
typedef Anope::unordered_map<User *> user_map;
extern CoreExport user_map UserListByNick, UserListByUID;
@@ -44,8 +44,6 @@ protected:
Anope::string vident;
Anope::string ident;
Anope::string uid;
/* If the user is on the access list of the nick they're on */
bool on_access;
/* Map of user modes and the params this user has (if any) */
ModeList modes;
/* NickCore account the user is currently logged in as, if they are logged in */
@@ -116,7 +114,7 @@ protected:
virtual ~User();
public:
static User* OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
static User *OnIntroduce(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ts, const Anope::string &smodes, const Anope::string &suid, NickCore *nc);
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.
@@ -193,6 +191,7 @@ public:
*/
void SendMessage(BotInfo *source, const char *fmt, ...) ATTR_FORMAT(3, 4);
void SendMessage(BotInfo *source, const Anope::string &msg) override;
void SendMessage(CommandSource &source, const Anope::string &msg) override;
/** Identify the user to a nick.
* updates last_seen, logs the user in,
@@ -216,18 +215,17 @@ public:
*/
NickCore *Account() const;
/** Get the account nick the user is logged in using
* @return The account nick or NULL
*/
NickAlias *AccountNick() const;
/** Check if the user is identified for their nick
* @param check_nick True to check if the user is identified to the nickname they are on too
* @return true or false
*/
bool IsIdentified(bool check_nick = false) const;
/** Check if the user is recognized for their nick (on the nicks access list)
* @param check_secure Only returns true if the user has secure off
* @return true or false
*/
bool IsRecognized(bool check_secure = true) const;
/** Check if the user is connected securely.
* @return True if the user is connected securely; otherwise, false.
*/
@@ -250,8 +248,7 @@ public:
*/
bool HasPriv(const Anope::string &privstr);
/** Update the last usermask stored for a user, and check to see if they are recognized
*/
/** Update the last usermask stored for a user. */
void UpdateHost();
/** Check if the user has a mode
@@ -368,12 +365,15 @@ public:
*/
bool BadPassword();
/** Determines whether this user should receive a PRIVMSG instead of a NOTICE. */
bool ShouldPrivmsg() const;
/** Finds a user by nick, or possibly UID
* @param name The nick, or possibly UID, to lookup
* @param nick_only set to true to only look up by nick, not UID
* @return the user, if they exist
*/
static User* Find(const Anope::string &name, bool nick_only = false);
static User *Find(const Anope::string &name, bool nick_only = false);
/** Quits all users who are pending to be quit
*/
+1 -1
View File
@@ -42,7 +42,7 @@ static std::string get_git_hash(const std::string &git_dir)
}
fd.close();
return "g" + filebuf.substr(0, 7);
return filebuf.substr(0, 7);
}
static bool read_version_sh(const std::string &version_sh, std::map<std::string, std::string> &versions)
+3 -3
View File
@@ -45,7 +45,7 @@ public:
bool IsRegex() const;
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
/* Managers XLines. There is one XLineManager per type of XLine. */
@@ -125,7 +125,7 @@ public:
* @param index The index
* @return The XLine, or NULL if the index is out of bounds
*/
XLine* GetEntry(unsigned index);
XLine *GetEntry(unsigned index);
/** Clear the XLine vector
* Note: This does not remove the XLines from the IRCd
@@ -145,7 +145,7 @@ public:
* @param mask The mask
* @return The XLine the user matches, or NULL
*/
XLine* HasEntry(const Anope::string &mask);
XLine *HasEntry(const Anope::string &mask);
/** Check a user against all of the xlines in this XLineManager
* @param u The user
File diff suppressed because it is too large Load Diff
+535 -627
View File
File diff suppressed because it is too large Load Diff
+19 -19
View File
@@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-08 13:20+0000\n"
"PO-Revision-Date: 2024-01-08 13:33+0000\n"
"Last-Translator: Thomas Fargeix <t.fargeix@gmail.com>\n"
"POT-Creation-Date: 2024-02-22 16:34+0000\n"
"PO-Revision-Date: 2024-02-22 16:36+0000\n"
"Last-Translator: Val Lorentz <progval+git@progval.net>\n"
"Language-Team: French\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
@@ -2640,15 +2640,15 @@ msgid "Bot bans will no longer automatically expire."
msgstr "Le bans du bot n'expireront plus automatiquement."
#, c-format
msgid "Bot hosts may only be %d characters long."
msgstr "Les hosts des bots ne doivent contenir que %d caractères."
msgid "Bot hosts may only be %zu characters long."
msgstr "Les hosts des bots ne doivent contenir que %zu caractères."
msgid "Bot hosts may only contain valid host characters."
msgstr "Les hosts des bots ne doivent contenir que des caractères valides pour un host."
#, c-format
msgid "Bot idents may only be %d characters long."
msgstr "Les ident des bots ne doivent contenir que %d caractères."
msgid "Bot idents may only be %zu characters long."
msgstr "Les ident des bots ne doivent contenir que %zu caractères."
msgid "Bot idents may only contain valid ident characters."
msgstr "Les ident des bots ne doivent contenir que des caractères valides pour un ident."
@@ -2664,8 +2664,8 @@ msgid "Bot nick"
msgstr "Pseudo du bot"
#, c-format
msgid "Bot nicks may only be %d characters long."
msgstr "Les pseudos des bots ne doivent contenir que %d caractères."
msgid "Bot nicks may only be %zu characters long."
msgstr "Les pseudos des bots ne doivent contenir que %zu caractères."
msgid "Bot nicks may only contain valid nick characters."
msgstr "Les pseudos des bots ne peuvent contenir que des caractères valides."
@@ -3949,12 +3949,12 @@ msgid "Error reloading configuration file: %s"
msgstr "Erreur en rechargeant le fichier de configuration : %s"
#, c-format
msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters."
msgstr "Erreur ! L'ident du vHost est trop long, merci d'utiliser un ident plus court que %d caractères."
msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters."
msgstr "Erreur ! L'ident du vHost est trop long, merci d'utiliser un ident plus court que %zu caractères."
#, c-format
msgid "Error! The vHost is too long, please use a hostname shorter than %d characters."
msgstr "Erreur ! Le vHost est trop long, merci d'utiliser un hostname plus court que %d caractères."
msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters."
msgstr "Erreur ! Le vHost est trop long, merci d'utiliser un hostname plus court que %zu caractères."
msgid ""
"Examples:\n"
@@ -5140,8 +5140,8 @@ msgid "Nick %s isn't registered."
msgstr "Le pseudo %s n'est pas enregistré."
#, c-format
msgid "Nick %s was truncated to %u characters."
msgstr "Le pseudo %s a été tronqué à %u caractères."
msgid "Nick %s was truncated to %zu characters."
msgstr "Le pseudo %s a été tronqué à %zu caractères."
#, c-format
msgid "Nick %s will expire."
@@ -5184,8 +5184,8 @@ msgid "Nick %s is now suspended."
msgstr "Le pseudo %s a été suspendu."
#, c-format
msgid "Nick too long, max length is %u characters."
msgstr "Pseudo trop long, la taille maximale est de %u caractères."
msgid "Nick too long, max length is %zu characters."
msgstr "Pseudo trop long, la taille maximale est de %zu caractères."
#, c-format
msgid "Nickname %s has been dropped."
@@ -5714,7 +5714,7 @@ msgid ""
"your nickname as a password is a much worse idea ;) and,\n"
"in fact, %s will not allow it. Also, short\n"
"passwords are vulnerable to trial-and-error searches, so\n"
"you should choose a password at least 5 characters long.\n"
"you should choose a password at least %u characters long.\n"
"Finally, the space character cannot be used in passwords."
msgstr ""
"Enregistre votre pseudo dans la base de données de %s.\n"
@@ -5735,7 +5735,7 @@ msgstr ""
"ne vous laissera pas faire.. De même, les mots de passe\n"
"courts sont vulnérables aux recherches méthodiques,\n"
"donc vous devez choisir un mot de passe d'au moins \n"
"5 caractères. Le caractère espace ne peut pas être \n"
"%u caractères. Le caractère espace ne peut pas être \n"
"utilisé dans les mots de passe."
msgid "Registration is currently disabled."
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-08 13:20+0000\n"
"PO-Revision-Date: 2024-01-08 13:40+0000\n"
"POT-Creation-Date: 2024-02-22 16:34+0000\n"
"PO-Revision-Date: 2024-02-22 16:38+0000\n"
"Last-Translator: Dragone2 <dragone2@risposteinformatiche.it>\n"
"Language-Team: Italian\n"
"Language: it_IT\n"
@@ -2637,15 +2637,15 @@ msgid "Bot bans will no longer automatically expire."
msgstr "I ban del bot non scadranno automaticamente."
#, c-format
msgid "Bot hosts may only be %d characters long."
msgstr "Gli host dei bot possono contenere solamente %d caratteri."
msgid "Bot hosts may only be %zu characters long."
msgstr "Gli host dei bot possono contenere solamente %zu caratteri."
msgid "Bot hosts may only contain valid host characters."
msgstr "Gli host dei bot possono contenere unicamente caratteri validi."
#, c-format
msgid "Bot idents may only be %d characters long."
msgstr "Le ident dei bot possono contenere solamente %d caratteri."
msgid "Bot idents may only be %zu characters long."
msgstr "Le ident dei bot possono contenere solamente %zu caratteri."
msgid "Bot idents may only contain valid ident characters."
msgstr "Le ident dei bot possono contenere unicamente caratteri validi."
@@ -2661,8 +2661,8 @@ msgid "Bot nick"
msgstr "Bot nick"
#, c-format
msgid "Bot nicks may only be %d characters long."
msgstr "I nick dei Bot possono contenere solamente %d caratteri."
msgid "Bot nicks may only be %zu characters long."
msgstr "I nick dei Bot possono contenere solamente %zu caratteri."
msgid "Bot nicks may only contain valid nick characters."
msgstr "I nick dei bot possono contenere unicamente caratteri validi."
@@ -3942,12 +3942,12 @@ msgid "Error reloading configuration file: %s"
msgstr "Errore durante il ricaricamento del file di configurazione: %s"
#, c-format
msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters."
msgstr "Errore! L'ident del vHost è troppo lunga, usa una ident più corta di %d caratteri."
msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters."
msgstr "Errore! L'ident del vHost è troppo lunga, usa una ident più corta di %zu caratteri."
#, c-format
msgid "Error! The vHost is too long, please use a hostname shorter than %d characters."
msgstr "Errore! Il vHost è troppo lungo, usa un hostname più corto di %d caratteri."
msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters."
msgstr "Errore! Il vHost è troppo lungo, usa un hostname più corto di %zu caratteri."
msgid ""
"Examples:\n"
@@ -5143,8 +5143,8 @@ msgid "Nick %s isn't registered."
msgstr "Il nick %s non è registrato."
#, c-format
msgid "Nick %s was truncated to %u characters."
msgstr "Il nick %s è stato troncato a %u caratteri."
msgid "Nick %s was truncated to %zu characters."
msgstr "Il nick %s è stato troncato a %zu caratteri."
#, c-format
msgid "Nick %s will expire."
@@ -5187,8 +5187,8 @@ msgid "Nick %s is now suspended."
msgstr "Il nick %s è ora sospeso."
#, c-format
msgid "Nick too long, max length is %u characters."
msgstr "Nick troppo lungo, lunghezza massima consentita %u caratteri."
msgid "Nick too long, max length is %zu characters."
msgstr "Nick troppo lungo, lunghezza massima consentita %zu caratteri."
#, c-format
msgid "Nickname %s has been dropped."
@@ -5716,7 +5716,7 @@ msgid ""
"your nickname as a password is a much worse idea ;) and,\n"
"in fact, %s will not allow it. Also, short\n"
"passwords are vulnerable to trial-and-error searches, so\n"
"you should choose a password at least 5 characters long.\n"
"you should choose a password at least %u characters long.\n"
"Finally, the space character cannot be used in passwords."
msgstr ""
"Registra il tuo nick nel database di %s. Quando il\n"
@@ -5737,7 +5737,7 @@ msgstr ""
"anche peggiore, infatti %s non ti permetterà di farlo.\n"
"Inoltre, le password brevi sono facili da indovinare con\n"
"meno tentativi, pertanto è necessario scegliere una password \n"
"di almeno 5 caratteri. Infine, gli spazi non possono essere \n"
"di almeno %u caratteri. Infine, gli spazi non possono essere \n"
"usati all'interno di una password."
msgid "Registration is currently disabled."
+19 -18
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-30 04:54+0100\n"
"PO-Revision-Date: 2024-01-31 05:55+0100\n"
"POT-Creation-Date: 2024-02-22 16:34+0000\n"
"PO-Revision-Date: 2024-02-22 16:39+0000\n"
"Last-Translator: Robby <robby@chatbelgie.be>\n"
"Language-Team: Dutch\n"
"Language: nl_NL\n"
@@ -16,6 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4\n"
#, c-format
msgid "%d channel(s) cleared, and %d channel(s) dropped."
@@ -2643,15 +2644,15 @@ msgid "Bot bans will no longer automatically expire."
msgstr "Bot bans zullen niet langer automatisch verlopen."
#, c-format
msgid "Bot hosts may only be %d characters long."
msgstr "Bot hosts mogen maximaal %d karakters bevatten."
msgid "Bot hosts may only be %zu characters long."
msgstr "Bot hosts mogen maximaal %zu karakters bevatten."
msgid "Bot hosts may only contain valid host characters."
msgstr "Bot hosts mogen alleen geldige host-karakters bevatten."
#, c-format
msgid "Bot idents may only be %d characters long."
msgstr "Bot idents mogen maximaal %d karakters bevatten."
msgid "Bot idents may only be %zu characters long."
msgstr "Bot idents mogen maximaal %zu karakters bevatten."
msgid "Bot idents may only contain valid ident characters."
msgstr "Bot idents mogen alleen geldige ident-karakters bevatten."
@@ -2667,8 +2668,8 @@ msgid "Bot nick"
msgstr "Bot nick"
#, c-format
msgid "Bot nicks may only be %d characters long."
msgstr "Bot nicks mogen maximaal %d karakters bevatten."
msgid "Bot nicks may only be %zu characters long."
msgstr "Bot nicks mogen maximaal %zu karakters bevatten."
msgid "Bot nicks may only contain valid nick characters."
msgstr "Bot nicks mogen alleen geldige nick-karakters bevatten."
@@ -3953,12 +3954,12 @@ msgid "Error reloading configuration file: %s"
msgstr "Fout bij laden configuratiebestand: %s"
#, c-format
msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters."
msgstr "Fout! De vHost ident is te lang, gelieve een ident korter dan %d karakters op te geven."
msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters."
msgstr "Fout! De vHost ident is te lang, gelieve een ident korter dan %zu karakters op te geven."
#, c-format
msgid "Error! The vHost is too long, please use a hostname shorter than %d characters."
msgstr "Fout! De vHost is te lang, gelieve een host korter dan %d karakters op te geven."
msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters."
msgstr "Fout! De vHost is te lang, gelieve een host korter dan %zu karakters op te geven."
msgid ""
"Examples:\n"
@@ -5156,8 +5157,8 @@ msgid "Nick %s isn't registered."
msgstr "Nick %s is niet geregistreerd."
#, c-format
msgid "Nick %s was truncated to %u characters."
msgstr "Nick %s werd verkort naar %u karakters."
msgid "Nick %s was truncated to %zu characters."
msgstr "Nick %s werd verkort naar %zu karakters."
#, c-format
msgid "Nick %s will expire."
@@ -5200,8 +5201,8 @@ msgid "Nick %s is now suspended."
msgstr "Nick %s is nu geschorst."
#, c-format
msgid "Nick too long, max length is %u characters."
msgstr "Nick te lang, maximum lengte is %u karakters."
msgid "Nick too long, max length is %zu characters."
msgstr "Nick te lang, maximum lengte is %zu karakters."
#, c-format
msgid "Nickname %s has been dropped."
@@ -5730,7 +5731,7 @@ msgid ""
"your nickname as a password is a much worse idea ;) and,\n"
"in fact, %s will not allow it. Also, short\n"
"passwords are vulnerable to trial-and-error searches, so\n"
"you should choose a password at least 5 characters long.\n"
"you should choose a password at least %u characters long.\n"
"Finally, the space character cannot be used in passwords."
msgstr ""
"Registreert je nick in de %s database. Wanneer je nick\n"
@@ -5749,7 +5750,7 @@ msgstr ""
"nick als een wachtwoord gebruiken is een veel slechter idee ;)\n"
"en in feite, %s staat het niet toe. Bovendien zijn korte wachtwoorden\n"
"kwetsbaar voor zoekacties, dus kies je best een wachtwoord\n"
"dat minstens 5 karakters lang is. Als laatste, de spatie kan niet\n"
"dat minstens %u karakters lang is. Als laatste, de spatie kan niet\n"
"gebruikt worden in wachtwoorden."
msgid "Registration is currently disabled."
+19 -19
View File
@@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-01-08 13:20+0000\n"
"PO-Revision-Date: 2024-01-08 13:46+0000\n"
"Last-Translator: Adam <adam@anope.org>\n"
"POT-Creation-Date: 2024-02-22 16:34+0000\n"
"PO-Revision-Date: 2024-02-22 16:42+0000\n"
"Last-Translator: k4be <k4be@pirc.pl>\n"
"Language-Team: Polish\n"
"Language: pl_PL\n"
"MIME-Version: 1.0\n"
@@ -2632,15 +2632,15 @@ msgid "Bot bans will no longer automatically expire."
msgstr "Bany zakładane przez bota nie będą już się przedawniały."
#, c-format
msgid "Bot hosts may only be %d characters long."
msgstr "Host bota może się składać maksymalnie z %d znaków."
msgid "Bot hosts may only be %zu characters long."
msgstr "Host bota może się składać maksymalnie z %zu znaków."
msgid "Bot hosts may only contain valid host characters."
msgstr "Host bota może zawierać tylko prawidłowe znaki."
#, c-format
msgid "Bot idents may only be %d characters long."
msgstr "Ident bota może się składać maksymalnie z %d znaków."
msgid "Bot idents may only be %zu characters long."
msgstr "Ident bota może się składać maksymalnie z %zu znaków."
msgid "Bot idents may only contain valid ident characters."
msgstr "Ident bota może zawierać tylko prawidłowe znaki."
@@ -2656,8 +2656,8 @@ msgid "Bot nick"
msgstr "Nick bota"
#, c-format
msgid "Bot nicks may only be %d characters long."
msgstr "Nick bota może się składać maksymalnie z %d znaków."
msgid "Bot nicks may only be %zu characters long."
msgstr "Nick bota może się składać maksymalnie z %zu znaków."
msgid "Bot nicks may only contain valid nick characters."
msgstr "Nick bota może zawierać tylko prawidłowe znaki."
@@ -3926,12 +3926,12 @@ msgid "Error reloading configuration file: %s"
msgstr "Błąd przeładowywania pliku konfiguracyjnego: %s"
#, c-format
msgid "Error! The vHost ident is too long, please use an ident shorter than %d characters."
msgstr "Błąd: podany wirtualny ident jest zbyt długi. Proszę użyć nazwy krótszej niż %d znaków."
msgid "Error! The vHost ident is too long, please use an ident shorter than %zu characters."
msgstr "Błąd: podany wirtualny ident jest zbyt długi. Proszę użyć nazwy krótszej niż %zu znaków."
#, c-format
msgid "Error! The vHost is too long, please use a hostname shorter than %d characters."
msgstr "Błąd: podany vHost jest zbyt długi. Proszę użyć nazwy krótszej niż %d znaków."
msgid "Error! The vHost is too long, please use a hostname shorter than %zu characters."
msgstr "Błąd: podany vHost jest zbyt długi. Proszę użyć nazwy krótszej niż %zu znaków."
msgid ""
"Examples:\n"
@@ -5126,8 +5126,8 @@ msgid "Nick %s isn't registered."
msgstr "Nick %s nie jest zarejestrowany."
#, c-format
msgid "Nick %s was truncated to %u characters."
msgstr "Nick %s został skrócony do %u znaków."
msgid "Nick %s was truncated to %zu characters."
msgstr "Nick %s został skrócony do %zu znaków."
#, c-format
msgid "Nick %s will expire."
@@ -5170,8 +5170,8 @@ msgid "Nick %s is now suspended."
msgstr "Nick %s został zawieszony."
#, c-format
msgid "Nick too long, max length is %u characters."
msgstr "Zbyt długi nick. Maksymalna długość to %u znaków."
msgid "Nick too long, max length is %zu characters."
msgstr "Zbyt długi nick. Maksymalna długość to %zu znaków."
#, c-format
msgid "Nickname %s has been dropped."
@@ -5697,7 +5697,7 @@ msgid ""
"your nickname as a password is a much worse idea ;) and,\n"
"in fact, %s will not allow it. Also, short\n"
"passwords are vulnerable to trial-and-error searches, so\n"
"you should choose a password at least 5 characters long.\n"
"you should choose a password at least %u characters long.\n"
"Finally, the space character cannot be used in passwords."
msgstr ""
"Rejestruje aktualnie używany nick w bazie %s.\n"
@@ -5714,7 +5714,7 @@ msgstr ""
"jako haseł jest niewskazane. Nie wolno użyć hasła takiego\n"
"samego, jak nick (a %s na to nie pozwoli). Bardzo krótkie\n"
"hasło może zostać odgadnięte metodą prób i błędów.\n"
"Twoje hasło musi mieć długość co najmniej 5 znaków.\n"
"Twoje hasło musi mieć długość co najmniej %u znaków.\n"
"Znak spacji nie może być użyty w haśle."
msgid "Registration is currently disabled."
+2350 -4599
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+272 -379
View File
File diff suppressed because it is too large Load Diff
+7 -8
View File
@@ -19,18 +19,13 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()
enable_extra("enc_argon2" "ARGON2")
enable_extra("mysql" "LIBMYSQLCLIENT")
enable_extra("regex_pcre2" "PCRE2")
enable_extra("sqlite" "SQLITE3")
enable_extra("ssl_openssl" "OPENSSL")
# this uses Wldap so should always be available
copy_extra("ldap")
# these don't actually have extra dependencies, but require a module which does
copy_extra("sql_authentication")
copy_extra("sql_log")
copy_extra("sql_oper")
copy_extra("ldap_authentication")
copy_extra("ldap_oper")
# Package extra dlls
file(GLOB EXTRA_DLLS "${Anope_SOURCE_DIR}/extradll/bin/*.dll" "${Anope_SOURCE_DIR}/extradll/lib/*.dll")
@@ -99,7 +94,9 @@ macro(build_modules SRC)
target_link_libraries(${SO} ${PROGRAM_NAME})
endif()
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules)
install(TARGETS ${SO}
DESTINATION ${MODULE_DIR}
LIBRARY)
endif()
endif()
endforeach()
@@ -173,7 +170,9 @@ macro(build_subdir)
endif()
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO} DESTINATION ${LIB_DIR}/modules)
install(TARGETS ${SO}
DESTINATION ${MODULE_DIR}
LIBRARY)
endmacro()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+17 -12
View File
@@ -57,29 +57,34 @@ public:
BotInfo *bi = user->server == Me ? dynamic_cast<BotInfo *>(user) : NULL;
if (bi && Config->GetModule(this)->Get<bool>("smartjoin"))
{
/* We check for bans */
for (const auto &entry : c->GetModeList("BAN"))
if (IRCD->CanClearBans)
{
Entry ban("BAN", entry);
if (ban.Matches(user))
c->RemoveMode(NULL, "BAN", ban.GetMask());
// We can ask the IRCd to clear bans.
IRCD->SendClearBans(bi, c, bi);
}
else
{
// We have to check for bans.
for (const auto &entry : c->GetModeList("BAN"))
{
Entry ban("BAN", entry);
if (ban.Matches(user))
c->RemoveMode(NULL, "BAN", ban.GetMask());
}
}
Anope::string Limit;
unsigned limit = 0;
try
{
if (c->GetParam("LIMIT", Limit))
limit = convertTo<unsigned>(Limit);
}
catch (const ConvertException &) { }
if (c->GetParam("LIMIT", Limit))
limit = Anope::Convert<unsigned>(Limit, limit);
/* Should we be invited? */
if (c->HasMode("INVITE") || (limit && c->users.size() >= limit))
{
ChannelMode *cm = ModeManager::FindChannelModeByName("OP");
char symbol = cm ? anope_dynamic_static_cast<ChannelModeStatus *>(cm)->symbol : 0;
IRCD->SendNotice(bi, (symbol ? Anope::string(symbol) : "") + c->name, "%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
const auto message = Anope::printf("%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
IRCD->SendNotice(bi, (symbol ? Anope::string(symbol) : "") + c->name, message);
}
ModeManager::ProcessModes();
+3 -3
View File
@@ -28,7 +28,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot assignment is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
@@ -97,7 +97,7 @@ public:
{
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot assignment is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
@@ -164,7 +164,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
+10 -10
View File
@@ -21,12 +21,12 @@ struct BadWordImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << this->chan;
data["word"] << this->word;
data.SetType("type", Serialize::Data::DT_INT); data["type"] << this->type;
data.Store("ci", this->chan);
data.Store("word", this->word);
data.Store("type", this->type);
}
static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
};
struct BadWordsImpl final
@@ -40,7 +40,7 @@ struct BadWordsImpl final
~BadWordsImpl() override;
BadWord* AddBadWord(const Anope::string &word, BadWordType type) override
BadWord *AddBadWord(const Anope::string &word, BadWordType type) override
{
auto *bw = new BadWordImpl();
bw->chan = ci->name;
@@ -54,7 +54,7 @@ struct BadWordsImpl final
return bw;
}
BadWord* GetBadWord(unsigned index) const override
BadWord *GetBadWord(unsigned index) const override
{
if (this->badwords->empty() || index >= this->badwords->size())
return NULL;
@@ -117,7 +117,7 @@ BadWordImpl::~BadWordImpl()
}
}
Serializable* BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
Serializable *BadWordImpl::Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string sci, sword;
@@ -222,7 +222,7 @@ private:
const BadWord *b = bw->GetBadWord(Number - 1);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(Number);
entry["Number"] = Anope::ToString(Number);
entry["Word"] = b->word;
entry["Type"] = b->type == BW_SINGLE ? "(SINGLE)" : (b->type == BW_START ? "(START)" : (b->type == BW_END ? "(END)" : ""));
this->list.AddEntry(entry);
@@ -241,7 +241,7 @@ private:
continue;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
entry["Word"] = b->word;
entry["Type"] = b->type == BW_SINGLE ? "(SINGLE)" : (b->type == BW_START ? "(START)" : (b->type == BW_END ? "(END)" : ""));
list.AddEntry(entry);
@@ -407,7 +407,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bad words list modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
+14 -17
View File
@@ -28,23 +28,21 @@ private:
return;
}
Configuration::Block *networkinfo = Config->GetBlock("networkinfo");
if (nick.length() > networkinfo->Get<unsigned>("nicklen"))
if (nick.length() > IRCD->MaxNick)
{
source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen"));
source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->MaxNick);
return;
}
if (user.length() > networkinfo->Get<unsigned>("userlen"))
if (user.length() > IRCD->MaxUser)
{
source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen"));
source.Reply(_("Bot idents may only be %zu characters long."), IRCD->MaxUser);
return;
}
if (host.length() > networkinfo->Get<unsigned>("hostlen"))
if (host.length() > IRCD->MaxHost)
{
source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("hostlen"));
source.Reply(_("Bot hosts may only be %zu characters long."), IRCD->MaxHost);
return;
}
@@ -120,23 +118,22 @@ private:
return;
}
Configuration::Block *networkinfo = Config->GetBlock("networkinfo");
if (nick.length() > networkinfo->Get<unsigned>("nicklen"))
if (nick.length() > IRCD->MaxNick)
{
source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen"));
source.Reply(_("Bot nicks may only be %zu characters long."), IRCD->MaxNick);
return;
}
if (user.length() > networkinfo->Get<unsigned>("userlen"))
if (user.length() > IRCD->MaxUser)
{
source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen"));
source.Reply(_("Bot idents may only be %zu characters long."), IRCD->MaxUser);
return;
}
if (host.length() > networkinfo->Get<unsigned>("hostlen"))
if (host.length() > IRCD->MaxHost)
{
source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("hostlen"));
source.Reply(_("Bot hosts may only be %zu characters long."), IRCD->MaxHost
);
return;
}
@@ -279,7 +276,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
+2 -6
View File
@@ -56,7 +56,7 @@ public:
return;
}
IRCD->SendPrivmsg(*ci->bi, ci->name, "%s", text.c_str());
IRCD->SendPrivmsg(*ci->bi, ci->name, text);
ci->bi->lastmsg = Anope::CurTime;
bool override = !source.AccessFor(ci).HasPriv("SAY");
@@ -111,11 +111,7 @@ public:
return;
}
message = message.replace_all_cs("\1", "");
if (message.empty())
return;
IRCD->SendAction(*ci->bi, ci->name, "%s", message.c_str());
IRCD->SendPrivmsg(*ci->bi, ci->name, Anope::FormatCTCP("ACTION", message));
ci->bi->lastmsg = Anope::CurTime;
bool override = !source.AccessFor(ci).HasPriv("SAY");
+3 -3
View File
@@ -15,7 +15,7 @@ class CommandBSInfo final
: public Command
{
private:
void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
static void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi)
{
Anope::string buf;
for (const auto &[_, ci] : *RegisteredChannelList)
@@ -50,12 +50,12 @@ public:
if (bi)
{
source.Reply(_("Information for bot \002%s\002:"), bi->nick.c_str());
source.Reply(_("Information about bot \002%s\002:"), bi->nick.c_str());
info[_("Mask")] = bi->GetIdent() + "@" + bi->host;
info[_("Real name")] = bi->realname;
info[_("Created")] = Anope::strftime(bi->created, source.GetAccount());
info[_("Options")] = bi->oper_only ? _("Private") : _("None");
info[_("Used on")] = stringify(bi->GetChannelCount()) + " channel(s)";
info[_("Used on")] = Anope::ToString(bi->GetChannelCount()) + " channel(s)";
FOREACH_MOD(OnBotInfo, (source, bi, ci, info));
+51 -105
View File
@@ -53,26 +53,28 @@ struct KickerDataImpl final
if (kd == NULL)
return;
data["kickerdata:amsgs"] << kd->amsgs;
data["kickerdata:badwords"] << kd->badwords;
data["kickerdata:bolds"] << kd->bolds;
data["kickerdata:caps"] << kd->caps;
data["kickerdata:colors"] << kd->colors;
data["kickerdata:flood"] << kd->flood;
data["kickerdata:italics"] << kd->italics;
data["kickerdata:repeat"] << kd->repeat;
data["kickerdata:reverses"] << kd->reverses;
data["kickerdata:underlines"] << kd->underlines;
data.Store("kickerdata:amsgs", kd->amsgs);
data.Store("kickerdata:badwords", kd->badwords);
data.Store("kickerdata:bolds", kd->bolds);
data.Store("kickerdata:caps", kd->caps);
data.Store("kickerdata:colors", kd->colors);
data.Store("kickerdata:flood", kd->flood);
data.Store("kickerdata:italics", kd->italics);
data.Store("kickerdata:repeat", kd->repeat);
data.Store("kickerdata:reverses", kd->reverses);
data.Store("kickerdata:underlines", kd->underlines);
data.Store("capsmin", kd->capsmin);
data.Store("capspercent", kd->capspercent);
data.Store("floodlines", kd->floodlines);
data.Store("floodsecs", kd->floodsecs);
data.Store("repeattimes", kd->repeattimes);
data.Store("dontkickops", kd->dontkickops);
data.Store("dontkickvoices", kd->dontkickvoices);
data.SetType("capsmin", Serialize::Data::DT_INT); data["capsmin"] << kd->capsmin;
data.SetType("capspercent", Serialize::Data::DT_INT); data["capspercent"] << kd->capspercent;
data.SetType("floodlines", Serialize::Data::DT_INT); data["floodlines"] << kd->floodlines;
data.SetType("floodsecs", Serialize::Data::DT_INT); data["floodsecs"] << kd->floodsecs;
data.SetType("repeattimes", Serialize::Data::DT_INT); data["repeattimes"] << kd->repeattimes;
data.SetType("dontkickops", Serialize::Data::DT_INT); data["dontkickops"] << kd->dontkickops;
data.SetType("dontkickvoices", Serialize::Data::DT_INT); data["dontkickvoices"] << kd->dontkickvoices;
std::ostringstream oss;
for (auto ttbtype : kd->ttb)
data["ttb"] << ttbtype << " ";
oss << ttbtype << " ";
data.Store("ttb", oss.str());
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
@@ -106,11 +108,10 @@ struct KickerDataImpl final
data["ttb"] >> ttb;
spacesepstream sep(ttb);
for (int i = 0; sep.GetToken(tok) && i < TTB_SIZE; ++i)
try
{
kd->ttb[i] = convertTo<int16_t>(tok);
}
catch (const ConvertException &) { }
{
if (auto n = Anope::TryConvert<int16_t>(tok))
kd->ttb[i] = n.value();
}
kd->Check(ci);
}
@@ -175,7 +176,7 @@ public:
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0;
protected:
bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChannelInfo* &ci)
bool CheckArguments(CommandSource &source, const std::vector<Anope::string> &params, ChannelInfo *&ci)
{
const Anope::string &chan = params[0];
const Anope::string &option = params[1];
@@ -183,7 +184,7 @@ protected:
ci = ChannelInfo::Find(chan);
if (Anope::ReadOnly)
source.Reply(_("Sorry, kicker configuration is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
else if (ci == NULL)
source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
else if (option.empty())
@@ -206,21 +207,13 @@ protected:
{
if (!ttb.empty())
{
int16_t i;
try
{
i = convertTo<int16_t>(ttb);
if (i < 0)
throw ConvertException();
}
catch (const ConvertException &)
kd->ttb[ttb_idx] = Anope::Convert<int16_t>(ttb, -1);
if (kd->ttb[ttb_idx] < 0)
{
kd->ttb[ttb_idx] = 0;
source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str());
return;
}
kd->ttb[ttb_idx] = i;
}
else
kd->ttb[ttb_idx] = 0;
@@ -386,13 +379,8 @@ public:
if (!ttb.empty())
{
try
{
kd->ttb[TTB_CAPS] = convertTo<int16_t>(ttb);
if (kd->ttb[TTB_CAPS] < 0)
throw ConvertException();
}
catch (const ConvertException &)
kd->ttb[TTB_CAPS] = Anope::Convert<int16_t>(ttb, -1);
if (kd->ttb[TTB_CAPS] < 0)
{
kd->ttb[TTB_CAPS] = 0;
source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str());
@@ -402,21 +390,11 @@ public:
else
kd->ttb[TTB_CAPS] = 0;
kd->capsmin = 10;
try
{
kd->capsmin = convertTo<int16_t>(min);
}
catch (const ConvertException &) { }
kd->capsmin = Anope::Convert(min, 0);
if (kd->capsmin < 1)
kd->capsmin = 10;
kd->capspercent = 25;
try
{
kd->capspercent = convertTo<int16_t>(percent);
}
catch (const ConvertException &) { }
kd->capspercent = Anope::Convert(percent, 0);
if (kd->capspercent < 1 || kd->capspercent > 100)
kd->capspercent = 25;
@@ -518,42 +496,25 @@ public:
if (!ttb.empty())
{
int16_t i;
try
{
i = convertTo<int16_t>(ttb);
if (i < 0)
throw ConvertException();
}
catch (const ConvertException &)
kd->ttb[TTB_FLOOD] = Anope::Convert<int16_t>(ttb, -1);
if (kd->ttb[TTB_FLOOD] < 0)
{
kd->ttb[TTB_FLOOD] = 0;
source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str());
return;
}
kd->ttb[TTB_FLOOD] = i;
}
else
kd->ttb[TTB_FLOOD] = 0;
kd->floodlines = 6;
try
{
kd->floodlines = convertTo<int16_t>(lines);
}
catch (const ConvertException &) { }
kd->floodlines = Anope::Convert(lines, -1);
if (kd->floodlines < 2)
kd->floodlines = 6;
kd->floodsecs = 10;
try
{
kd->floodsecs = convertTo<int16_t>(secs);
}
catch (const ConvertException &) { }
kd->floodsecs = Anope::Convert(secs, -1);
if (kd->floodsecs < 1)
kd->floodsecs = 10;
if (kd->floodsecs > Config->GetModule(me)->Get<time_t>("keepdata"))
kd->floodsecs = Config->GetModule(me)->Get<time_t>("keepdata");
@@ -651,31 +612,18 @@ public:
if (!ttb.empty())
{
int16_t i;
try
{
i = convertTo<int16_t>(ttb);
if (i < 0)
throw ConvertException();
}
catch (const ConvertException &)
kd->ttb[TTB_REPEAT] = Anope::Convert(ttb, -1);
if (kd->ttb[TTB_REPEAT] < 0)
{
kd->ttb[TTB_REPEAT] = 0;
source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str());
return;
}
kd->ttb[TTB_REPEAT] = i;
}
else
kd->ttb[TTB_REPEAT] = 0;
kd->repeattimes = 3;
try
{
kd->repeattimes = convertTo<int16_t>(times);
}
catch (const ConvertException &) { }
kd->repeattimes = Anope::Convert<int16_t>(times, -1);
if (kd->repeattimes < 1)
kd->repeattimes = 3;
@@ -826,7 +774,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
@@ -892,7 +840,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot option setting is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
@@ -1091,7 +1039,7 @@ class BSKick final
}
}
void bot_kick(ChannelInfo *ci, User *u, const char *message, ...) ATTR_FORMAT(4, 5)
static void bot_kick(ChannelInfo *ci, User *u, const char *message, ...) ATTR_FORMAT(3, 4)
{
va_list args;
char buf[1024];
@@ -1104,7 +1052,7 @@ class BSKick final
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
va_end(args);
ci->c->Kick(ci->bi, u, "%s", buf);
ci->c->Kick(ci->bi, u, Anope::string(buf));
}
public:
@@ -1241,7 +1189,7 @@ public:
info.AddOption(_("Voices protection"));
}
void OnPrivmsg(User *u, Channel *c, Anope::string &msg) override
void OnPrivmsg(User *u, Channel *c, Anope::string &msg, const Anope::map<Anope::string> &tags) override
{
/* Now we can make kicker stuff. We try to order the checks
* from the fastest one to the slowest one, since there's
@@ -1270,11 +1218,9 @@ public:
/* If it's a /me, cut the CTCP part because the ACTION will cause
* problems with the caps or badwords kicker
*/
if (realbuf.substr(0, 8).equals_ci("\1ACTION ") && realbuf[realbuf.length() - 1] == '\1')
{
realbuf.erase(0, 8);
realbuf.erase(realbuf.length() - 1);
}
Anope::string ctcpname, ctcpbody;
if (Anope::ParseCTCP(msg, ctcpname, ctcpbody) && ctcpname.equals_ci("ACTION"))
realbuf = ctcpbody;
if (realbuf.empty())
return;
+1 -1
View File
@@ -118,7 +118,7 @@ public:
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, changing bot options is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
return;
}
+3 -4
View File
@@ -52,7 +52,7 @@ public:
* @param chan The channel
*/
ChanServTimer(Reference<BotInfo> &cs, ExtensibleItem<bool> &i, Module *m, Channel *chan)
: Timer(m, Config->GetModule(m)->Get<time_t>("inhabit", "15s"))
: Timer(m, Config->GetModule(m)->Get<time_t>("inhabit", "1m"))
, ChanServ(cs)
, inhabit(i)
, c(chan)
@@ -116,12 +116,11 @@ public:
ChanServ = bi;
spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "keeptopic peace cs_secure securefounder signkick")).GetTokens(defaults);
spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "keeptopic peace securefounder signkick")).GetTokens(defaults);
if (defaults.empty())
{
defaults.emplace_back("KEEPTOPIC");
defaults.emplace_back("PEACE");
defaults.emplace_back("CS_SECURE");
defaults.emplace_back("SECUREFOUNDER");
defaults.emplace_back("SIGNKICK");
}
@@ -137,7 +136,7 @@ public:
ChanServ = NULL;
}
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) override
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override
{
if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER"))
{
+16 -25
View File
@@ -37,18 +37,13 @@ public:
Anope::string AccessSerialize() const override
{
return stringify(this->level);
return Anope::ToString(this->level);
}
void AccessUnserialize(const Anope::string &data) override
{
try
{
this->level = convertTo<int>(data);
}
catch (const ConvertException &)
{
}
if (auto l = Anope::TryConvert<int>(data))
this->level = l.value();
}
bool operator>(const ChanAccess &other) const override
@@ -84,7 +79,7 @@ public:
return new AccessChanAccess(this);
}
};
AccessAccessProvider* AccessAccessProvider::me;
AccessAccessProvider *AccessAccessProvider::me;
class CommandCSAccess final
: public Command
@@ -95,11 +90,9 @@ class CommandCSAccess final
Privilege *p = NULL;
int level = ACCESS_INVALID;
try
{
level = convertTo<int>(params[3]);
}
catch (const ConvertException &)
if (auto lvl = Anope::TryConvert<int>(params[3]))
level = lvl.value();
else
{
p = PrivilegeManager::FindPrivilege(params[3]);
if (p != NULL && defaultLevels[p->name])
@@ -207,7 +200,7 @@ class CommandCSAccess final
}
}
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1024");
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
if (access_max && ci->GetDeepAccessCount() >= access_max)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
@@ -402,7 +395,7 @@ class CommandCSAccess final
}
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
entry["Number"] = Anope::ToString(number);
entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->Mask();
entry["By"] = access->creator;
@@ -442,7 +435,7 @@ class CommandCSAccess final
}
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->Mask();
entry["By"] = access->creator;
@@ -567,7 +560,7 @@ public:
else if (!has_access)
source.Reply(ACCESS_DENIED);
else if (Anope::ReadOnly && !is_list)
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
else if (cmd.equals_ci("ADD"))
this->DoAdd(source, ci, params);
else if (cmd.equals_ci("DEL"))
@@ -652,11 +645,9 @@ class CommandCSLevels final
level = ACCESS_FOUNDER;
else
{
try
{
level = convertTo<int>(lev);
}
catch (const ConvertException &)
if (auto lvl = Anope::TryConvert<int>(lev))
level = lvl.value();
else
{
this->OnSyntaxError(source, "SET");
return;
@@ -713,7 +704,7 @@ class CommandCSLevels final
source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str());
}
void DoList(CommandSource &source, ChannelInfo *ci)
static void DoList(CommandSource &source, ChannelInfo *ci)
{
source.Reply(_("Access level settings for channel %s:"), ci->name.c_str());
@@ -734,7 +725,7 @@ class CommandCSLevels final
else if (j == ACCESS_FOUNDER)
entry["Level"] = Language::Translate(source.GetAccount(), _("(founder only)"));
else
entry["Level"] = stringify(j);
entry["Level"] = Anope::ToString(j);
list.AddEntry(entry);
}
+3 -3
View File
@@ -311,7 +311,7 @@ class CommandCSAKick final
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(number);
entry["Number"] = Anope::ToString(number);
if (akick->nc)
entry["Mask"] = akick->nc->display;
else
@@ -351,7 +351,7 @@ class CommandCSAKick final
lastused = UNKNOWN;
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
if (akick->nc)
entry["Mask"] = akick->nc->display;
else
@@ -466,7 +466,7 @@ public:
else if (!has_access)
source.Reply(ACCESS_DENIED);
else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && Anope::ReadOnly)
source.Reply(_("Sorry, channel autokick list modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
else if (cmd.equals_ci("ADD"))
this->DoAdd(source, ci, params);
else if (cmd.equals_ci("DEL"))
+7 -7
View File
@@ -15,16 +15,16 @@
class CommandCSClone final
: public Command
{
void CopySetting(ChannelInfo *ci, ChannelInfo *target_ci, const Anope::string &setting)
static void CopySetting(ChannelInfo *ci, ChannelInfo *target_ci, const Anope::string &setting)
{
if (ci->HasExt(setting))
target_ci->Extend<bool>(setting);
}
void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
static void CopyAccess(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
std::set<Anope::string> masks;
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1024");
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
unsigned count = 0;
for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i)
@@ -58,7 +58,7 @@ class CommandCSClone final
source.Reply(_("%d access entries from \002%s\002 have been cloned to \002%s\002."), count, ci->name.c_str(), target_ci->name.c_str());
}
void CopyAkick(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
static void CopyAkick(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
target_ci->ClearAkick();
for (unsigned i = 0; i < ci->GetAkickCount(); ++i)
@@ -73,7 +73,7 @@ class CommandCSClone final
source.Reply(_("All akick entries from \002%s\002 have been cloned to \002%s\002."), ci->name.c_str(), target_ci->name.c_str());
}
void CopyBadwords(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
static void CopyBadwords(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
BadWords *target_badwords = target_ci->Require<BadWords>("badwords"),
*badwords = ci->Require<BadWords>("badwords");
@@ -98,7 +98,7 @@ class CommandCSClone final
source.Reply(_("All badword entries from \002%s\002 have been cloned to \002%s\002."), ci->name.c_str(), target_ci->name.c_str());
}
void CopyLevels(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
static void CopyLevels(CommandSource &source, ChannelInfo *ci, ChannelInfo *target_ci)
{
for (const auto &[priv, level] : ci->GetLevelEntries())
{
@@ -196,7 +196,7 @@ public:
target_ci->last_topic_setter = source.service->nick;
const Anope::string settings[] = { "NOAUTOOP", "CS_KEEP_MODES", "PEACE", "PERSIST", "RESTRICTED",
"CS_SECURE", "SECUREFOUNDER", "SECUREOPS", "SIGNKICK", "SIGNKICK_LEVEL", "CS_NO_EXPIRE" };
"SECUREFOUNDER", "SECUREOPS", "SIGNKICK", "SIGNKICK_LEVEL", "CS_NO_EXPIRE" };
for (const auto &setting : settings)
CopySetting(ci, target_ci, setting);
+29 -9
View File
@@ -14,11 +14,16 @@
class CommandCSDrop final
: public Command
{
private:
PrimitiveExtensibleItem<Anope::string> dropcode;
public:
CommandCSDrop(Module *creator) : Command(creator, "chanserv/drop", 1, 2)
CommandCSDrop(Module *creator)
: Command(creator, "chanserv/drop", 1, 2)
, dropcode(creator, "channel-dropcode")
{
this->SetDesc(_("Cancel the registration of a channel"));
this->SetSyntax(_("\037channel\037 \037channel\037"));
this->SetSyntax(_("\037channel\037 [\037code\037]"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -27,7 +32,7 @@ public:
if (Anope::ReadOnly && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE?
source.Reply(READ_ONLY_MODE);
return;
}
@@ -38,22 +43,33 @@ public:
return;
}
if (params.size() < 2 || !chan.equals_ci(params[1]))
{
source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002%s\002."), chan.c_str());
return;
}
if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
{
source.Reply(ACCESS_DENIED);
return;
}
auto *code = dropcode.Get(ci);
if (params.size() < 2 || ((!code || !code->equals_ci(params[1])) && (!source.HasPriv("chanserv/drop/override") || params[1] != "OVERRIDE")))
{
if (!code)
{
code = ci->Extend<Anope::string>("channel-dropcode");
*code = Anope::Random(15);
}
source.Reply(CONFIRM_DROP, ci->name.c_str(), Config->StrictPrivmsg.c_str(),
source.service->nick.c_str(), ci->name.c_str(), code->c_str());
return;
}
EventReturn MOD_RESULT;
FOREACH_RESULT(OnChanDrop, MOD_RESULT, (source, ci));
if (MOD_RESULT == EVENT_STOP)
{
dropcode.Unset(ci);
return;
}
bool override = (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")";
@@ -78,6 +94,10 @@ public:
source.Reply(_("Unregisters the named channel. Can only be used by\n"
"the \002channel founder\002."));
source.Reply(" ");
if (source.HasPriv("chanserv/drop/override"))
source.Reply(_("Additionally, Services Operators with the \037chanserv/drop/override\037 permission can\n"
"replace \037code\037 with \002OVERRIDE\002 to drop without a confirmation code."));
return true;
}
};
+2 -8
View File
@@ -166,14 +166,8 @@ private:
return;
}
int l;
try
{
l = convertTo<int>(l_str);
if (l < 0)
throw ConvertException();
}
catch (const ConvertException &)
auto l = Anope::Convert<int>(l_str, -1);
if (l < 0)
{
source.Reply(_("The limit on %s is not valid."), ci->name.c_str());
return;
+26 -25
View File
@@ -32,13 +32,13 @@ struct EntryMsgImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << this->chan;
data["creator"] << this->creator;
data["message"] << this->message;
data.SetType("when", Serialize::Data::DT_INT); data["when"] << this->when;
data.Store("ci", this->chan);
data.Store("creator", this->creator);
data.Store("message", this->message);
data.Store("when", this->when);
}
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
struct EntryMessageListImpl final
@@ -46,7 +46,7 @@ struct EntryMessageListImpl final
{
EntryMessageListImpl(Extensible *) { }
EntryMsg* Create() override
EntryMsg *Create() override
{
return new EntryMsgImpl();
}
@@ -68,7 +68,7 @@ EntryMsgImpl::~EntryMsgImpl()
}
Serializable* EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data)
Serializable *EntryMsgImpl::Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string sci, screator, smessage;
time_t swhen;
@@ -104,7 +104,7 @@ class CommandEntryMessage final
: public Command
{
private:
void DoList(CommandSource &source, ChannelInfo *ci)
static void DoList(CommandSource &source, ChannelInfo *ci)
{
EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg");
@@ -123,7 +123,7 @@ private:
EntryMsg *msg = (*messages)->at(i);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
entry["Creator"] = msg->creator;
entry["Created"] = Anope::strftime(msg->when, NULL, true);
entry["Message"] = msg->message;
@@ -162,21 +162,16 @@ private:
source.Reply(_("Entry message list for \002%s\002 is empty."), ci->name.c_str());
else
{
try
auto i = Anope::Convert<unsigned>(message, 0);
if (i > 0 && i <= (*messages)->size())
{
unsigned i = convertTo<unsigned>(message);
if (i > 0 && i <= (*messages)->size())
{
delete (*messages)->at(i - 1);
if ((*messages)->empty())
ci->Shrink<EntryMessageList>("entrymsg");
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
source.Reply(_("Entry message \002%i\002 for \002%s\002 deleted."), i, ci->name.c_str());
}
else
throw ConvertException();
delete (*messages)->at(i - 1);
if ((*messages)->empty())
ci->Shrink<EntryMessageList>("entrymsg");
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
source.Reply(_("Entry message \002%i\002 for \002%s\002 deleted."), i, ci->name.c_str());
}
catch (const ConvertException &)
else
{
source.Reply(_("Entry message \002%s\002 not found on channel \002%s\002."), message.c_str(), ci->name.c_str());
}
@@ -283,10 +278,16 @@ public:
if (u && c && c->ci && u->server->IsSynced())
{
EntryMessageList *messages = c->ci->GetExt<EntryMessageList>("entrymsg");
if (!messages)
return;
if (messages != NULL)
for (const auto &message : *(*messages))
u->SendMessage(c->ci->WhoSends(), "[%s] %s", c->ci->name.c_str(), message->message.c_str());
for (const auto &message : *(*messages))
{
if (u->ShouldPrivmsg())
IRCD->SendContextPrivmsg(c->ci->WhoSends(), u, c, message->message);
else
IRCD->SendContextNotice(c->ci->WhoSends(), u, c, message->message);
}
}
}
};
+7 -9
View File
@@ -26,9 +26,7 @@ public:
bool HasPriv(const Anope::string &priv) const override
{
std::map<Anope::string, char>::iterator it = defaultFlags.find(priv);
if (it != defaultFlags.end() && this->flags.count(it->second) > 0)
return true;
return false;
return it != defaultFlags.end() && this->flags.count(it->second) > 0;
}
Anope::string AccessSerialize() const override
@@ -76,7 +74,7 @@ public:
return new FlagsChanAccess(this);
}
};
FlagsAccessProvider* FlagsAccessProvider::ap;
FlagsAccessProvider *FlagsAccessProvider::ap;
class CommandCSFlags final
: public Command
@@ -177,7 +175,7 @@ class CommandCSFlags final
}
}
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1024");
unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1000");
if (access_max && ci->GetDeepAccessCount() >= access_max)
{
source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
@@ -296,7 +294,7 @@ class CommandCSFlags final
source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str());
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
static void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
const Anope::string &arg = params.size() > 2 ? params[2] : "";
@@ -324,7 +322,7 @@ class CommandCSFlags final
for (size_t j = 1; j < arg.length(); ++j)
if (flags.find(arg[j]) == Anope::string::npos)
pass = false;
if (pass == false)
if (!pass)
continue;
}
else if (!Anope::Match(access->Mask(), arg))
@@ -333,7 +331,7 @@ class CommandCSFlags final
ListFormatter::ListEntry entry;
++count;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
entry["Mask"] = access->Mask();
entry["Flags"] = flags;
entry["Creator"] = access->creator;
@@ -413,7 +411,7 @@ public:
if (!has_access)
source.Reply(ACCESS_DENIED);
else if (Anope::ReadOnly && !is_list)
source.Reply(_("Sorry, channel access list modification is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
else if (is_list)
this->DoList(source, ci, params);
else if (cmd.equals_ci("CLEAR"))
+1 -1
View File
@@ -58,7 +58,7 @@ public:
if (show_all)
{
info[_("Ban type")] = stringify(ci->bantype);
info[_("Ban type")] = Anope::ToString(ci->bantype);
}
FOREACH_MOD(OnChanInfo, (source, ci, info, show_all));
+6 -6
View File
@@ -36,12 +36,10 @@ public:
sepstream(pattern.substr(1), '-').GetToken(n1, 0);
sepstream(pattern, '-').GetToken(n2, 1);
try
{
from = convertTo<int>(n1);
to = convertTo<int>(n2);
}
catch (const ConvertException &)
auto num1 = Anope::TryConvert<int>(n1);
auto num2 = Anope::TryConvert<int>(n2);
if (!num1.has_value() || !num2.has_value())
{
source.Reply(LIST_INCORRECT_RANGE);
source.Reply(_("To search for channels starting with #, search for the channel\n"
@@ -49,6 +47,8 @@ public:
return;
}
from = num1.value();
to = num2.value();
pattern = "*";
}
+12 -12
View File
@@ -37,17 +37,17 @@ struct LogSettingImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << chan;
data["service_name"] << service_name;
data["command_service"] << command_service;
data["command_name"] << command_name;
data["method"] << method;
data["extra"] << extra;
data["creator"] << creator;
data.SetType("created", Serialize::Data::DT_INT); data["created"] << created;
data.Store("ci", chan);
data.Store("service_name", service_name);
data.Store("command_service", command_service);
data.Store("command_name", command_name);
data.Store("method", method);
data.Store("extra", extra);
data.Store("creator", creator);
data.Store("created", created);
}
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data)
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string sci;
data["ci"] >> sci;
@@ -135,7 +135,7 @@ public:
const LogSetting *log = (*ls)->at(i);
ListFormatter::ListEntry entry;
entry["Number"] = stringify(i + 1);
entry["Number"] = Anope::ToString(i + 1);
entry["Service"] = log->command_service;
entry["Command"] = !log->command_name.empty() ? log->command_name : log->service_name;
entry["Method"] = log->method;
@@ -391,11 +391,11 @@ public:
/* Sending a channel message or notice in response to a fantasy command */;
else if (log->method.equals_ci("MESSAGE") && l->ci->c)
{
IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, buffer);
l->ci->WhoSends()->lastmsg = Anope::CurTime;
}
else if (log->method.equals_ci("NOTICE") && l->ci->c)
IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str());
IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, buffer);
}
}
}
+13 -12
View File
@@ -32,7 +32,7 @@ struct ModeLockImpl final
}
void Serialize(Serialize::Data &data) const override;
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
};
struct ModeLocksImpl final
@@ -205,15 +205,15 @@ struct ModeLocksImpl final
void ModeLockImpl::Serialize(Serialize::Data &data) const
{
data["ci"] << this->ci;
data["set"] << this->set;
data["name"] << this->name;
data["param"] << this->param;
data["setter"] << this->setter;
data.SetType("created", Serialize::Data::DT_INT); data["created"] << this->created;
data.Store("ci", this->ci);
data.Store("set", this->set);
data.Store("name", this->name);
data.Store("param", this->param);
data.Store("setter", this->setter);
data.Store("created", this->created);
}
Serializable* ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data)
Serializable *ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string sci;
@@ -247,7 +247,7 @@ Serializable* ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data
class CommandCSMode final
: public Command
{
bool CanSet(CommandSource &source, ChannelInfo *ci, ChannelMode *cm, bool self)
static bool CanSet(CommandSource &source, ChannelInfo *ci, ChannelMode *cm, bool self)
{
if (!ci || !cm || cm->type != MODE_STATUS)
return false;
@@ -336,7 +336,7 @@ class CommandCSMode final
continue;
}
if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "32"))
if (modelocks->GetMLock().size() >= Config->GetModule(this->owner)->Get<unsigned>("max", "50"))
{
source.Reply(_("The mode lock list of \002%s\002 is full."), ci->name.c_str());
continue;
@@ -658,7 +658,8 @@ class CommandCSMode final
}
else
{
for (const auto &mode : ci->c->GetModeList(cm->name))
std::vector<Anope::string> v = ci->c->GetModeList(cm->name);
for (const auto &mode : v)
{
if (Anope::Match(mode, param))
ci->c->RemoveMode(NULL, cm, mode);
@@ -716,7 +717,7 @@ class CommandCSMode final
std::vector<Anope::string> new_params;
new_params.push_back(params[0]);
new_params.emplace_back("SET");
new_params.push_back("-" + stringify(cm->mchar));
new_params.push_back("-" + Anope::ToString(cm->mchar));
new_params.emplace_back("*");
this->DoSet(source, ci, new_params);
}
+1 -1
View File
@@ -33,7 +33,7 @@ public:
ChannelInfo *ci = ChannelInfo::Find(params[0]);
if (Anope::ReadOnly)
source.Reply(_("Sorry, channel registration is temporarily disabled."));
source.Reply(READ_ONLY_MODE);
else if (nc->HasExt("UNCONFIRMED"))
source.Reply(_("You must confirm your account before you can register a channel."));
else if (chan[0] == '&')
+15 -15
View File
@@ -19,7 +19,7 @@ enum TypeInfo
static bool simple;
struct SeenInfo;
static SeenInfo *FindInfo(const Anope::string &nick);
typedef Anope::hash_map<SeenInfo *> database_map;
typedef Anope::unordered_map<SeenInfo *> database_map;
database_map database;
struct SeenInfo final
@@ -46,16 +46,16 @@ struct SeenInfo final
void Serialize(Serialize::Data &data) const override
{
data["nick"] << nick;
data["vhost"] << vhost;
data["type"] << type;
data["nick2"] << nick2;
data["channel"] << channel;
data["message"] << message;
data.SetType("last", Serialize::Data::DT_INT); data["last"] << last;
data.Store("nick", nick);
data.Store("vhost", vhost);
data.Store("type", type);
data.Store("nick2", nick2);
data.Store("channel", channel);
data.Store("message", message);
data.Store("last", last);
}
static Serializable* Unserialize(Serializable *obj, Serialize::Data &data)
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
{
Anope::string snick;
@@ -66,7 +66,7 @@ struct SeenInfo final
s = anope_dynamic_static_cast<SeenInfo *>(obj);
else
{
SeenInfo* &info = database[snick];
SeenInfo *&info = database[snick];
if (!info)
info = new SeenInfo();
s = info;
@@ -185,7 +185,7 @@ public:
class CommandSeen final
: public Command
{
void SimpleSeen(CommandSource &source, const std::vector<Anope::string> &params)
static void SimpleSeen(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!source.c || !source.c->ci)
{
@@ -270,9 +270,9 @@ public:
if (simple)
return this->SimpleSeen(source, params);
if (target.length() > Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"))
if (target.length() > IRCD->MaxNick)
{
source.Reply(_("Nick too long, max length is %u characters."), Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"));
source.Reply(_("Nick too long, max length is %zu characters."), IRCD->MaxNick);
return;
}
@@ -440,12 +440,12 @@ public:
}
private:
void UpdateUser(const User *u, const TypeInfo Type, const Anope::string &nick, const Anope::string &nick2, const Anope::string &channel, const Anope::string &message)
static void UpdateUser(const User *u, const TypeInfo Type, const Anope::string &nick, const Anope::string &nick2, const Anope::string &channel, const Anope::string &message)
{
if (simple || !u->server->IsSynced())
return;
SeenInfo* &info = database[nick];
SeenInfo *&info = database[nick];
if (!info)
info = new SeenInfo();
info->nick = nick;

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