1
0
mirror of https://github.com/anope/anope.git synced 2026-06-22 06:16:38 +02:00

Compare commits

...

136 Commits

Author SHA1 Message Date
Sadie Powell da799bd6f1 Release 2.1.18. 2025-10-01 11:07:16 +01:00
Sadie Powell 4dada51e08 Sort options in the information formatter output. 2025-09-29 13:00:17 +01:00
Sadie Powell 1275fd01a7 Fix a missing command description in hs_request. 2025-09-28 14:58:35 +01:00
Sadie Powell 5b8018eb80 Update the change logs. 2025-09-27 20:33:21 +01:00
Sadie Powell b2026fe739 Fix various stupid mistakes in nickserv/confirm/register. 2025-09-27 18:12:34 +01:00
Sadie Powell 3390d82ebe Log the fingerprint used to authenticate in ns_cert. 2025-09-26 11:22:20 +01:00
Sadie Powell 4762e306f9 Default to code registration confirmation. 2025-09-23 18:23:12 +01:00
Sadie Powell fd759f7bd3 Fix a minor comment typo in Anope::Template. 2025-09-23 18:18:52 +01:00
Sadie Powell 003ddde09d Improve the services.host define documentation. 2025-09-23 18:18:52 +01:00
Sadie Powell c021d7134e Tweak the badwords documentation to document ALL. 2025-09-23 18:18:52 +01:00
Sadie Powell a792088a62 Add the monospace layout.
This works best in clients like The Lounge which use a variable-width
font but support monospace formatting.
2025-09-20 14:56:51 +01:00
Sadie Powell 03e2ebe2d2 Make LineWrapper UTF-8 aware. 2025-09-20 00:01:26 +01:00
Sadie Powell 0238f0a9e3 Move setting the display nickname to ns_group. 2025-09-19 21:30:52 +01:00
Sadie Powell c2dfb9a447 Use rounded durations in more places. 2025-09-19 20:38:53 +01:00
Sadie Powell bd8435a061 Add the reason to the regular version of operserv/session. 2025-09-19 20:38:53 +01:00
Sadie Powell 2cd67c9f36 Add a registration date column to nickserv/glist. 2025-09-19 20:38:53 +01:00
Sadie Powell 45ab094d63 Fix the case of the new SET LAYOUT command. 2025-09-19 19:25:57 +01:00
Sadie Powell 54389f474b Implement support for flexible table layouts. 2025-09-19 18:50:27 +01:00
Sadie Powell ac2b38b1b6 Fix a minor layout issue in cs_log. 2025-09-19 16:06:39 +01:00
Sadie Powell df551bee03 Fix the documentation of the ns_set_protect module. 2025-09-19 12:55:58 +01:00
Sadie Powell 59bb9d3d06 Rework the InfoFormatter/ListFormatter APIs and move to textproc. 2025-09-19 12:31:15 +01:00
Sadie Powell 3b2d798e76 Allow unprivileged users to use !help by default. 2025-09-19 11:41:02 +01:00
Sadie Powell ff6d6bdb3c Remove some now unused code. 2025-09-14 13:43:18 +01:00
Sadie Powell 411b3ce65a Update the en_US translation. 2025-09-12 15:44:42 +01:00
Sadie Powell ad19603818 Show the account id as part of the account field. 2025-09-12 15:44:24 +01:00
Sadie Powell 535ff9b839 Stop showing the last real name in the nick information output.
This isn't really used anymore and a lot of clients just set it to
a static string so it doesn't make sense to show it.
2025-09-12 15:33:00 +01:00
Sadie Powell 51916a50d2 Remove extraneous whitespace from the example configs. 2025-09-12 15:07:37 +01:00
Sadie Powell 42e58952cc Alias the old GETPASS command to RESETPASS. 2025-09-12 15:05:09 +01:00
Sadie Powell ba9f4e93c2 Redo how information tables are built to be multibyte aware. 2025-09-12 14:34:39 +01:00
Sadie Powell 679a313ae2 Add the utf8length method to Anope::string. 2025-09-12 14:21:39 +01:00
Sadie Powell 390975e6c4 Remove some duplicate code from ns_set. 2025-09-11 16:01:58 +01:00
Sadie Powell d631885495 Split autoop and neverop out into their own module. 2025-09-11 16:01:58 +01:00
Sadie Powell 8e337c6592 Fix printing the MySQL version when building against MariaDB. 2025-09-11 16:01:58 +01:00
Sadie Powell 9d89d8233d Modernize the ns_sasl_plain module slightly. 2025-09-10 12:30:45 +01:00
Sadie Powell 6f27418381 Fail an EXTERNAL auth attempt if the user has no client cert. 2025-09-08 15:13:57 +01:00
Sadie Powell 1932081c27 Modularise the supported SASL mechanisms. 2025-09-07 15:10:19 +01:00
Sadie Powell f73159159f Fix the name of the DNS record config option for the previous commit. 2025-09-06 17:48:46 +01:00
Sadie Powell eccb338cdd Add support for self-service vhost validation via DNS. 2025-09-06 17:46:01 +01:00
Sadie Powell 4021c0bb68 Fix looking up TXT records using the dns module. 2025-09-06 17:02:02 +01:00
Sadie Powell 7dfb40cb58 Update yyjson (for real this time). 2025-09-03 11:18:02 +01:00
dependabot[bot] 0fbd3095c4 Bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [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/v4...v5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-02 10:50:15 +01:00
Sadie Powell 6d426ec386 Update yyjson. 2025-08-26 18:06:48 +01:00
Sadie Powell 1b33a51695 Update the Turkish translation.
Co-Authored-By: CaPa CuL <capacul@gmail.com>
2025-08-26 13:04:16 +01:00
Sadie Powell 168a1173ed Error out when db_json can't find the backup directory. 2025-08-25 20:01:02 +01:00
Sadie Powell 59c777d4ff Fix the pid check on systems with reliable pid ordering (e.g. Docker). 2025-08-25 18:40:19 +01:00
Sadie Powell 43f88524e2 Vendor utfcpp, use to fix alignment for non-ascii syntax messages. 2025-08-24 23:18:06 +01:00
Sadie Powell 04de41ad7f Fix some code which was supposed to be part of the previous commit. 2025-08-21 10:45:39 +01:00
Sadie Powell dd13846cad Allow a different badpasslimit for partially connected users.
Closes #455.
2025-08-21 10:12:13 +01:00
Sadie Powell 6864bc6171 Fix building on Windows. 2025-08-08 16:15:51 +01:00
Sadie Powell 003cb55409 Skip deprecated modules when checking for a database/encryption backend. 2025-08-08 14:12:56 +01:00
Sadie Powell d15b8ee949 Remove some dead code from enc_sha256. 2025-08-08 13:14:14 +01:00
Sadie Powell 70de2b7de2 Move B64{Decode,Encode} to textproc and redesign their interface. 2025-08-08 12:27:28 +01:00
Sadie Powell e5c5689985 Move Anope::Distance to textproc. 2025-08-08 12:09:42 +01:00
Sadie Powell 928d4260dc Allow db_flatfile to be loadable first to import databases. 2025-08-07 10:03:34 +01:00
Sadie Powell 5e8561a7f1 Add support for TXT and SRV records in the dns module. 2025-08-06 15:38:13 +01:00
Sadie Powell 4dd3075ddf Merge branch '2.0' into 2.1. 2025-08-05 17:26:29 +01:00
Sadie Powell dbef7a7c64 Don't try to write to a buffered socket if there's no data.
This can cause the SSL modules to act weirdly because the TLS
library will return 0 bytes written (correctly) which is then
interpreted as an error.
2025-08-05 13:10:16 +01:00
Sadie Powell cd0f00a819 Improve the error diagnostics when the link fails. 2025-08-03 13:15:14 +01:00
Sadie Powell b2d40d4189 Improve how Anope formats C strings. 2025-08-02 18:17:01 +01:00
Sadie Powell e6e812c43c Move NormalizeBuffer to textproc and rename more descriptively. 2025-08-02 17:09:24 +01:00
Sadie Powell 2dbd41d244 Move some methods to textproc. 2025-08-02 17:00:31 +01:00
Sadie Powell 02aeb254ee Add an option to disable the encryption and database module checks. 2025-08-01 13:57:47 +01:00
Sadie Powell 1245b43ade Require that users have a non-deprecated database module loaded. 2025-08-01 13:28:29 +01:00
Sadie Powell 5a3f9f3f87 Warn when a user loads a deprecated module. 2025-08-01 13:08:22 +01:00
Sadie Powell 2c6f4d7c27 Make db_flatfile import-only. 2025-08-01 12:41:27 +01:00
Sadie Powell 64f8449bf4 Banish db_old and enc_old to the shadow realm. 2025-08-01 12:41:27 +01:00
Sadie Powell 0e1f6b403b Bump for 2.1.18-git. 2025-08-01 12:22:21 +01:00
Sadie Powell 206192abdc Release 2.1.17. 2025-08-01 12:21:00 +01:00
Sadie Powell 32d3ddc0e4 Fix the grammar of two messages. 2025-07-30 15:30:44 +01:00
Sadie Powell 4410e5ccce Update the change logs. 2025-07-27 19:23:02 +01:00
Sadie Powell d5f2232140 Fix importing some older databases. 2025-07-27 15:42:32 +01:00
Sadie Powell 6d754b7d73 Add the intended target of the mode to CanSet. 2025-07-25 21:07:26 +01:00
Sadie Powell 4d2870fa45 Make it more clear that db_flatfile is deprecated. 2025-07-25 13:38:13 +01:00
Sadie Powell 5948c2ea53 Simplify the Windows module copying logic.
As far as I can tell from reading the Windows documentation there
is no reason to overcomplicate this so much.
2025-07-25 13:21:15 +01:00
Sadie Powell ace7d99797 Tweak the default ns_set_misc examples slightly.
- Discord is proprietary software so we shouldn't be encouraging
  its use. ;-)

- Time zone is going to be replaced by a future feature that allows
  users to get timestamps in their local time so I'm removing it
  now to prevent future conflict.

- Location is a good example of how this should be used for extra
  fields.
2025-07-25 12:53:47 +01:00
Sadie Powell 52595b90fa Rewrite nickserv/resend with some functionality improvements.
- Allow server operators to resend a confirmation email. Closes #518.
- Allow use of the command whilst unauthenticated.
2025-07-25 12:28:14 +01:00
Sadie Powell b39f002d1b Remove some unused files. 2025-07-21 19:14:34 +01:00
Sadie Powell 5df95d9f86 Remove a variant message which is only used in one place. 2025-07-12 16:33:14 +01:00
Sadie Powell a56d9a4096 Only show the last quit message if the user is not online. 2025-07-12 15:28:57 +01:00
Sadie Powell ce7bb15c18 Use IsIdentValid for validating usernames in hs_request. 2025-07-12 14:41:09 +01:00
Sadie Powell 6873630f2e Improve the "please identify" messages. 2025-07-08 16:24:16 +01:00
Sadie Powell 44a4d62654 Show the last real mask to services operators with nickserv/list. 2025-07-07 11:51:10 +01:00
Sadie Powell 97389cd105 Rename some fields to be more accurately named. 2025-07-07 11:51:10 +01:00
Sadie Powell 80c0adf7c8 Make a message consistent with others. 2025-07-02 14:08:04 +01:00
Sadie Powell 6a539277b9 Bump for 2.1.17-git. 2025-07-01 10:58:05 +01:00
Sadie Powell 9930fa01ac Release 2.1.16. 2025-07-01 10:56:40 +01:00
Sadie Powell 40929a0490 Update the change logs. 2025-07-01 10:13:36 +01:00
Sadie Powell 783be31f64 Update author list. 2025-07-01 09:48:19 +01:00
Sadie Powell 0f5f2aef2e Bump the minimum OpenSSL version to 1.1.1.
Close #517.
2025-07-01 00:00:55 +01:00
Sadie Powell 6cc997c4e9 When unsetting a temporary ban delete the unset timer.
This prevents Anope from unsetting a later-added ban,

Resolves MantisBT bug 1709.
2025-06-25 19:16:15 +01:00
Sadie Powell eda6d8cc0f Fix storing the setter of a list mode. 2025-06-25 19:10:49 +01:00
Sadie Powell 3440b38a21 Merge branch '2.0' into 2.1. 2025-06-25 17:50:01 +01:00
Sadie Powell fca421aa2a Fix resetpass confirming accounts when not using email confirmation.
Fixes MantisBT bug 1734.
2025-06-25 17:36:16 +01:00
Sadie Powell 035905d321 Fix example messages using .site which is a real TLD now. 2025-06-25 15:39:35 +01:00
Sadie Powell d1cd57d98e Resynchronise the en_US language file. 2025-06-25 15:34:01 +01:00
Sadie Powell 48daeeac1d Merge branch '2.0' into 2.1. 2025-06-25 15:33:36 +01:00
Sadie Powell 9bcf46f8ea Fix using service's instead of services' where appropriate. 2025-06-25 15:29:16 +01:00
Sadie Powell 0b6c7ce5d6 Update some messages for the language used by modern BIND versions. 2025-06-25 15:28:54 +01:00
Sadie Powell a0d21b207b Fix reading the purge time in cs_seen. 2025-06-25 14:08:44 +01:00
Sadie Powell 3cc5b5143f Remove the old 1.8-style seen system. 2025-06-25 14:06:59 +01:00
Sadie Powell da738126a4 Merge branch '2.0' into 2.1. 2025-06-25 12:07:36 +01:00
Sadie Powell 0bb1bc5c67 Backport various minor config changes from 2.1. 2025-06-25 12:00:33 +01:00
Sadie Powell 72010cd1a9 Fix messages that say IRC Operator when they mean Services Operator. 2025-06-24 13:58:47 +01:00
Sadie Powell c48b3af3d4 Remove an obsolete workaround from Config. 2025-06-24 09:29:33 +01:00
Sadie Powell 85c129701b Clarify how to migrate db_flatfile databases to db_json. 2025-06-23 23:39:20 +01:00
Sadie Powell a9e5a79e91 Remove some unused strings in os_news. 2025-06-22 15:45:21 +01:00
Sadie Powell adc1343d6c Serialize item types as strings instead of integers.
Using the type cast to an integer here was undefined behaviour.
2025-06-22 15:45:21 +01:00
Sadie Powell 8aa1102c7a Default to db_json. 2025-06-22 15:45:21 +01:00
TehPeGaSuS 1a89d32926 Document NS_STATS and CS_STATS. 2025-06-21 17:09:26 +01:00
Sadie Powell ad06853edf Fix suggesting unloaded commands in the "did you mean" message. 2025-06-21 09:56:02 +01:00
Sadie Powell 66ae20e0f2 Tweak a message to make it easier for ESL speakers to understand. 2025-06-21 09:48:01 +01:00
Sadie Powell 2850e3c65c Implement serializer hashing in db_json. 2025-06-21 00:31:02 +01:00
Sadie Powell 80b8856254 Consistently use "account" instead of "nick group". 2025-06-20 20:30:21 +01:00
Sadie Powell 21c8164539 When assigning a new display nick use the oldest not the first. 2025-06-20 20:27:39 +01:00
Sadie Powell a4abd27ffd Fix the grammar of a message in ns_confirm. 2025-06-20 19:43:02 +01:00
Sadie Powell b912b403f0 Fix a comment in CommandInfo. 2025-06-20 19:43:02 +01:00
Sadie Powell 59e9d47667 Update another message to use pluralisation. 2025-06-18 20:53:11 +01:00
Sadie Powell 1108e54250 We don't need to reserialize aliases now we use account identifiers. 2025-06-17 14:50:36 +01:00
Sadie Powell 8b37cdb5d5 Make the access description more useful when importing from Atheme. 2025-06-17 14:50:36 +01:00
Sadie Powell c5bff3a099 Fix various issues with language strings. 2025-06-16 12:30:42 +01:00
Sadie Powell 61b0c82884 Rework how confirmation works and make it modular. 2025-06-16 10:00:41 +01:00
Sadie Powell c4c159d197 Fix showing the MORE_INFO message. 2025-06-15 11:49:26 +01:00
Sadie Powell 04a32be1e1 Add support for code authentication via IRC.
This breaks spambots which try to register but that can't handle
reading the response from services.
2025-06-15 11:22:03 +01:00
Sadie Powell fe4b8ee669 When a command is missing in GetQueryCommand just return (MISSING). 2025-06-15 11:20:34 +01:00
Sadie Powell 34b451f36c The require_privilege option should default to yes not no. 2025-06-11 09:28:46 +01:00
Sadie Powell 16aff210fd Allow configuring fantasy commands to not require the FANTASY priv. 2025-06-10 16:05:11 +01:00
Sadie Powell 5702fb9145 Add a PREPEND subcommand to chanserv/topic. 2025-06-10 12:06:02 +01:00
Sadie Powell 783ba3fd74 Undocument DISCOURAGED; we do not use this anymore. 2025-06-08 16:21:08 +01:00
Sadie Powell f1ddd7cd02 Promote NickServ from OPTIONAL to RECOMMENDED.
Not sure why this wasn't already.
2025-06-08 16:09:43 +01:00
Sadie Powell c424c4d24d Document cs_statusupdate in the same way as other modules. 2025-06-08 12:22:45 +01:00
Sadie Powell 2d88383d9e Group some more chanserv commands. 2025-06-08 12:18:10 +01:00
Sadie Powell c73a6c621f Make the set_misc help format consistent with other set commands. 2025-06-07 13:27:30 +01:00
Sadie Powell 96a503b4d9 Fix a memory leak in the db_json module.
This reworks the module to store Data instead of a yyjson document
which does not free until yyjson_doc_free even if an array is cleared
(which annoyingly was only documented using a single comment in the
yyjson docs).
2025-06-05 22:01:45 +01:00
Sadie Powell 0632abd111 Banish irc2sql to the shadow realm. 2025-06-05 18:22:13 +01:00
TehPeGaSuS 1043e2189c Remove a reference to a config option that doesn't exist.
There's no `memoreceipt` anywhere, as far as I could check.
2025-06-01 15:29:35 +01:00
Sadie Powell 85f0d56c39 Bump for 2.1.16-git. 2025-06-01 10:14:44 +01:00
178 changed files with 10584 additions and 13837 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install dependencies
run: |
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
CXX: ${{ matrix.compiler }}
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Install dependencies
run: |
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
CONAN_USER_HOME: ${{ github.workspace }}/win/build
CONAN_USER_HOME_SHORT: None
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Setup NSIS
run: |-
+2 -10
View File
@@ -13,14 +13,6 @@
#
###########################################################################
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
else
return 1
fi
}
Load_Cache () {
if [ -f $SOURCE_DIR/config.cache -a -r $SOURCE_DIR/config.cache -a ! "$IGNORE_CACHE" ] ; then
echo "Using defaults from config.cache. To ignore, $SOURCE_DIR/Config -nocache"
@@ -208,7 +200,7 @@ while [ $ok -eq 0 ] ; do
INPUT=$INSTDIR
fi
if [ ! -d "$INPUT" ] ; then
if exists "$INPUT" ; then
if [ -e "$INPUT" ]; then
echo "$INPUT exists, but is not a directory!"
else
echo "$INPUT does not exist. Create it?"
@@ -220,7 +212,7 @@ while [ $ok -eq 0 ] ; do
fi
fi
fi
elif exists "$INPUT/include/services.h" ; then
elif [ -e "$INPUT/include/services.h" ]; then
echo "You cannot use the Anope source directory as a target directory."
else
ok=1
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
# Only install cron.example.sh 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 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)
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)
install(FILES ${DATA}
DESTINATION ${CONF_DIR}
)
+25 -102
View File
@@ -65,10 +65,6 @@
* will typically be disabled. If this is not the case, more
* information will be given in the documentation.
*
* [DISCOURAGED]
* Indicates a directive which may cause undesirable side effects if
* specified.
*
* [DEPRECATED]
* Indicates a directive which will disappear in a future version of
* Anope, usually because its functionality has been either
@@ -87,8 +83,9 @@
*/
/*
* The services.host define is used in multiple different locations throughout the
* configuration for the server name and pseudoclient hostnames.
* The "services.host" define is used in multiple different locations throughout
* the configuration for the server name and pseudoclient hostnames. You should
* change the value to the hostname you wish to use for your services server.
*/
define
{
@@ -347,7 +344,7 @@ networkinfo
*
* It is recommended you DON'T change this.
*/
disallow_start_or_end = ".-"
disallow_start_or_end = ".-/"
}
/*
@@ -587,7 +584,7 @@ include
}
/*
* [OPTIONAL] NickServ
* [RECOMMENDED] NickServ
*
* Includes nickserv.example.conf, which is necessary for NickServ functionality.
*
@@ -745,11 +742,13 @@ log
* 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/confirm/email - Can confirm other users email address change
* nickserv/confirm/register - Can confirm other users account registration
* 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
* nickserv/resend - Can resend confirmation codes via email
* operserv/config - Can modify services's configuration
* operserv/oper/modify - Can add and remove operators with at most the same privileges
* protected - Can not be kicked from channels by services
@@ -814,10 +813,10 @@ opertype
inherits = "Helper, Another Helper"
/* What commands (see above) this opertype may use */
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
commands = "chanserv/list chanserv/suspend chanserv/topic memoserv/staff nickserv/list nickserv/resend nickserv/suspend operserv/mode operserv/chankill operserv/akill operserv/session operserv/modinfo operserv/sqline operserv/oper operserv/kick operserv/ignore operserv/snline"
/* What privs (see above) this opertype has */
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm"
privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auspex nickserv/confirm/*"
/*
* Modes to be set on users when they identify to accounts linked to this opertype.
@@ -994,7 +993,7 @@ mail
registration_message = "Hi,
You have requested to register the nickname {nick} on {network}.
Please type \" /msg NickServ CONFIRM {code} \" to complete registration.
Please type \" /msg NickServ CONFIRM REGISTER {code} \" to complete registration.
If you don't know why this mail was sent to you, please ignore it silently.
@@ -1012,7 +1011,7 @@ mail
reset_message = "Hi,
You have requested to have the password for {nick} reset.
To reset your password, type \" /msg NickServ CONFIRM {nick} {code} \"
To reset your password, type \" /msg NickServ CONFIRM RESETPASS {nick} {code} \"
If you don't know why this mail was sent to you, please ignore it silently.
@@ -1032,7 +1031,7 @@ mail
emailchange_message = "Hi,
You have requested to change your email address from {old_email} to {new_email}.
Please type \" /msg NickServ CONFIRM {code} \" to confirm this change.
Please type \" /msg NickServ CONFIRM EMAIL {code} \" to confirm this change.
If you don't know why this mail was sent to you, please ignore it silently.
@@ -1066,97 +1065,44 @@ mail
* have will not be stored!
*/
/*
* [DEPRECATED] db_old
*
* This is the old binary database format from late Anope 1.7.x, Anope 1.8.x, and
* early Anope 1.9.x. This module only loads these databases, and will NOT save them.
* You should only use this to upgrade old databases to a newer database format by loading
* other database modules in addition to this one, which will be used when saving databases.
*/
#module
{
name = "db_old"
/*
* This is the encryption type used by the databases. This must be set correctly or
* your passwords will not work. Valid options are: md5, oldmd5, sha1, and plain.
* You must also be sure to load the correct encryption module below in the Encryption
* Modules section so that your passwords work.
*/
#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.
* This allows importing databases from Atheme. You should load another database
* module like db_json 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.
* The file that db_atheme will import your main database from.
*/
database = "atheme.db"
}
/*
* [RECOMMENDED] db_flatfile
* [DEPRECATED] db_flatfile
*
* This is the default flatfile database format.
* This allows importing databases from the custom flat file format used between
* Anope 1.9.6 and 2.1.17. You should load another database module like db_json
* as well as this as it can only read db_flatfile databases not write them.
*/
module
#module
{
name = "db_flatfile"
/*
* The database name db_flatfile should use
* The file that db_flatfile will import your main database from.
*/
database = "anope.db"
/*
* Sets the number of days backups of databases are kept. If you don't give it,
* or if you set it to 0, Anope won't backup the databases.
*
* This directive is optional, but recommended.
*/
keepbackups = 7
/*
* Allows Anope to continue file write operations (i.e. database saving)
* even if the original file cannot be backed up. Enabling this option may
* allow Anope to continue operation under conditions where it might
* otherwise fail, such as a nearly-full disk.
*
* NOTE: Enabling this option can cause irrecoverable data loss under some
* conditions, so make CERTAIN you know what you're doing when you enable it!
*
* This directive is optional, and you are discouraged against enabling it.
*/
#nobackupokay = yes
/*
* If enabled, services will fork a child process to save databases.
*
* This is only useful with very large databases, with hundreds
* of thousands of objects, that have a noticeable delay from
* writing databases.
*/
fork = no
}
/*
* db_json
* [RECOMMENDED] db_json
*
* Stores your database in a JSON file.
*
* IMPORTANT: This will become the default database module in the future but is
* currently experimental and has not been fully tested so make sure you have
* db_flatfile loaded as a secondary database module if you use this as your
* primary database module.
*/
module
{
@@ -1374,7 +1320,7 @@ module
#module { name = "enc_posix" }
/*
* [DEPRECATED] enc_md5, enc_none, enc_old, enc_sha1, enc_sha256
* [DEPRECATED] enc_md5, enc_none, 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
@@ -1384,8 +1330,6 @@ module
* 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.
*
@@ -1394,7 +1338,6 @@ module
*/
#module { name = "enc_md5" }
#module { name = "enc_none" }
#module { name = "enc_old" }
#module { name = "enc_sha1" }
#module { name = "enc_sha256" }
@@ -1414,23 +1357,3 @@ include
type = "file"
name = "chanstats.example.conf"
}
/*
* [DEPRECATED] IRC2SQL Gateway
*
* This module collects data about users, channels and servers. It doesn't build stats
* itself, however, it gives you the database, it's up to you how you use it.
*
* This module is deprecated in favour of the RPC interface and the rpc_data
* module. This should provide almost all of the same information as irc2sql but
* without requiring MySQL and with much better performance. If you have a use
* case which is not covered by rpc_data then please open an issue so we can
* extend rpc_data before irc2sql is removed.
*
* Requires a MySQL Database and MySQL version 5.5 or higher
*/
#include
{
type = "file"
name = "irc2sql.example.conf"
}
+1 -4
View File
@@ -296,11 +296,9 @@ command { service = "BotServ"; name = "KICK ITALICS"; command = "botserv/kick/it
command { service = "BotServ"; name = "KICK REPEAT"; command = "botserv/kick/repeat"; }
command { service = "BotServ"; name = "KICK REVERSES"; command = "botserv/kick/reverses"; }
command { service = "BotServ"; name = "KICK UNDERLINES"; command = "botserv/kick/underlines"; }
command { service = "BotServ"; name = "SET DONTKICKOPS"; command = "botserv/set/dontkickops"; }
command { service = "BotServ"; name = "SET DONTKICKVOICES"; command = "botserv/set/dontkickvoices"; }
/*
* bs_set
*
@@ -341,7 +339,6 @@ privilege
xop = "AOP"
}
/*
* fantasy
*
@@ -387,7 +384,7 @@ fantasy { name = "ENFORCE"; command = "chanserv/enforce"; }
fantasy { name = "ENTRYMSG"; command = "chanserv/entrymsg"; }
fantasy { name = "FLAGS"; command = "chanserv/flags"; }
fantasy { name = "HALFOP"; command = "chanserv/modes"; }
fantasy { name = "HELP"; command = "generic/help"; prepend_channel = no; }
fantasy { name = "HELP"; command = "generic/help"; prepend_channel = no; require_privilege = no; }
fantasy { name = "HOP"; command = "chanserv/xop"; }
fantasy { name = "INFO"; command = "chanserv/info"; prepend_channel = no; }
fantasy { name = "INVITE"; command = "chanserv/invite"; }
+12 -22
View File
@@ -100,6 +100,7 @@ module
* not in use.
* - cs_no_expire: Enables no expire. Needs founder, successor (if set) or anyone in the access list
* to be a registered nick, otherwise the channel will be dropped.
* - cs_stats: Enable Chanstats for newly registered channels
* - none: No defaults
*
* This directive is optional, if left blank, the options will default to cs_keep_modes, keeptopic, peace,
@@ -946,7 +947,7 @@ command { service = "ChanServ"; name = "AKICK"; command = "chanserv/akick"; grou
* Used for banning users from channels.
*/
module { name = "cs_ban" }
command { service = "ChanServ"; name = "BAN"; command = "chanserv/ban"; }
command { service = "ChanServ"; name = "BAN"; command = "chanserv/ban"; group = "chanserv/management"; }
/*
* cs_clone
@@ -1047,7 +1048,7 @@ command { service = "ChanServ"; name = "INVITE"; command = "chanserv/invite"; }
* Used for kicking users from channels.
*/
module { name = "cs_kick" }
command { service = "ChanServ"; name = "KICK"; command = "chanserv/kick"; }
command { service = "ChanServ"; name = "KICK"; command = "chanserv/kick"; group = "chanserv/management"; }
/*
* cs_list
@@ -1066,10 +1067,8 @@ module
listmax = 50
}
command { service = "ChanServ"; name = "LIST"; command = "chanserv/list"; }
command { service = "ChanServ"; name = "SET PRIVATE"; command = "chanserv/set/private"; }
/*
* cs_log
*
@@ -1155,7 +1154,6 @@ command { service = "ChanServ"; name = "DEHALFOP"; command = "chanserv/modes"; g
command { service = "ChanServ"; name = "VOICE"; command = "chanserv/modes"; group = "chanserv/status"; set = "VOICE" }
command { service = "ChanServ"; name = "DEVOICE"; command = "chanserv/modes"; group = "chanserv/status"; unset = "VOICE" }
/*
* cs_register
*
@@ -1178,9 +1176,6 @@ module
{
name = "cs_seen"
/* If set, uses the older 1.8 style seen, which is less resource intensive */
simple = no
/* Sets the time to keep seen entries in the seen database. */
purgetime = 90d
}
@@ -1271,6 +1266,14 @@ module { name = "cs_status" }
command { service = "ChanServ"; name = "STATUS"; command = "chanserv/status"; }
command { service = "ChanServ"; name = "WHY"; command = "chanserv/status"; hide = yes; }
/*
* cs_statusupdate
*
* This module automatically updates users' status on channels when the
* channel's access list is modified.
*/
module { name = "cs_statusupdate" }
/*
* cs_suspend
*
@@ -1330,7 +1333,7 @@ command { service = "ChanServ"; name = "SET KEEPTOPIC"; command = "chanserv/set/
* Used for unbanning users from channels.
*/
module { name = "cs_unban" }
command { service = "ChanServ"; name = "UNBAN"; command = "chanserv/unban"; }
command { service = "ChanServ"; name = "UNBAN"; command = "chanserv/unban"; group = "chanserv/management"; }
/*
* cs_updown
@@ -1363,16 +1366,3 @@ command { service = "ChanServ"; name = "SOP"; command = "chanserv/xop"; group =
command { service = "ChanServ"; name = "AOP"; command = "chanserv/xop"; group = "chanserv/access"; }
command { service = "ChanServ"; name = "HOP"; command = "chanserv/xop"; group = "chanserv/access"; }
command { service = "ChanServ"; name = "VOP"; command = "chanserv/xop"; group = "chanserv/access"; }
/*
* Extra ChanServ related modules.
*/
/*
* cs_statusupdate
*
* This module automatically updates users' status on channels when the
* channel's access list is modified.
*/
module { name = "cs_statusupdate" }
+1 -1
View File
@@ -93,7 +93,7 @@ module
#globaloncycleup = "Services are now back online - have a nice day"
/*
* If set, Anope will hide the IRC Operator's nick in a global
* If set, Anope will hide the Services Operator's nick in a global
* message/notice.
*
* This directive is optional.
+20 -1
View File
@@ -168,7 +168,13 @@ command { service = "HostServ"; name = "ON"; command = "hostserv/on"; }
/*
* hs_request
*
* Provides the commands hostserv/request, hostserv/activate, hostserv/reject, and hostserv/waiting.
* Provides the commands:
* hostserv/request - Requests a vhost.
* hostserv/activate - Approves a requested vhost.
* hostserv/reject - Rejects a requested vhost.
* hostserv/waiting - Lists pending vhost requests.
* hostserv/validate - Allows self-service approval of vhosts using DNS
* validation (requires the dns module).
*
* Used to manage vhosts requested by users.
*/
@@ -186,11 +192,24 @@ module
* If set, Anope will send a memo to all services staff when a new vhost is requested.
*/
#memooper = yes
/*
* If DNS validation is enabled, how long should users have to wait between
* attempts at DNS validation. Defaults to 5 minutes.
*/
#validationcooldown = 5m
/*
* If DNS validation is enabled, the TXT record to look for when determining
* if the requester controls the domain. Defaults to anope-dns-validation.
*/
#validationrecord = "anope-dns-validation"
}
command { service = "HostServ"; name = "REQUEST"; command = "hostserv/request"; }
command { service = "HostServ"; name = "ACTIVATE"; command = "hostserv/activate"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "REJECT"; command = "hostserv/reject"; permission = "hostserv/set"; }
command { service = "HostServ"; name = "WAITING"; command = "hostserv/waiting"; permission = "hostserv/set"; }
#command { service = "HostServ"; name = "VALIDATE"; command = "hostserv/validate"; }
/*
* hs_set
-97
View File
@@ -1,97 +0,0 @@
/*
* Example configuration file for the irc2sql gateway
*
*/
service
{
/*
* The name of the StatServ client.
*/
nick = "StatServ"
/*
* The username of the StatServ client.
*/
user = "StatServ"
/*
* The hostname of the StatServ client.
*/
host = "${services.host}"
/*
* The realname of the StatServ client.
*/
real = "Statistical Service"
/*
* The modes this client should use.
* Do not modify this unless you know what you are doing.
*
* These modes are very IRCd specific. If left commented, sane defaults
* are used based on what protocol module you have loaded.
*
* Note that setting this option incorrectly could potentially BREAK some, if
* not all, usefulness of the client. We will not support you if this client is
* unable to do certain things if this option is enabled.
*/
#modes = "+o"
/*
* An optional comma separated list of channels this service should join. Outside
* of log channels this is not very useful, as the service will just idle in the
* specified channels, and will not accept any types of commands.
*
* Prefixes may be given to the channels in the form of mode characters or prefix symbols.
*/
#channels = "@#stats,#mychan"
}
module
{
name = "irc2sql"
/*
* The name of the client that should send the CTCP VERSION requests.
* It must already exist or must be defined in the following service block.
*/
client = "StatServ"
/*
* The name of the SQL engine to use.
* This must be MySQL and must match the name in the mysql{} block
*/
engine = "mysql/main"
/*
* An optional prefix to prepended to the name of each created table.
* Do not use the same prefix for other programs.
*/
prefix = "anope_"
/*
* GeoIP - Automatically adds users geoip location to the user table.
* Tables are created by irc2sql, you have to run the
* geoipupdate script after you started Anope to download
* and import the GeoIP database.
*
* The geoip database can be the smaller "country" database or the
* larger "city" database. Comment to disable geoip lookup.
*/
geoip_database = "country"
/*
* Get the CTCP version from users
* The users connecting to the network will receive a CTCP VERSION
* request from the above configured stats client
*/
ctcpuser = "yes"
/*
* Send out CTCP VERSION requests to users during burst.
* Disable this if you restart Anope often and don't want to
* annoy your users.
*/
ctcpeob = "yes"
}
-2
View File
@@ -196,8 +196,6 @@ command { service = "MemoServ"; name = "READ"; command = "memoserv/read"; }
* Provides the command memoserv/rsend.
*
* Used to send a memo requiring a receipt be sent back once it is read.
*
* Requires configuring memoserv:memoreceipt.
*/
#module
{
+16 -18
View File
@@ -41,7 +41,6 @@ module { name = "help" }
*/
timeout = 5
/* Only edit below if you are expecting to use os_dns or otherwise answer DNS queries. */
/*
@@ -54,7 +53,6 @@ module { name = "help" }
ip = "0.0.0.0"
port = 53
/*
* SOA record information.
*/
@@ -65,7 +63,7 @@ module { name = "help" }
/* This should be the names of the public facing nameservers serving the records. */
nameservers = "ns1.example.com ns2.example.com"
/* The time slave servers are allowed to cache. This should be reasonably low
/* The time secondary servers are allowed to cache for. This should be reasonably low
* if you want your records to be updated without much delay.
*/
refresh = 3600
@@ -233,7 +231,7 @@ module { name = "help" }
}
/*
* ldap [EXTRA]
* [EXTRA] ldap
*
* This module allows other modules to use LDAP. By itself, this module does nothing useful.
*/
@@ -304,13 +302,13 @@ module { name = "help" }
*
* If not set, then registration is not blocked.
*/
#disable_register_reason = "To register on this network visit https://some.misconfigured.site/register"
#disable_register_reason = "To register on this network visit https://some.misconfigured.site.example/register"
/*
* If set, the reason to give the users who try to "/msg NickServ SET EMAIL".
* If not set, then email changing is not blocked.
*/
#disable_email_reason = "To change your email address visit https://some.misconfigured.site"
#disable_email_reason = "To change your email address visit https://some.misconfigured.site.example"
}
/*
@@ -355,7 +353,7 @@ module { name = "help" }
}
/*
* mysql [EXTRA]
* [EXTRA] mysql
*
* This module allows other modules to use MySQL.
*/
@@ -402,7 +400,7 @@ module { name = "help" }
}
/*
* regex_pcre2 [EXTRA]
* [EXTRA] regex_pcre2
*
* Provides the regex engine regex/pcre, which uses version 2 of the Perl Compatible Regular
* Expressions library.
@@ -410,7 +408,7 @@ module { name = "help" }
#module { name = "regex_pcre2" }
/*
* regex_posix [EXTRA]
* [EXTRA] regex_posix
*
* Provides the regex engine regex/posix, which uses the POSIX compliant regular expressions.
*/
@@ -440,7 +438,7 @@ module
}
/*
* regex_tre [EXTRA]
* [EXTRA] regex_tre
*
* Provides the regex engine regex/tre, which uses the TRE regex library.
*/
@@ -559,7 +557,7 @@ module
}
/*
* ssl_gnutls [EXTRA]
* [EXTRA] ssl_gnutls
*
* This module provides SSL services to Anope using GnuTLS, for example to
* connect to the uplink server(s) via SSL.
@@ -598,7 +596,7 @@ module
}
/*
* ssl_openssl [EXTRA]
* [EXTRA] ssl_openssl
*
* This module provides SSL services to Anope using OpenSSL, for example to
* connect to the uplink server(s) via SSL.
@@ -691,20 +689,20 @@ module
* If set, the reason to give the users who try to "/msg NickServ REGISTER".
* If not set, then registration is not blocked.
*/
#disable_reason = "To register on this network visit https://some.misconfigured.site/register"
#disable_reason = "To register on this network visit https://some.misconfigured.site.example/register"
/*
* If set, the reason to give the users who try to "/msg NickServ SET EMAIL".
* If not set, then email changing is not blocked.
*/
#disable_email_reason = "To change your email address visit https://some.misconfigured.site"
#disable_email_reason = "To change your email address visit https://some.misconfigured.site.example"
}
/*
* sql_log
*
* This module adds an additional target option to log{} blocks
* that allows logging Service's logs to SQL. To log to SQL, add
* that allows logging Services' logs to SQL. To log to SQL, add
* the SQL service name to log:targets prefixed by sql_log:. For
* example:
*
@@ -723,8 +721,8 @@ module
/*
* 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.
* This module allows granting users Services Operator privileges based on an
* external SQL database using a custom query.
*/
#module
{
@@ -747,7 +745,7 @@ module
}
/*
* sqlite [EXTRA]
* [EXTRA] sqlite
*
* This module allows other modules to use SQLite.
*/
+127 -37
View File
@@ -118,6 +118,7 @@ module
* - msg: Messages will be sent as PRIVMSGs instead of NOTICEs
* - ns_keep_modes: Enables keepmodes, which retains user modes across sessions
* - protect: Protects the registered nickname from use by unidentified users.
* - ns_stats: Enable Chanstats for newly registered nicks
*
* 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.
@@ -250,8 +251,8 @@ module
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.
* Whether all of the secondary nicks of an account have to expire or be
* dropped before the display nick can expire or be dropped.
*/
preservedisplay = no
}
@@ -335,6 +336,16 @@ module
}
command { service = "NickServ"; name = "CERT"; command = "nickserv/cert"; }
/*
* ns_confirm
*
* Provides the command nickserv/confirm.
*
* Used for confirming previous account actions.
*/
module { name = "ns_confirm" }
command { service = "NickServ"; name = "CONFIRM"; command = "nickserv/confirm"; }
/*
* ns_drop
*
@@ -351,6 +362,7 @@ command { service = "NickServ"; name = "DROP"; command = "nickserv/drop"; }
* Provides various functionality relating to email addresses. This includes the
* following commands:
*
* - nickserv/confirm/email: Used for confirming email changes.
* - nickserv/getemail: Used for getting accounts by searching for emails.
* - nickserv/set/email, nickserv/saset/email: Used for setting an account's
* emailvaddress.
@@ -359,6 +371,12 @@ module
{
name = "ns_email"
/*
* The amount of time a user has after requesting a change of email address
* before it expires. Defaults to 1 day.
*/
#changeexpire = 1d
/*
* The limit to how many registered accounts can use the same email address.
* If set to 0 or left commented there will be no limit enforced when
@@ -373,7 +391,7 @@ module
*/
#remove_aliases = yes
}
command { service = "NickServ"; name = "CONFIRM EMAIL"; command = "nickserv/confirm/email"; }
command { service = "NickServ"; name = "GETEMAIL"; command = "nickserv/getemail"; permission = "nickserv/getemail"; group = "nickserv/admin"; }
command { service = "NickServ"; name = "SET EMAIL"; command = "nickserv/set/email"; }
command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/email"; permission = "nickserv/saset/email"; }
@@ -381,9 +399,14 @@ command { service = "NickServ"; name = "SASET EMAIL"; command = "nickserv/saset/
/*
* ns_group
*
* Provides the commands nickserv/group, nickserv/glist, and nickserv/ungroup.
* Provides the commands:
* nickserv/group
* nickserv/ungroup
* nickserv/glist
* nickserv/saset/display
* nickserv/set/display
*
* Used for controlling nick groups.
* Used for controlling grouped nicknames.
*/
module
{
@@ -408,6 +431,12 @@ module
command { service = "NickServ"; name = "GLIST"; command = "nickserv/glist"; }
command { service = "NickServ"; name = "GROUP"; command = "nickserv/group"; }
command { service = "NickServ"; name = "UNGROUP"; command = "nickserv/ungroup"; }
command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; permission = "nickserv/saset/display"; }
# For compatibility with Atheme.
command { service = "NickServ"; name = "SET ACCOUNTNAME"; command = "nickserv/set/display"; hide = yes; }
command { service = "NickServ"; name = "SASET ACCOUNTNAME"; command = "nickserv/saset/display"; permission = "nickserv/saset/display"; hide = yes; }
/*
* ns_identify
@@ -442,7 +471,6 @@ command { service = "NickServ"; name = "INFO"; command = "nickserv/info"; }
command { service = "NickServ"; name = "SET HIDE"; command = "nickserv/set/hide"; }
command { service = "NickServ"; name = "SASET HIDE"; command = "nickserv/saset/hide"; permission = "nickserv/saset/hide"; }
/*
* ns_list
*
@@ -461,11 +489,9 @@ module
listmax = 50
}
command { service = "NickServ"; name = "LIST"; command = "nickserv/list"; }
command { service = "NickServ"; name = "SET PRIVATE"; command = "nickserv/set/private"; }
command { service = "NickServ"; name = "SASET PRIVATE"; command = "nickserv/saset/private"; permission = "nickserv/saset/private"; }
/*
* ns_logout
*
@@ -504,7 +530,7 @@ command { service = "NickServ"; name = "RELEASE"; command = "nickserv/recover";
/*
* ns_register
*
* Provides the commands nickserv/confirm, nickserv/register, and nickserv/resend.
* Provides the commands nickserv/confirm/register, nickserv/register, and nickserv/resend.
*
* Used for registering accounts.
*/
@@ -513,11 +539,15 @@ module
name = "ns_register"
/*
* Registration confirmation setting. Set to "none" for no registration confirmation,
* "mail" for email confirmation, and "admin" to have services operators manually confirm
* every registration. Set to "disable" to completely disable all registrations.
* The method for confirming account registrations. Possible values are:
*
* "admin" to require confirmation by a Services Operator.
* "code" to require confirmation with a code provided via IRC.
* "disable" to disable account registration.
* "mail" to require confirmation with a code provided via email.
* "none" to automatically confirm (this is the default).
*/
registration = "none"
registration = "code"
/*
* The minimum length of time between consecutive uses of NickServ's RESEND command.
@@ -532,7 +562,7 @@ module
*
* This directive is optional.
*/
nickregdelay = 15s
#nickregdelay = 1m
/*
* The length of time a user using an unconfirmed account has
@@ -540,20 +570,33 @@ module
*/
#unconfirmedexpire = 1d
}
command { service = "NickServ"; name = "CONFIRM"; command = "nickserv/confirm"; }
command { service = "NickServ"; name = "CONFIRM REGISTER"; command = "nickserv/confirm/register"; }
command { service = "NickServ"; name = "REGISTER"; command = "nickserv/register"; }
command { service = "NickServ"; name = "RESEND"; command = "nickserv/resend"; }
/*
* ns_resetpass
*
* Provides the command nickserv/resetpass.
* Provides the command nickserv/confirm/resetpass and nickserv/resetpass.
*
* Used for resetting passwords by emailing users a temporary one.
*/
module { name = "ns_resetpass" }
module
{
name = "ns_resetpass"
/*
* The amount of time a user has after requesting a password reset before it
* expires. Defaults to 1 day.
*/
#resetexpire = 1d
}
command { service = "NickServ"; name = "CONFIRM RESETPASS"; command = "nickserv/confirm/resetpass"; }
command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpass"; }
# For compatibility with Anope 2.0.
command { service = "NickServ"; name = "GETPASS"; command = "nickserv/resetpass"; hide = yes; }
/*
* ns_sasl
*
@@ -573,17 +616,46 @@ module
* The nick of the client which operates as the SASL agent.
*/
#agent = "NickServ"
/*
* Sets the number of invalid SASL authentication attempts before services
* removes a partially-connected user from the network. If not defined then
* the value specified in options:badpasslimit will be used instead.
*/
#badpasslimit = 1
/*
* Sets the time after which invalid SASL authentication attempts are
* forgotten about. If a user does not fail to authenticate in this amount
* of time, the incorrect password count will reset to zero. If not defined
* then the value specified in options:badpasstimeout will be used instead.
*/
#badpasstimeout = 15m
}
/*
* ns_sasl_anonymous, ns_sasl_external, ns_sasl_plain
*
* Provides support for the following SASL mechanisms:
*
* ns_sasl_anonymous: Adds the ANONYMOUS mechanism which allows logging out of
* an account. See RFC 4505 for more details.
* ns_sasl_external: Adds the EXTERNAL mechanism which allows logging into an
account using a TLS client certificate. See RFC 4422 for
for more details.
* ns_sasl_plain: Adds the PLAIN mechanism which allows logging in to an
account using a plain text username and password. See RFC
4422 for more details.
*/
module { name = "ns_sasl_anonymous" }
module { name = "ns_sasl_external" }
module { name = "ns_sasl_plain" }
/*
* ns_set
*
* Provides the commands:
* nickserv/set, nickserv/saset - Dummy help wrappers for the SET and SASET commands.
* nickserv/set/autoop, nickserv/saset/autoop - Determines whether or not modes are automatically set users when joining a channel.
* nickserv/set/display, nickserv/saset/display - Used for setting a users display name.
* nickserv/set/keepmodes, nickserv/saset/keepmodes - Configure whether or not services should retain a user's modes across sessions.
* 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.
*/
@@ -592,18 +664,9 @@ module { name = "ns_set" }
command { service = "NickServ"; name = "SET"; command = "nickserv/set"; }
command { service = "NickServ"; name = "SASET"; command = "nickserv/saset"; permission = "nickserv/saset/"; group = "nickserv/admin"; }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
command { service = "NickServ"; name = "SET DISPLAY"; command = "nickserv/set/display"; }
command { service = "NickServ"; name = "SASET DISPLAY"; command = "nickserv/saset/display"; permission = "nickserv/saset/display"; }
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 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"; }
/*
@@ -638,6 +701,17 @@ 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_layout
*
* Provides the command nickserv/set/layout and nickserv/saset/layout.
*
* Allows configuring the layout that services uses.
*/
module { name = "ns_set_layout" }
command { service = "NickServ"; name = "SET LAYOUT"; command = "nickserv/set/layout"; }
command { service = "NickServ"; name = "SASET LAYOUT"; command = "nickserv/saset/layout"; permission = "nickserv/saset/layout"; }
/*
* ns_set_message
*
@@ -664,24 +738,40 @@ command { service = "NickServ"; name = "SASET LANGUAGE"; command = "nickserv/sas
module { name = "ns_set_misc" }
command { service = "NickServ"; name = "SET URL"; command = "nickserv/set/misc"; misc_description = _("Associate a URL with your account"); }
command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/misc"; misc_description = _("Associate a URL with this account"); permission = "nickserv/saset/url"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET DISCORD"; command = "nickserv/set/misc"; misc_description = _("Associate a Discord account with your account"); }
#command { service = "NickServ"; name = "SASET DISCORD"; command = "nickserv/saset/misc"; misc_description = _("Associate a Discord account with this account"); permission = "nickserv/saset/discord"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET MASTODON"; command = "nickserv/set/misc"; misc_description = _("Associate a Mastodon account with your account"); }
#command { service = "NickServ"; name = "SASET MASTODON"; command = "nickserv/saset/misc"; misc_description = _("Associate a Mastodon account with this account"); permission = "nickserv/saset/mastodon"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET TIMEZONE"; command = "nickserv/set/misc"; misc_description = _("Associate a time zone with your account"); }
#command { service = "NickServ"; name = "SASET TIMEZONE"; command = "nickserv/saset/misc"; misc_description = _("Associate a time zone with this account"); permission = "nickserv/saset/timezone"; group = "nickserv/admin"; }
#command { service = "NickServ"; name = "SET LOCATION"; command = "nickserv/set/misc"; misc_description = _("Associate a location with your account"); }
#command { service = "NickServ"; name = "SASET LOCATION"; command = "nickserv/saset/misc"; misc_description = _("Associate a location with this account"); permission = "nickserv/saset/location"; group = "nickserv/admin"; }
/*
* ns_set_op
*
* Provides the commands:
* nickserv/set/autoop, nickserv/saset/autoop - Allows configuring whether status modes are automatically granted when joining a channel.
* nickserv/set/neverop, nickserv/saset/neverop - Allows configuring whether a user can be added to access lists.
*/
module { name = "ns_set_op" }
command { service = "NickServ"; name = "SET AUTOOP"; command = "nickserv/set/autoop"; }
command { service = "NickServ"; name = "SASET AUTOOP"; command = "nickserv/saset/autoop"; permission = "nickserv/saset/autoop"; }
command { service = "NickServ"; name = "SET NEVEROP"; command = "nickserv/set/neverop"; }
command { service = "NickServ"; name = "SASET NEVEROP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; }
# For compatibility with DALnet Services.
command { service = "NickServ"; name = "SET NOOP"; command = "nickserv/set/neverop"; hide = yes; }
command { service = "NickServ"; name = "SASET NOOP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; hide = yes; }
/*
* ns_set_protect
*
* Provides the commands nickserv/set/protect and kickserv/saset/protect.
* Provides the commands nickserv/set/protect and nickserv/saset/protect.
*
* Used for configuring nickname protection.
*/
module { name = "ns_set_protect" }
command { service = "NickServ"; name = "SET PROTECT"; command = "nickserv/set/protect"; }
command { service = "NickServ"; name = "SASET PROTECT"; command = "nickserv/saset/protect"; permission = "nickserv/saset/kill"; }
command { service = "NickServ"; name = "SASET PROTECT"; command = "nickserv/saset/protect"; permission = "nickserv/saset/protect"; }
# For compatibility with Anope 2.0.
command { service = "NickServ"; name = "SET KILL"; command = "nickserv/set/protect"; hide = yes; }
+4 -4
View File
@@ -111,7 +111,7 @@ module
killonsqline = yes
/*
* Adds the nickname of the IRC Operator issuing an AKILL to the kill reason.
* Adds the nickname of the Services Operator issuing an AKILL to the kill reason.
*
* This directive is optional.
*/
@@ -287,15 +287,15 @@ command { service = "OperServ"; name = "CHANKILL"; command = "operserv/chankill"
* To use this module you must set a nameserver record for services
* so that DNS queries go to services.
*
* Alternatively, you may use a slave DNS server to hide service's IP,
* Alternatively, you may use a secondary DNS server to hide services' IP,
* provide query caching, and provide better fault tolerance.
*
* To do this using BIND, configure similar to:
*
* options { max-refresh-time 60; };
* zone "irc.example.com" IN {
* type slave;
* masters { 127.0.0.1 port 5353; };
* type secondary;
* primaries { 127.0.0.1 port 5353; };
* };
*
* Where 127.0.0.1:5353 is the IP and port services are listening on.
-514
View File
@@ -1,514 +0,0 @@
/*
* Example configuration file for Anope. After making the appropriate
* changes to this file, place it in the Anope conf directory (as
* specified in the "Config" script, default /home/username/anope/conf)
* under the name "anope.conf".
*
* The format of this file is fairly simple: three types of comments are supported:
* - All text after a '#' on a line is ignored, as in shell scripting
* - All text after '//' on a line is ignored, as in C++
* - A block of text like this one is ignored, as in C
*
* Outside of comments, there are three structures: blocks, keys, and values.
*
* A block is a named container, which contains a number of key to value pairs
* - you may think of this as an array.
*
* A block is created like so:
* foobar
* {
* moo = "cow"
* foo = bar
* }
*
* Note that nameless blocks are allowed and are often used with comments to allow
* easily commenting an entire block, for example:
* #foobar
* {
* moo = "cow"
* foo = bar
* }
* is an entirely commented block.
*
* Keys are case insensitive. Values depend on what key - generally, information is
* given in the key comment. The quoting of values (and most other syntax) is quite
* flexible, however, please do not forget to quote your strings:
*
* "This is a parameter string with spaces in it"
*
* If you need to include a double quote inside a quoted string, precede it
* by a backslash:
*
* "This string has \"double quotes\" in it"
*
* Time parameters can be specified either as an integer representing a
* number of seconds (e.g. "3600" = 1 hour), or as an integer with a unit
* specifier: "s" = seconds, "m" = minutes, "h" = hours, "d" = days.
* Combinations (such as "1h30m") are not permitted. Examples (all of which
* represent the same length of time, one day):
*
* "86400", "86400s", "1440m", "24h", "1d"
*
* In the documentation for each directive, one of the following will be
* included to indicate whether an option is required:
*
* [REQUIRED]
* Indicates a directive which must be given. Without it, Anope will
* not start.
*
* [RECOMMENDED]
* Indicates a directive which may be omitted, but omitting it may cause
* undesirable side effects.
*
* [OPTIONAL]
* Indicates a directive which is optional. If not given, the feature
* will typically be disabled. If this is not the case, more
* information will be given in the documentation.
*
* [DISCOURAGED]
* Indicates a directive which may cause undesirable side effects if
* specified.
*
* [DEPRECATED]
* Indicates a directive which will disappear in a future version of
* Anope, usually because its functionality has been either
* superseded by that of other directives or incorporated into the main
* program.
*/
/*
* [OPTIONAL] Defines
*
* You can use defines for repeated information, which can be used to easily change many
* values in the configuration at once.
*
* To use a define called foo.bar you use ${foo.bar} in your config file. You can also use
* environment variables by prefixing their name with "env." like ${env.USER}.
*/
/*
* The services.host define is used in multiple different locations throughout the
* configuration for the server name and pseudoclient hostnames.
*/
define
{
name = "services.host"
value = "stats.example.com"
}
/*
* [OPTIONAL] Additional Includes
*
* You can include additional configuration files here.
* You may also include executable files, which will be executed and
* the output from it will be included into your configuration.
*/
#include
{
type = "file"
name = "some.conf"
}
#include
{
type = "executable"
name = "/usr/bin/wget -q -O - https://some.misconfigured.network.com/stats.conf"
}
/*
* [REQUIRED] IRCd Config
*
* This section is used to set up Anope to connect to your IRC network.
* This section can be included multiple times, and Anope will attempt to
* connect to each server until it finally connects.
*
* Each uplink IRCd should have a corresponding configuration to allow Anope
* to link to it.
*
* An example configuration for InspIRCd that is compatible with the below uplink
* and serverinfo configuration would look like:
*
* # This goes in inspircd.conf, *NOT* your Anope config!
* <link name="stats.example.com"
* ipaddr="127.0.0.1"
* port="7000"
* sendpass="mypassword"
* recvpass="mypassword">
* <uline server="stats.example.com" silent="yes">
* <bind address="127.0.0.1" port="7000" type="servers">
*
* An example configuration for UnrealIRCd that is compatible with the below uplink
* and serverinfo configuration would look like:
*
* // This goes in unrealircd.conf, *NOT* your Anope config!
* listen {
* ip 127.0.0.1;
* port 7000;
* options {
* serversonly;
* };
* };
* link stats.example.com {
* incoming {
* mask *@127.0.0.1;
* };
* password "mypassword";
* class servers;
* };
* ulines { stats.example.com; };
*/
uplink
{
/*
* The IP address, hostname, or UNIX socket path of the IRC server you wish
* to connect Anope to.
* Usually, you will want to connect over 127.0.0.1 (aka localhost).
*
* NOTE: On some shell providers, this will not be an option.
*/
host = "127.0.0.1"
/*
* The protocol that Anope should use when connecting to the uplink. Can
* be set to "ipv4" (the default), "ipv6", or "unix".
*/
protocol = "ipv4"
/*
* Enable if Anope should connect using SSL.
* You must have an SSL module loaded for this to work.
*/
ssl = no
/*
* The port to connect to.
* The IRCd *MUST* be configured to listen on this port, and to accept
* server connections.
*
* Refer to your IRCd documentation for how this is to be done.
*/
port = 7000
/*
* The password to send to the IRC server for authentication.
* This must match the link block on your IRCd.
*
* Refer to your IRCd documentation for more information on link blocks.
*/
password = "mypassword"
}
/*
* [REQUIRED] Server Information
*
* This section contains information about the services server.
*/
serverinfo
{
/*
* The hostname that Anope will be seen as, it must have no conflicts with any
* other server names on the rest of your IRC network. Note that it does not have
* to be an existing hostname, just one that isn't on your network already.
*/
name = "${services.host}"
/*
* The text which should appear as the server's information in /WHOIS and similar
* queries.
*/
description = "Anope IRC Statistics"
/*
* The local address that Anope will bind to before connecting to the remote
* server. This may be useful for multihomed hosts. If omitted, Anope will let
* the Operating System choose the local address. This directive is optional.
*
* If you don't know what this means or don't need to use it, just leave this
* directive commented out.
*/
#localhost = "nowhere."
/*
* What Server ID to use for this connection?
* Note: This should *ONLY* be used for TS6/P10 IRCds. Refer to your IRCd documentation
* to see if this is needed.
*/
#id = "00A"
/*
* The filename containing the Anope process ID. The path is relative to the
* data directory.
*/
pid = "anope.pid"
/*
* The filename containing the Message of the Day. The path is relative to the
* config directory.
*/
motd = "motd.txt"
}
/*
* [REQUIRED] Protocol module
*
* This directive tells Anope which IRCd Protocol to speak when connecting.
* You MUST modify this to match the IRCd you run.
*
* Supported:
* - hybrid
* - inspircd
* - ngircd
* - plexus
* - ratbox
* - solanum
* - unrealircd
*/
module
{
name = "inspircd"
}
/*
* [REQUIRED] Network Information
*
* This section contains information about the IRC network that Anope will be
* connecting to.
*/
networkinfo
{
/*
* This is the name of the network that Anope will be running on.
*/
networkname = "LocalNet"
/*
* 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. Defaults to 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. Defaults to 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. Defaults to 64.
*/
#hostlen = 64
/* Set this to the maximum allowed channel length on your network.
* Defaults to 64.
*/
#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.
*/
modelistsize = 100
/*
* The characters allowed in hostnames. This is used for validating hostnames given
* to services, such as BotServ bot hostnames and user vhosts. Changing this is not
* recommended unless you know for sure your IRCd supports whatever characters you are
* wanting to use. Telling services to set a vhost containing characters your IRCd
* disallows could potentially break the IRCd and/or Anope.
*
* It is recommended you DON'T change this.
*/
vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"
/*
* If enabled, allows vhosts to not contain dots (.).
* Newer IRCds generally do not have a problem with this, but the same warning as
* vhost_chars applies.
*
* It is recommended you DON'T change this.
*/
allow_undotted_vhosts = no
/*
* The characters that are not allowed to be at the very beginning or very ending
* of a vhost. The same warning as vhost_chars applies.
*
* It is recommended you DON'T change this.
*/
disallow_start_or_end = ".-"
}
/*
* [REQUIRED] Anope Options
*
* This section contains various options which determine how Anope will operate.
*/
options
{
/*
* On Linux/UNIX systems Anope can setuid and setgid to this user and group
* after starting up. This is useful if Anope has to bind to privileged ports.
*/
#user = "anope"
#group = "anope"
/*
* The case mapping used by services. This must be set to a valid locale name
* installed on your machine. Anope uses this case map to compare, with
* case insensitivity, things such as nick names, channel names, etc.
*
* We provide two special casemaps shipped with Anope, ascii and rfc1459.
*
* This value should be set to what your IRCd uses, which is probably rfc1459,
* however Anope has always used ascii for comparison, so the default is ascii.
*
* Changing this value once set is not recommended.
*/
casemap = "ascii"
/*
* Sets the timeout period for reading from the uplink.
*/
readtimeout = 5s
/*
* If set, Anope will only show /stats o to IRC Operators. This directive
* is optional.
*/
#hidestatso = yes
/*
* A space-separated list of U-lined servers on your network, it is assumed that
* the servers in this list are allowed to set channel modes and Anope will
* not attempt to reverse their mode changes.
*
* WARNING: Do NOT put your normal IRC user servers in this directive.
*
* This directive is optional.
*/
#ulineservers = "services.your.network"
/*
* How long to wait between connection retries with the uplink(s).
*/
retrywait = 60s
}
/*
* [RECOMMENDED] Logging Configuration
*
* This section is used for configuring what is logged and where it is logged to.
* You may have multiple log blocks if you wish. Remember to properly secure any
* channels you choose to have Anope log to!
*/
log
{
/*
* Target(s) to log to, which may be one of the following:
* - a channel name
* - a filename
* - globops
*/
target = "stats.log"
/* Log to both stats.log and the channel #stats
*
* Note that some older IRCds, such as Ratbox, require services to be in the
* log channel to be able to message it. To do this, configure service:channels to
* join your logging channel.
*/
#target = "stats.log #stats"
/*
* The source(s) to only accept log messages from. Leave commented to allow all sources.
* This can be a users name, a channel name, one of our clients (e.g. OperServ), or a server name.
*/
#source = ""
/*
* The bot used to log generic messages which have no predefined sender if there
* is a channel in the target directive.
*/
bot = "Global"
/*
* The number of days to keep log files, only useful if you are logging to a file.
* Set to 0 to never delete old log files.
*
* Note that Anope must run 24 hours a day for this feature to work correctly.
*/
logage = 7
/*
* What types of log messages should be logged by this block. There are nine general categories:
*
* servers - Server actions, linking, squitting, etc.
* channels - Actions in channels such as joins, parts, kicks, etc.
* users - User actions such as connecting, disconnecting, changing name, etc.
* other - All other messages without a category.
* rawio - Logs raw input and output from services
* debug - Debug messages (log files can become VERY large from this).
*
* These options determine what messages from the categories should be logged. Wildcards are accepted, and
* you can also negate values with a ~. For example, "~operserv/akill operserv/*" would log all operserv
* messages except for operserv/akill. Note that processing stops at the first matching option, which
* means "* ~operserv/*" would log everything because * matches everything.
*
* Valid server options are:
* connect, quit, sync, squit
*
* Valid channel options are:
* create, destroy, join, part, kick, leave, mode
*
* Valid user options are:
* connect, disconnect, quit, nick, ident, host, mode, maxusers, oper, away
*
* Rawio and debug are simple yes/no answers, there are no types for them.
*
* Note that modules may add their own values to these options.
*/
servers = "*"
#channels = "~mode *"
users = "connect disconnect nick"
other = "*"
rawio = no
debug = no
}
/*
* [REQUIRED] MySQL Database configuration.
*
* mysql
*
* This module allows other modules to use MySQL.
*/
module
{
name = "mysql"
mysql
{
/* The name of this service. */
name = "mysql/main"
database = "anope"
server = "127.0.0.1"
username = "anope"
password = "mypassword"
port = 3306
}
}
/*
* IRC2SQL Gateway
* This module collects data about users, channels and servers. It doesn't build stats
* itself, however, it gives you the database, it's up to you how you use it.
*
* Requires a MySQL Database and MySQL version 5.5 or higher
*/
include
{
type = "file"
name = "irc2sql.example.conf"
}
+1 -1
View File
@@ -22,9 +22,9 @@ contributions they have made, are:
* Michael Wobst <wobst.michael@web.de>
* Mark Summers <mark@goopler.net>
* Matt Schatz <genius3000@g3k.solutions>
* PeGaSuS <droider.pc@gmail.com>
* Daniel Vassdal <shutter@canternet.org>
* MatthewM <mcm@they-got.us>
* PeGaSuS <droider.pc@gmail.com>
* Sebastian V. <hal9000@denorastats.org>
* Alvaro Toledo <atoledo@keldon.org>
* Dragone2 <dragone2@risposteinformatiche.it>
+51
View File
@@ -1,3 +1,54 @@
Anope Version 2.1.18
--------------------
Added a check that a non-deprecated database module is loaded.
Added support for flexible and monospace layouts to make text easier to read on clients that use a variable-width font.
Added support for logging about deprecated modules on boot.
Added support for per-IRCd hints when a link fails.
Added support for self-service validation of vhosts using DNS TXT records.
Added support for separate bad password limits for pre-connection SASL authentication.
Added support for SRV and TXT records to the dns module.
Added the --nodb option to disable database and encrytption module checks.
Added the nickname registration date to the nickserv/glist output.
Changed db_flatfile to be import-only (migrate to db_json).
Changed the default registration confirmation type to code validation.
Changed the fantasy !help command to not require the FANTASY privilege by default.
Changed various length measurement code to be UTF-8 aware.
Disabled the nickname registration delay by default.
Fixed reporting the MySQL version that the mysql module was built against.
Improved the layout of the nickserv/info command.
Modularised the ns_sasl module to make it easier to pick SASL mechanisms.
Moved duration rounding logic from Anope::Expires to Anope::Duration.
Removed support for importing old databases from 1.8.
Removed support for verifying "old MD5" passwords from 1.7.
Reworked how memory is allocated when formatting messages.
Anope Version 2.1.17
--------------------
Allowed opers to resend passwords for users in nickserv/resend.
Fixed HostServ using a different valid username character set to the protocol module.
Fixed losing the channel and nickname registration time when upgrading from an earlier 2.1 release.
Improved the messages sent when a user is forced off a protected nickname.
Simplified copying modules to the runtime directory on Windows.
Anope Version 2.1.16
--------------------
Added support for on-IRC code confirmation.
Added the ability for fantasy commands to be executable without the FANTASY privilege.
Added the ability to prepend to topics as well as appending to them.
Changed various fields to serialize to the database as a string not an integer.
Disabled db_flatfile by default in preparation for becoming import-only.
Fixed a memory leak in the db_json module.
Fixed building on OpenSSL 1.1.1 (for now).
Fixed removed and later re-added temporary bans being removed automatically.
Fixed sometimes sending malformed LMODE messages on InspIRCd.
Fixed the "did you mean" message suggesting unloaded commands.
Fixed various issues with the example config files.
Marked db_json as the recommended database module.
Moved the BAN, UNBAN, and KICK commands to the chanserv/management group.
Removed support for the 1.8-style seen command.
Reworked confirmation to allow confirmation of multiple account actions.
When dropping a display nickname the new display will now be the oldest in the group.
Anope Version 2.1.15
--------------------
Added a workaround to the jsonrpc module for JavaScript truncating big integers.
+40
View File
@@ -1,3 +1,43 @@
Anope Version 2.1.18
--------------------
Added the hostserv/validate command.
Added the nickserv/saset/layout command.
Added the nickserv/set/layout command.
Added the ns_sasl_anonymous module.
Added the ns_sasl_external module.
Added the ns_sasl_plain module.
Added the ns_set_layout module.
Added the ns_set_op module.
Added {hs_request}:validationcooldown (defaults to 5 minutes).
Added {hs_request}:validationrecord (defaults to "anope-dns-validation").
Added {ns_sasl}:badpasslimit (defaults to options:badpasslimit).
Added {ns_sasl}:badpasstimeout (defaults to options:badpasstimeout).
Moved nickserv/set/autoop and nickserv/saset/autoop to the ns_set_op module.
Moved nickserv/set/display and nickserv/saset/display to the ns_set_group module.
Moved nickserv/set/neverop and nickserv/saset/neverop to the ns_set_op module.
Removed the db_old module.
Removed the enc_old module.
Removed {db_flatfile}:fork (module is now import-only).
Removed {db_flatfile}:keepbackups (module is now import-only).
Removed {db_flatfile}:nobackupokay (module is now import-only).
Anope Version 2.1.17
--------------------
Added the nickserv/resend oper privilege.
Anope Version 2.1.16
--------------------
Added fantasy:require_privilege (defaults to yes).
Added the nickserv/confirm/email command.
Added the nickserv/confirm/email oper privilege.
Added the nickserv/confirm/register command.
Added the ns_confirm module.
Added {ns_email}:changeexpire (defaults to 1 day).
Added {ns_resetpass}:resetexpire (defaults to 1 day).
Removed the irc2sql module (migrate to JSON-RPC instead).
Removed {ns_seen}:simple (1.8-style seen has been removed).
Renamed the nickserv/confirm oper privilege to nickserv/confirm/register.
Anope Version 2.1.15
--------------------
Added the ns_email module.
+5 -6
View File
@@ -48,11 +48,10 @@ private:
public:
Anope::string nick;
Anope::string last_quit;
Anope::string last_realname;
/* Last usermask this nick was seen on, eg user@host */
Anope::string last_usermask;
/* Last uncloaked usermask, requires nickserv/auspex to see */
Anope::string last_realhost;
/* Last cloaked user@host this nick was seen using. */
Anope::string last_userhost;
/* Last real user@host this nick was seen using. */
Anope::string last_userhost_real;
time_t registered = Anope::CurTime;
time_t last_seen = Anope::CurTime;
@@ -164,7 +163,7 @@ public:
/* Unsaved data */
/** The display nick for this account. */
NickAlias *na = nullptr;
Serialize::Reference<NickAlias> na;
/* Number of channels registered by this account */
uint16_t channelcount = 0;
/* Users online now logged into this account */
+5 -78
View File
@@ -14,6 +14,7 @@
#include <signal.h>
#include "hashcomp.h"
#include "utfcpp/unchecked.h"
namespace Anope
{
@@ -129,6 +130,7 @@ namespace Anope
* Returns the string's length.
*/
inline size_type length() const { return this->_string.length(); }
inline size_type utf8length() const { return utf8::unchecked::distance(str().begin(), str().end()); }
/**
* Returns the size of the currently allocated storage space in the string object.
@@ -383,7 +385,7 @@ namespace Anope
/** Other command line options.
*/
extern CoreExport bool ReadOnly, NoFork, NoThird, NoPID, NoExpire, ProtocolDebug;
extern CoreExport bool ReadOnly, NoFork, NoThird, NoDB, NoPID, NoExpire, ProtocolDebug;
/** The root of the Anope installation. Usually ~/anope
*/
@@ -463,33 +465,12 @@ namespace Anope
extern CoreExport void Unhex(const string &src, string &dest);
extern CoreExport void Unhex(const string &src, char *dest, size_t sz);
/** Base 64 encode a string
* @param src The string to encode
* @param target Where the encoded string is placed
*/
extern CoreExport void B64Encode(const string &src, string &target);
/** Base 64 decode a string
* @param src The base64 encoded string
* @param target The plain text result
*/
extern CoreExport void B64Decode(const string &src, string &target);
/** Encrypts what is in 'src' to 'dest'
* @param src The source string to encrypt
* @param dest The destination where the encrypted string is placed
*/
extern CoreExport bool Encrypt(const Anope::string &src, Anope::string &dest);
/** Returns a sequence of data formatted as the format argument specifies.
** After the format parameter, the function expects at least as many
** additional arguments as specified in format.
* @param fmt Format of the Message
* @param ... any number of parameters
* @return a Anope::string
*/
extern CoreExport string printf(const char *fmt, ...) ATTR_FORMAT(1, 2);
/** Return the last error code
* @return The error code
*/
@@ -513,9 +494,10 @@ namespace Anope
/** Retrieves a human readable string representing the time in seconds
* @param seconds The time on seconds, eg 60
* @param nc The account to use language settings for to translate this string, if applicable
* @param round Whether to round the duration to produce a shorter output.
* @return A human readable string, eg "1 minute"
*/
extern CoreExport Anope::string Duration(time_t seconds, const NickCore *nc = NULL);
extern CoreExport Anope::string Duration(time_t seconds, const NickCore *nc = nullptr, bool round = false);
/** Generates a human readable string of type "expires in ..."
* @param expires time in seconds
@@ -531,12 +513,6 @@ namespace Anope
*/
extern CoreExport Anope::string strftime(time_t t, const NickCore *nc = NULL, bool short_output = false);
/** Normalize buffer, stripping control characters and colors
* @param A string to be parsed for control and color codes
* @return A string stripped of control and color codes
*/
extern CoreExport Anope::string NormalizeBuffer(const Anope::string &);
/** Parses a raw message from the uplink and calls its command handler.
* @param message Raw message from the uplink
*/
@@ -572,57 +548,8 @@ namespace Anope
/** 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);
/** Replaces template variables within a string with values from a map.
* @param str The string to template from.
* @param vars The variables to replace within the string.
* @return The specified string with all variables replaced within it.
*/
extern CoreExport Anope::string Template(const Anope::string &str, const Anope::map<Anope::string> &vars);
}
/** sepstream allows for splitting token separated lists.
+4 -2
View File
@@ -32,10 +32,12 @@ struct CommandInfo final
Anope::string permission;
/* Group this command is in */
Anope::string group;
/* whether or not to hide this command in help output */
/* Whether to hide this command in help and suggestions */
bool hide = false;
/* Only used with fantasy */
/* Whether to prepend the channel name (only used with fantasy) */
bool prepend_channel = false;
/* Whether to require the FANTASY privilege (only used with fantasy) */
bool require_privilege = true;
};
/* Where the replies from commands go to. User inherits from this and is the normal
+1 -7
View File
@@ -102,7 +102,7 @@ namespace Language
/* Commonly used language strings */
#define CONFIRM_DROP _("Please confirm that you want to drop \002%s\002 with \002%s\032%s\032%s\002")
#define SERVICE_UNAVAILABLE _("Sorry, %s is temporarily unavailable.")
#define MORE_INFO _("\002%s\002 for more information.")
#define MORE_INFO _("Type \002%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.")
@@ -114,7 +114,6 @@ namespace Language
"cannot contain the space or tab characters.")
#define PASSWORD_TOO_SHORT _("Your password is too short. It must be longer than %u characters.")
#define PASSWORD_TOO_LONG _("Your password is too long. It must be shorter than %u characters.")
#define NICK_NOT_REGISTERED _("Your nick isn't registered.")
#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.")
#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.")
#define NICK_X_NOT_ON_CHAN _("\002%s\002 is not currently on channel %s.")
@@ -127,14 +126,9 @@ namespace Language
#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_SECURE _("This nickname is registered and protected. If it is your " \
"nick, type \002%s\032\037password\037\002. Otherwise, " \
"please choose a different nick.")
#define FORCENICKCHANGE_NOW _("This nickname has been registered; you may not use it.")
#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 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.")
-32
View File
@@ -57,35 +57,3 @@ public:
*/
virtual bool InvalidRange(const Anope::string &list);
};
/** This class handles formatting LIST/VIEW replies.
*/
class CoreExport ListFormatter final
{
public:
typedef std::map<Anope::string, Anope::string> ListEntry;
private:
NickCore *nc;
std::vector<Anope::string> columns;
std::vector<ListEntry> entries;
public:
ListFormatter(NickCore *nc);
ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry);
bool IsEmpty() const;
void Process(std::vector<Anope::string> &);
};
/** This class handles formatting INFO replies
*/
class CoreExport InfoFormatter final
{
NickCore *nc;
std::vector<std::pair<Anope::string, Anope::string> > replies;
unsigned longest = 0;
public:
InfoFormatter(NickCore *nc);
void Process(std::vector<Anope::string> &);
Anope::string &operator[](const Anope::string &key);
void AddOption(const Anope::string &opt);
};
+15 -10
View File
@@ -70,11 +70,6 @@ public:
*/
Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type);
virtual ~Mode() = default;
/** Can a user set this mode, used for mlock
* @param u The user
*/
virtual bool CanSet(User *u) const;
};
/** This class is a user mode, all user modes use this/inherit from this
@@ -88,6 +83,12 @@ public:
* @param mc The mode char
*/
UserMode(const Anope::string &name, char mc);
/** Can a user set this mode, used for mlock
* @param source The user who is setting the mode.
* @param target The user the mode is being set on.
*/
virtual bool CanSet(User *source, User *target) const { return true; }
};
class CoreExport UserModeParam
@@ -122,7 +123,11 @@ public:
*/
ChannelMode(const Anope::string &name, char mc);
bool CanSet(User *u) const override;
/** Can a user set this mode, used for mlock
* @param u The user who is setting the mode.
* @param c The channel the mode is being set on.
*/
virtual bool CanSet(User *u, Channel *c) const;
virtual void Check() { }
@@ -270,7 +275,7 @@ class CoreExport UserModeOperOnly
public:
UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { }
bool CanSet(User *u) const override;
bool CanSet(User *source, User *target) const override;
};
class CoreExport UserModeNoone
@@ -279,7 +284,7 @@ class CoreExport UserModeNoone
public:
UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { }
bool CanSet(User *u) const override;
bool CanSet(User *source, User *target) const override;
};
/** Channel mode +k (key)
@@ -302,7 +307,7 @@ public:
ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
/* Opers only */
bool CanSet(User *u) const override;
bool CanSet(User *u, Channel *c) const override;
};
/** This class is used for channel modes only servers may set
@@ -313,7 +318,7 @@ class CoreExport ChannelModeNoone
public:
ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { }
bool CanSet(User *u) const override;
bool CanSet(User *u, Channel *c) const override;
};
/** This is the mode manager
+1
View File
@@ -39,6 +39,7 @@
#include "services.h"
#include "socketengine.h"
#include "sockets.h"
#include "textproc.h"
#include "threadengine.h"
#include "timers.h"
#include "uplink.h"
+7 -3
View File
@@ -158,7 +158,9 @@ enum
PSEUDOCLIENT = 1 << 5,
/* Module provides IRCd protocol support */
PROTOCOL = 1 << 6,
MT_END = 1 << 7
/* Module is deprecated */
DEPRECATED = 1 << 7,
MT_END = DEPRECATED,
};
typedef unsigned short ModType;
@@ -1046,9 +1048,10 @@ public:
/** Called to determine if a channel mode can be set by a user
* @param u The user
* @param c The channel
* @param cm The mode
*/
virtual EventReturn OnCanSet(User *u, const ChannelMode *cm) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
virtual EventReturn OnCanSet(User *u, Channel *c, const ChannelMode *cm) ATTR_NOT_NULL(2, 3) { throw NotImplementedException(); }
virtual EventReturn OnCheckDelete(Channel *c) ATTR_NOT_NULL(2) { throw NotImplementedException(); }
@@ -1245,9 +1248,10 @@ public:
/** Find the first module of a certain type
* @param type The module type
* @param ignoredeprecated Whether to ignore deprecated modules.
* @return The module
*/
static Module *FindFirstOf(ModType type);
static Module *FindFirstOf(ModType type, bool ignoredeprecated = false);
/** Checks whether this version of Anope is at least major.minor.patch.build
* Throws a ModuleException if not
+18
View File
@@ -11,6 +11,8 @@
#pragma once
#include <memory>
namespace DNS
{
/** Valid query types
@@ -29,8 +31,12 @@ namespace DNS
QUERY_SOA = 6,
/* Reverse DNS lookup */
QUERY_PTR = 12,
/* TXT lookup */
QUERY_TXT = 16,
/* IPv6 AAAA lookup */
QUERY_AAAA = 28,
/** SRV lookup */
QUERY_SRV = 33,
/* Zone transfer */
QUERY_AXFR = 252,
/* A lookup for any record */
@@ -88,11 +94,23 @@ namespace DNS
};
};
namespace Record
{
struct SRV final
{
uint16_t priority = UINT16_MAX;
uint16_t weight = 0;
uint16_t port = 0;
Anope::string host;
};
}
struct ResourceRecord final
: Question
{
unsigned int ttl = 0;
Anope::string rdata;
std::shared_ptr<void> rdataobj;
time_t created;
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), created(Anope::CurTime) { }
+2
View File
@@ -18,6 +18,8 @@ public:
Anope::string ident;
Anope::string host;
time_t time = 0;
Anope::string validation_token;
time_t last_validation = 0;
virtual ~HostRequest() = default;
};
+1 -1
View File
@@ -151,7 +151,7 @@ struct SASL::Session
if (u)
return u->GetMask();
if (!hostname.empty() && !ip.empty())
return Anope::printf("%s (%s)", hostname.c_str(), ip.c_str());
return Anope::Format("%s (%s)", hostname.c_str(), ip.c_str());
return "A user";
};
};
-7
View File
@@ -15,13 +15,6 @@ enum NewsType
NEWS_OPER
};
struct NewsMessages final
{
NewsType type;
Anope::string name;
const char *msgs[10];
};
struct NewsItem
: Serializable
{
+1 -3
View File
@@ -228,9 +228,7 @@ public:
if (header.compare(0, 7, "Bearer ", 7) != 0)
return false; // No token provided.
Anope::string rawtoken;
Anope::B64Decode(header.substr(7), rawtoken);
auto rawtoken = Anope::B64Decode(header.substr(7));
for (const auto &token : tokens)
{
if (!CompareToken(token, rawtoken))
+5 -1
View File
@@ -131,11 +131,15 @@ public:
/* 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();
/** Retrieves advice on what might be the problem when a link fails.
* @param advice The location to store the advice.
*/
virtual void GetLinkAdvice(std::vector<Anope::string> &advice) { }
/** Extracts a timestamp from a string. */
virtual time_t ExtractTimestamp(const Anope::string &str);
+125
View File
@@ -11,6 +11,93 @@
#pragma once
#define ANOPE_FORMAT(LAST, FORMAT, BUFFER) \
do { \
va_list _valist; \
va_start(_valist, LAST); \
(BUFFER) = Anope::Format(_valist, (FORMAT)); \
va_end(_valist); \
} while (false);
namespace Anope
{
/** Encode a string as base-64.
* @param str The string to encode as base-64 .
*/
extern CoreExport Anope::string B64Encode(const Anope::string &str);
/** Decode a string from base-64.
* @param str The string to decode from base-64.
*/
extern CoreExport Anope::string B64Decode(const Anope::string &str);
/** 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);
/** 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 string using one or more values. This uses snprintf internally but with a flexible buffer.
* @param fmt The message to format.
*/
extern CoreExport Anope::string Format(const char *fmt, ...) ATTR_FORMAT(1, 2);
/** Formats a string using a list of values. This uses snprintf internally but with a flexible buffer.
* @param valist A list of values to format the message with.
* @param fmt The message to format.
*/
extern CoreExport Anope::string Format(va_list &valist, const char *fmt) ATTR_FORMAT(2, 0);
/** 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);
/** Remove all formatting characters from a string.
* @param text A string containing formatting characters.
* @return A copy of \p text with all formatting characters removed.
*/
extern CoreExport Anope::string RemoveFormatting(const Anope::string &text);
/** Replaces template variables within a string with values from a map.
* @param str The string to template from.
* @param vars The variables to replace within the string.
* @return The specified string with all variables replaced within it.
*/
extern CoreExport Anope::string Template(const Anope::string &str, const Anope::map<Anope::string> &vars);
}
class CoreExport HelpWrapper final
{
private:
@@ -22,6 +109,21 @@ public:
void SendTo(CommandSource &source);
};
class CoreExport InfoFormatter final
{
private:
size_t longest = 0;
NickCore *nc;
std::vector<Anope::string> options;
std::vector<std::pair<Anope::string, Anope::string>> replies;
public:
InfoFormatter(NickCore *nc);
Anope::string &operator[](const Anope::string &key);
void AddOption(const Anope::string &opt);
void SendTo(CommandSource &source);
};
class CoreExport LineWrapper final
{
private:
@@ -34,3 +136,26 @@ public:
bool GetLine(Anope::string &out);
};
class CoreExport ListFormatter final
{
public:
using ListEntry = std::map<Anope::string, Anope::string>;
using FlexibleFormatFn = std::function<Anope::string(ListEntry &)>;
private:
std::vector<Anope::string> columns;
std::vector<ListEntry> entries;
FlexibleFormatFn flexiblerow;
NickCore *nc;
void SendFixed(CommandSource &source);
void SendFlexible(CommandSource &source);
public:
ListFormatter(NickCore *nc);
ListFormatter &AddColumn(const Anope::string &name);
void AddEntry(const ListEntry &entry);
bool IsEmpty() const;
void SendTo(CommandSource &source);
void SetFlexible(const Anope::string &format);
void SetFlexible(const FlexibleFormatFn &formatter);
};
+1 -1
View File
@@ -253,7 +253,7 @@ public:
*/
bool HasPriv(const Anope::string &privstr);
/** Update the last usermask stored for a user. */
/** Update the last mask stored for a user. */
void UpdateHost();
/** Update the away state for a user. */
+1 -1
View File
@@ -6607,7 +6607,7 @@ msgid "Service"
msgstr "Server gefunden: %d"
#, fuzzy, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "Die Services haben den Nicknamen wieder verfügbar gemacht."
#, fuzzy
+1 -1
View File
@@ -6832,7 +6832,7 @@ msgid "Service"
msgstr "Τα services είναι ενεργά για %s"
#, fuzzy, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "Οι υπηρεσίες απελευθέρωααν το ψευδώνυμό σου."
#, fuzzy
+427 -210
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -6273,7 +6273,7 @@ msgid "Service"
msgstr "Servicio"
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "El nick %s retenido por los servicios ha sido liberado."
#, fuzzy
+1 -1
View File
@@ -6155,7 +6155,7 @@ msgid "Service"
msgstr "Service"
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "La tutelle des Services sur %s a été enlevée."
msgid "Services Operator commands"
+1 -1
View File
@@ -6146,7 +6146,7 @@ msgid "Service"
msgstr "Servizio"
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "Il blocco dei servizi sul nick %s è stato rilasciato."
msgid "Services Operator commands"
+1 -1
View File
@@ -6182,7 +6182,7 @@ msgid "Service"
msgstr "Service"
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "Nick %s werd vrijgegeven."
msgid "Services Operator commands"
+1 -1
View File
@@ -6123,7 +6123,7 @@ msgid "Service"
msgstr "Usługa"
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr "Serwisy właśnie zwolniły nicka %s."
msgid "Services Operator commands"
+1 -1
View File
@@ -5675,7 +5675,7 @@ msgid "Service"
msgstr ""
#, c-format
msgid "Service's hold on %s has been released."
msgid "Services' hold on %s has been released."
msgstr ""
msgid "Services Operator commands"
+1627 -3622
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -83,7 +83,7 @@ public:
{
ChannelMode *cm = ModeManager::FindChannelModeByName("OP");
char symbol = cm ? anope_dynamic_static_cast<ChannelModeStatus *>(cm)->symbol : 0;
const auto message = Anope::printf("%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
const auto message = Anope::Format("%s invited %s into the channel.", user->nick.c_str(), user->nick.c_str());
IRCD->SendNotice(bi, (symbol ? Anope::string(symbol) : "") + c->name, message);
}
+45 -23
View File
@@ -12,6 +12,39 @@
#include "module.h"
#include "modules/botserv/badwords.h"
namespace
{
Anope::string TypeToString(BadWordType bw)
{
switch (bw)
{
case BW_ANY:
return "ANY";
case BW_SINGLE:
return "SINGLE";
case BW_START:
return "START";
case BW_END:
return "END";
}
return ""; // Should never happen.
}
BadWordType StringToType(const Anope::string &bw)
{
if (bw.equals_ci("ANY") || bw.equals_ci("0"))
return BW_ANY;
if (bw.equals_ci("SINGLE") || bw.equals_ci("1"))
return BW_SINGLE;
if (bw.equals_ci("START") || bw.equals_ci("2"))
return BW_START;
if (bw.equals_ci("END") || bw.equals_ci("3"))
return BW_END;
return BW_ANY; // Should never happen.
}
}
struct BadWordImpl final
: BadWord
, Serializable
@@ -33,7 +66,7 @@ struct BadWordTypeImpl final
const auto *bw = static_cast<const BadWordImpl *>(obj);
data.Store("ci", bw->chan);
data.Store("word", bw->word);
data.Store("type", bw->type);
data.Store("type", TypeToString(bw->type));
}
Serializable *Unserialize(Serializable *obj, Serialize::Data &) const override;
@@ -138,7 +171,7 @@ Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &d
if (!ci)
return NULL;
unsigned int n;
Anope::string n;
data["type"] >> n;
BadWordImpl *bw;
@@ -148,7 +181,7 @@ Serializable *BadWordTypeImpl::Unserialize(Serializable *obj, Serialize::Data &d
bw = new BadWordImpl();
bw->chan = sci;
bw->word = sword;
bw->type = static_cast<BadWordType>(n);
bw->type = StringToType(n);
BadWordsImpl *bws = ci->Require<BadWordsImpl>("badwords");
if (!obj)
@@ -213,11 +246,12 @@ private:
{
bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "LIST";
ListFormatter list(source.GetAccount());
BadWords *bw = ci->GetExt<BadWords>("badwords");
list.AddColumn(_("Number")).AddColumn(_("Word")).AddColumn(_("Type"));
list.SetFlexible(_("{number}: \002{word}\002 -- type: {type}"));
BadWords *bw = ci->GetExt<BadWords>("badwords");
if (!bw || !bw->GetBadWordCount())
{
source.Reply(_("%s bad words list is empty."), ci->name.c_str());
@@ -244,7 +278,7 @@ private:
ListFormatter::ListEntry entry;
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)" : ""));
entry["Type"] = TypeToString(b->type);
this->list.AddEntry(entry);
}
}
@@ -263,7 +297,7 @@ private:
ListFormatter::ListEntry entry;
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)" : ""));
entry["Type"] = TypeToString(b->type);
list.AddEntry(entry);
}
}
@@ -272,14 +306,8 @@ private:
source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Bad words list for %s:"), ci->name.c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("End of bad words list."));
}
}
@@ -295,14 +323,7 @@ private:
{
Anope::string opt = word.substr(pos + 1);
if (!opt.empty())
{
if (opt.equals_ci("SINGLE"))
bwtype = BW_SINGLE;
else if (opt.equals_ci("START"))
bwtype = BW_START;
else if (opt.equals_ci("END"))
bwtype = BW_END;
}
bwtype = StringToType(opt);
realword = word.substr(0, pos);
}
@@ -460,7 +481,8 @@ public:
"that starts with \037word\037. If END is specified, a kick "
"will be done if a user says a word that ends with "
"\037word\037. If you don't specify anything, a kick will "
"be issued every time \037word\037 is said by a user."
"be issued every time \037word\037 is said by a user. This "
"will be shown in the \002LIST\002 output as ANY."
"\n\n"
"The \002DEL\002 command removes the given word from the "
"bad words list. If a list of entry numbers is given, those "
+3 -9
View File
@@ -41,11 +41,11 @@ public:
}
}
unsigned count = 0;
ListFormatter list(source.GetAccount());
list.AddColumn(_("Nick")).AddColumn(_("Mask")).AddColumn(_("Real name"));
list.SetFlexible(_("\002{nick}\002 ({mask}) [{real_name}]"));
unsigned count = 0;
for (const auto &[_, bi] : *BotListByNick)
{
if (is_admin || !bi->oper_only)
@@ -66,9 +66,6 @@ public:
}
}
std::vector<Anope::string> replies;
list.Process(replies);
if (!count)
{
source.Reply(_(
@@ -79,10 +76,7 @@ public:
else
{
source.Reply(_("Bot list:"));
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("%d bots available."), count);
}
}
+4 -14
View File
@@ -55,15 +55,10 @@ public:
info[_("Real name")] = bi->realname;
info[_("Created")] = Anope::strftime(bi->created, source.GetAccount());
info[_("Options")] = bi->oper_only ? _("Private") : _("None");
info[_("Used on")] = Anope::printf(Language::Translate(source.nc, bi->GetChannelCount(), N_("%u channel", "%u channels")), bi->GetChannelCount());
info[_("Used on")] = Anope::Format(Language::Translate(source.nc, bi->GetChannelCount(), N_("%u channel", "%u channels")), bi->GetChannelCount());
FOREACH_MOD(OnBotInfo, (source, bi, ci, info));
std::vector<Anope::string> replies;
info.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
info.SendTo(source);
if (source.HasPriv("botserv/administration"))
{
@@ -89,12 +84,7 @@ public:
Anope::string disabled = Language::Translate(source.nc, _("Disabled"));
FOREACH_MOD(OnBotInfo, (source, bi, ci, info));
std::vector<Anope::string> replies;
info.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
info.SendTo(source);
}
else
source.Reply(_("\002%s\002 is not a valid bot or registered channel."), query.c_str());
@@ -116,7 +106,7 @@ public:
const Anope::string GetDesc(CommandSource &source) const override
{
return Anope::printf(Language::Translate(source.GetAccount(), _("Allows you to see %s information about a channel or a bot")), source.service->nick.c_str());
return Anope::Format(Language::Translate(source.GetAccount(), _("Allows you to see %s information about a channel or a bot")), source.service->nick.c_str());
}
};
+18 -22
View File
@@ -1112,18 +1112,14 @@ class BSKick final
static void bot_kick(ChannelInfo *ci, User *u, const char *message, ...) ATTR_FORMAT(3, 4)
{
va_list args;
char buf[1024];
if (!ci || !ci->bi || !ci->c || !u || u->IsProtected() || !ci->c->FindUser(u))
return;
Anope::string fmt = Language::Translate(u, message);
va_start(args, message);
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
va_end(args);
const auto *fmt = Language::Translate(u, message);
ci->c->Kick(ci->bi, u, Anope::string(buf));
Anope::string buf;
ANOPE_FORMAT(message, fmt, buf);
ci->c->Kick(ci->bi, u, buf);
}
public:
@@ -1157,7 +1153,7 @@ public:
if (kd && kd->badwords)
{
if (kd->ttb[TTB_BADWORDS])
info[_("Bad words kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), kd->ttb[TTB_BADWORDS]);
info[_("Bad words kicker")] = Anope::Format("%s (%d kick(s) to ban)", enabled.c_str(), kd->ttb[TTB_BADWORDS]);
else
info[_("Bad words kicker")] = enabled;
}
@@ -1167,7 +1163,7 @@ public:
if (kd && kd->bolds)
{
if (kd->ttb[TTB_BOLDS])
info[_("Bolds kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), kd->ttb[TTB_BOLDS]);
info[_("Bolds kicker")] = Anope::Format("%s (%d kick(s) to ban)", enabled.c_str(), kd->ttb[TTB_BOLDS]);
else
info[_("Bolds kicker")] = enabled;
}
@@ -1177,9 +1173,9 @@ public:
if (kd && kd->caps)
{
if (kd->ttb[TTB_CAPS])
info[_("Caps kicker")] = Anope::printf(_("%s (%d kick(s) to ban; minimum %d/%d%%)"), enabled.c_str(), kd->ttb[TTB_CAPS], kd->capsmin, kd->capspercent);
info[_("Caps kicker")] = Anope::Format(_("%s (%d kick(s) to ban; minimum %d/%d%%)"), enabled.c_str(), kd->ttb[TTB_CAPS], kd->capsmin, kd->capspercent);
else
info[_("Caps kicker")] = Anope::printf(_("%s (minimum %d/%d%%)"), enabled.c_str(), kd->capsmin, kd->capspercent);
info[_("Caps kicker")] = Anope::Format(_("%s (minimum %d/%d%%)"), enabled.c_str(), kd->capsmin, kd->capspercent);
}
else
info[_("Caps kicker")] = disabled;
@@ -1187,7 +1183,7 @@ public:
if (kd && kd->colors)
{
if (kd->ttb[TTB_COLORS])
info[_("Colors kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_COLORS]);
info[_("Colors kicker")] = Anope::Format(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_COLORS]);
else
info[_("Colors kicker")] = enabled;
}
@@ -1197,9 +1193,9 @@ public:
if (kd && kd->flood)
{
if (kd->ttb[TTB_FLOOD])
info[_("Flood kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d lines in %ds)"), enabled.c_str(), kd->ttb[TTB_FLOOD], kd->floodlines, kd->floodsecs);
info[_("Flood kicker")] = Anope::Format(_("%s (%d kick(s) to ban; %d lines in %ds)"), enabled.c_str(), kd->ttb[TTB_FLOOD], kd->floodlines, kd->floodsecs);
else
info[_("Flood kicker")] = Anope::printf(_("%s (%d lines in %ds)"), enabled.c_str(), kd->floodlines, kd->floodsecs);
info[_("Flood kicker")] = Anope::Format(_("%s (%d lines in %ds)"), enabled.c_str(), kd->floodlines, kd->floodsecs);
}
else
info[_("Flood kicker")] = disabled;
@@ -1207,9 +1203,9 @@ public:
if (kd && kd->repeat)
{
if (kd->ttb[TTB_REPEAT])
info[_("Repeat kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d times)"), enabled.c_str(), kd->ttb[TTB_REPEAT], kd->repeattimes);
info[_("Repeat kicker")] = Anope::Format(_("%s (%d kick(s) to ban; %d times)"), enabled.c_str(), kd->ttb[TTB_REPEAT], kd->repeattimes);
else
info[_("Repeat kicker")] = Anope::printf(_("%s (%d times)"), enabled.c_str(), kd->repeattimes);
info[_("Repeat kicker")] = Anope::Format(_("%s (%d times)"), enabled.c_str(), kd->repeattimes);
}
else
info[_("Repeat kicker")] = disabled;
@@ -1217,7 +1213,7 @@ public:
if (kd && kd->reverses)
{
if (kd->ttb[TTB_REVERSES])
info[_("Reverses kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_REVERSES]);
info[_("Reverses kicker")] = Anope::Format(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_REVERSES]);
else
info[_("Reverses kicker")] = enabled;
}
@@ -1227,7 +1223,7 @@ public:
if (kd && kd->underlines)
{
if (kd->ttb[TTB_UNDERLINES])
info[_("Underlines kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_UNDERLINES]);
info[_("Underlines kicker")] = Anope::Format(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_UNDERLINES]);
else
info[_("Underlines kicker")] = enabled;
}
@@ -1237,7 +1233,7 @@ public:
if (kd && kd->italics)
{
if (kd->ttb[TTB_ITALICS])
info[_("Italics kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_ITALICS]);
info[_("Italics kicker")] = Anope::Format(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_ITALICS]);
else
info[_("Italics kicker")] = enabled;
}
@@ -1247,7 +1243,7 @@ public:
if (kd && kd->amsgs)
{
if (kd->ttb[TTB_AMSGS])
info[_("AMSG kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_AMSGS]);
info[_("AMSG kicker")] = Anope::Format(_("%s (%d kick(s) to ban)"), enabled.c_str(), kd->ttb[TTB_AMSGS]);
else
info[_("AMSG kicker")] = enabled;
}
@@ -1369,7 +1365,7 @@ public:
BadWords *badwords = ci->GetExt<BadWords>("badwords");
/* Normalize the buffer */
Anope::string nbuf = Anope::NormalizeBuffer(realbuf);
Anope::string nbuf = Anope::RemoveFormatting(realbuf);
bool casesensitive = Config->GetModule("botserv").Get<bool>("casesensitive");
/* Normalize can return an empty string if this only contains control codes etc */
+2 -2
View File
@@ -173,7 +173,7 @@ class CommandBSSetPrivate final
public:
CommandBSSetPrivate(Module *creator, const Anope::string &sname = "botserv/set/private") : Command(creator, sname, 2, 2)
{
this->SetDesc(_("Prevent a bot from being assigned by non IRC operators"));
this->SetDesc(_("Prevent a bot from being assigned by non Services Operators"));
this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}"));
}
@@ -214,7 +214,7 @@ public:
source.Reply(" ");
source.Reply(_(
"This option prevents a bot from being assigned to a "
"channel by users that aren't IRC Operators."
"channel by users that aren't Services Operators."
));
return true;
}
+1 -1
View File
@@ -330,7 +330,7 @@ public:
ci->Extend<bool>(def.upper());
}
EventReturn OnCanSet(User *u, const ChannelMode *cm) override
EventReturn OnCanSet(User *u, Channel *c, const ChannelMode *cm) override
{
if (Config->GetModule(this).Get<const Anope::string>("nomlock").find(cm->mchar) != Anope::string::npos
|| Config->GetModule(this).Get<const Anope::string>("require").find(cm->mchar) != Anope::string::npos)
+21 -19
View File
@@ -109,7 +109,7 @@ private:
entry["Number"] = Anope::ToString(number);
entry["Level"] = access->AccessSerialize();
entry["Mask"] = access->Mask();
entry["By"] = access->creator;
entry["Creator"] = access->creator;
entry["Last seen"] = timebuf;
entry["Description"] = access->description;
list.AddEntry(entry);
@@ -435,14 +435,8 @@ private:
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Access list for %s:"), ci->name.c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("End of access list"));
}
@@ -459,6 +453,13 @@ private:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Level")).AddColumn(_("Mask")).AddColumn(_("Description"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Description"].empty()
? _("{number}: \002{mask}\002 = {level}")
: _("{number}: \002{mask}\002 = {level} ({description})");
});
this->ProcessList(source, ci, params, list);
}
@@ -471,7 +472,14 @@ private:
}
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Level")).AddColumn(_("Mask")).AddColumn(_("By")).AddColumn(_("Last seen")).AddColumn(_("Description"));
list.AddColumn(_("Number")).AddColumn(_("Level")).AddColumn(_("Mask")).AddColumn(_("Creator")).AddColumn(_("Last seen")).AddColumn(_("Description"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Description"].empty()
? _("{number}: \002{mask}\002 = {level} -- created by {creator}; last seen {last_seen}")
: _("{number}: \002{mask}\002 = {level} -- created by {creator}; last seen {last_seen} ({description})");
});
this->ProcessList(source, ci, params, list);
}
@@ -724,6 +732,7 @@ class CommandCSLevels final
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Level"));
list.SetFlexible(_("\002{name}\002 = {level}"));
const std::vector<Privilege> &privs = PrivilegeManager::GetPrivileges();
@@ -744,11 +753,7 @@ class CommandCSLevels final
list.AddEntry(entry);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
void DoReset(CommandSource &source, ChannelInfo *ci)
@@ -825,6 +830,7 @@ public:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Description"));
list.SetFlexible(_("\002{name}\002: {description}"));
for (const auto &p : PrivilegeManager::GetPrivileges())
{
@@ -834,11 +840,7 @@ public:
list.AddEntry(entry);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
else
{
+18 -10
View File
@@ -141,7 +141,7 @@ class CommandCSAKick final
}
}
/* Match against the lastusermask of all nickalias's with equal
/* Match against the last mask of all nickalias's with equal
* or higher access. - Viper */
for (const auto &[_, na2] : *NickAliasList)
{
@@ -150,7 +150,7 @@ class CommandCSAKick final
AccessGroup nc_access = ci->AccessFor(na->nc), u_access = source.AccessFor(ci);
if (na->nc && (na->nc == ci->GetFounder() || nc_access >= u_access))
{
Anope::string buf = na->nick + "!" + na->last_usermask;
Anope::string buf = na->nick + "!" + na->last_userhost;
if (Anope::Match(buf, mask))
{
source.Reply(ACCESS_DENIED);
@@ -378,14 +378,8 @@ class CommandCSAKick final
source.Reply(_("No matching entries on %s autokick list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Autokick list for %s:"), ci->name.c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("End of autokick list"));
}
}
@@ -400,6 +394,13 @@ class CommandCSAKick final
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Reason"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Reason"].empty()
? _("{number}: \002{mask}\002")
: _("{number}: \002{mask}\002 ({reason})");
});
this->ProcessList(source, ci, params, list);
}
@@ -413,6 +414,13 @@ class CommandCSAKick final
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Last used")).AddColumn(_("Reason"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Reason"].empty()
? _("{number}: \002{mask}\002 -- added by {creator} on {created}; last used: {last_used}")
: _("{number}: \002{mask}\002 -- added by {creator} on {created}; last used: {last_used} ({reason})");
});
this->ProcessList(source, ci, params, list);
}
@@ -506,7 +514,7 @@ public:
"%s will ban that user from the channel, then kick "
"the user."
"\n\n"
"The \002%s\032ADD\002 command adds the given nick or usermask "
"The \002%s\032ADD\002 command adds the given nick or mask "
"to the AutoKick list. If a \037reason\037 is given with "
"the command, that reason will be used when the user is "
"kicked; if not, the default reason is \"User has been "
+34 -1
View File
@@ -13,6 +13,9 @@
static Module *me;
class TempBan;
static std::vector<TempBan *> tempbans;
class TempBan final
: public Timer
{
@@ -28,6 +31,21 @@ public:
, mask(banmask)
, mode(mod)
{
tempbans.push_back(this);
}
~TempBan()
{
auto it = std::find(tempbans.begin(), tempbans.end(), this);
if (it != tempbans.end())
tempbans.erase(it);
}
bool Matches(Channel *chan, ChannelMode *cmode, const Anope::string &bmask) const
{
return chan->name.equals_ci(this->channel)
&& cmode->name == this->mode
&& bmask == this->mask;
}
void Tick() override
@@ -258,10 +276,25 @@ class CSBan final
CommandCSBan commandcsban;
public:
CSBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandcsban(this)
CSBan(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, VENDOR)
, commandcsban(this)
{
me = this;
}
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *cmode, const Anope::string &param) override
{
for (const auto *tempban : tempbans)
{
if (tempban->Matches(c, cmode, param))
{
delete tempban;
break;
}
}
return EVENT_CONTINUE;
}
};
MODULE_INIT(CSBan)
+3 -5
View File
@@ -128,6 +128,8 @@ private:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Message"));
list.SetFlexible(_("{number}: {message} -- created by {creator} at {created}"));
for (unsigned i = 0; i < (*messages)->size(); ++i)
{
EntryMsg *msg = (*messages)->at(i);
@@ -140,11 +142,7 @@ private:
list.AddEntry(entry);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("End of entry message list."));
}
+7 -6
View File
@@ -309,8 +309,13 @@ class CommandCSFlags final
}
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Flags")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Description"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Description"].empty()
? _("{number}: \002{mask}\002 = {flags} -- added by {creator} at {created}")
: _("{number}: \002{mask}\002 = {flags} -- added by {creator} at {created} ({description})");
});
unsigned count = 0;
for (unsigned i = 0, end = ci->GetAccessCount(); i < end; ++i)
@@ -348,12 +353,8 @@ class CommandCSFlags final
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Flags list for %s"), ci->name.c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
if (count == ci->GetAccessCount())
source.Reply(_("End of access list."));
else
+1 -6
View File
@@ -62,12 +62,7 @@ public:
}
FOREACH_MOD(OnChanInfo, (source, ci, info, show_all));
std::vector<Anope::string> replies;
info.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
info.SendTo(source);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
+7 -6
View File
@@ -76,6 +76,12 @@ public:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Description"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Description"].empty()
? _("\002{name}\002")
: _("\002{name}\002 ({description})");
});
Anope::map<ChannelInfo *> ordered_map;
for (const auto &[cname, ci] : *RegisteredChannelList)
@@ -122,12 +128,7 @@ public:
}
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("End of list - %d/%d matches shown."), nchans > listmax ? listmax : nchans, nchans);
}
+5 -10
View File
@@ -138,7 +138,8 @@ public:
else
{
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Service")).AddColumn(_("Command")).AddColumn(_("Method")).AddColumn("");
list.AddColumn(_("Number")).AddColumn(_("Service")).AddColumn(_("Command")).AddColumn(_("Method"));
list.SetFlexible(_("{number}: {command} on {service}: {method}"));
for (unsigned i = 0; i < (*ls)->size(); ++i)
{
@@ -147,19 +148,13 @@ public:
ListFormatter::ListEntry entry;
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;
entry[""] = log->extra;
entry["Command"] = !log->command_name.empty() ? log->command_name.upper() : log->service_name;
entry["Method"] = log->method + (log->extra.empty() ? "" : " ") + log->extra;
list.AddEntry(entry);
}
source.Reply(_("Log list for %s:"), ci->name.c_str());
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
}
else if (params.size() > 2)
+15 -14
View File
@@ -288,7 +288,7 @@ class CommandCSMode final
for (auto *ml : mlocks)
{
ChannelMode *cm = ModeManager::FindChannelModeByName(ml->name);
if (cm && cm->CanSet(source.GetUser()))
if (cm && cm->CanSet(source.GetUser(), ci->c))
modelocks->RemoveMLock(cm, ml->set, ml->param);
}
}
@@ -320,7 +320,7 @@ class CommandCSMode final
source.Reply(_("Unknown mode character %c ignored."), mode);
break;
}
else if (u && !cm->CanSet(u))
else if (u && !cm->CanSet(u, ci->c))
{
source.Reply(_("You may not (un)lock mode %c."), mode);
break;
@@ -412,7 +412,7 @@ class CommandCSMode final
source.Reply(_("Unknown mode character %c ignored."), mode);
break;
}
else if (u && !cm->CanSet(u))
else if (u && !cm->CanSet(u, ci->c))
{
source.Reply(_("You may not (un)lock mode %c."), mode);
break;
@@ -450,6 +450,12 @@ class CommandCSMode final
{
ListFormatter list(source.GetAccount());
list.AddColumn(_("Mode")).AddColumn(_("Param")).AddColumn(_("Creator")).AddColumn(_("Created"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Param"].empty()
? _("{mode} -- created by {creator} on {created}")
: _("{mode} {param} -- created by {creator} on {created}");
});
for (auto *ml : mlocks)
{
@@ -458,7 +464,7 @@ class CommandCSMode final
continue;
ListFormatter::ListEntry entry;
entry["Mode"] = Anope::printf("%c%c", ml->set ? '+' : '-', cm->mchar);
entry["Mode"] = Anope::Format("%c%c", ml->set ? '+' : '-', cm->mchar);
entry["Param"] = ml->param;
entry["Creator"] = ml->setter;
entry["Created"] = Anope::strftime(ml->created, NULL, true);
@@ -466,12 +472,7 @@ class CommandCSMode final
}
source.Reply(_("Mode locks for %s:"), ci->name.c_str());
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
}
else
@@ -508,7 +509,7 @@ class CommandCSMode final
{
ChannelMode *cm = ModeManager::GetChannelModes()[j];
if (!u || cm->CanSet(u) || can_override)
if (!u || cm->CanSet(u, ci->c) || can_override)
{
if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM))
{
@@ -524,7 +525,7 @@ class CommandCSMode final
if (adding == -1)
break;
ChannelMode *cm = ModeManager::FindChannelModeByChar(mode);
if (!cm || (u && !cm->CanSet(u) && !can_override))
if (!cm || (u && !cm->CanSet(u, ci->c) && !can_override))
continue;
switch (cm->type)
{
@@ -917,9 +918,9 @@ public:
if (!m.second.empty())
{
if (m.first)
return Anope::printf(Language::Translate(source.GetAccount(), _("Gives you or the specified nick %s status on a channel")), m.second.c_str());
return Anope::Format(Language::Translate(source.GetAccount(), _("Gives you or the specified nick %s status on a channel")), m.second.c_str());
else
return Anope::printf(Language::Translate(source.GetAccount(), _("Removes %s status from you or the specified nick on a channel")), m.second.c_str());
return Anope::Format(Language::Translate(source.GetAccount(), _("Removes %s status from you or the specified nick on a channel")), m.second.c_str());
}
else
return "";
+53 -89
View File
@@ -16,7 +16,6 @@ enum TypeInfo
NEW, NICK_TO, NICK_FROM, JOIN, PART, QUIT, KICK
};
static bool simple;
struct SeenInfo;
static SeenInfo *FindInfo(const Anope::string &nick);
typedef Anope::unordered_map<SeenInfo *> database_map;
@@ -53,12 +52,54 @@ struct SeenInfoType final
{
}
static Anope::string TypeToString(TypeInfo ti)
{
switch (ti)
{
case NEW:
return "NEW";
case NICK_TO:
return "NICK_TO";
case NICK_FROM:
return "NICK_FROM";
case JOIN:
return "JOIN";
case PART:
return "PART";
case QUIT:
return "QUIT";
case KICK:
return "KICK";
}
return ""; // Should never happen.
}
static TypeInfo StringToType(const Anope::string &ti)
{
if (ti.equals_ci("NEW") || ti.equals_ci("0"))
return NEW;
if (ti.equals_ci("NICK_TO") || ti.equals_ci("1"))
return NICK_TO;
if (ti.equals_ci("NICK_FROM") || ti.equals_ci("2"))
return NICK_FROM;
if (ti.equals_ci("JOIN") || ti.equals_ci("3"))
return JOIN;
if (ti.equals_ci("PART") || ti.equals_ci("4"))
return PART;
if (ti.equals_ci("QUIT") || ti.equals_ci("5"))
return QUIT;
if (ti.equals_ci("KICK") || ti.equals_ci("6"))
return KICK;
return NEW; // Should never happen.
}
void Serialize(Serializable *obj, Serialize::Data &data) const override
{
const auto *s = static_cast<const SeenInfo *>(obj);
data.Store("nick", s->nick);
data.Store("vhost", s->vhost);
data.Store("type", s->type);
data.Store("type", TypeToString(s->type));
data.Store("nick2", s->nick2);
data.Store("channel", s->channel);
data.Store("message", s->message);
@@ -84,9 +125,9 @@ struct SeenInfoType final
s->nick = snick;
data["vhost"] >> s->vhost;
unsigned int n;
Anope::string n;
data["type"] >> n;
s->type = static_cast<TypeInfo>(n);
s->type = StringToType(n);
data["nick2"] >> s->nick2;
data["channel"] >> s->channel;
data["message"] >> s->message;
@@ -199,76 +240,6 @@ public:
class CommandSeen final
: public Command
{
static void SimpleSeen(CommandSource &source, const std::vector<Anope::string> &params)
{
if (!source.c || !source.c->ci)
{
if (source.IsOper())
source.Reply("Seen in simple mode is designed as a fantasy command only!");
return;
}
BotInfo *bi = BotInfo::Find(params[0], true);
if (bi)
{
if (bi == source.c->ci->bi)
source.Reply(_("You found me, %s!"), source.GetNick().c_str());
else
source.Reply(_("%s is a network service."), bi->nick.c_str());
return;
}
NickAlias *na = NickAlias::Find(params[0]);
if (!na)
{
source.Reply(_("I don't know who %s is."), params[0].c_str());
return;
}
if (source.GetAccount() == na->nc)
{
source.Reply(_("Looking for yourself, eh %s?"), source.GetNick().c_str());
return;
}
User *target = User::Find(params[0], true);
if (target && source.c->FindUser(target))
{
source.Reply(_("%s is on the channel right now!"), target->nick.c_str());
return;
}
for (const auto &[_, uc] : source.c->users)
{
User *u = uc->user;
if (u->Account() == na->nc)
{
source.Reply(_("%s is on the channel right now (as %s)!"), params[0].c_str(), u->nick.c_str());
return;
}
}
AccessGroup ag = source.c->ci->AccessFor(na->nc);
time_t last = 0;
for (const auto &p : ag.paths)
{
if (p.empty())
continue;
ChanAccess *a = p[p.size() - 1];
if (a->GetAccount() == na->nc && a->last_seen > last)
last = a->last_seen;
}
if (last > Anope::CurTime || !last)
source.Reply(_("I've never seen %s on this channel."), na->nick.c_str());
else
source.Reply(_("%s was last seen here %s ago."), na->nick.c_str(), Anope::Duration(Anope::CurTime - last, source.GetAccount()).c_str());
}
public:
CommandSeen(Module *creator) : Command(creator, "chanserv/seen", 1, 2)
{
@@ -281,9 +252,6 @@ public:
{
const Anope::string &target = params[0];
if (simple)
return this->SimpleSeen(source, params);
if (target.length() > IRCD->MaxNick)
{
source.Reply(_("Nick too long, max length is %zu characters."), IRCD->MaxNick);
@@ -314,7 +282,7 @@ public:
if (u2)
onlinestatus = ".";
else
onlinestatus = Anope::printf(Language::Translate(source.nc, _(" but %s mysteriously dematerialized.")), target.c_str());
onlinestatus = Anope::Format(Language::Translate(source.nc, _(" but %s mysteriously dematerialized.")), target.c_str());
Anope::string timebuf = Anope::Duration(Anope::CurTime - info->last, source.nc);
Anope::string timebuf2 = Anope::strftime(info->last, source.nc, true);
@@ -328,9 +296,9 @@ public:
{
u2 = User::Find(info->nick2, true);
if (u2)
onlinestatus = Anope::printf(Language::Translate(source.nc, _(". %s is still online.")), u2->nick.c_str());
onlinestatus = Anope::Format(Language::Translate(source.nc, _(". %s is still online.")), u2->nick.c_str());
else
onlinestatus = Anope::printf(Language::Translate(source.nc, _(", but %s mysteriously dematerialized.")), info->nick2.c_str());
onlinestatus = Anope::Format(Language::Translate(source.nc, _(", but %s mysteriously dematerialized.")), info->nick2.c_str());
source.Reply(_("%s (%s) was last seen changing nick to %s %s ago%s"),
target.c_str(), info->vhost.c_str(), info->nick2.c_str(), timebuf.c_str(), onlinestatus.c_str());
@@ -401,17 +369,13 @@ public:
{
}
void OnReload(Configuration::Conf &conf) override
{
simple = conf.GetModule(this).Get<bool>("simple");
}
void OnExpireTick() override
{
size_t previous_size = database.size();
time_t purgetime = Config->GetModule(this).Get<time_t>("purgetime");
auto purgetime = Config->GetModule(this).Get<time_t>("purgetime", "90d");
if (!purgetime)
purgetime = Anope::DoTime("30d");
return;
auto previous_size = database.size();
for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;)
{
database_map::iterator cur = it;
@@ -461,7 +425,7 @@ public:
private:
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())
if (!u->server->IsSynced())
return;
SeenInfo *&info = database[nick];
+1 -1
View File
@@ -1333,7 +1333,7 @@ public:
if (persist.HasExt(ci))
info.AddOption(_("Persistent"));
if (noexpire.HasExt(ci))
info.AddOption(_("No expire"));
info.AddOption(_("No expiry"));
if (keep_modes.HasExt(ci))
info.AddOption(_("Keep modes"));
if (noautoop.HasExt(ci))
+1
View File
@@ -171,6 +171,7 @@ public:
if (descriptions.count(source.command))
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply("%s", Language::Translate(source.nc, descriptions[source.command].c_str()));
return true;
}
+10 -3
View File
@@ -132,14 +132,18 @@ class CommandCSTopic final
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
}
void Append(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
void Combine(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params, bool append)
{
const Anope::string &topic = params[2];
Anope::string new_topic;
if (!ci->c->topic.empty())
{
new_topic = ci->c->topic + " " + topic;
if (append)
new_topic = ci->c->topic + " " + topic;
else
new_topic = topic + " " + ci->c->topic;
ci->last_topic.clear();
}
else
@@ -155,6 +159,7 @@ public:
this->SetDesc(_("Manipulate the topic of the specified channel"));
this->SetSyntax(_("\037channel\037 [SET] [\037topic\037]"));
this->SetSyntax(_("\037channel\037 APPEND \037topic\037"));
this->SetSyntax(_("\037channel\037 PREPEND \037topic\037"));
this->SetSyntax(_("\037channel\037 [UNLOCK|LOCK]"));
}
@@ -174,7 +179,9 @@ public:
else if (!ci->c)
source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str());
else if (subcmd.equals_ci("APPEND") && params.size() > 2)
this->Append(source, ci, params);
this->Combine(source, ci, params, true);
else if (subcmd.equals_ci("PREPEND") && params.size() > 2)
this->Combine(source, ci, params, false);
else
{
Anope::string topic;
+8 -6
View File
@@ -397,6 +397,12 @@ private:
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Mask")).AddColumn(_("Description"));
list.SetFlexible([](ListFormatter::ListEntry &row)
{
return row["Description"].empty()
? _("{number}: \002{mask}\002")
: _("{number}: \002{mask}\002 ({description})");
});
if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos)
{
@@ -453,12 +459,8 @@ private:
source.Reply(_("No matching entries on %s access list."), ci->name.c_str());
else
{
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("%s list for %s"), source.command.nobreak().c_str(), ci->name.c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
}
@@ -511,7 +513,7 @@ public:
const Anope::string GetDesc(CommandSource &source) const override
{
return Anope::printf(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.nobreak().c_str());
return Anope::Format(Language::Translate(source.GetAccount(), _("Modify the list of %s users")), source.command.nobreak().c_str());
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
+18 -22
View File
@@ -134,9 +134,9 @@ struct UserData final
Anope::string info_adder;
Anope::string info_message;
time_t info_ts = 0;
Anope::string last_mask;
Anope::string last_quit;
Anope::string last_real_mask;
Anope::string last_userhost;
Anope::string last_userhost_real;
bool noexpire = false;
bool protect = false;
std::optional<time_t> protectafter;
@@ -432,7 +432,7 @@ private:
// crypt3-md5 Converted to enc_posix
// crypt3-sha2-256 Converted to enc_posix
// crypt3-sha2-512 Converted to enc_posix
// ircservices Converted to enc_old
// ircservices NO
// pbkdf2 NO
// pbkdf2v2 NO
// rawmd5 Converted to enc_md5
@@ -443,10 +443,9 @@ private:
if (pass.compare(0, 18, "$anope$enc_sha256$", 18) == 0)
{
auto sep = pass.find('$', 18);
Anope::string iv, pass;
Anope::B64Decode(pass.substr(18, sep - 18), iv);
Anope::B64Decode(pass.substr(sep + 1), pass);
nc->pass = "sha256:" + Anope::Hex(pass) + ":" + Anope::Hex(iv);
auto iv = Anope::B64Decode(pass.substr(18, sep - 18));
auto pw = Anope::B64Decode(pass.substr(sep + 1));
nc->pass = "sha256:" + Anope::Hex(pw) + ":" + Anope::Hex(iv);
}
else if (pass.compare(0, 9, "$argon2d$", 9) == 0)
@@ -460,14 +459,10 @@ private:
else if (pass.compare(0, 8, "$base64$", 8) == 0)
{
Anope::string rawpass;
Anope::B64Decode(pass.substr(8), rawpass);
auto rawpass = Anope::B64Decode(pass.substr(8));
Anope::Encrypt(rawpass, nc->pass);
}
else if (pass.compare(0, 13, "$ircservices$", 13) == 0)
nc->pass = "oldmd5:" + pass.substr(13);
else if (pass.compare(0, 8, "$rawmd5$", 8) == 0)
nc->pass = "md5:" + pass.substr(8);
@@ -512,7 +507,7 @@ private:
if (!forbid_service)
{
Log(this) << "Unable to convert forbidden email " << email << " as os_forbid is not loaded";
Log(this) << "Unable to convert forbidden email address " << email << " as os_forbid is not loaded";
return true;
}
@@ -625,6 +620,7 @@ private:
return true;
}
auto originalflags = flags;
Anope::string accessflags;
ApplyAccess(flags, 'A', accessflags, { "ACCESS_LIST" });
ApplyAccess(flags, 'a', accessflags, { "AUTOPROTECT", "PROTECT", "PROTECTME" });
@@ -647,7 +643,7 @@ private:
auto *access = accessprov->Create();
access->SetMask(mask, ci);
access->creator = setter;
access->description = "Imported from Atheme";
access->description = "Imported from Atheme: " + flags;
access->last_seen = modifiedtime;
access->created = modifiedtime;
access->AccessUnserialize(accessflags);
@@ -805,7 +801,7 @@ private:
auto *ni = news_service->CreateNewsItem();
ni->type = NEWS_LOGON;
ni->text = Anope::printf("[%s] %s", subject.c_str(), body.c_str());
ni->text = Anope::Format("[%s] %s", subject.c_str(), body.c_str());
ni->who = setter;
ni->time = ts;
news_service->AddNewsItem(ni);
@@ -831,7 +827,7 @@ private:
auto *ni = news_service->CreateNewsItem();
ni->type = NEWS_OPER;
ni->text = Anope::printf("[%s] %s", subject.c_str(), body.c_str());
ni->text = Anope::Format("[%s] %s", subject.c_str(), body.c_str());
ni->who = setter;
ni->time = ts;
news_service->AddNewsItem(ni);
@@ -1145,9 +1141,9 @@ private:
else if (key == "private:freeze:timestamp")
data->suspend_ts = Anope::Convert<time_t>(value, 0);
else if (key == "private:host:actual")
data->last_real_mask = value;
data->last_userhost_real = value;
else if (key == "private:host:vhost")
data->last_mask = value;
data->last_userhost = value;
else if (key == "private:lastquit:message")
data->last_quit = value;
else if (key == "private:loginfail:failnum")
@@ -1313,14 +1309,14 @@ private:
auto *data = userdata.Get(nc);
if (data)
{
if (!data->last_mask.empty())
na->last_usermask = data->last_mask;
if (!data->last_userhost.empty())
na->last_userhost = data->last_userhost;
if (!data->last_quit.empty())
na->last_quit = data->last_quit;
if (!data->last_real_mask.empty())
na->last_realhost = data->last_real_mask;
if (!data->last_userhost_real.empty())
na->last_userhost_real = data->last_userhost_real;
if (data->noexpire)
na->Extend<bool>("NS_NO_EXPIRE");
+3 -251
View File
@@ -11,31 +11,6 @@
#include "module.h"
#ifndef _WIN32
#include <sys/wait.h>
#endif
#include <filesystem>
class SaveData final
: public Serialize::Data
{
public:
Anope::string last;
std::fstream *fs = nullptr;
std::iostream &operator[](const Anope::string &key) override
{
if (key != last)
{
*fs << "\nDATA " << key << " ";
last = key;
}
return *fs;
}
};
class LoadData final
: public Serialize::Data
{
@@ -97,133 +72,14 @@ public:
class DBFlatFile final
: public Module
, public Pipe
{
/* Day the last backup was on */
int last_day = 0;
private:
bool loaded = false;
int child_pid = -1;
void BackupDatabase()
{
tm *tm = localtime(&Anope::CurTime);
if (tm->tm_mday != last_day)
{
last_day = tm->tm_mday;
std::set<Anope::string> dbs;
dbs.insert(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
for (const auto &type_order : Serialize::Type::GetTypeOrder())
{
Serialize::Type *stype = Serialize::Type::Find(type_order);
if (stype && stype->GetOwner())
dbs.insert("module_" + stype->GetOwner()->name + ".db");
}
const auto backupdir = Anope::ExpandData("backups");
for (const auto &db : dbs)
{
const auto oldname = Anope::ExpandData(db);
const auto basename = Anope::Expand(backupdir, db + "-");
const auto newname = Anope::printf("%s%04i-%02i-%02i", basename.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
/* Backup already exists or no database to backup */
if (Anope::IsFile(newname) || !Anope::IsFile(oldname))
continue;
Log(LOG_DEBUG) << "db_flatfile: Attempting to rename " << db << " to " << newname;
if (rename(oldname.c_str(), newname.c_str()))
{
Anope::string err = Anope::LastError();
Log(this) << "Unable to back up database " << db << " (" << err << ")!";
if (!Config->GetModule(this).Get<bool>("nobackupokay"))
{
Anope::Quitting = true;
Anope::QuitReason = "Unable to back up database " + db + " (" + err + ")";
}
continue;
}
const auto keepbackups = Config->GetModule(this).Get<unsigned>("keepbackups", "7");
if (!keepbackups)
continue;
std::error_code ec;
std::set<Anope::string> old_backups;
for (const auto &entry : std::filesystem::directory_iterator(backupdir.str(), ec))
{
Anope::string entryname = entry.path().string();
if (entryname.compare(0, basename.length(), basename) != 0)
continue;
old_backups.insert(entryname);
if (old_backups.size() <= keepbackups)
continue;
Log(LOG_DEBUG) << "Deleting expired backup " << *old_backups.begin();
if (!std::filesystem::remove(old_backups.begin()->str(), ec))
{
Log(this) << "Failed to delete expired backup " << *old_backups.begin() << ": " << ec.message();
continue;
}
old_backups.erase(old_backups.begin());
}
}
}
}
public:
DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR)
DBFlatFile(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, DATABASE | DEPRECATED | VENDOR)
{
}
#ifndef _WIN32
void OnRestart() override
{
OnShutdown();
}
void OnShutdown() override
{
if (child_pid > -1)
{
Log(this) << "Waiting for child to exit...";
int status;
waitpid(child_pid, &status, 0);
Log(this) << "Done";
}
}
#endif
void OnNotify() override
{
char buf[512];
int i = this->Read(buf, sizeof(buf) - 1);
if (i <= 0)
return;
buf[i] = 0;
child_pid = -1;
if (!*buf)
{
Log(this) << "Finished saving databases";
return;
}
Log(this) << "Error saving databases: " << buf;
if (!Config->GetModule(this).Get<bool>("nobackupokay"))
Anope::Quitting = true;
}
EventReturn OnLoadDatabase() override
@@ -270,110 +126,6 @@ public:
return EVENT_STOP;
}
void OnSaveDatabase() override
{
if (child_pid > -1)
{
Log(this) << "Database save is already in progress!";
return;
}
BackupDatabase();
int i = -1;
#ifndef _WIN32
if (!Anope::Quitting && Config->GetModule(this).Get<bool>("fork"))
{
i = fork();
if (i > 0)
{
child_pid = i;
return;
}
else if (i < 0)
Log(this) << "Unable to fork for database save";
}
#endif
try
{
std::map<Module *, std::fstream *> databases;
/* First open the databases of all of the registered types. This way, if we have a type with 0 objects, that database will be properly cleared */
for (const auto &[_, s_type] : Serialize::Type::GetTypes())
{
if (databases[s_type->GetOwner()])
continue;
Anope::string db_name;
if (s_type->GetOwner())
db_name = Anope::ExpandData("module_" + s_type->GetOwner()->name + ".db");
else
db_name = Anope::ExpandData(Config->GetModule(this).Get<const Anope::string>("database", "anope.db"));
std::fstream *fs = databases[s_type->GetOwner()] = new std::fstream((db_name + ".tmp").c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
if (!fs->is_open())
Log(this) << "Unable to open " << db_name << " for writing";
}
SaveData data;
const std::list<Serializable *> &items = Serializable::GetItems();
for (auto *base : items)
{
Serialize::Type *s_type = base->GetSerializableType();
if (!s_type)
continue;
data.fs = databases[s_type->GetOwner()];
if (!data.fs || !data.fs->is_open())
continue;
*data.fs << "OBJECT " << s_type->GetName();
if (base->id)
*data.fs << "\nID " << base->id;
s_type->Serialize(base, data);
*data.fs << "\nEND\n";
}
for (auto &[mod, f] : databases)
{
const auto db_name = Anope::ExpandData((mod ? (mod->name + ".db") : Config->GetModule(this).Get<const Anope::string>("database", "anope.db")));
if (!f->is_open() || !f->good())
{
this->Write("Unable to write database " + db_name);
f->close();
}
else
{
f->close();
#ifdef _WIN32
/* Windows rename() fails if the file already exists. */
remove(db_name.c_str());
#endif
rename((db_name + ".tmp").c_str(), db_name.c_str());
}
delete f;
}
}
catch (...)
{
if (i)
throw;
}
if (!i)
{
this->Notify();
exit(0);
}
}
/* Load just one type. Done if a module is reloaded during runtime */
void OnSerializeTypeCreate(Serialize::Type *stype) override
{
if (!loaded)
+181 -152
View File
@@ -20,23 +20,13 @@ namespace fs = std::filesystem;
// TODO:
// * forking into background
// * stable key order
inline Anope::string yyjson_mut_get_astr(yyjson_mut_val *val)
inline Anope::string yyjson_get_astr(yyjson_val *val)
{
const auto *str = yyjson_mut_get_str(val);
const auto *str = yyjson_get_str(val);
return str ? str : "";
}
inline void yyjson_mut_obj_upsert(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, yyjson_mut_val *val)
{
auto *oldval = yyjson_mut_obj_get(obj, key);
if (oldval)
yyjson_mut_obj_replace(obj, yyjson_mut_str(doc, key), val);
else
yyjson_mut_obj_add_val(doc, obj, key, val);
}
class Data final
: public Serialize::Data
{
@@ -48,37 +38,42 @@ public:
Anope::map<std::stringstream> data;
// Used when writing data.
Data() = default;
Data(Serialize::Type *s_type, Serializable *obj)
{
if (obj->id)
this->id = obj->id;
s_type->Serialize(obj, *this);
}
// Used when reading data.
Data(yyjson_mut_val *elem)
Data(yyjson_val *elem)
{
size_t idx, max;
yyjson_mut_val *key, *value;
yyjson_mut_obj_foreach(elem, idx, max, key, value)
yyjson_val *key, *value;
yyjson_obj_foreach(elem, idx, max, key, value)
{
if (yyjson_mut_get_type(key) != YYJSON_TYPE_STR)
if (yyjson_get_type(key) != YYJSON_TYPE_STR)
continue;
Anope::string akey(yyjson_mut_get_str(key));
auto akey = yyjson_get_astr(key);
if (akey.equals_ci("@id"))
{
this->id = yyjson_mut_get_uint(value);
this->id = yyjson_get_uint(value);
continue;
}
if (yyjson_mut_is_bool(value))
data[akey] << yyjson_mut_get_bool(value);
else if (yyjson_mut_is_int(value))
data[akey] << yyjson_mut_get_int(value);
else if (yyjson_mut_is_null(value))
if (yyjson_is_bool(value))
data[akey] << yyjson_get_bool(value);
else if (yyjson_is_int(value))
data[akey] << yyjson_get_int(value);
else if (yyjson_is_null(value))
data[akey];
else if (yyjson_mut_is_real(value))
data[akey] << yyjson_mut_get_real(value);
else if (yyjson_mut_is_str(value))
data[akey] << yyjson_mut_get_str(value);
else if (yyjson_mut_is_uint(value))
data[akey] << yyjson_mut_get_uint(value);
else if (yyjson_is_real(value))
data[akey] << yyjson_get_real(value);
else if (yyjson_is_str(value))
data[akey] << yyjson_get_astr(value);
else if (yyjson_is_uint(value))
data[akey] << yyjson_get_uint(value);
}
}
@@ -86,16 +81,29 @@ public:
{
return data[key];
}
size_t Hash() const override
{
size_t hash = 0;
for (const auto &[_, value] : this->data)
{
auto valuestr = value.str();
if (!valuestr.empty())
hash ^= Anope::hash_cs()(valuestr);
}
return hash;
}
};
class DBJSON final
: public Module
{
private:
using DBPair = std::pair<yyjson_mut_doc *, yyjson_mut_val *>;
// Multimap from serializable type to serializable data.
using DBData = Anope::multimap<Data>;
// The databases which have already been loaded from disk.
std::unordered_map<Module *, DBPair> databases;
std::unordered_map<Module *, DBData> databases;
// Whether OnLoadDatabase has been called yet.
bool loaded = false;
@@ -182,7 +190,7 @@ private:
return; // No backups.
auto backupdir = Anope::ExpandData(modconf.Get<Anope::string>("backup_directory", "backups"));
if (!fs::is_directory(backupdir.str(), ec) && !ec)
if (!fs::is_directory(backupdir.str(), ec))
{
fs::create_directories(backupdir.str(), ec);
if (ec)
@@ -201,71 +209,131 @@ private:
CreateBackup(backupdir, dbpath, monthly_backups, "%Y-%m", "\?\?\?\?-\?\?");
}
void LoadType(Serialize::Type *s_type, yyjson_mut_val *data)
void LoadType(Serialize::Type *s_type, DBData &data)
{
auto *entries = yyjson_mut_obj_get(data, s_type->GetName().c_str());
if (!entries || !yyjson_mut_is_arr(entries))
auto entries = data.equal_range(s_type->GetName());
if (entries.first == entries.second)
return;
Log(LOG_DEBUG) << "Loading " << yyjson_mut_arr_size(entries) << " " << s_type->GetName() << " records";
size_t idx, max;
yyjson_mut_val *elem;
yyjson_mut_arr_foreach(entries, idx, max, elem)
{
Data ld(elem);
s_type->Unserialize(nullptr, ld);
}
for (auto it = entries.first; it != entries.second; ++it)
s_type->Unserialize(nullptr, it->second);
}
DBPair ReadDatabase(const Anope::string &dbname)
std::optional<DBData> ReadDatabase(const Anope::string &dbname)
{
yyjson_read_err errmsg;
const auto flags = YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_INVALID_UNICODE;
auto *idoc = yyjson_read_file(dbname.c_str(), flags, nullptr, &errmsg);
if (!idoc)
auto *doc = yyjson_read_file(dbname.c_str(), flags, nullptr, &errmsg);
if (!doc)
{
Log(this) << "Unable to read " << dbname << ": error #" << errmsg.code << ": " << errmsg.msg;
return { nullptr, nullptr };
return std::nullopt;
}
// We operate on a mutable document because we need to write to it later.
auto *doc = yyjson_doc_mut_copy(idoc, nullptr);
yyjson_doc_free(idoc);
auto *root = yyjson_mut_doc_get_root(doc);
if (!yyjson_mut_is_obj(root))
auto *root = yyjson_doc_get_root(doc);
if (!yyjson_is_obj(root))
{
Log(this) << "Unable to read " << dbname << ": root element is not an object";
return { nullptr, nullptr };
return std::nullopt;
}
auto version = yyjson_mut_get_uint(yyjson_mut_obj_get(root, "version"));
auto version = yyjson_get_uint(yyjson_obj_get(root, "version"));
if (version && version != ANOPE_DATABASE_VERSION)
{
Log(this) << "Refusing to load an unsupported database version: " << version;
return { nullptr, nullptr };
return std::nullopt;
}
auto generator = yyjson_mut_get_astr(yyjson_mut_obj_get(root, "generator"));
auto updated = yyjson_mut_get_uint(yyjson_mut_obj_get(root, "updated"));
auto generator = yyjson_get_astr(yyjson_obj_get(root, "generator"));
auto updated = yyjson_get_uint(yyjson_obj_get(root, "updated"));
Log(LOG_DEBUG) << "Database " << dbname << " was generated on " << Anope::strftime(updated) << " by " << generator;
auto *data = yyjson_mut_obj_get(root, "data");
if (!data || !yyjson_mut_is_obj(data))
auto *data = yyjson_obj_get(root, "data");
if (!data || !yyjson_is_obj(data))
{
Log(this) << "Unable to read " << dbname << ": data element is missing or not an object";
return { nullptr, nullptr };
return std::nullopt;
}
return { doc, data };
DBData ret;
size_t idx, max;
yyjson_val *key, *val;
yyjson_obj_foreach(data, idx, max, key, val)
{
if (!yyjson_is_str(key))
{
Log(this) << "Unable to read part of " << dbname << ": key of data element #" << idx << " is not a string";
continue;
}
auto keystr = yyjson_get_astr(key);
if (!yyjson_is_arr(val))
{
Log(this) << "Unable to read part of " << dbname << ": " << keystr << " value of data element #" << idx << " is not an array";
continue;
}
Log(LOG_DEBUG) << "Loading " << yyjson_arr_size(val) << " " << keystr << " records";
size_t idx, max;
yyjson_val *elem;
yyjson_arr_foreach(val, idx, max, elem)
{
Data ld(elem);
ret.emplace(keystr, std::move(ld));
}
}
yyjson_doc_free(doc);
return ret;
}
static void UpdateMetadata(yyjson_mut_doc *doc, yyjson_mut_val *obj)
void SaveType(yyjson_mut_doc *doc, yyjson_mut_val *obj, const Anope::string &typestr, const Data &data)
{
const auto generator = "Anope " + Anope::Version() + " " + Anope::VersionBuildString();
yyjson_mut_obj_upsert(doc, obj, "generator", yyjson_mut_strncpy(doc, generator.c_str(), generator.length()));
yyjson_mut_obj_upsert(doc, obj, "version", yyjson_mut_uint(doc, ANOPE_DATABASE_VERSION));
yyjson_mut_obj_upsert(doc, obj, "updated", yyjson_mut_int(doc, Anope::CurTime));
auto *type = yyjson_mut_obj_getn(obj, typestr.c_str(), typestr.length());
if (!type || !yyjson_mut_is_arr(type))
{
// We haven't seen this element before.
type = yyjson_mut_arr(doc);
yyjson_mut_obj_add_val(doc, obj, typestr.c_str(), type);
}
auto *elem = yyjson_mut_obj(doc);
if (data.id)
yyjson_mut_obj_add_uint(doc, elem, "@id", data.id);
for (const auto &[key, value] : data.data)
{
yyjson_mut_val *v;
switch (data.GetType(key))
{
case Serialize::DataType::BOOL:
v = yyjson_mut_bool(doc, Anope::Convert<bool>(value.str(), false));
break;
case Serialize::DataType::FLOAT:
v = yyjson_mut_real(doc, Anope::Convert<double>(value.str(), 0.0));
break;
case Serialize::DataType::INT:
v = yyjson_mut_int(doc, Anope::Convert<int64_t>(value.str(), 0));
break;
case Serialize::DataType::TEXT:
{
auto str = value.str();
v = str.empty() ? yyjson_mut_null(doc) : yyjson_mut_strncpy(doc, str.c_str(), str.length());
break;
}
case Serialize::DataType::UINT:
v = yyjson_mut_uint(doc, Anope::Convert<uint64_t>(value.str(), 0));
break;
}
auto *k = yyjson_mut_strncpy(doc, key.c_str(), key.length());
yyjson_mut_obj_add(elem, k, v);
}
yyjson_mut_arr_add_val(type, elem);
}
public:
@@ -278,15 +346,15 @@ public:
{
auto dbname = GetDatabaseFile(nullptr);
auto [doc, data] = ReadDatabase(dbname);
if (!data)
auto db = ReadDatabase(dbname);
if (!db)
return EVENT_STOP;
for (const auto &type : Serialize::Type::GetTypeOrder())
{
auto *s_type = Serialize::Type::Find(type);
if (s_type && !s_type->GetOwner())
LoadType(s_type, data);
LoadType(s_type, db.value());
}
loaded = true;
@@ -295,111 +363,73 @@ public:
void OnSaveDatabase() override
{
std::set<Module *> updated;
for (const auto &[_, s_type] : Serialize::Type::GetTypes())
// Step 1: clear the old data.
for (const auto &type : Serialize::Type::GetTypeOrder())
{
auto *s_type = Serialize::Type::Find(type);
if (!s_type)
continue; // Provider has been unloaded.
auto it = databases.find(s_type->GetOwner());
if (it == databases.end())
{
auto *doc = yyjson_mut_doc_new(nullptr);
auto *root = yyjson_mut_obj(doc);
yyjson_mut_doc_set_root(doc, root);
UpdateMetadata(doc, root);
auto *data = yyjson_mut_obj(doc);
yyjson_mut_obj_add_val(doc, root, "data", data);
databases[s_type->GetOwner()] = { doc, data };
databases.emplace(s_type->GetOwner(), DBData());
continue; // We just need to create for this type.
}
else if (updated.find(s_type->GetOwner()) == updated.end())
{
auto *doc = it->second.first;
auto *root = yyjson_mut_doc_get_root(doc);
UpdateMetadata(doc, root);
updated.insert(s_type->GetOwner());
}
// As this type has been written before we need to clear the entries
// from the previous writes so we can update it in the next loop. We
// have to do it this way so we don't purge any entries for unloaded
// modules.
it->second.erase(s_type->GetName());
}
std::set<Serialize::Type *> seen;
// Step 2: store the new data.
for (auto *item : Serializable::GetItems())
{
auto *s_type = item->GetSerializableType();
if (!s_type)
continue; // Provider has been unloaded.
// This should always be found because we create it in the previous step.
auto it = databases.find(s_type->GetOwner());
if (it == databases.end())
continue; // Type has not been registered?
auto &[doc, data] = it->second;
// If the type object doesn't exist then create it. Otherwise, clear.
// all of the previous objects stored in it.
auto *type = yyjson_mut_obj_getn(data, s_type->GetName().c_str(), s_type->GetName().length());
if (!type || yyjson_mut_get_type(type) != YYJSON_TYPE_ARR)
{
// We haven't seen this element before.
type = yyjson_mut_arr(doc);
yyjson_mut_obj_add_val(doc, data, s_type->GetName().c_str(), type);
}
else if (seen.find(s_type) == seen.end())
{
// We are reusing an existing element, clear it.
yyjson_mut_arr_clear(type);
seen.insert(s_type);
}
auto *elem = yyjson_mut_arr_add_obj(doc, type);
if (item->id)
yyjson_mut_obj_add_uint(doc, elem, "@id", item->id);
Data sd;
s_type->Serialize(item, sd);
for (const auto &[key, value] : sd.data)
{
yyjson_mut_val *v;
switch (sd.GetType(key))
{
case Serialize::DataType::BOOL:
v = yyjson_mut_bool(doc, Anope::Convert<bool>(value.str(), false));
break;
case Serialize::DataType::FLOAT:
v = yyjson_mut_real(doc, Anope::Convert<double>(value.str(), 0.0));
break;
case Serialize::DataType::INT:
v = yyjson_mut_int(doc, Anope::Convert<int64_t>(value.str(), 0));
break;
case Serialize::DataType::TEXT:
{
auto str = value.str();
v = str.empty() ? yyjson_mut_null(doc) : yyjson_mut_strncpy(doc, str.c_str(), str.length());
break;
}
case Serialize::DataType::UINT:
v = yyjson_mut_uint(doc, Anope::Convert<uint64_t>(value.str(), 0));
break;
}
auto *k = yyjson_mut_strncpy(doc, key.c_str(), key.length());
yyjson_mut_obj_add(elem, k, v);
}
if (it != databases.end())
it->second.emplace(s_type->GetName(), Data(s_type, item));
}
// Step 3: serialize to JSON.
for (auto &[mod, database] : databases)
{
auto dbname = GetDatabaseFile(mod);
BackupDatabase(dbname);
auto *doc = yyjson_mut_doc_new(nullptr);
auto *root = yyjson_mut_obj(doc);
yyjson_mut_doc_set_root(doc, root);
const auto generator = "Anope " + Anope::Version() + " " + Anope::VersionBuildString();
yyjson_mut_obj_add_strncpy(doc, root, "generator", generator.c_str(), generator.length());
yyjson_mut_obj_add_uint(doc, root, "version", ANOPE_DATABASE_VERSION);
yyjson_mut_obj_add_int(doc, root, "updated", Anope::CurTime);
auto *data = yyjson_mut_obj(doc);
yyjson_mut_obj_add_val(doc, root, "data", data);
for (const auto &[name, items] : database)
SaveType(doc, data, name, items);
Log(LOG_DEBUG) << "Writing " << dbname;
yyjson_write_err errmsg;
const auto flags = YYJSON_WRITE_ALLOW_INVALID_UNICODE | YYJSON_WRITE_NEWLINE_AT_END | YYJSON_WRITE_PRETTY;
if (!yyjson_mut_write_file(dbname.c_str(), database.first, flags, nullptr, &errmsg))
if (!yyjson_mut_write_file(dbname.c_str(), doc, flags, nullptr, &errmsg))
{
Log(this) << "Unable to write " << dbname << ": error #" << errmsg.code << ": " << errmsg.msg;
// TODO: exit??? retry???
}
yyjson_mut_doc_free(doc);
}
}
@@ -415,14 +445,13 @@ public:
const auto dbname = GetDatabaseFile(s_type->GetOwner());
auto db = ReadDatabase(dbname);
if (!db.second)
if (!db)
return; // Not much we can do here.
it = databases.emplace(s_type->GetOwner(), db).first;
it = databases.emplace(s_type->GetOwner(), std::move(db.value())).first;
}
auto &[_, data] = it->second;
LoadType(s_type, data);
LoadType(s_type, it->second);
}
};
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -174,9 +174,9 @@ public:
if (!this->CheckInit() || obj->GetTimestamp() == Anope::CurTime)
return;
Anope::string sql = Anope::printf("SELECT * from `%s`", GetTableName(obj).c_str());
Anope::string sql = Anope::Format("SELECT * from `%s`", GetTableName(obj).c_str());
if (obj->GetTimestamp())
sql += Anope::printf(" WHERE (`timestamp` >= %s OR `timestamp` IS NULL)", this->SQL->FromUnixtime(obj->GetTimestamp()).c_str());
sql += Anope::Format(" WHERE (`timestamp` >= %s OR `timestamp` IS NULL)", this->SQL->FromUnixtime(obj->GetTimestamp()).c_str());
Query query(sql);
+41 -3
View File
@@ -142,7 +142,7 @@ class Packet final
record.ttl = (input[pos] << 24) | (input[pos + 1] << 16) | (input[pos + 2] << 8) | input[pos + 3];
pos += 4;
//record.rdlength = input[pos] << 8 | input[pos + 1];
auto rdlength = input[pos] << 8 | input[pos + 1];
pos += 2;
switch (record.type)
@@ -192,6 +192,44 @@ class Packet final
break;
}
case DNS::QUERY_TXT:
{
if (pos + rdlength > input_size)
throw SocketException("Unable to unpack TXT resource record");
auto txtlength = input[pos++];
if (pos + txtlength > input_size)
throw SocketException("Unable to unpack TXT resource record");
record.rdata = Anope::string(reinterpret_cast<const char* >(input + pos), txtlength);
pos += rdlength - 1;
break;
}
case DNS::QUERY_SRV:
{
if (rdlength < 6 || pos + rdlength > input_size)
throw SocketException("Unable to unpack SRV resource record");
auto srv = std::make_shared<DNS::Record::SRV>();
srv->priority = input[pos] << 8 | input[pos + 1];
pos += 2;
srv->weight = input[pos] << 8 | input[pos + 1];
pos += 2;
srv->port = input[pos] << 8 | input[pos + 1];
pos += 2;
srv->host = this->UnpackName(input, input_size, pos);
if (!IsValidName(srv->host))
throw SocketException("Invalid name in SRV resource record");
record.rdata = Anope::Format("%hu %hu %hu %s", srv->priority,
srv->weight, srv->port, srv->host.c_str());
record.rdataobj = srv;
break;
}
default:
break;
}
@@ -638,7 +676,7 @@ public:
if (!packet)
return false;
Log(LOG_DEBUG_2) << "Resolver: Notifying slave " << packet->addr.addr();
Log(LOG_DEBUG_2) << "Resolver: Notifying secondary " << packet->addr.addr();
try
{
@@ -939,7 +977,7 @@ public:
void Notify(const Anope::string &zone) override
{
/* notify slaves of the update */
/* notify secondaries of the update */
for (const auto &[ip, port] : notify)
{
sockaddrs addr;
+1 -1
View File
@@ -49,7 +49,7 @@ private:
public:
EMD5(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, ENCRYPTION | VENDOR)
: Module(modname, creator, DEPRECATED | ENCRYPTION | VENDOR)
, md5provider(this, "md5", 16, 64)
{
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+2 -4
View File
@@ -14,7 +14,7 @@ class ENone final
{
public:
ENone(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, ENCRYPTION | VENDOR)
: Module(modname, creator, DEPRECATED | ENCRYPTION | VENDOR)
{
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
throw ModuleException("enc_none is deprecated and can not be used as a primary encryption method");
@@ -35,9 +35,7 @@ public:
if (!hash_method.equals_cs("plain"))
return;
Anope::string b64pass;
Anope::B64Encode(req->GetPassword(), b64pass);
auto enc = "plain:" + b64pass;
auto enc = "plain:" + Anope::B64Encode(req->GetPassword());
if (nc->pass.equals_cs(enc))
{
// If we are NOT the first encryption module we want to re-encrypt
-86
View File
@@ -1,86 +0,0 @@
/* Include file for high-level encryption routines.
*
* (C) 2003-2025 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.
*/
#include "module.h"
#include "modules/encryption.h"
class EOld final
: public Module
{
private:
ServiceReference<Encryption::Provider> md5;
Anope::string EncryptInternal(const Anope::string &src)
{
if (!md5)
return {};
char digest[32];
memset(digest, 0, sizeof(digest));
auto hash = md5->Encrypt(src);
if (hash.length() != sizeof(digest))
return {}; // Probably a bug?
memcpy(digest, hash.data(), hash.length());
char digest2[16];
for (size_t i = 0; i < sizeof(digest); i += 2)
digest2[i / 2] = XTOI(digest[i]) << 4 | XTOI(digest[i + 1]);
return Anope::Hex(digest2, sizeof(digest2));
}
inline static char XTOI(char c)
{
return c > 9 ? c - 'A' + 10 : c - '0';
}
public:
EOld(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, ENCRYPTION | VENDOR)
, md5("Encryption::Provider", "md5")
{
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
throw ModuleException("enc_old is deprecated and can not be used as a primary encryption method");
ModuleManager::LoadModule("enc_md5", User::Find(creator, true));
if (!md5)
throw ModuleException("Unable to find md5 reference");
}
void OnCheckAuthentication(User *, IdentifyRequest *req) override
{
const auto *na = NickAlias::Find(req->GetAccount());
if (!na)
return;
NickCore *nc = na->nc;
size_t pos = nc->pass.find(':');
if (pos == Anope::string::npos)
return;
Anope::string hash_method(nc->pass.begin(), nc->pass.begin() + pos);
if (!hash_method.equals_cs("oldmd5"))
return;
auto enc = EncryptInternal(req->GetPassword());
if (!enc.empty() && nc->pass.equals_cs(enc))
{
// If we are NOT the first encryption module we want to re-encrypt
// the password with the primary encryption method.
if (ModuleManager::FindFirstOf(ENCRYPTION) != this)
Anope::Encrypt(req->GetPassword(), nc->pass);
req->Success(this);
}
}
};
MODULE_INIT(EOld)
+1 -1
View File
@@ -173,7 +173,7 @@ private:
public:
ESHA1(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, ENCRYPTION | VENDOR)
: Module(modname, creator, DEPRECATED | ENCRYPTION | VENDOR)
, sha1provider(this, "sha1", 20, 64)
{
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
+1 -16
View File
@@ -17,14 +17,6 @@ class ESHA256 final
{
private:
unsigned iv[8];
bool use_iv;
/* initializes the IV with a new random value */
void NewRandomIV()
{
for (auto &ivsegment : iv)
ivsegment = static_cast<uint32_t>(Anope::RandomNumber());
}
/* returns the IV as base64-encrypted string */
Anope::string GetIVString()
@@ -50,11 +42,6 @@ private:
Anope::string EncryptInternal(const Anope::string &src)
{
if (!use_iv)
NewRandomIV();
else
use_iv = false;
sha256_ctx ctx;
sha256_init(&ctx);
for (size_t i = 0; i < 8; ++i)
@@ -69,9 +56,8 @@ private:
public:
ESHA256(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, ENCRYPTION | VENDOR)
: Module(modname, creator, DEPRECATED | ENCRYPTION | VENDOR)
{
use_iv = false;
if (ModuleManager::FindFirstOf(ENCRYPTION) == this)
throw ModuleException("enc_sha256 is deprecated and can not be used as a primary encryption method");
}
@@ -92,7 +78,6 @@ public:
return;
GetIVFromPass(nc->pass);
use_iv = true;
auto enc = EncryptInternal(req->GetPassword());
if (nc->pass.equals_cs(enc))
{
+6 -6
View File
@@ -200,7 +200,7 @@ public:
Anope::string GetColumn(Serialize::DataType dt)
{
return Anope::printf("%s %s DEFAULT %s",
return Anope::Format("%s %s DEFAULT %s",
GetColumnType(dt),
GetColumnNull(dt) ? "NULL" : "NOT NULL",
GetColumnDefault(dt));
@@ -245,7 +245,7 @@ public:
DThread = new DispatcherThread();
DThread->Start();
Log(this) << "Module was compiled against MySQL version " << (MYSQL_VERSION_ID / 10000) << "." << (MYSQL_VERSION_ID / 100 % 100) << "." << (MYSQL_VERSION_ID % 100) << " and is running against version " << mysql_get_client_info();
Log(this) << "Module was compiled against MySQL version " << MYSQL_SERVER_VERSION << " and is running against version " << mysql_get_client_info();
}
~ModuleSQL()
@@ -498,24 +498,24 @@ std::vector<Query> MySQLService::CreateTable(const Anope::string &table, const D
{
// We can't just use MODIFY COLUMN here because the value may not
// be valid and we may need to replace with the default.
auto res = this->RunQuery(Anope::printf("ALTER TABLE `%s` ADD COLUMN `%s_new` %s; ",
auto res = this->RunQuery(Anope::Format("ALTER TABLE `%s` ADD COLUMN `%s_new` %s; ",
table.c_str(), column.c_str(), GetColumn(stype).c_str()));
if (res)
{
res = this->RunQuery(Anope::printf("UPDATE IGNORE `%s` SET `%s_new` = %s; ",
res = this->RunQuery(Anope::Format("UPDATE IGNORE `%s` SET `%s_new` = %s; ",
table.c_str(), column.c_str(), column.c_str()));
}
if (res)
{
res = this->RunQuery(Anope::printf("ALTER TABLE `%s` DROP COLUMN `%s`; ",
res = this->RunQuery(Anope::Format("ALTER TABLE `%s` DROP COLUMN `%s`; ",
table.c_str(), column.c_str()));
}
if (res)
{
res = this->RunQuery(Anope::printf("ALTER TABLE `%s` RENAME COLUMN `%s_new` TO `%s`; ",
res = this->RunQuery(Anope::Format("ALTER TABLE `%s` RENAME COLUMN `%s_new` TO `%s`; ",
table.c_str(), column.c_str(), column.c_str()));
}
+3 -1
View File
@@ -12,7 +12,7 @@
#include "module.h"
#include "modules/ssl.h"
#define OPENSSL_API_COMPAT 0x10100000L
#define OPENSSL_API_COMPAT 0x10101000L
#define OPENSSL_NO_DEPRECATED
#include <openssl/bio.h>
@@ -126,7 +126,9 @@ public:
SSL_CTX_set_session_id_context(client_ctx, reinterpret_cast<const unsigned char *>(context_name.c_str()), context_name.length());
SSL_CTX_set_session_id_context(server_ctx, reinterpret_cast<const unsigned char *>(context_name.c_str()), context_name.length());
#ifdef OPENSSL_VERSION_STR
Log(this) << "Module was compiled against OpenSSL version " << OPENSSL_VERSION_STR << " and is running against version " << OpenSSL_version(OPENSSL_VERSION_STRING);
#endif
}
~SSLModule()
+1 -1
View File
@@ -148,7 +148,7 @@ public:
if (request.data.size() < event->GetMinParams())
{
auto error = Anope::printf("Not enough parameters (given %zu, expected %zu)",
auto error = Anope::Format("Not enough parameters (given %zu, expected %zu)",
request.data.size(), event->GetMinParams());
xmlrpc_env_set_fault(&env, RPC::ERR_INVALID_PARAMS, error.c_str());
SendError(reply, env);
+3 -3
View File
@@ -110,7 +110,7 @@ public:
if (params.empty())
return;
Anope::string normalized_param0 = Anope::NormalizeBuffer(params[0]);
Anope::string normalized_param0 = Anope::RemoveFormatting(params[0]);
Anope::string fantasy_chars = Config->GetModule(this).Get<Anope::string>("fantasycharacter", "!");
if (!normalized_param0.find(c->ci->bi->nick))
@@ -143,7 +143,7 @@ public:
full_command.erase(full_command.begin());
++count;
it = Config->Fantasy.find(Anope::NormalizeBuffer(full_command));
it = Config->Fantasy.find(Anope::RemoveFormatting(full_command));
}
if (it == Config->Fantasy.end())
@@ -188,7 +188,7 @@ public:
source.permission = info.permission;
AccessGroup ag = c->ci->AccessFor(u);
bool has_fantasy = ag.HasPriv("FANTASY") || source.HasPriv("botserv/fantasy");
bool has_fantasy = !info.require_privilege || ag.HasPriv("FANTASY") || source.HasPriv("botserv/fantasy");
EventReturn MOD_RESULT;
if (has_fantasy)
+3 -5
View File
@@ -114,6 +114,8 @@ private:
ListFormatter list(source.nc);
list.AddColumn(_("Number")).AddColumn(_("Message"));
list.SetFlexible(_("{number}: {message}"));
for (size_t i = 0; i < q->size(); ++i)
{
ListFormatter::ListEntry entry;
@@ -121,11 +123,7 @@ private:
entry["Message"] = (*q)[i];
list.AddEntry(entry);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
public:
+1 -1
View File
@@ -141,7 +141,7 @@ public:
if (source && !Config->GetModule(this).Get<bool>("anonymousglobal"))
{
// A source is available and they're not anonymous.
line = Anope::printf("[%s] %s", source->GetNick().c_str(), message.c_str());
line = Anope::Format("[%s] %s", source->GetNick().c_str(), message.c_str());
}
else
{
+1 -1
View File
@@ -204,7 +204,7 @@ public:
Anope::string *greet = ns_greet.Get(user->Account());
if (bs_greet.HasExt(c->ci) && greet != NULL && !greet->empty() && c->FindUser(c->ci->bi) && c->ci->AccessFor(user).HasPriv("GREET"))
{
const auto message = Anope::printf("[%s] %s", user->Account()->display.c_str(), greet->c_str());
const auto message = Anope::Format("[%s] %s", user->Account()->display.c_str(), greet->c_str());
IRCD->SendPrivmsg(*c->ci->bi, c->name, message);
c->ci->bi->lastmsg = Anope::CurTime;
}
+4 -4
View File
@@ -57,7 +57,7 @@ class CommandHSDelAll final
public:
CommandHSDelAll(Module *creator) : Command(creator, "hostserv/delall", 1, 1)
{
this->SetDesc(_("Deletes the vhost for all nicks in a group"));
this->SetDesc(_("Deletes the vhost for all nicks in an account"));
this->SetSyntax(_("\037nick\037"));
}
@@ -80,8 +80,8 @@ public:
na = alias;
na->RemoveVHost();
}
Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->display;
source.Reply(_("VHosts for group \002%s\002 have been removed."), nc->display.c_str());
Log(LOG_ADMIN, source, this) << "for all nicks in account " << nc->display;
source.Reply(_("VHosts for account \002%s\002 have been removed."), nc->display.c_str());
}
else
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
@@ -91,7 +91,7 @@ public:
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Deletes the vhost for all nicks in the same group as that of the given nick."));
source.Reply(_("Deletes the vhost for all nicks in the same account as that of the given nick."));
return true;
}
};
+2 -2
View File
@@ -39,7 +39,7 @@ public:
CommandHSGroup(Module *creator) : Command(creator, "hostserv/group", 0, 0)
{
this->SetDesc(_("Syncs the vhost for all nicks in a group"));
this->SetDesc(_("Syncs the vhost for all nicks in an account"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -54,7 +54,7 @@ public:
if (na && source.GetAccount() == na->nc && na->HasVHost())
{
this->Sync(na);
source.Reply(_("All vhosts in the group \002%s\002 have been set to \002%s\002."),
source.Reply(_("All vhosts for the account \002%s\002 have been set to \002%s\002."),
source.nc->display.c_str(), na->GetVHostMask().c_str());
}
else
+3 -5
View File
@@ -52,8 +52,10 @@ public:
}
unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50");
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Creator")).AddColumn(_("Created"));
list.SetFlexible(_("{number}: \002{nick}\002 = {vhost} -- created by {creator} at {created}"));
for (const auto &[_, na] : *NickAliasList)
{
@@ -112,11 +114,7 @@ public:
source.Reply(_("Displayed all records (count: \002%d\002)."), display_counter);
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
+221 -21
View File
@@ -15,12 +15,20 @@
*/
#include "module.h"
#include "modules/dns.h"
#include "modules/hostserv/request.h"
static ServiceReference<DNS::Manager> dnsmanager("DNS::Manager", "dns/manager");
static ServiceReference<MemoServService> memoserv("MemoServService", "MemoServ");
static void req_send_memos(Module *me, CommandSource &source, const Anope::string &vident, const Anope::string &vhost);
namespace
{
// The name of the DNS record used for validation.
Anope::string validation_record;
}
struct HostRequestImpl final
: HostRequest
, Serializable
@@ -29,6 +37,23 @@ struct HostRequestImpl final
: Serializable("HostRequest")
{
}
static HostRequestImpl *Get(NickAlias *na)
{
return na ? na->GetExt<HostRequestImpl>("hostrequest") : nullptr;
}
Anope::string Mask() const
{
if (ident.empty())
return host;
return ident + "@" + host;
}
Anope::string GetValidationRecord() const
{
return Anope::Format("%s=%s", validation_record.c_str(), this->validation_token.c_str());
}
};
struct HostRequestTypeImpl final
@@ -46,6 +71,8 @@ struct HostRequestTypeImpl final
data.Store("ident", req->ident);
data.Store("host", req->host);
data.Store("time", req->time);
data.Store("validation_token", req->validation_token);
data.Store("last_validation", req->last_validation);
}
Serializable *Unserialize(Serializable *obj, Serialize::Data &data) const override
@@ -68,20 +95,99 @@ struct HostRequestTypeImpl final
data["ident"] >> req->ident;
data["host"] >> req->host;
data["time"] >> req->time;
data["validation_token"] >> req->validation_token;
data["last_validation"] >> req->last_validation;
}
return req;
}
};
class DNSHostResolver final
: public DNS::Request
{
private:
Command *command;
Reference<NickAlias> nickalias;
CommandSource source;
void HandleError(HostRequestImpl *hr)
{
source.Reply(_(
"Unable to find the DNS record required to validate \002%s\002. If you have not already "
"done this add a TXT record for %s with the value %s and re-execute this command."
),
hr->Mask().c_str(),
hr->host.c_str(),
hr->GetValidationRecord().c_str()
);
}
public:
DNSHostResolver(Command *cmd, HostRequest *hr, NickAlias *na, const CommandSource &src)
: Request(dnsmanager, cmd->module, hr->host, DNS::QUERY_TXT, false)
, command(cmd)
, nickalias(na)
, source(src)
{
hr->last_validation = Anope::CurTime;
Log(LOG_DEBUG) << "Checking " << hr->host << " for " << hr->validation_token;
}
void OnError(const DNS::Query *record) override
{
NickAlias *na = nickalias;
if (!na)
return; // Nick has been dropped.
auto *hr = HostRequestImpl::Get(na);
if (!hr)
{
source.Reply(_("No request for nick %s found."), source.GetNick().c_str());
return;
}
HandleError(hr);
}
void OnLookupComplete(const DNS::Query *record) override
{
NickAlias *na = nickalias;
if (!na)
return; // Nick has been dropped.
auto *hr = HostRequestImpl::Get(na);
if (!hr)
{
source.Reply(_("No request for nick %s found."), source.GetNick().c_str());
return;
}
for (const auto &answer : record->answers)
{
if (answer.rdata != hr->GetValidationRecord())
continue; // Not for us.
na->SetVHost(hr->ident, hr->host, source.GetNick(), hr->time);
FOREACH_MOD(OnSetVHost, (na));
if (Config->GetModule(command->module).Get<bool>("memouser") && memoserv)
memoserv->Send(source.service->nick, na->nick, _("Your requested vhost has been validated via DNS."), true);
source.Reply(_("VHost for %s has been validated using DNS."), na->nick.c_str());
Log(LOG_COMMAND, source, command) << "for " << na->nick << " for vhost " << hr->Mask();
na->Shrink<HostRequestImpl>("hostrequest");
return; // We're done.
}
HandleError(hr);
}
};
class CommandHSRequest final
: public Command
{
static bool isvalidchar(char c)
{
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-';
}
public:
CommandHSRequest(Module *creator) : Command(creator, "hostserv/request", 1, 1)
{
@@ -142,13 +248,11 @@ public:
source.Reply(HOST_NO_VIDENT);
return;
}
for (const auto &chr : user)
if (!IRCD->IsIdentValid(user))
{
if (!isvalidchar(chr))
{
source.Reply(HOST_SET_IDENT_ERROR);
return;
}
source.Reply(HOST_SET_IDENT_ERROR);
return;
}
}
@@ -178,9 +282,28 @@ public:
req.ident = user;
req.host = host;
req.time = Anope::CurTime;
req.validation_token = Anope::Random(Config->GetBlock("options").Get<size_t>("codelength", "15"));
na->Extend<HostRequestImpl>("hostrequest", req);
source.Reply(_("Your vhost has been requested."));
BotInfo *bi;
Anope::string cmd;
if (dnsmanager && Command::FindCommandFromService("hostserv/validate", bi, cmd))
{
source.Reply(_(
"Your vhost \002%s\002 has been requested. If the requested vhost is for a valid "
"DNS name you can add a TXT record for %s with the value %s and automatically "
"approve your vhost using \002%s\002."
),
req.Mask().c_str(),
req.host.c_str(),
req.GetValidationRecord().c_str(),
bi->GetQueryCommand("hostserv/validate").c_str()
);
}
else
source.Reply(_("Your vhost \002%s\002 has been requested."), req.Mask().c_str());
req_send_memos(owner, source, user, host);
Log(LOG_COMMAND, source, this) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host;
}
@@ -279,7 +402,7 @@ public:
{
Anope::string message;
if (!reason.empty())
message = Anope::printf(_("Your requested vhost has been rejected. Reason: %s"), reason.c_str());
message = Anope::Format(_("Your requested vhost has been rejected. Reason: %s"), reason.c_str());
else
message = _("Your requested vhost has been rejected.");
@@ -318,9 +441,10 @@ public:
{
unsigned counter = 0;
unsigned display_counter = 0, listmax = Config->GetModule(this->owner).Get<unsigned>("listmax");
ListFormatter list(source.GetAccount());
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Nick")).AddColumn(_("VHost")).AddColumn(_("Created"));
list.SetFlexible(_("{number}: \002{nick}\002 = {vhost} -- created by {creator} at {created}"));
for (const auto &[nick, na] : *NickAliasList)
{
@@ -345,12 +469,7 @@ public:
++counter;
}
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
source.Reply(_("Displayed \002%d\002 records (\002%d\002 total)."), display_counter, counter);
}
@@ -364,6 +483,78 @@ public:
}
};
class CommandHSValidate final
: public Command
{
public:
time_t cooldown;
CommandHSValidate(Module *creator)
: Command(creator, "hostserv/validate", 0)
{
this->SetDesc(_("Validates a previously requested vhost using DNS"));
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
if (Anope::ReadOnly)
{
source.Reply(READ_ONLY_MODE);
return;
}
auto *na = NickAlias::Find(source.GetNick());
if (!na || na->nc != source.GetAccount())
{
source.Reply(ACCESS_DENIED);
return;
}
auto *req = HostRequestImpl::Get(na);
if (!req)
{
source.Reply(_("No request for nick %s found."), source.GetNick().c_str());
return;
}
auto next_validation = req->last_validation + cooldown;
if (req->last_validation && next_validation > Anope::CurTime)
{
source.Reply(_("You must wait for %s before trying DNS validation again."),
Anope::Duration(next_validation - Anope::CurTime).c_str());
return;
}
DNSHostResolver *res = nullptr;
try
{
if (!dnsmanager)
throw SocketException("DNS is not available");
res = new DNSHostResolver(this, req, na, source);
dnsmanager->Process(res);
}
catch (const SocketException &ex)
{
Log(this->module) << ex.GetReason();
source.Reply("Unable to validate vhosts right now. Please try again later.");
delete res;
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_(
"Validates a previously requested vhost using DNS. If you own the domain you "
"have requested as a vhost you can validate your ownership of it using a DNS "
"TXT record to approve your own vhost."
));
return true;
}
};
class HSRequest final
: public Module
{
@@ -371,6 +562,7 @@ class HSRequest final
CommandHSActivate commandhsactive;
CommandHSReject commandhsreject;
CommandHSWaiting commandhswaiting;
CommandHSValidate commandhsvalidate;
ExtensibleItem<HostRequestImpl> hostrequest;
HostRequestTypeImpl request_type;
@@ -381,11 +573,19 @@ public:
, commandhsactive(this)
, commandhsreject(this)
, commandhswaiting(this)
, commandhsvalidate(this)
, hostrequest(this, "hostrequest")
{
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");
}
void OnReload(Configuration::Conf &conf) override
{
const auto &block = conf.GetModule(this);
commandhsvalidate.cooldown = block.Get<time_t>("validationcooldown", "5m");
validation_record = block.Get<const Anope::string>("validationrecord", "anope-dns-validation");
}
};
static void req_send_memos(Module *me, CommandSource &source, const Anope::string &vident, const Anope::string &vhost)
@@ -404,7 +604,7 @@ static void req_send_memos(Module *me, CommandSource &source, const Anope::strin
if (!na)
continue;
Anope::string message = Anope::printf(_("VHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str());
Anope::string message = Anope::Format(_("VHost \002%s\002 has been requested by %s."), host.c_str(), source.GetNick().c_str());
memoserv->Send(source.service->nick, na->nick, message, true);
}
+4 -4
View File
@@ -122,7 +122,7 @@ class CommandHSSetAll final
public:
CommandHSSetAll(Module *creator) : Command(creator, "hostserv/setall", 2, 2)
{
this->SetDesc(_("Set the vhost for all nicks in a group"));
this->SetDesc(_("Set the vhost for all nicks in an account"));
this->SetSyntax(_("\037nick\037 \037hostmask\037"));
}
@@ -193,7 +193,7 @@ public:
na->SetVHost(user, host, source.GetNick());
this->Sync(na);
FOREACH_MOD(OnSetVHost, (na));
source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), na->GetVHostMask().c_str());
source.Reply(_("VHost for account \002%s\002 set to \002%s\002."), nick.c_str(), na->GetVHostMask().c_str());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -201,13 +201,13 @@ public:
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_(
"Sets the vhost for all nicks in the same group as that "
"Sets the vhost for all nicks in the same account as that "
"of the given nick. If your IRCD supports vidents, then "
"using SETALL <nick> <ident>@<hostmask> will set idents "
"for users as well as vhosts."
"\n\n"
"* NOTE, this will not update the vhost for any nicks "
"added to the group after this command was used."
"added to the account after this command was used."
));
return true;
}
-1
View File
@@ -1 +0,0 @@
build_subdir(${CMAKE_CURRENT_SOURCE_DIR})
-325
View File
@@ -1,325 +0,0 @@
/*
*
* (C) 2013-2025 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "irc2sql.h"
void IRC2SQL::OnShutdown()
{
// TODO: test if we really have to use blocking query here
// (sometimes mysql get unloaded before the other thread executed all queries)
if (this->sql)
SQL::Result r = this->sql->RunQuery(SQL::Query("CALL " + prefix + "OnShutdown()"));
quitting = true;
}
void IRC2SQL::OnReload(Configuration::Conf &conf)
{
const auto &block = Config->GetModule(this);
prefix = block.Get<const Anope::string>("prefix", "anope_");
GeoIPDB = block.Get<const Anope::string>("geoip_database");
ctcpuser = block.Get<bool>("ctcpuser", "no");
ctcpeob = block.Get<bool>("ctcpeob", "yes");
Anope::string engine = block.Get<const Anope::string>("engine");
this->sql = ServiceReference<SQL::Provider>("SQL::Provider", engine);
if (sql)
this->CheckTables();
else
Log() << "IRC2SQL: no database connection to " << engine;
const Anope::string &snick = block.Get<const Anope::string>("client");
if (snick.empty())
throw ConfigException(Module::name + ": <client> must be defined");
StatServ = BotInfo::Find(snick, true);
if (!StatServ)
throw ConfigException(Module::name + ": no bot named " + snick);
if (firstrun)
{
firstrun = false;
for (Anope::map<Server *>::const_iterator it = Servers::ByName.begin(); it != Servers::ByName.end(); ++it)
{
this->OnNewServer(it->second);
}
for (const auto &[_, c] : ChannelList)
{
this->OnChannelCreate(c);
}
for (const auto &[_, u] : UserListByNick)
{
bool exempt = false;
this->OnUserConnect(u, exempt);
for (const auto &[_, uc] : u->chans)
{
this->OnJoinChannel(u, uc->chan);
}
}
}
}
void IRC2SQL::OnNewServer(Server *server)
{
query = "INSERT DELAYED INTO `" + prefix + "server` (name, hops, comment, link_time, online, ulined) "
"VALUES (@name@, @hops@, @comment@, now(), 'Y', @ulined@) "
"ON DUPLICATE KEY UPDATE name=VALUES(name), hops=VALUES(hops), comment=VALUES(comment), "
"link_time=VALUES(link_time), online=VALUES(online), ulined=VALUES(ulined)";
query.SetValue("name", server->GetName());
query.SetValue("hops", server->GetHops());
query.SetValue("comment", server->GetDescription());
query.SetValue("ulined", server->IsULined() ? "Y" : "N");
this->RunQuery(query);
}
void IRC2SQL::OnServerQuit(Server *server)
{
if (quitting)
return;
query = "CALL " + prefix + "ServerQuit(@name@)";
query.SetValue("name", server->GetName());
this->RunQuery(query);
}
void IRC2SQL::OnUserConnect(User *u, bool &exempt)
{
if (!introduced_myself)
{
this->OnNewServer(Me);
introduced_myself = true;
}
query = "CALL " + prefix + "UserConnect(@nick@,@host@,@vhost@,@chost@,@realname@,@ip@,@ident@,@vident@,"
"@account@,@secure@,@fingerprint@,@signon@,@server@,@uuid@,@modes@,@oper@)";
query.SetValue("nick", u->nick);
query.SetValue("host", u->host);
query.SetValue("vhost", u->vhost);
query.SetValue("chost", u->chost);
query.SetValue("realname", u->realname);
query.SetValue("ip", u->ip.addr());
query.SetValue("ident", u->GetIdent());
query.SetValue("vident", u->GetVIdent());
query.SetValue("secure", u->IsSecurelyConnected() ? "Y" : "N");
query.SetValue("account", u->IsIdentified() ? u->Account()->display : "");
query.SetValue("fingerprint", u->fingerprint);
query.SetValue("signon", u->signon);
query.SetValue("server", u->server->GetName());
query.SetValue("uuid", u->GetUID());
query.SetValue("modes", u->GetModes());
query.SetValue("oper", u->HasMode("OPER") ? "Y" : "N");
this->RunQuery(query);
if (ctcpuser && (Me->IsSynced() || ctcpeob) && u->server != Me)
IRCD->SendPrivmsg(StatServ, u->GetUID(), Anope::FormatCTCP("VERSION"));
}
void IRC2SQL::OnUserQuit(User *u, const Anope::string &msg)
{
if (quitting || u->server->IsQuitting())
return;
query = "CALL " + prefix + "UserQuit(@nick@)";
query.SetValue("nick", u->nick);
this->RunQuery(query);
}
void IRC2SQL::OnUserNickChange(User *u, const Anope::string &oldnick)
{
query = "UPDATE `" + prefix + "user` SET nick=@newnick@ WHERE nick=@oldnick@";
query.SetValue("newnick", u->nick);
query.SetValue("oldnick", oldnick);
this->RunQuery(query);
}
void IRC2SQL::OnUserAway(User *u, const Anope::string &message)
{
query = "UPDATE `" + prefix + "user` SET away=@away@, awaymsg=@awaymsg@ WHERE nick=@nick@";
query.SetValue("away", (!message.empty()) ? "Y" : "N");
query.SetValue("awaymsg", message);
query.SetValue("nick", u->nick);
this->RunQuery(query);
}
void IRC2SQL::OnFingerprint(User *u)
{
query = "UPDATE `" + prefix + "user` SET secure=@secure@, fingerprint=@fingerprint@ WHERE nick=@nick@";
query.SetValue("secure", u->IsSecurelyConnected() ? "Y" : "N");
query.SetValue("fingerprint", u->fingerprint);
query.SetValue("nick", u->nick);
this->RunQuery(query);
}
void IRC2SQL::OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname)
{
query = "UPDATE `" + prefix + "user` SET modes=@modes@, oper=@oper@ WHERE nick=@nick@";
query.SetValue("nick", u->nick);
query.SetValue("modes", u->GetModes());
query.SetValue("oper", u->HasMode("OPER") ? "Y" : "N");
this->RunQuery(query);
}
void IRC2SQL::OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname)
{
this->OnUserModeSet(setter, u, mname);
}
void IRC2SQL::OnUserLogin(User *u)
{
query = "UPDATE `" + prefix + "user` SET account=@account@ WHERE nick=@nick@";
query.SetValue("nick", u->nick);
query.SetValue("account", u->IsIdentified() ? u->Account()->display : "");
this->RunQuery(query);
}
void IRC2SQL::OnNickLogout(User *u)
{
this->OnUserLogin(u);
}
void IRC2SQL::OnSetDisplayedHost(User *u)
{
query = "UPDATE `" + prefix + "user` "
"SET vhost=@vhost@ "
"WHERE nick=@nick@";
query.SetValue("vhost", u->GetDisplayedHost());
query.SetValue("nick", u->nick);
this->RunQuery(query);
}
void IRC2SQL::OnChannelCreate(Channel *c)
{
query = "INSERT INTO `" + prefix + "chan` (channel, topic, topicauthor, topictime, modes) "
"VALUES (@channel@,@topic@,@topicauthor@,@topictime@,@modes@) "
"ON DUPLICATE KEY UPDATE channel=VALUES(channel), topic=VALUES(topic),"
"topicauthor=VALUES(topicauthor), topictime=VALUES(topictime), modes=VALUES(modes)";
query.SetValue("channel", c->name);
query.SetValue("topic", c->topic);
query.SetValue("topicauthor", c->topic_setter);
if (c->topic_ts > 0)
query.SetValue("topictime", c->topic_ts);
else
query.SetValue("topictime", "NULL", false);
query.SetValue("modes", c->GetModes(true,true));
this->RunQuery(query);
}
void IRC2SQL::OnChannelDelete(Channel *c)
{
query = "DELETE FROM `" + prefix + "chan` WHERE channel=@channel@";
query.SetValue("channel", c->name);
this->RunQuery(query);
}
void IRC2SQL::OnJoinChannel(User *u, Channel *c)
{
Anope::string modes;
ChanUserContainer *cu = u->FindChannel(c);
if (cu)
modes = cu->status.Modes();
query = "CALL " + prefix + "JoinUser(@nick@,@channel@,@modes@)";
query.SetValue("nick", u->nick);
query.SetValue("channel", c->name);
query.SetValue("modes", modes);
this->RunQuery(query);
}
EventReturn IRC2SQL::OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const ModeData &data)
{
if (mode->type == MODE_STATUS)
{
User *u = User::Find(data.value);
if (u == NULL)
return EVENT_CONTINUE;
ChanUserContainer *cc = u->FindChannel(c);
if (cc == NULL)
return EVENT_CONTINUE;
query = "UPDATE `" + prefix + "user` AS u, `" + prefix + "ison` AS i, `" + prefix + "chan` AS c"
" SET i.modes=@modes@"
" WHERE u.nick=@nick@ AND c.channel=@channel@"
" AND u.nickid = i.nickid AND c.chanid = i.chanid";
query.SetValue("nick", u->nick);
query.SetValue("modes", cc->status.Modes());
query.SetValue("channel", c->name);
this->RunQuery(query);
}
else
{
query = "UPDATE `" + prefix + "chan` SET modes=@modes@ WHERE channel=@channel@";
query.SetValue("channel", c->name);
query.SetValue("modes", c->GetModes(true,true));
this->RunQuery(query);
}
return EVENT_CONTINUE;
}
EventReturn IRC2SQL::OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param)
{
this->OnChannelModeSet(c, setter, mode, param);
return EVENT_CONTINUE;
}
void IRC2SQL::OnLeaveChannel(User *u, Channel *c)
{
if (quitting)
return;
/*
* user is quitting, we already received a OnUserQuit()
* at this point the user is already removed from SQL and all channels
*/
if (u->Quitting())
return;
query = "CALL " + prefix + "PartUser(@nick@,@channel@)";
query.SetValue("nick", u->nick);
query.SetValue("channel", c->name);
this->RunQuery(query);
}
void IRC2SQL::OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic)
{
query = "UPDATE `" + prefix + "chan` "
"SET topic=@topic@, topicauthor=@author@, topictime=FROM_UNIXTIME(@time@) "
"WHERE channel=@channel@";
query.SetValue("topic", c->topic);
query.SetValue("author", c->topic_setter);
query.SetValue("time", c->topic_ts);
query.SetValue("channel", c->name);
this->RunQuery(query);
}
void IRC2SQL::OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags)
{
if (bi != StatServ)
return;
Anope::string ctcpname, ctcpbody;
if (!Anope::ParseCTCP(message, ctcpname, ctcpbody) || ctcpname != "VERSION")
return;
if (u->HasExt("CTCPVERSION"))
return;
u->Extend<bool>("CTCPVERSION");
auto versionstr = Anope::NormalizeBuffer(ctcpbody);
if (versionstr.empty())
return;
query = "UPDATE `" + prefix + "user` "
"SET version=@version@ "
"WHERE nick=@nick@";
query.SetValue("version", versionstr);
query.SetValue("nick", u->nick);
this->RunQuery(query);
}
MODULE_INIT(IRC2SQL)
-88
View File
@@ -1,88 +0,0 @@
/*
*
* (C) 2013-2025 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#pragma once
#include "module.h"
#include "modules/sql.h"
class MySQLInterface final
: public SQL::Interface
{
public:
MySQLInterface(Module *o) : SQL::Interface(o) { }
void OnResult(const SQL::Result &r) override
{
}
void OnError(const SQL::Result &r) override
{
if (!r.GetQuery().query.empty())
Log(LOG_DEBUG) << "irc2sql: Error executing query " << r.finished_query << ": " << r.GetError();
else
Log(LOG_DEBUG) << "irc2sql: Error executing query: " << r.GetError();
}
};
class IRC2SQL final
: public Module
{
ServiceReference<SQL::Provider> sql;
MySQLInterface sqlinterface;
SQL::Query query;
std::vector<Anope::string> TableList, ProcedureList, EventList;
Anope::string prefix, GeoIPDB;
bool quitting, introduced_myself, ctcpuser, ctcpeob, firstrun;
BotInfo *StatServ;
PrimitiveExtensibleItem<bool> versionreply;
void RunQuery(const SQL::Query &q);
void GetTables();
bool HasTable(const Anope::string &table);
bool HasProcedure(const Anope::string &table);
bool HasEvent(const Anope::string &table);
void CheckTables();
public:
IRC2SQL(const Anope::string &modname, const Anope::string &creator) :
Module(modname, creator, EXTRA | VENDOR), sql("", ""), sqlinterface(this), versionreply(this, "CTCPVERSION")
{
firstrun = true;
quitting = false;
introduced_myself = false;
}
void OnShutdown() override;
void OnReload(Configuration::Conf &config) override;
void OnNewServer(Server *server) override;
void OnServerQuit(Server *server) override;
void OnUserConnect(User *u, bool &exempt) override;
void OnUserQuit(User *u, const Anope::string &msg) override;
void OnUserNickChange(User *u, const Anope::string &oldnick) override;
void OnUserAway(User *u, const Anope::string &message) override;
void OnFingerprint(User *u) override;
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) override;
void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) override;
void OnUserLogin(User *u) override;
void OnNickLogout(User *u) override;
void OnSetDisplayedHost(User *u) override;
void OnChannelCreate(Channel *c) override;
void OnChannelDelete(Channel *c) override;
void OnLeaveChannel(User *u, Channel *c) override;
void OnJoinChannel(User *u, Channel *c) override;
EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const ModeData &data) override;
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) override;
void OnTopicUpdated(User *source, Channel *c, const Anope::string &user, const Anope::string &topic) override;
void OnBotNotice(User *u, BotInfo *bi, Anope::string &message, const Anope::map<Anope::string> &tags) override;
};
-343
View File
@@ -1,343 +0,0 @@
/*
*
* (C) 2013-2025 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "irc2sql.h"
void IRC2SQL::CheckTables()
{
Anope::string geoquery("");
if (firstrun)
{
/*
* reset some tables to make sure they are really empty
*/
this->sql->RunQuery("TRUNCATE TABLE " + prefix + "user");
this->sql->RunQuery("TRUNCATE TABLE " + prefix + "chan");
this->sql->RunQuery("TRUNCATE TABLE " + prefix + "ison");
this->sql->RunQuery("UPDATE `" + prefix + "server` SET currentusers=0, online='N'");
}
this->GetTables();
if (GeoIPDB.equals_ci("country"))
{
if (!this->HasTable(prefix + "geoip_country"))
{
query = "CREATE TABLE `" + prefix + "geoip_country` ("
"`start` INT UNSIGNED NOT NULL,"
"`end` INT UNSIGNED NOT NULL,"
"`countrycode` varchar(2),"
"`countryname` varchar(50),"
"PRIMARY KEY `end` (`end`),"
"KEY `start` (`start`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
}
else if (GeoIPDB.equals_ci("city"))
{
if (!this->HasTable(prefix + "geoip_city_blocks"))
{
query = "CREATE TABLE `" + prefix + "geoip_city_blocks` ("
"`start` INT UNSIGNED NOT NULL,"
"`end` INT UNSIGNED NOT NULL,"
"`locId` INT UNSIGNED NOT NULL,"
"PRIMARY KEY `end` (`end`),"
"KEY `start` (`start`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "geoip_city_location"))
{
query = "CREATE TABLE `" + prefix + "geoip_city_location` ("
"`locId` INT UNSIGNED NOT NULL,"
"`country` CHAR(2) NOT NULL,"
"`region` CHAR(2) NOT NULL,"
"`city` VARCHAR(50),"
"`latitude` FLOAT,"
"`longitude` FLOAT,"
"`areaCode` INT,"
"PRIMARY KEY (`locId`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "geoip_city_region"))
{ query = "CREATE TABLE `" + prefix + "geoip_city_region` ("
"`country` CHAR(2) NOT NULL,"
"`region` CHAR(2) NOT NULL,"
"`regionname` VARCHAR(100) NOT NULL,"
"PRIMARY KEY (`country`,`region`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
}
if (!this->HasTable(prefix + "server"))
{
query = "CREATE TABLE `" + prefix + "server` ("
"`id` int UNSIGNED NOT NULL AUTO_INCREMENT,"
"`name` varchar(64) NOT NULL,"
"`hops` tinyint NOT NULL,"
"`comment` varchar(255) NOT NULL,"
"`link_time` datetime DEFAULT NULL,"
"`split_time` datetime DEFAULT NULL,"
"`version` varchar(127) DEFAULT NULL,"
"`currentusers` int DEFAULT 0,"
"`online` enum('Y','N') NOT NULL DEFAULT 'Y',"
"`ulined` enum('Y','N') NOT NULL DEFAULT 'N',"
"PRIMARY KEY (`id`),"
"UNIQUE KEY `name` (`name`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "chan"))
{
query = "CREATE TABLE `" + prefix + "chan` ("
"`chanid` int UNSIGNED NOT NULL AUTO_INCREMENT,"
"`channel` varchar(255) NOT NULL,"
"`topic` varchar(512) DEFAULT NULL,"
"`topicauthor` varchar(255) DEFAULT NULL,"
"`topictime` datetime DEFAULT NULL,"
"`modes` varchar(512) DEFAULT NULL,"
"PRIMARY KEY (`chanid`),"
"UNIQUE KEY `channel`(`channel`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "user"))
{
query = "CREATE TABLE `" + prefix + "user` ("
"`nickid` int UNSIGNED NOT NULL AUTO_INCREMENT,"
"`nick` varchar(255) NOT NULL DEFAULT '',"
"`host` varchar(255) NOT NULL DEFAULT '',"
"`vhost` varchar(255) NOT NULL DEFAULT '',"
"`chost` varchar(255) NOT NULL DEFAULT '',"
"`realname` varchar(255) NOT NULL DEFAULT '',"
"`ip` varchar(255) NOT NULL DEFAULT '',"
"`ident` varchar(32) NOT NULL DEFAULT '',"
"`vident` varchar(32) NOT NULL DEFAULT '',"
"`modes` varchar(255) NOT NULL DEFAULT '',"
"`account` varchar(255) NOT NULL DEFAULT '',"
"`secure` enum('Y','N') NOT NULL DEFAULT 'N',"
"`fingerprint` varchar(128) NOT NULL DEFAULT '',"
"`signon` datetime DEFAULT NULL,"
"`server` varchar(255) NOT NULL DEFAULT '',"
"`servid` int UNSIGNED NOT NULL DEFAULT '0',"
"`uuid` varchar(32) NOT NULL DEFAULT '',"
"`oper` enum('Y','N') NOT NULL DEFAULT 'N',"
"`away` enum('Y','N') NOT NULL DEFAULT 'N',"
"`awaymsg` varchar(255) NOT NULL DEFAULT '',"
"`version` varchar(255) NOT NULL DEFAULT '',"
"`geocode` varchar(16) NOT NULL DEFAULT '',"
"`geocountry` varchar(64) NOT NULL DEFAULT '',"
"`georegion` varchar(100) NOT NULL DEFAULT '',"
"`geocity` varchar(128) NOT NULL DEFAULT '',"
"`locId` INT UNSIGNED,"
"PRIMARY KEY (`nickid`),"
"UNIQUE KEY `nick` (`nick`),"
"KEY `servid` (`servid`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "ison"))
{
query = "CREATE TABLE `" + prefix + "ison` ("
"`nickid` int unsigned NOT NULL default '0',"
"`chanid` int unsigned NOT NULL default '0',"
"`modes` varchar(255) NOT NULL default '',"
"PRIMARY KEY (`nickid`,`chanid`),"
"KEY `modes` (`modes`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (!this->HasTable(prefix + "maxusers"))
{
query = "CREATE TABLE `" + prefix + "maxusers` ("
"`name` VARCHAR(255) NOT NULL,"
"`maxusers` int NOT NULL,"
"`maxtime` DATETIME NOT NULL,"
"`lastused` DATETIME NOT NULL,"
"UNIQUE KEY `name` (`name`)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
this->RunQuery(query);
}
if (this->HasProcedure(prefix + "UserConnect"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "UserConnect"));
if (GeoIPDB.equals_ci("country"))
geoquery = "UPDATE `" + prefix + "user` AS u "
"JOIN ( SELECT `countrycode`, `countryname` "
"FROM `" + prefix + "geoip_country` "
"WHERE INET_ATON(ip_) <= `end` "
"AND `start` <= INET_ATON(ip_) "
"ORDER BY `end` ASC LIMIT 1 ) as c "
"SET u.geocode = c.countrycode, u.geocountry = c.countryname "
"WHERE u.nick = nick_; ";
else if (GeoIPDB.equals_ci("city"))
geoquery = "UPDATE `" + prefix + "user` as u "
"JOIN ( SELECT * FROM `" + prefix + "geoip_city_location` "
"WHERE `locID` = ( SELECT `locID` "
"FROM `" + prefix + "geoip_city_blocks` "
"WHERE INET_ATON(ip_) <= `end` "
"AND `start` <= INET_ATON(ip_) "
"ORDER BY `end` ASC LIMIT 1 ) "
") as l "
"SET u.geocode = l.country, "
"u.geocity = l.city, "
"u.locID = l.locID, "
"u.georegion = ( SELECT `regionname` "
"FROM `" + prefix + "geoip_city_region` "
"WHERE `country` = l.country "
"AND `region` = l.region )"
"WHERE u.nick = nick_;";
query = "CREATE PROCEDURE `" + prefix + "UserConnect`"
"(nick_ varchar(255), host_ varchar(255), vhost_ varchar(255), "
"chost_ varchar(255), realname_ varchar(255), ip_ varchar(255), "
"ident_ varchar(255), vident_ varchar(255), account_ varchar(255), "
"secure_ enum('Y','N'), fingerprint_ varchar(255), signon_ int, "
"server_ varchar(255), uuid_ varchar(32), modes_ varchar(255), "
"oper_ enum('Y','N')) "
"BEGIN "
"DECLARE cur int;"
"DECLARE max int;"
"INSERT INTO `" + prefix + "user` "
"(nick, host, vhost, chost, realname, ip, ident, vident, account, "
"secure, fingerprint, signon, server, uuid, modes, oper) "
"VALUES (nick_, host_, vhost_, chost_, realname_, ip_, ident_, vident_, "
"account_, secure_, fingerprint_, FROM_UNIXTIME(signon_), server_, "
"uuid_, modes_, oper_) "
"ON DUPLICATE KEY UPDATE host=VALUES(host), vhost=VALUES(vhost), "
"chost=VALUES(chost), realname=VALUES(realname), ip=VALUES(ip), "
"ident=VALUES(ident), vident=VALUES(vident), account=VALUES(account), "
"secure=VALUES(secure), fingerprint=VALUES(fingerprint), signon=VALUES(signon), "
"server=VALUES(server), uuid=VALUES(uuid), modes=VALUES(modes), "
"oper=VALUES(oper);"
"UPDATE `" + prefix + "user` as `u`, `" + prefix + "server` as `s`"
"SET u.servid = s.id, "
"s.currentusers = s.currentusers + 1 "
"WHERE s.name = server_ AND u.nick = nick_;"
"SELECT `currentusers` INTO cur FROM `" + prefix + "server` WHERE name=server_;"
"SELECT `maxusers` INTO max FROM `" + prefix + "maxusers` WHERE name=server_;"
"IF found_rows() AND cur <= max THEN "
"UPDATE `" + prefix + "maxusers` SET lastused=now() WHERE name=server_;"
"ELSE "
"INSERT INTO `" + prefix + "maxusers` (name, maxusers, maxtime, lastused) "
"VALUES ( server_, cur, now(), now() ) "
"ON DUPLICATE KEY UPDATE "
"name=VALUES(name), maxusers=VALUES(maxusers),"
"maxtime=VALUES(maxtime), lastused=VALUES(lastused);"
"END IF;"
+ geoquery +
"END";
this->RunQuery(query);
if (this->HasProcedure(prefix + "ServerQuit"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "ServerQuit"));
query = "CREATE PROCEDURE " + prefix + "ServerQuit(sname_ varchar(255)) "
"BEGIN "
/* 1.
* remove all users on the splitting server from the ison table
*/
"DELETE i FROM `" + prefix + "ison` AS i "
"INNER JOIN `" + prefix + "server` AS s "
"INNER JOIN `" + prefix + "user` AS u "
"WHERE i.nickid = u.nickid "
"AND u.servid = s.id "
"AND s.name = sname_;"
/* 2.
* remove all users on the splitting server from the user table
*/
"DELETE u FROM `" + prefix + "user` AS u "
"INNER JOIN `" + prefix + "server` AS s "
"WHERE s.id = u.servid "
"AND s.name = sname_;"
/* 3.
* on the splitting server, set usercount = 0, split_time = now(), online = 'N'
*/
"UPDATE `" + prefix + "server` SET currentusers = 0, split_time = now(), online = 'N' "
"WHERE name = sname_;"
"END;"; // end of the procedure
this->RunQuery(query);
if (this->HasProcedure(prefix + "UserQuit"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "UserQuit"));
query = "CREATE PROCEDURE `" + prefix + "UserQuit`"
"(nick_ varchar(255)) "
"BEGIN "
/* decrease usercount on the server where the user was on */
"UPDATE `" + prefix + "user` AS `u`, `" + prefix + "server` AS `s` "
"SET s.currentusers = s.currentusers - 1 "
"WHERE u.nick=nick_ AND u.servid = s.id; "
/* remove from all channels where the user was on */
"DELETE i FROM `" + prefix + "ison` AS i "
"INNER JOIN `" + prefix + "user` as u "
"WHERE u.nick = nick_ "
"AND i.nickid = u.nickid;"
/* remove the user from the user table */
"DELETE FROM `" + prefix + "user` WHERE nick = nick_; "
"END";
this->RunQuery(query);
if (this->HasProcedure(prefix + "ShutDown"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "ShutDown"));
query = "CREATE PROCEDURE `" + prefix + "ShutDown`()"
"BEGIN "
"UPDATE `" + prefix + "server` "
"SET currentusers=0, online='N', split_time=now();"
"TRUNCATE TABLE `" + prefix + "user`;"
"TRUNCATE TABLE `" + prefix + "chan`;"
"TRUNCATE TABLE `" + prefix + "ison`;"
"END";
this->RunQuery(query);
if (this->HasProcedure(prefix + "JoinUser"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "JoinUser"));
query = "CREATE PROCEDURE `"+ prefix + "JoinUser`"
"(nick_ varchar(255), channel_ varchar(255), modes_ varchar(255)) "
"BEGIN "
"DECLARE cur int;"
"DECLARE max int;"
"INSERT INTO `" + prefix + "ison` (nickid, chanid, modes) "
"SELECT u.nickid, c.chanid, modes_ "
"FROM " + prefix + "user AS u, " + prefix + "chan AS c "
"WHERE u.nick=nick_ AND c.channel=channel_;"
"SELECT count(i.chanid) INTO cur "
"FROM `" + prefix + "chan` AS c, " + prefix + "ison AS i "
"WHERE i.chanid = c.chanid AND c.channel=channel_;"
"SELECT `maxusers` INTO max FROM `" + prefix + "maxusers` WHERE name=channel_;"
"IF found_rows() AND cur <= max THEN "
"UPDATE `" + prefix + "maxusers` SET lastused=now() WHERE name=channel_;"
"ELSE "
"INSERT INTO `" + prefix + "maxusers` (name, maxusers, maxtime, lastused) "
"VALUES ( channel_, cur, now(), now() ) "
"ON DUPLICATE KEY UPDATE "
"name=VALUES(name), maxusers=VALUES(maxusers),"
"maxtime=VALUES(maxtime), lastused=VALUES(lastused);"
"END IF;"
"END";
this->RunQuery(query);
if (this->HasProcedure(prefix + "PartUser"))
this->RunQuery(SQL::Query("DROP PROCEDURE " + prefix + "PartUser"));
query = "CREATE PROCEDURE `" + prefix + "PartUser`"
"(nick_ varchar(255), channel_ varchar(255)) "
"BEGIN "
"DELETE i FROM `" + prefix + "ison` AS i "
"INNER JOIN `" + prefix + "user` AS u "
"INNER JOIN `" + prefix + "chan` AS c "
"WHERE i.nickid = u.nickid "
"AND u.nick = nick_ "
"AND i.chanid = c.chanid "
"AND c.channel = channel_;"
"END";
this->RunQuery(query);
}
-68
View File
@@ -1,68 +0,0 @@
/*
*
* (C) 2013-2025 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "irc2sql.h"
void IRC2SQL::RunQuery(const SQL::Query &q)
{
if (sql)
sql->Run(&sqlinterface, q);
}
void IRC2SQL::GetTables()
{
TableList.clear();
ProcedureList.clear();
EventList.clear();
if (!sql)
return;
SQL::Result r = this->sql->RunQuery(this->sql->GetTables(prefix));
for (int i = 0; i < r.Rows(); ++i)
{
const std::map<Anope::string, Anope::string> &map = r.Row(i);
for (std::map<Anope::string, Anope::string>::const_iterator it = map.begin(); it != map.end(); ++it)
TableList.push_back(it->second);
}
query = "SHOW PROCEDURE STATUS WHERE `Db` = Database();";
r = this->sql->RunQuery(query);
for (int i = 0; i < r.Rows(); ++i)
{
ProcedureList.push_back(r.Get(i, "Name"));
}
query = "SHOW EVENTS WHERE `Db` = Database();";
r = this->sql->RunQuery(query);
for (int i = 0; i < r.Rows(); ++i)
{
EventList.push_back(r.Get(i, "Name"));
}
}
bool IRC2SQL::HasTable(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = TableList.begin(); it != TableList.end(); ++it)
if (*it == table)
return true;
return false;
}
bool IRC2SQL::HasProcedure(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = ProcedureList.begin(); it != ProcedureList.end(); ++it)
if (*it == table)
return true;
return false;
}
bool IRC2SQL::HasEvent(const Anope::string &table)
{
for (std::vector<Anope::string>::const_iterator it = EventList.begin(); it != EventList.end(); ++it)
if (*it == table)
return true;
return false;
}
+1 -2
View File
@@ -107,7 +107,6 @@ public:
if (na == NULL)
{
na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
na->last_realname = ii->user ? ii->user->realname : ii->req->GetAccount();
FOREACH_MOD(OnNickRegister, (ii->user, na, ii->req->GetPassword()));
BotInfo *NickServ = Config->GetClient("NickServ");
if (ii->user && NickServ)
@@ -161,7 +160,7 @@ public:
u->Account()->email = email;
BotInfo *NickServ = Config->GetClient("NickServ");
if (NickServ)
u->SendMessage(NickServ, _("Your email has been updated to \002%s\002"), email.c_str());
u->SendMessage(NickServ, _("Your email address has been updated to \002%s\002"), email.c_str());
Log(this->owner) << "Updated email address for " << u->nick << " (" << u->Account()->display << ") to " << email;
}
}
+3 -4
View File
@@ -187,10 +187,9 @@ public:
{
if (c->ci && !c->ci->memos.memos->empty() && c->ci->AccessFor(u).HasPriv("MEMO"))
{
if (c->ci->memos.memos->size() == 1)
u->SendMessage(MemoServ, _("There is \002%zu\002 memo on channel %s."), c->ci->memos.memos->size(), c->ci->name.c_str());
else
u->SendMessage(MemoServ, _("There are \002%zu\002 memos on channel %s."), c->ci->memos.memos->size(), c->ci->name.c_str());
auto memocount = c->ci->memos.memos->size();
u->SendMessage(MemoServ, memocount, N_("There is \002%zu\002 memo on channel %s.", "There are \002%zu\002 memos on channel %s."),
memocount, c->ci->name.c_str());
}
}
+3 -6
View File
@@ -77,6 +77,8 @@ public:
{
ListFormatter list(source.GetAccount());
list.AddColumn(_("Mask"));
list.SetFlexible(_("\002{mask}\002"));
for (const auto &ignore : mi->ignores)
{
ListFormatter::ListEntry entry;
@@ -85,12 +87,7 @@ public:
}
source.Reply(_("Memo ignore list:"));
std::vector<Anope::string> replies;
list.Process(replies);
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
}
else
+2 -6
View File
@@ -61,8 +61,8 @@ public:
else
{
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Sender")).AddColumn(_("Date/Time"));
list.SetFlexible(_("{number}: sent by \002{sender}\002 at {date/time}"));
if (!param.empty() && isdigit(param[0]))
{
@@ -127,12 +127,8 @@ public:
}
}
std::vector<Anope::string> replies;
list.Process(replies);
source.Reply(_("Memos for %s:"), ci ? ci->name.c_str() : source.GetNick().c_str());
for (const auto &reply : replies)
source.Reply(reply);
list.SendTo(source);
}
return;
}
+1 -1
View File
@@ -32,7 +32,7 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Ano
/* Text of the memo varies if the recipient was a
nick or channel */
Anope::string text = Anope::printf(Language::Translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str());
Anope::string text = Anope::Format(Language::Translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str());
/* Send notification */
MemoServService->Send(source.GetNick(), m->sender, text, true);

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