mirror of
https://github.com/anope/anope.git
synced 2026-06-12 17:04:47 +02:00
Compare commits
48 Commits
2.1.24
...
a861a059f6
| Author | SHA1 | Date | |
|---|---|---|---|
| a861a059f6 | |||
| 90da25f84f | |||
| ab362c9828 | |||
| d1f6da1817 | |||
| 9280d90aba | |||
| c71f69208d | |||
| d0080b85a7 | |||
| 745e94783d | |||
| c32be6a711 | |||
| 9dd3acfc87 | |||
| 82b6da3763 | |||
| 8e691eac80 | |||
| 2327c6ac9a | |||
| e23ea8f8ea | |||
| 449cfa6503 | |||
| 59c60849b6 | |||
| 6d2c4fb612 | |||
| 01fc7421b6 | |||
| 3a59a81aa4 | |||
| c24de0ca8f | |||
| 18555638c9 | |||
| d5a653fe94 | |||
| ad3be96283 | |||
| d689c0686d | |||
| 4ca2952069 | |||
| caf904c938 | |||
| 8930cc2a92 | |||
| 47b927d788 | |||
| 647a07ff96 | |||
| a856e80b1e | |||
| 55746e1098 | |||
| e0da3bae18 | |||
| c1cf7b0bcc | |||
| 1cf64a49c0 | |||
| 92ed0071d7 | |||
| 9469cb8b0e | |||
| e0b715b185 | |||
| e6d7306202 | |||
| 2107d18d9e | |||
| acb9428635 | |||
| d942da1df5 | |||
| a961259556 | |||
| 27a19dcc52 | |||
| e45814bfd6 | |||
| f12b590a6d | |||
| c0bafe10b4 | |||
| 5f40d0d6bb | |||
| 6b416cc64d |
@@ -35,5 +35,6 @@ I have ensured that:
|
||||
|
||||
- [ ] The code I am submitting is my own work and/or I have permission from the author to share it.
|
||||
- [ ] Generative AI (Copilot, ChatGPT, etc) was not used to create any part of this pull request.
|
||||
- [ ] I have documented any features added by this pull request.
|
||||
- [ ] If the pull request contains a security fix I have followed the reporting rules mentioned in [the security policy](https://github.com/anope/anope/security/policy) (delete if not applicable).
|
||||
- [ ] I have documented any features added by this pull request (delete if not applicable).
|
||||
- [ ] This pull request does not introduce any incompatible API changes (stable branches only, delete if not applicable).
|
||||
|
||||
@@ -3,21 +3,18 @@ on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
- cron: 0 0 * * 0
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip alpine ci]')"
|
||||
container: alpine:edge
|
||||
container: alpine:latest
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
CXXFLAGS: -Werror
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
run: |-
|
||||
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
|
||||
apk update
|
||||
apk add \
|
||||
@@ -37,24 +34,36 @@ jobs:
|
||||
tre-dev
|
||||
|
||||
- name: Enable extras
|
||||
run: |
|
||||
run: |-
|
||||
for MODULE in enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre sqlite ssl_gnutls ssl_openssl
|
||||
do
|
||||
ln -s $PWD/modules/extra/$MODULE.cpp $PWD/modules
|
||||
done
|
||||
|
||||
- name: Run CMake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=$(readlink -f ../run) ..
|
||||
env:
|
||||
CC: ${{ matrix.compiler.cc }}
|
||||
CXX: ${{ matrix.compiler.cxx }}
|
||||
CXXFLAGS: -Werror
|
||||
run: |-
|
||||
cmake -B "build" \
|
||||
-D "CMAKE_BUILD_TYPE=Debug" \
|
||||
-D "INSTDIR=$(readlink -f ../run)" \
|
||||
-G "Ninja" \
|
||||
-Wdeprecated \
|
||||
-Wdev
|
||||
|
||||
- name: Build Anope
|
||||
run: |
|
||||
ninja -C build install
|
||||
- name: Build and install
|
||||
env:
|
||||
VERBOSE: ${{ runner.debug }}
|
||||
run: |-
|
||||
ninja -C "build" ${{ runner.debug == '1' && '-v' || '' }} install
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler:
|
||||
- clang++
|
||||
- g++
|
||||
- cc: clang
|
||||
cxx: clang++
|
||||
- cc: gcc
|
||||
cxx: g++
|
||||
|
||||
@@ -3,20 +3,17 @@ on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
- cron: 0 0 * * 0
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip ubuntu ci]')"
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
CXXFLAGS: -Werror
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
run: |-
|
||||
sudo apt-get update --assume-yes
|
||||
sudo apt-get install --assume-yes --no-install-recommends \
|
||||
clang \
|
||||
@@ -34,24 +31,36 @@ jobs:
|
||||
ninja-build
|
||||
|
||||
- name: Enable extras
|
||||
run: |
|
||||
run: |-
|
||||
for MODULE in enc_argon2 enc_posix ldap mysql regex_pcre2 regex_posix regex_tre sqlite ssl_gnutls ssl_openssl
|
||||
do
|
||||
ln -s ${{ github.workspace }}/modules/extra/$MODULE.cpp ${{ github.workspace }}/modules
|
||||
done
|
||||
|
||||
- name: Run CMake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=DEBUG -DINSTDIR:STRING=${{ github.workspace }}/run ..
|
||||
env:
|
||||
CC: ${{ matrix.compiler.cc }}
|
||||
CXX: ${{ matrix.compiler.cxx }}
|
||||
CXXFLAGS: -Werror
|
||||
run: |-
|
||||
cmake -B "build" \
|
||||
-D "CMAKE_BUILD_TYPE=Debug" \
|
||||
-D "INSTDIR=${{ github.workspace }}/run" \
|
||||
-G "Ninja" \
|
||||
-Wdeprecated \
|
||||
-Wdev
|
||||
|
||||
- name: Build Anope
|
||||
run: |
|
||||
ninja -C ${{ github.workspace }}/build install
|
||||
- name: Build and install
|
||||
env:
|
||||
VERBOSE: ${{ runner.debug }}
|
||||
run: |-
|
||||
ninja -C "build" ${{ runner.debug == '1' && '-v' || '' }} install
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler:
|
||||
- clang++
|
||||
- g++
|
||||
- cc: clang
|
||||
cxx: clang++
|
||||
- cc: gcc
|
||||
cxx: g++
|
||||
|
||||
@@ -6,77 +6,90 @@ on:
|
||||
types:
|
||||
- published
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
- cron: 0 0 * * 0
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
if: "!contains(github.event.head_commit.message, '[skip windows ci]')"
|
||||
runs-on: windows-2025
|
||||
env:
|
||||
BUILD_PATH: ${{ github.workspace }}\build
|
||||
BUILD_TYPE: ${{ github.event_name == 'release' && 'Release' || 'Debug' }}
|
||||
CONAN_FILE: ${{ github.workspace }}\src\win32\conanfile.txt
|
||||
CONAN_HOME: ${{ github.workspace }}\build\conan
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install NSIS
|
||||
uses: negrutiu/nsis-install@v2
|
||||
- name: Setup MSVC
|
||||
uses: TheMrMilchmann/setup-msvc-dev@v4
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Setup NSIS
|
||||
uses: negrutiu/nsis-install@v3
|
||||
with:
|
||||
distro: official
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v3
|
||||
|
||||
- name: Setup Conan
|
||||
uses: turtlebrowser/get-conan@v1.2
|
||||
|
||||
- name: Create Conan profile
|
||||
- name: Create Conan configuration
|
||||
run: |-
|
||||
conan profile detect
|
||||
(Get-Content ${{ env.CONAN_HOME }}\profiles\default).replace('build_type=Release', 'build_type=${{ env.BUILD_TYPE }}') | Set-Content ${{ env.CONAN_HOME }}\profiles\default
|
||||
(Get-Content ${{ env.CONAN_HOME }}\profiles\default).replace('compiler.cppstd=14', 'compiler.cppstd=17') | Set-Content ${{ env.CONAN_HOME }}\profiles\default
|
||||
|
||||
Write-Output 'core.sources:download_urls=["origin", "https://c3i.jfrog.io/artifactory/conan-center-backup-sources/"]' | Out-File -Append ${{ env.CONAN_HOME }}\global.conf
|
||||
Write-Output 'tools.cmake.cmaketoolchain:generator=Ninja' | Out-File -Append ${{ env.CONAN_HOME }}\global.conf
|
||||
Write-Output 'user.openssl:windows_use_jom=True' | Out-File -Append ${{ env.CONAN_HOME }}\global.conf
|
||||
|
||||
- name: Try to restore libraries from the cache
|
||||
if: github.event_name != 'release'
|
||||
uses: actions/cache/restore@v5
|
||||
id: library-cache
|
||||
with:
|
||||
key: conan-${{ env.BUILD_TYPE }}-${{ hashFiles('src\win32\conanfile.txt') }}
|
||||
path: ${{ env.CONAN_HOME }}\p
|
||||
key: Conan VS${{ env.VisualStudioVersion }} ${{ env.BUILD_TYPE }} ${{ hashFiles(env.CONAN_FILE) }}
|
||||
path: ${{ env.CONAN_HOME }}/p
|
||||
|
||||
- name: Install libraries
|
||||
run: |
|
||||
(Get-Content ${{ github.workspace }}\src\win32\conanfile.txt).replace('##', '') | Set-Content ${{ github.workspace }}\src\win32\conanfile.txt
|
||||
conan install ${{ github.workspace }}\src\win32 --build missing --deployer runtime_deploy --deployer-folder ${{ github.workspace }}\build\extradll --output-folder .
|
||||
working-directory: ${{ env.BUILD_PATH }}
|
||||
run: |-
|
||||
(Get-Content ${{ env.CONAN_FILE }}).replace('##', '') | Set-Content ${{ env.CONAN_FILE }}
|
||||
conan install ${{ env.CONAN_FILE }} --build missing --deployer runtime_deploy --deployer-folder extradll --output-folder .
|
||||
conan cache clean "*"
|
||||
|
||||
- name: Save libraries to the cache
|
||||
if: ${{ steps.library-cache.outputs.cache-hit != 'true' }}
|
||||
if: steps.library-cache.outputs.cache-hit != 'true' && github.event_name != 'release'
|
||||
uses: actions/cache/save@v5
|
||||
with:
|
||||
key: ${{ steps.library-cache.outputs.cache-primary-key }}
|
||||
path: ${{ env.CONAN_HOME }}\p
|
||||
|
||||
- name: Run CMake
|
||||
shell: cmd # work around a conan-io/conan-center-index bug #21823
|
||||
working-directory: ${{ github.workspace }}\build
|
||||
run: |
|
||||
call ${{ github.workspace }}\conanbuild.bat
|
||||
cmake -A x64 -D "CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}" -D CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -G "Visual Studio 17 2022" ..
|
||||
working-directory: ${{ env.BUILD_PATH }}
|
||||
run: |-
|
||||
cmake -D "CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}" `
|
||||
-D "CMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake" `
|
||||
-G "Ninja Multi-Config" `
|
||||
-S "${{ github.workspace }}" `
|
||||
-Wdeprecated `
|
||||
-Wdev
|
||||
|
||||
- name: Build Anope
|
||||
working-directory: ${{ github.workspace }}\build
|
||||
run: |
|
||||
msbuild PACKAGE.vcxproj /M:5 /P:Configuration=${{ env.BUILD_TYPE }} /P:Platform=x64 /VERBOSITY:MINIMAL
|
||||
- name: Build installer
|
||||
working-directory: ${{ env.BUILD_PATH }}
|
||||
run: |-
|
||||
ninja -f "build-${{ env.BUILD_TYPE }}.ninja" ${{ runner.debug == '1' && '-v' || '' }} package
|
||||
|
||||
- name: Upload installer
|
||||
if: "${{ github.event_name == 'release' }}"
|
||||
working-directory: ${{ github.workspace }}\build
|
||||
if: github.event_name == 'release'
|
||||
working-directory: ${{ env.BUILD_PATH }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gh release upload ${{ github.event.release.tag_name }} $(Get-ChildItem anope-*.exe)
|
||||
|
||||
- name: Upload artifact
|
||||
if: "${{ github.event_name != 'release' }}"
|
||||
if: github.event_name != 'release'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: windows-installer
|
||||
|
||||
@@ -51,7 +51,8 @@ Robby <robby@chatbelgie.be> <robby@chat.be>
|
||||
Robert Scheck <robert@fedoraproject.org> <robert-scheck@users.noreply.github.com>
|
||||
Robin Burchell <w00t@inspircd.org> <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>
|
||||
Robin Burchell <w00t@inspircd.org> <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864>
|
||||
Sadie Powell <sadie@witchery.services> <petpow@saberuk.com>
|
||||
Sadie Powell <sadie@sadiepowell.dev> <petpow@saberuk.com>
|
||||
Sadie Powell <sadie@sadiepowell.dev> <sadie@witchery.services>
|
||||
Sebastian Barfurth <github@afreshmelon.com>
|
||||
Sebastian V. <hal9000@denorastats.org>
|
||||
Sebastian V. <hal9000@denorastats.org> <pimpmylinux@5417fbe8-f217-4b02-8779-1006273d7864>
|
||||
|
||||
+2
-2
@@ -43,12 +43,12 @@ endif()
|
||||
# Find gettext
|
||||
find_package(Gettext)
|
||||
find_package(Intl)
|
||||
if(GETTEXT_FOUND AND Intl_FOUND)
|
||||
if(Gettext_FOUND AND Intl_FOUND)
|
||||
set(HAVE_LOCALIZATION ON)
|
||||
include_directories(${Intl_INCLUDE_DIRS})
|
||||
link_libraries(${Intl_LIBRARIES})
|
||||
else()
|
||||
message("Unable to find gettext and libintl; disabling localization")
|
||||
message(STATUS "Unable to find gettext and/or libintl -- read docs/LANGUAGE for how to enable localization")
|
||||
set(HAVE_LOCALIZATION OFF)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ Run_Build_System () {
|
||||
CMAKE_COMMAND="${CMAKE_COMMAND} -D EXTRA_LIBS=$EXTRA_LIB_DIRS"
|
||||
fi
|
||||
|
||||
if [ "$EXTRA_CONFIG_ARGS" != "" ] ; then
|
||||
CMAKE_COMMAND="${CMAKE_COMMAND} $EXTRA_CONFIG_ARGS"
|
||||
fi
|
||||
|
||||
echo $CMAKE_COMMAND
|
||||
$CMAKE_COMMAND
|
||||
|
||||
|
||||
@@ -1296,7 +1296,7 @@ module
|
||||
/** The memory hardness in kibibytes of the Argon2 algorithm. Defaults to
|
||||
* 128 mebibytes.
|
||||
*/
|
||||
#memory_cost = 121072
|
||||
#memory_cost = 131072
|
||||
|
||||
/** The time hardness (iterations) of the Argon2 algorithm. Defaults to 3.
|
||||
*/
|
||||
|
||||
@@ -252,6 +252,7 @@ privilege
|
||||
rank = 10
|
||||
level = 3
|
||||
flag = "f"
|
||||
flag_migration_requires = "ACCESS_CHANGE"
|
||||
xop = "VOP"
|
||||
}
|
||||
|
||||
@@ -496,6 +497,7 @@ privilege
|
||||
rank = 110
|
||||
level = 4
|
||||
flag = "h"
|
||||
flag_migration_requires = "HALFOP"
|
||||
xop = "HOP"
|
||||
}
|
||||
|
||||
@@ -638,6 +640,7 @@ privilege
|
||||
rank = 220
|
||||
level = 5
|
||||
flag = "o"
|
||||
flag_migration_requires = "OP"
|
||||
xop = "AOP"
|
||||
}
|
||||
|
||||
@@ -710,6 +713,7 @@ privilege
|
||||
rank = 300
|
||||
level = 10
|
||||
flag = "a"
|
||||
flag_migration_requires = "PROTECT"
|
||||
xop = "SOP"
|
||||
}
|
||||
|
||||
@@ -853,6 +857,7 @@ privilege
|
||||
rank = 60
|
||||
level = 3
|
||||
flag = "v"
|
||||
flag_migration_requires = "VOICE"
|
||||
xop = "VOP"
|
||||
}
|
||||
|
||||
|
||||
@@ -128,9 +128,9 @@ module
|
||||
|
||||
/*
|
||||
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
|
||||
* directive is optional, but recommended. If not set, this restriction will be disabled.
|
||||
* directive is optional, but recommended. If not set, it defaults to 15 minutes.
|
||||
*/
|
||||
regdelay = 5m
|
||||
regdelay = 15m
|
||||
|
||||
/*
|
||||
* The length of time before a nick's registration expires.
|
||||
@@ -416,6 +416,12 @@ module
|
||||
{
|
||||
name = "ns_group"
|
||||
|
||||
/*
|
||||
* The minimum length of time between consecutive uses of the GROUP command. This directive is
|
||||
* optional, but recommended. If not set, it defaults to 5 minutes.
|
||||
*/
|
||||
delay = 5m
|
||||
|
||||
/*
|
||||
* The maximum number of nicks allowed in a group.
|
||||
*
|
||||
@@ -741,6 +747,9 @@ command { service = "NickServ"; name = "SASET LAYOUT"; command = "nickserv/saset
|
||||
*
|
||||
* misc_description: A description of the command to show in the help.
|
||||
* misc_title: A human-readable description of the stored data.
|
||||
* misc_priority: Positive integer representing display order in nickserv/info
|
||||
* and (if enabled) WHOIS output. Entries with unspecified
|
||||
* priority will be prioritized in the order of declaration.
|
||||
* misc_pattern: If defined then a regex pattern (using the engine specified
|
||||
* in <options:regexengine> to validate the data with).
|
||||
* misc_syntax: If defined then the syntax to show in the help output and, if
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ and other useful contributions to Anope. These people, ordered by the number of
|
||||
contributions they have made, are:
|
||||
|
||||
* Adam <adam@anope.org>
|
||||
* Sadie Powell <sadie@witchery.services>
|
||||
* Sadie Powell <sadie@sadiepowell.dev>
|
||||
* Robin Burchell <w00t@inspircd.org>
|
||||
* Naram Qashat <cyberbotx@anope.org>
|
||||
* Pieter Bootsma <geniusdex@anope.org>
|
||||
@@ -20,8 +20,8 @@ contributions they have made, are:
|
||||
* Adam Kramer <ribosome@anope.org>
|
||||
* Attila Molnar <attilamolnar@hush.com>
|
||||
* Michael Wobst <wobst.michael@web.de>
|
||||
* Matt Schatz <genius3000@g3k.solutions>
|
||||
* PeGaSuS <droider.pc@gmail.com>
|
||||
* Matt Schatz <genius3000@g3k.solutions>
|
||||
* Mark Summers <mark@goopler.net>
|
||||
* Daniel Vassdal <shutter@canternet.org>
|
||||
* MatthewM <mcm@they-got.us>
|
||||
@@ -49,6 +49,7 @@ contributions they have made, are:
|
||||
* Robert Scheck <robert@fedoraproject.org>
|
||||
* Dennis Friis <peavey@inspircd.org>
|
||||
* Filippo Cortigiani <simos@simosnap.org>
|
||||
* KidProtect
|
||||
* Michał Zegan <webczat_200@poczta.onet.pl>
|
||||
* AlphaTech <alphat3ch@icloud.com>
|
||||
* Austin Ellis <siniStar@IRC4Fun.net>
|
||||
@@ -71,7 +72,6 @@ contributions they have made, are:
|
||||
* Jason Foster <retsofaj@gmail.com>
|
||||
* Jeremy <jeremy@ssnet.ca>
|
||||
* Josh Soref
|
||||
* KidProtect
|
||||
* KindOne <ineedalifetoday@live.com>
|
||||
* linuxdaemon
|
||||
* Mantas Mikulėnas <grawity@gmail.com>
|
||||
|
||||
+17
-1
@@ -1,6 +1,22 @@
|
||||
# Anope Change Log
|
||||
|
||||
## Anope 2.1.24 (unreleased)
|
||||
## Anope 2.1.25 (unreleased)
|
||||
|
||||
### Changes
|
||||
|
||||
* Fixed a crash when a temporary ban expires.
|
||||
|
||||
* Fixed a potential crash caused by unusual timestamps being passed to `Anope::strftime`.
|
||||
|
||||
* Fixed confirming accounts when `{ns_register}:registration` is set to "admin".
|
||||
|
||||
* Fixed migrating access entries from xop to flags granting new privileges in cases where multiple privileges share the same flag.
|
||||
|
||||
* Fixed migrating access entries sometimes giving the wrong flags.
|
||||
|
||||
* Fixed not being able to update the description of a flags access entry.
|
||||
|
||||
## Anope 2.1.24 (2026-04-01)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ Anope Multi Language Support
|
||||
but 0x1B is special to Anope and is used to prevent the automatic linewrapper from breaking messages in the middle of
|
||||
text that should not be split (e.g. commands). Your editor may not show these so be careful you don't delete them!
|
||||
|
||||
If you have finished a language file translation and you want others to use it, please file a pull request on GitHub
|
||||
or send it to team@anope.org (don't forget to mention clearly your (nick)name, your email and the language name).
|
||||
If you have finished a language file translation and you want others to use it, please file a pull request on GitHub.
|
||||
You'll of course get full credit for it.
|
||||
|
||||
3) Using languages with modules
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
*/
|
||||
virtual ChanAccess *Create() = 0;
|
||||
|
||||
virtual void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) = 0;
|
||||
static void SendAccess(CommandSource &source, const Anope::string &pname);
|
||||
|
||||
private:
|
||||
static std::list<AccessProvider *> Providers;
|
||||
public:
|
||||
|
||||
+13
-10
@@ -18,6 +18,7 @@
|
||||
#include "regchannel.h"
|
||||
#include "users.h"
|
||||
#include "opertype.h"
|
||||
#include "miscutils.h"
|
||||
|
||||
namespace Configuration
|
||||
{
|
||||
@@ -26,14 +27,15 @@ namespace Configuration
|
||||
friend class Configuration::Conf;
|
||||
|
||||
public:
|
||||
typedef Anope::map<Anope::string> item_map;
|
||||
typedef Anope::multimap<Block> block_map;
|
||||
typedef Anope::map<Anope::string> ItemMap;
|
||||
typedef Anope::multimap<Block> BlockMap;
|
||||
typedef Anope::iterator_range<BlockMap::const_iterator> BlockList;
|
||||
|
||||
private:
|
||||
Anope::string name;
|
||||
item_map items;
|
||||
block_map blocks;
|
||||
int linenum;
|
||||
ItemMap items;
|
||||
BlockMap blocks;
|
||||
unsigned linenum;
|
||||
|
||||
/* Represents a missing tag. */
|
||||
static Block EmptyBlock;
|
||||
@@ -41,9 +43,10 @@ namespace Configuration
|
||||
public:
|
||||
Block(const Anope::string &);
|
||||
const Anope::string &GetName() const;
|
||||
int CountBlock(const Anope::string &name) const;
|
||||
const Block &GetBlock(const Anope::string &name, int num = 0) const;
|
||||
Block *GetMutableBlock(const Anope::string &name, int num = 0);
|
||||
size_t CountBlock(const Anope::string &name) const;
|
||||
BlockList GetBlocks(const Anope::string &name) const;
|
||||
const Block &GetBlock(const Anope::string &name, size_t num = 0) const;
|
||||
Block *GetMutableBlock(const Anope::string &name, size_t num = 0);
|
||||
|
||||
template<typename T> T Get(const Anope::string &tag, const Anope::string &def = "") const
|
||||
{
|
||||
@@ -51,7 +54,7 @@ namespace Configuration
|
||||
}
|
||||
|
||||
bool Set(const Anope::string &tag, const Anope::string &value);
|
||||
const item_map &GetItems() const;
|
||||
const ItemMap &GetItems() const;
|
||||
};
|
||||
|
||||
template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string &def) const;
|
||||
@@ -85,7 +88,7 @@ namespace Configuration
|
||||
{
|
||||
private:
|
||||
/** Replaces defined variables within a string. */
|
||||
Anope::string ReplaceVars(const Anope::string &str, const File &file, int linenumber);
|
||||
Anope::string ReplaceVars(const Anope::string &str, const File &file, unsigned linenumber);
|
||||
|
||||
public:
|
||||
/* options:readtimeout */
|
||||
|
||||
@@ -142,10 +142,6 @@ namespace Language
|
||||
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
|
||||
#define CHAN_ACCESS_MALFORMED _("You cannot add a malformed mask to an access list. Did you mean to add %s instead?")
|
||||
#define CHAN_ACCESS_FOREIGN N_("%u access entry from other access systems not shown; use \002%s\033ALL\002 to view all access entries.", "%u access entries from other access systems not shown; use \002%s\033ALL\002 to view all access entries.")
|
||||
#define CHAN_ACCESS_MIGRATED_1 _("\002%s\002 has been migrated to the %s access system.")
|
||||
#define CHAN_ACCESS_MIGRATED_N N_("\002%u\002 entry has been migrated to the %s access system.", "\002%u\002 entries have been migrated to the %s access system.")
|
||||
#define CHAN_ACCESS_NOT_MIGRATED_1 _("\002%s\002 can not be migrated to the %s access system because they have privileges that you do not.")
|
||||
#define CHAN_ACCESS_NOT_MIGRATED_N N_("\002%u\002 entry can not be migrated to the %s access system because they have privileges that you do not.", "\002%u\002 entries can not be migrated to the %s access system because they have privileges that you do not.")
|
||||
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
|
||||
#define CHAN_INFO_HEADER _("Information about channel \002%s\002:")
|
||||
#define CHAN_LIMIT_EXCEEDED _("You have already exceeded your limit of \002%d\002 channels.")
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// Anope IRC Services <https://www.anope.org/>
|
||||
//
|
||||
// Copyright (C) 2003-2026 Anope Contributors
|
||||
//
|
||||
// Anope is free software. You can use, modify, and/or distribute it under the
|
||||
// terms of version 2 of the GNU General Public License. See docs/LICENSE.txt
|
||||
// for the complete terms of this license and docs/AUTHORS.txt for a list of
|
||||
// contributors.
|
||||
//
|
||||
// Based on the original code of Epona by Lara
|
||||
// Based on the original code of Services by Andy Church
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
namespace Anope
|
||||
{
|
||||
template <typename Iterator>
|
||||
class iterator_range;
|
||||
|
||||
/** Returns a range containing all elements equivalent to \p value.
|
||||
* @param collection The collection to search within.
|
||||
* @param value The value to search for.
|
||||
*/
|
||||
template <typename Collection, typename Value>
|
||||
auto equal_range(const Collection& collection, const Value& value)
|
||||
{
|
||||
return iterator_range(collection.equal_range(value));
|
||||
}
|
||||
|
||||
/** Returns a range representing a reverse iterator for the specified colleciton.
|
||||
* @param collection The collection to create a reverse iterator for.
|
||||
*/
|
||||
template <typename Collection>
|
||||
auto reverse_range(const Collection& collection)
|
||||
{
|
||||
return iterator_range(collection.rbegin(), collection.rend());
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents a range of iterators. */
|
||||
template <typename Iterator>
|
||||
class Anope::iterator_range final
|
||||
{
|
||||
private:
|
||||
/** An iterator which points to the start of the range. */
|
||||
const Iterator begini;
|
||||
|
||||
/* An iterator which points to one past the end of the range. */
|
||||
const Iterator endi;
|
||||
|
||||
public:
|
||||
/** Initialises a new iterator range with the specified iterators.
|
||||
* @param begin An iterator which points to the start of the range.
|
||||
* @param end An iterator which points to one past the end of the range.
|
||||
*/
|
||||
explicit iterator_range(Iterator begin, Iterator end)
|
||||
: begini(begin)
|
||||
, endi(end)
|
||||
{
|
||||
}
|
||||
|
||||
/** Initialises a new iterator range from a pair of iterators.
|
||||
* @param range A pair of iterators in the format [first, last).
|
||||
*/
|
||||
explicit iterator_range(std::pair<Iterator, Iterator> range)
|
||||
: begini(range.first)
|
||||
, endi(range.second)
|
||||
{
|
||||
}
|
||||
|
||||
/** Determines whether the iterator range is empty. */
|
||||
bool empty() const { return begini == endi; }
|
||||
|
||||
/** Retrieves an iterator which points to the start of the range. */
|
||||
const Iterator& begin() const { return begini; }
|
||||
|
||||
/** Retrieves an iterator which points to one past the end of the range. */
|
||||
const Iterator& end() const { return endi; }
|
||||
|
||||
/** Retrieves the number of hops within the iterator range. */
|
||||
typename std::iterator_traits<Iterator>::difference_type count() const { return std::distance(begini, endi); }
|
||||
};
|
||||
@@ -194,12 +194,13 @@ namespace DNS
|
||||
/** Used to time out the query, xalls OnError and lets the TimerManager
|
||||
* delete this request.
|
||||
*/
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name;
|
||||
Query rr(*this);
|
||||
rr.error = ERROR_TIMEDOUT;
|
||||
this->OnError(&rr);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -173,4 +173,14 @@ public:
|
||||
* @param attributes The attributes to modify
|
||||
*/
|
||||
virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0;
|
||||
|
||||
/** Escapes a LDAP string for use in a DN.
|
||||
* @param str The string to escape.
|
||||
*/
|
||||
virtual Anope::string EscapeDN(const Anope::string &str) const = 0;
|
||||
|
||||
/** Escapes a LDAP string for use in a search filter.
|
||||
* @param str The string to escape.
|
||||
*/
|
||||
virtual Anope::string EscapeSF(const Anope::string &str) const = 0;
|
||||
};
|
||||
|
||||
+1
-1
@@ -279,7 +279,7 @@ public:
|
||||
virtual void SendSVSHold(const Anope::string &, time_t) { }
|
||||
virtual void SendSVSHoldDel(const Anope::string &) { }
|
||||
|
||||
virtual void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, const Anope::string &message) { };
|
||||
virtual void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, time_t priority, const Anope::string &message) { };
|
||||
virtual void SendSWhoisDel(const MessageSource &source, User *target, const Anope::string &tag, const Anope::string &message) { }
|
||||
|
||||
/** Introduces a server to the uplink
|
||||
|
||||
+3
-14
@@ -31,23 +31,17 @@ private:
|
||||
*/
|
||||
time_t secs;
|
||||
|
||||
/** True if this is a repeating timer
|
||||
*/
|
||||
bool repeat;
|
||||
|
||||
public:
|
||||
/** Constructor, initializes the triggering time
|
||||
* @param time_from_now The number of seconds from now to trigger the timer
|
||||
* @param repeating Repeat this timer every time_from_now if this is true
|
||||
*/
|
||||
Timer(time_t time_from_now, bool repeating = false);
|
||||
Timer(time_t time_from_now);
|
||||
|
||||
/** Constructor, initializes the triggering time
|
||||
* @param creator The creator of the timer
|
||||
* @param time_from_now The number of seconds from now to trigger the timer
|
||||
* @param repeating Repeat this timer every time_from_now if this is true
|
||||
*/
|
||||
Timer(Module *creator, time_t time_from_now, bool repeating = false);
|
||||
Timer(Module *creator, time_t time_from_now);
|
||||
|
||||
/** Destructor, removes the timer from the list
|
||||
*/
|
||||
@@ -63,11 +57,6 @@ public:
|
||||
*/
|
||||
time_t GetTimer() const;
|
||||
|
||||
/** Returns true if the timer is set to repeat
|
||||
* @return Returns true if the timer is set to repeat
|
||||
*/
|
||||
bool GetRepeat() const;
|
||||
|
||||
/** Set the interval between ticks
|
||||
* @paramt t The new interval
|
||||
*/
|
||||
@@ -86,7 +75,7 @@ public:
|
||||
/** Called when the timer ticks
|
||||
* This should be overridden with something useful
|
||||
*/
|
||||
virtual void Tick() = 0;
|
||||
virtual bool Tick() = 0;
|
||||
};
|
||||
|
||||
/** This class manages sets of Timers, and triggers them at their defined times.
|
||||
|
||||
+42
-24
@@ -16,13 +16,13 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Anope\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2026-04-26 18:25+0100\n"
|
||||
"PO-Revision-Date: 2026-04-26 18:25+0100\n"
|
||||
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
|
||||
"POT-Creation-Date: 2026-05-21 11:52+0100\n"
|
||||
"PO-Revision-Date: 2026-05-21 11:52+0100\n"
|
||||
"Last-Translator: Sadie Powell <sadie@sadiepowell.dev>\n"
|
||||
"Language-Team: English\n"
|
||||
"Language: en_US\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 3.4.2\n"
|
||||
@@ -129,7 +129,12 @@ msgstr ""
|
||||
msgid "%s already exists on the EXCEPTION list."
|
||||
msgstr ""
|
||||
|
||||
#: ../include/language.h
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%s can not be migrated to the %s access system because they have no migratable privileges."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%s can not be migrated to the %s access system because they have privileges that you do not."
|
||||
msgstr ""
|
||||
@@ -215,7 +220,7 @@ msgstr ""
|
||||
msgid "%s has been joined to %s."
|
||||
msgstr ""
|
||||
|
||||
#: ../include/language.h
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%s has been migrated to the %s access system."
|
||||
msgstr ""
|
||||
@@ -428,14 +433,21 @@ msgstr ""
|
||||
msgid "%s will now permanently be ignored."
|
||||
msgstr ""
|
||||
|
||||
#: ../include/language.h
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%u entry can not be migrated to the %s access system because they have no migratable privileges."
|
||||
msgid_plural "%u entries can not be migrated to the %s access system because they have no migratable privileges."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%u entry can not be migrated to the %s access system because they have privileges that you do not."
|
||||
msgid_plural "%u entries can not be migrated to the %s access system because they have privileges that you do not."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: ../include/language.h
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
#, c-format
|
||||
msgid "%u entry has been migrated to the %s access system."
|
||||
msgid_plural "%u entries have been migrated to the %s access system."
|
||||
@@ -2475,10 +2487,7 @@ msgid "Bans a given nick or mask on a channel"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_ban.cpp
|
||||
msgid ""
|
||||
"Bans a given nick or mask on a channel. An optional expiry may be given to cause services to remove the ban after a set amount of time.\n"
|
||||
"\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above on the channel. Channel founders may ban masks."
|
||||
msgid "Bans a given nick or mask on a channel. An optional expiry may be given to cause services to remove the ban after a set amount of time. Channel founders may ban masks."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_enforce.cpp
|
||||
@@ -2671,6 +2680,11 @@ msgstr ""
|
||||
msgid "Bot won't kick for repeats anymore."
|
||||
msgstr ""
|
||||
|
||||
#: ../src/access.cpp
|
||||
#, c-format
|
||||
msgid "By default, the %s command is limited to:"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/operserv/os_info.cpp
|
||||
msgid "CLEAR target"
|
||||
msgstr ""
|
||||
@@ -4000,6 +4014,10 @@ msgstr ""
|
||||
msgid "Fixed layout"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
msgid "Flag"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_flags.cpp
|
||||
msgid "Flags"
|
||||
msgstr ""
|
||||
@@ -4307,10 +4325,7 @@ msgid "Kicks a specified nick from a channel"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_kick.cpp
|
||||
msgid ""
|
||||
"Kicks a specified nick from a channel.\n"
|
||||
"\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above on the channel. Channel founders can also specify masks."
|
||||
msgid "Kicks a specified nick from a channel. Channel founders can also specify masks."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/operserv/os_kill.cpp
|
||||
@@ -6896,18 +6911,12 @@ msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_invite.cpp
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Tells %s to invite you or an optionally specified nick into the given channel.\n"
|
||||
"\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above on the channel."
|
||||
msgid "Tells %s to invite you or an optionally specified nick into the given channel."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_unban.cpp
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Tells %s to remove all bans preventing you or the given user from entering the given channel. If no channel is given, all bans affecting you in channels you have access in are removed.\n"
|
||||
"\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above on the channel."
|
||||
msgid "Tells %s to remove all bans preventing you or the given user from entering the given channel. If no channel is given, all bans affecting you in channels you have access in are removed."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/operserv/os_jupe.cpp
|
||||
@@ -7234,6 +7243,11 @@ msgstr ""
|
||||
msgid "The registration confirmation code you specified for %s is incorrect."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/nickserv/ns_register.cpp
|
||||
#, c-format
|
||||
msgid "The registration of %s can only be confirmed by an administrator."
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/nickserv/ns_info.cpp
|
||||
#, c-format
|
||||
msgid "The services access status of %s will now be hidden from %s INFO displays."
|
||||
@@ -7990,6 +8004,10 @@ msgstr ""
|
||||
msgid "Word"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/chanserv/cs_xop.cpp
|
||||
msgid "XOP"
|
||||
msgstr ""
|
||||
|
||||
#: ../modules/nickserv/ns_group.cpp
|
||||
#, c-format
|
||||
msgid "You are already a member of the account of %s."
|
||||
|
||||
+2001
-13
File diff suppressed because it is too large
Load Diff
+2000
-12
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,6 @@ find ../ \
|
||||
-print0 | sort -z | xargs -0 -I {} \
|
||||
xgettext \
|
||||
--language=C++ \
|
||||
--sort-output \
|
||||
--default-domain=Anope \
|
||||
--join-existing \
|
||||
--output=anope.pot \
|
||||
|
||||
@@ -1030,11 +1030,11 @@ class BanDataPurger final
|
||||
{
|
||||
public:
|
||||
BanDataPurger(Module *o)
|
||||
: Timer(o, 300, true)
|
||||
: Timer(o, 300)
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
Log(LOG_DEBUG) << "bs_main: Running bandata purger";
|
||||
|
||||
@@ -1048,6 +1048,7 @@ public:
|
||||
c->Shrink<BanData>("bandata");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -92,11 +92,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
Channel *c = Channel::Find(chname);
|
||||
if (c)
|
||||
c->RemoveMode(NULL, "BAN", mask);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ public:
|
||||
/** Called when the delay is up
|
||||
* @param The current time
|
||||
*/
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
if (!c)
|
||||
return;
|
||||
return false; // Dead channel.
|
||||
|
||||
/* In the event we don't part */
|
||||
c->RemoveMode(NULL, "SECRET");
|
||||
@@ -101,6 +101,8 @@ public:
|
||||
/* If someone has rejoined this channel in the meantime, don't part the bot */
|
||||
else if (c->users.size() <= 1)
|
||||
c->ci->bi->Part(c);
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -92,6 +92,13 @@ public:
|
||||
{
|
||||
return new AccessChanAccess(this);
|
||||
}
|
||||
|
||||
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
|
||||
{
|
||||
auto it = defaultLevels.find(p->name);
|
||||
if (it != defaultLevels.end())
|
||||
access[_("Level")] = LevelToString(source, it->second);
|
||||
}
|
||||
};
|
||||
AccessAccessProvider *AccessAccessProvider::me;
|
||||
|
||||
@@ -956,10 +963,8 @@ public:
|
||||
{
|
||||
defaultLevels.clear();
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
for (const auto &[_, priv] : conf.GetBlocks("privilege"))
|
||||
{
|
||||
const auto &priv = conf.GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &pname = priv.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
|
||||
@@ -28,6 +28,8 @@ private:
|
||||
Anope::string mode;
|
||||
|
||||
public:
|
||||
bool ticked = false;
|
||||
|
||||
TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod)
|
||||
: Timer(me, seconds)
|
||||
, channel(c->name)
|
||||
@@ -51,11 +53,17 @@ public:
|
||||
&& bmask == this->mask;
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
// We need to do this to prevent the remove-on-unban logic from double
|
||||
// deleting the timer.
|
||||
ticked = true;
|
||||
|
||||
Channel *c = Channel::Find(this->channel);
|
||||
if (c)
|
||||
c->RemoveMode(NULL, mode, this->mask);
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -264,11 +272,12 @@ public:
|
||||
source.Reply(_(
|
||||
"Bans a given nick or mask on a channel. An optional expiry may "
|
||||
"be given to cause services to remove the ban after a set amount "
|
||||
"of time."
|
||||
"\n\n"
|
||||
"By default, limited to AOPs or those with level 5 access "
|
||||
"and above on the channel. Channel founders may ban masks."
|
||||
"of time. Channel founders may ban masks."
|
||||
));
|
||||
|
||||
source.Reply(" ");
|
||||
AccessProvider::SendAccess(source, "BAN");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -290,7 +299,7 @@ public:
|
||||
{
|
||||
for (const auto *tempban : tempbans)
|
||||
{
|
||||
if (tempban->Matches(c, cmode, param))
|
||||
if (!tempban->ticked && tempban->Matches(c, cmode, param))
|
||||
{
|
||||
delete tempban;
|
||||
break;
|
||||
|
||||
@@ -14,7 +14,15 @@
|
||||
|
||||
#include "module.h"
|
||||
|
||||
#define FLAGS_MIGRATED_1 _("\002%s\002 has been migrated to the %s access system.")
|
||||
#define FLAGS_MIGRATED_N N_("\002%u\002 entry has been migrated to the %s access system.", "\002%u\002 entries have been migrated to the %s access system.")
|
||||
#define FLAGS_NOT_MIGRATABLE_1 _("\002%s\002 can not be migrated to the %s access system because they have no migratable privileges.")
|
||||
#define FLAGS_NOT_MIGRATABLE_N N_("\002%u\002 entry can not be migrated to the %s access system because they have no migratable privileges.", "\002%u\002 entries can not be migrated to the %s access system because they have no migratable privileges.")
|
||||
#define FLAGS_NOT_MIGRATED_1 _("\002%s\002 can not be migrated to the %s access system because they have privileges that you do not.")
|
||||
#define FLAGS_NOT_MIGRATED_N N_("\002%u\002 entry can not be migrated to the %s access system because they have privileges that you do not.", "\002%u\002 entries can not be migrated to the %s access system because they have privileges that you do not.")
|
||||
|
||||
static std::map<Anope::string, char> defaultFlags;
|
||||
static Anope::map<Anope::string> migrationRequires;
|
||||
|
||||
class FlagsChanAccess final
|
||||
: public ChanAccess
|
||||
@@ -76,6 +84,13 @@ public:
|
||||
{
|
||||
return new FlagsChanAccess(this);
|
||||
}
|
||||
|
||||
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
|
||||
{
|
||||
auto it = defaultFlags.find(p->name);
|
||||
if (it != defaultFlags.end())
|
||||
access[_("Flag")] = Anope::ToString(it->second);
|
||||
}
|
||||
};
|
||||
FlagsAccessProvider *FlagsAccessProvider::ap;
|
||||
|
||||
@@ -303,8 +318,8 @@ class CommandCSFlags final
|
||||
return;
|
||||
auto *access = anope_dynamic_static_cast<FlagsChanAccess *>(provider->Create());
|
||||
access->SetMask(mask, ci);
|
||||
access->creator = source.GetNick();
|
||||
access->description = current ? current->description : description;
|
||||
access->creator = source.GetNick();
|
||||
access->description = current && description.empty() ? current->description : description;
|
||||
access->last_seen = current ? current->last_seen : 0;
|
||||
access->created = Anope::CurTime;
|
||||
access->flags = current_flags;
|
||||
@@ -411,10 +426,9 @@ class CommandCSFlags final
|
||||
void DoMigrate(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
auto override = false;
|
||||
const auto source_access = source.AccessFor(ci);
|
||||
|
||||
unsigned migrated = 0, notmigrated = 0;
|
||||
Anope::string migratedmask, notmigratedmask;
|
||||
unsigned migrated = 0, notmigratable = 0, notmigrated = 0;
|
||||
Anope::string migratedmask, notmigratablemask, notmigratedmask;
|
||||
const auto &entry = params.size() > 2 ? params[2] : "*";
|
||||
for (auto idx = ci->GetAccessCount(); idx > 0; --idx)
|
||||
{
|
||||
@@ -428,34 +442,52 @@ class CommandCSFlags final
|
||||
std::set<char> newflags;
|
||||
for (auto &[priv, flag] : defaultFlags)
|
||||
{
|
||||
if (access->HasPriv(priv))
|
||||
if (!access->HasPriv(priv))
|
||||
continue; // Source doesn't have this flag.
|
||||
|
||||
// Check that the source has access to set this entry.
|
||||
const auto source_access = source.AccessFor(ci);
|
||||
if (!override && !source_access.HasPriv(priv) && !source_access.founder)
|
||||
{
|
||||
if (!source.HasPriv("chanserv/access/modify"))
|
||||
{
|
||||
notmigrated++;
|
||||
notmigratedmask = access->Mask();
|
||||
Log(LOG_DEBUG) << source.GetNick() << " does not have the access to migrate " << access->Mask() << " to flags";
|
||||
continue; // No privs
|
||||
}
|
||||
|
||||
override = true;
|
||||
}
|
||||
|
||||
auto req = migrationRequires.find(priv);
|
||||
if (req != migrationRequires.end() && !access->HasPriv(req->second))
|
||||
{
|
||||
Log(LOG_DEBUG) << access->Mask() << " has " << priv << " but not " << req->second << " so it will be lost on migration to flags";
|
||||
continue; // Required flag missing.
|
||||
}
|
||||
|
||||
newflags.insert(flag);
|
||||
}
|
||||
|
||||
if (newflags.empty())
|
||||
{
|
||||
notmigratable++;
|
||||
notmigratablemask = access->Mask();
|
||||
Log(LOG_DEBUG) << access->Mask() << " has " << access->AccessSerialize() << " that can not be migrated to flags";
|
||||
continue; // No privs that are migratable
|
||||
}
|
||||
|
||||
migrated++;
|
||||
migratedmask = access->Mask();
|
||||
|
||||
auto *newaccess = anope_dynamic_static_cast<FlagsChanAccess *>(FlagsAccessProvider::ap->Create());
|
||||
newaccess->SetMask(access->Mask(), ci);
|
||||
newaccess->created = access->created;
|
||||
newaccess->creator = access->creator;
|
||||
newaccess->description = access->description;
|
||||
newaccess->created = access->created;
|
||||
newaccess->flags = newflags;
|
||||
newaccess->last_seen = access->last_seen;
|
||||
|
||||
ci->EraseAccess(idx - 1);
|
||||
FOREACH_MOD(OnAccessDel, (ci, source, access, true));
|
||||
@@ -468,18 +500,23 @@ class CommandCSFlags final
|
||||
if (migrated == 1)
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to migrate " << migratedmask;
|
||||
source.Reply(CHAN_ACCESS_MIGRATED_1, migratedmask.c_str(), source.command.nobreak().c_str());
|
||||
source.Reply(FLAGS_MIGRATED_1, migratedmask.c_str(), source.command.nobreak().c_str());
|
||||
}
|
||||
else if (migrated > 1)
|
||||
{
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to migrate " << migrated << " access entries";
|
||||
source.Reply(migrated, CHAN_ACCESS_MIGRATED_N, migrated, source.command.nobreak().c_str());
|
||||
source.Reply(migrated, FLAGS_MIGRATED_N, migrated, source.command.nobreak().c_str());
|
||||
}
|
||||
|
||||
if (notmigratable == 1)
|
||||
source.Reply(FLAGS_NOT_MIGRATABLE_1, notmigratablemask.c_str(), source.command.nobreak().c_str());
|
||||
else if (notmigratable > 1)
|
||||
source.Reply(notmigratable, FLAGS_NOT_MIGRATABLE_N, notmigratable, source.command.nobreak().c_str());
|
||||
|
||||
if (notmigrated == 1)
|
||||
source.Reply(CHAN_ACCESS_NOT_MIGRATED_1, notmigratedmask.c_str(), source.command.nobreak().c_str());
|
||||
source.Reply(FLAGS_NOT_MIGRATED_1, notmigratedmask.c_str(), source.command.nobreak().c_str());
|
||||
else if (notmigrated > 1)
|
||||
source.Reply(migrated, CHAN_ACCESS_NOT_MIGRATED_N, notmigrated, source.command.nobreak().c_str());
|
||||
source.Reply(notmigrated, FLAGS_NOT_MIGRATED_N, notmigrated, source.command.nobreak().c_str());
|
||||
}
|
||||
|
||||
void DoClear(CommandSource &source, ChannelInfo *ci)
|
||||
@@ -624,10 +661,8 @@ public:
|
||||
{
|
||||
defaultFlags.clear();
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
for (const auto &[_, priv] : conf.GetBlocks("privilege"))
|
||||
{
|
||||
const auto &priv = conf.GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &pname = priv.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
@@ -638,6 +673,10 @@ public:
|
||||
if (value.empty())
|
||||
continue;
|
||||
|
||||
const auto &migration_requires = priv.Get<const Anope::string>("flag_migration_requires");
|
||||
if (!migration_requires.empty())
|
||||
migrationRequires[p->name] = migration_requires;
|
||||
|
||||
defaultFlags[p->name] = value[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,11 +95,12 @@ public:
|
||||
source.Reply(_(
|
||||
"Tells %s to invite you or an optionally specified "
|
||||
"nick into the given channel."
|
||||
"\n\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above "
|
||||
"on the channel."
|
||||
),
|
||||
source.service->nick.c_str());
|
||||
|
||||
source.Reply(" ");
|
||||
AccessProvider::SendAccess(source, "INVITE");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,12 +134,11 @@ public:
|
||||
{
|
||||
this->SendSyntax(source);
|
||||
source.Reply(" ");
|
||||
source.Reply(_(
|
||||
"Kicks a specified nick from a channel."
|
||||
"\n\n"
|
||||
"By default, limited to AOPs or those with level 5 access "
|
||||
"and above on the channel. Channel founders can also specify masks."
|
||||
));
|
||||
source.Reply(_("Kicks a specified nick from a channel. Channel founders can also specify masks."));
|
||||
|
||||
source.Reply(" ");
|
||||
AccessProvider::SendAccess(source, "KICK");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -331,10 +331,8 @@ public:
|
||||
const auto &block = conf.GetModule(this);
|
||||
defaults.clear();
|
||||
|
||||
for (int i = 0; i < block.CountBlock("default"); ++i)
|
||||
for (const auto &[_, def] : block.GetBlocks("default"))
|
||||
{
|
||||
const auto &def = block.GetBlock("default", i);
|
||||
|
||||
LogDefault ld;
|
||||
|
||||
ld.service = def.Get<const Anope::string>("service");
|
||||
|
||||
@@ -999,10 +999,8 @@ public:
|
||||
{
|
||||
modes.clear();
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
for (const auto &[_, block] : conf.GetBlocks("command"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("command", i);
|
||||
|
||||
const Anope::string &cname = block.Get<const Anope::string>("name"),
|
||||
&cmd = block.Get<const Anope::string>("command");
|
||||
|
||||
|
||||
@@ -268,9 +268,9 @@ public:
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
command_data.clear();
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
|
||||
for (const auto &[_, block] : conf.GetBlocks("command"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("command", i);
|
||||
if (block.Get<const Anope::string>("command") != "chanserv/set/misc")
|
||||
continue;
|
||||
|
||||
|
||||
@@ -128,11 +128,12 @@ public:
|
||||
"user from entering the given channel. If no channel is "
|
||||
"given, all bans affecting you in channels you have access "
|
||||
"in are removed."
|
||||
"\n\n"
|
||||
"By default, limited to AOPs or those with level 5 access and above "
|
||||
"on the channel."
|
||||
),
|
||||
source.service->nick.c_str());
|
||||
|
||||
source.Reply(" ");
|
||||
AccessProvider::SendAccess(source, "UNBAN");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -100,6 +100,19 @@ public:
|
||||
{
|
||||
return new XOPChanAccess(this);
|
||||
}
|
||||
|
||||
void GetAccess(CommandSource& source, const Privilege *p, Anope::map<Anope::string> &access) override
|
||||
{
|
||||
for (const auto& xop : order)
|
||||
{
|
||||
const auto &privs = permissions[xop];
|
||||
if (std::find(privs.begin(), privs.end(), p->name) != privs.end())
|
||||
{
|
||||
access[_("XOP")] = xop;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class CommandCSXOP final
|
||||
@@ -675,9 +688,8 @@ public:
|
||||
order.clear();
|
||||
permissions.clear();
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("privilege"); ++i)
|
||||
for (const auto &[_, block] : conf.GetBlocks("privilege"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("privilege", i);
|
||||
const Anope::string &pname = block.Get<const Anope::string>("name");
|
||||
|
||||
Privilege *p = PrivilegeManager::FindPrivilege(pname);
|
||||
@@ -691,9 +703,8 @@ public:
|
||||
permissions[xop].push_back(pname);
|
||||
}
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
for (const auto &[_, block] : conf.GetBlocks("command"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("command", i);
|
||||
const Anope::string &cname = block.Get<const Anope::string>("name"),
|
||||
&cserv = block.Get<const Anope::string>("command");
|
||||
if (cname.empty() || cserv != "chanserv/xop")
|
||||
|
||||
@@ -353,14 +353,16 @@ class MChanstats final
|
||||
"(nick_, '', 'total'), (nick_, '', 'monthly'),"
|
||||
"(nick_, '', 'weekly'), (nick_, '', 'daily');"
|
||||
"END IF;"
|
||||
"SET @echan = chan_;"
|
||||
"SET @enick = nick_;"
|
||||
"SET @update_query = CONCAT('UPDATE `" + prefix + "chanstats` SET line=line+', line_, ',"
|
||||
"letters=letters+', letters_, ' , words=words+', words_, ', actions=actions+', actions_, ', "
|
||||
"smileys_happy=smileys_happy+', sm_h_, ', smileys_sad=smileys_sad+', sm_s_, ', "
|
||||
"smileys_other=smileys_other+', sm_o_, ', kicks=kicks+', kicks_, ', kicked=kicked+', kicked_, ', "
|
||||
"modes=modes+', modes_, ', topics=topics+', topics_, ', ', time_ , '=', time_, '+', line_ ,' "
|
||||
"WHERE (nick='''' OR nick=''', nick_, ''') AND (chan='''' OR chan=''', chan_, ''')');"
|
||||
"WHERE (nick='''' OR nick=?) AND (chan='''' OR chan=?)');"
|
||||
"PREPARE update_query FROM @update_query;"
|
||||
"EXECUTE update_query;"
|
||||
"EXECUTE update_query using @enick, @echan;"
|
||||
"DEALLOCATE PREPARE update_query;"
|
||||
"END";
|
||||
this->RunQuery(query);
|
||||
|
||||
@@ -1584,9 +1584,8 @@ public:
|
||||
const auto &modconf = conf.GetModule(this);
|
||||
|
||||
csmiscdata.clear();
|
||||
for (auto idx = 0; idx < modconf.CountBlock("cs_set_misc"); ++idx)
|
||||
for (const auto &[_, data] : modconf.GetBlocks("cs_set_misc"))
|
||||
{
|
||||
const auto &data = modconf.GetBlock("cs_set_misc", idx);
|
||||
const auto &anope = data.Get<const Anope::string>("anope");
|
||||
const auto &atheme = data.Get<const Anope::string>("atheme");
|
||||
if (!anope.empty() && !atheme.empty())
|
||||
@@ -1594,9 +1593,8 @@ public:
|
||||
}
|
||||
|
||||
nsmiscdata.clear();
|
||||
for (auto idx = 0; idx < modconf.CountBlock("ns_set_misc"); ++idx)
|
||||
for (const auto &[_, data] : modconf.GetBlocks("ns_set_misc"))
|
||||
{
|
||||
const auto &data = modconf.GetBlock("ns_set_misc", idx);
|
||||
const auto &anope = data.Get<const Anope::string>("anope");
|
||||
const auto &atheme = data.Get<const Anope::string>("atheme");
|
||||
if (!anope.empty() && !atheme.empty())
|
||||
@@ -1604,9 +1602,8 @@ public:
|
||||
}
|
||||
|
||||
flags.clear();
|
||||
for (int i = 0; i < Config->CountBlock("privilege"); ++i)
|
||||
for (const auto &[_, priv] : conf.GetBlocks("privilege"))
|
||||
{
|
||||
const auto &priv = Config->GetBlock("privilege", i);
|
||||
const Anope::string &name = priv.Get<const Anope::string>("name");
|
||||
const Anope::string &value = priv.Get<const Anope::string>("flag");
|
||||
if (!name.empty() && !value.empty())
|
||||
|
||||
+6
-5
@@ -534,8 +534,9 @@ public:
|
||||
}
|
||||
|
||||
/* Times out after a few seconds */
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Reply(Packet *p) override
|
||||
@@ -718,7 +719,7 @@ public:
|
||||
|
||||
MyManager(Module *creator)
|
||||
: Manager(creator)
|
||||
, Timer(300, true)
|
||||
, Timer(300)
|
||||
, serial(Anope::CurTime)
|
||||
, cur_id(Anope::RandomNumber())
|
||||
{
|
||||
@@ -1011,7 +1012,7 @@ public:
|
||||
return serial;
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
Log(LOG_DEBUG_2) << "Resolver: Purging DNS cache";
|
||||
|
||||
@@ -1025,6 +1026,7 @@ public:
|
||||
if (req.created + static_cast<time_t>(req.ttl) < Anope::CurTime)
|
||||
this->cache.erase(it);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -1093,9 +1095,8 @@ public:
|
||||
refresh = block.Get<int>("refresh", "3600");
|
||||
|
||||
std::vector<std::pair<Anope::string, short> > notify;
|
||||
for (int i = 0; i < block.CountBlock("notify"); ++i)
|
||||
for (const auto &[_, n] : block.GetBlocks("notify"))
|
||||
{
|
||||
const auto &n = block.GetBlock("notify", i);
|
||||
auto nip = n.Get<Anope::string>("ip");
|
||||
auto nport = n.Get<short>("port");
|
||||
|
||||
|
||||
+3
-6
@@ -126,9 +126,8 @@ public:
|
||||
this->add_to_akill = block.Get<bool>("add_to_akill", "yes");
|
||||
|
||||
this->blacklists.clear();
|
||||
for (int i = 0; i < block.CountBlock("blacklist"); ++i)
|
||||
for (const auto &[_, bl] : block.GetBlocks("blacklist"))
|
||||
{
|
||||
const auto &bl = block.GetBlock("blacklist", i);
|
||||
Blacklist blacklist;
|
||||
|
||||
blacklist.name = bl.Get<Anope::string>("name");
|
||||
@@ -137,9 +136,8 @@ public:
|
||||
blacklist.bantime = bl.Get<time_t>("time", "4h");
|
||||
blacklist.reason = bl.Get<Anope::string>("reason");
|
||||
|
||||
for (int j = 0; j < bl.CountBlock("reply"); ++j)
|
||||
for (const auto &[_, reply] : block.GetBlocks("reply"))
|
||||
{
|
||||
const auto &reply = bl.GetBlock("reply", j);
|
||||
Blacklist::Reply r;
|
||||
|
||||
r.code = reply.Get<int>("code");
|
||||
@@ -153,9 +151,8 @@ public:
|
||||
}
|
||||
|
||||
this->exempts.clear();
|
||||
for (int i = 0; i < block.CountBlock("exempt"); ++i)
|
||||
for (const auto &[_, bl] : block.GetBlocks("exempt"))
|
||||
{
|
||||
const auto &bl = block.GetBlock("exempt", i);
|
||||
this->exempts.insert(bl.Get<Anope::string>("ip"));
|
||||
}
|
||||
}
|
||||
|
||||
+76
-4
@@ -405,6 +405,80 @@ public:
|
||||
QueueRequest(mod);
|
||||
}
|
||||
|
||||
Anope::string EscapeDN(const Anope::string &str) const override
|
||||
{
|
||||
if (str.empty())
|
||||
return str;
|
||||
|
||||
Anope::string newstr;
|
||||
newstr.str().reserve(str.length());
|
||||
for (size_t idx = 0; idx < str.length(); ++idx)
|
||||
{
|
||||
const char chr = str[idx];
|
||||
if (chr == '\0')
|
||||
{
|
||||
newstr.append("\\00");
|
||||
}
|
||||
else if (chr == '"' || chr == '+' || chr == ',' || chr == ';' ||
|
||||
chr == '<' || chr == '=' || chr == '>' || chr == '\\')
|
||||
{
|
||||
newstr.push_back('\\');
|
||||
newstr.push_back(chr);
|
||||
}
|
||||
else if (idx == 0 && (chr == '#' || chr == ' '))
|
||||
{
|
||||
newstr.push_back('\\');
|
||||
newstr.push_back(chr);
|
||||
}
|
||||
else if (idx == str.length() - 1 && chr == ' ')
|
||||
{
|
||||
newstr.push_back('\\');
|
||||
newstr.push_back(chr);
|
||||
}
|
||||
else
|
||||
{
|
||||
newstr.push_back(chr);
|
||||
}
|
||||
}
|
||||
|
||||
return newstr;
|
||||
}
|
||||
|
||||
Anope::string EscapeSF(const Anope::string &str) const override
|
||||
{
|
||||
if (str.empty())
|
||||
return str;
|
||||
|
||||
Anope::string newstr;
|
||||
newstr.str().reserve(str.length());
|
||||
for (size_t idx = 0; idx < str.length(); ++idx)
|
||||
{
|
||||
const char chr = str[idx];
|
||||
switch (chr)
|
||||
{
|
||||
case '\0':
|
||||
newstr.append("\\00");
|
||||
break;
|
||||
case '(':
|
||||
newstr.append("\\28");
|
||||
break;
|
||||
case ')':
|
||||
newstr.append("\\29");
|
||||
break;
|
||||
case '*':
|
||||
newstr.append("\\2A");
|
||||
break;
|
||||
case '\\':
|
||||
newstr.append("\\5C");
|
||||
break;
|
||||
default:
|
||||
newstr.push_back(chr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return newstr;
|
||||
}
|
||||
|
||||
private:
|
||||
void BuildReply(int res, LDAPRequest *req)
|
||||
{
|
||||
@@ -560,7 +634,7 @@ public:
|
||||
{
|
||||
const Anope::string &cname = it->first;
|
||||
LDAPService *s = it->second;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
++it;
|
||||
|
||||
@@ -580,10 +654,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("ldap"); ++i)
|
||||
for (const auto &[_, ldap] : conf.GetBlocks("ldap"))
|
||||
{
|
||||
const auto &ldap = conf.GetBlock("ldap", i);
|
||||
|
||||
const Anope::string &connname = ldap.Get<const Anope::string>("name", "ldap/main");
|
||||
|
||||
if (this->LDAPServices.find(connname) == this->LDAPServices.end())
|
||||
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
{
|
||||
const Anope::string &cname = it->first;
|
||||
MySQLService *s = it->second;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
++it;
|
||||
|
||||
@@ -298,9 +298,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < config.CountBlock("mysql"); ++i)
|
||||
for (const auto &[_, block] : config.GetBlocks("mysql"))
|
||||
{
|
||||
const auto &block = config.GetBlock("mysql", i);
|
||||
const Anope::string &connname = block.Get<const Anope::string>("name", "mysql/main");
|
||||
|
||||
if (this->MySQLServices.find(connname) == this->MySQLServices.end())
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
{
|
||||
const Anope::string &cname = it->first;
|
||||
SQLiteService *s = it->second;
|
||||
int i, num;
|
||||
size_t i, num;
|
||||
++it;
|
||||
|
||||
for (i = 0, num = config.CountBlock("sqlite"); i < num; ++i)
|
||||
@@ -145,9 +145,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < config.CountBlock("sqlite"); ++i)
|
||||
for (const auto &[_, block] : config.GetBlocks("sqlite"))
|
||||
{
|
||||
const auto &block = config.GetBlock("sqlite", i);
|
||||
Anope::string connname = block.Get<const Anope::string>("name", "sqlite/main");
|
||||
|
||||
if (this->SQLiteServices.find(connname) == this->SQLiteServices.end())
|
||||
|
||||
@@ -331,10 +331,8 @@ public:
|
||||
throw ConfigException("Unable to find http reference, is httpd loaded?");
|
||||
|
||||
xmlrpcinterface.tokens.clear();
|
||||
for (int i = 0; i < modconf.CountBlock("token"); ++i)
|
||||
for (const auto &[_, block] : modconf.GetBlocks("token"))
|
||||
{
|
||||
const auto &block = modconf.GetBlock("token", i);
|
||||
|
||||
RPC::Token token;
|
||||
token.token = block.Get<const Anope::string>("token");
|
||||
if (!token.token.empty())
|
||||
|
||||
+4
-6
@@ -298,12 +298,12 @@ public:
|
||||
MyHTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, const int t, bool s)
|
||||
: Socket(-1, i.find(':') == Anope::string::npos ? AF_INET : AF_INET6)
|
||||
, HTTP::Provider(c, n, i, p, s)
|
||||
, Timer(c, 10, true)
|
||||
, Timer(c, 10)
|
||||
, timeout(t)
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
while (!this->clients.empty())
|
||||
{
|
||||
@@ -314,6 +314,7 @@ public:
|
||||
delete c;
|
||||
this->clients.pop_front();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ClientSocket *OnAccept(int fd, const sockaddrs &addr) override
|
||||
@@ -371,11 +372,8 @@ public:
|
||||
const auto &conf = config.GetModule(this);
|
||||
std::set<Anope::string> existing;
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("httpd"); ++i)
|
||||
for (const auto &[_, block] : conf.GetBlocks("httpd"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("httpd", i);
|
||||
|
||||
|
||||
const Anope::string &hname = block.Get<const Anope::string>("name", "httpd/main");
|
||||
existing.insert(hname);
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ public:
|
||||
if (ii->admin_bind)
|
||||
{
|
||||
auto sf = Anope::Template(search_filter, {
|
||||
{ "account", ii->req->GetAccount() },
|
||||
{ "object_class", object_class },
|
||||
{ "account", ii->lprov->EscapeSF(ii->req->GetAccount()) },
|
||||
{ "object_class", object_class },
|
||||
});
|
||||
try
|
||||
{
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
attributes[3].name = this->password_attribute;
|
||||
attributes[3].values.push_back(pass);
|
||||
|
||||
Anope::string new_dn = username_attribute + "=" + na->nick + "," + basedn;
|
||||
Anope::string new_dn = username_attribute + "=" + this->ldap->EscapeDN(na->nick) + "," + basedn;
|
||||
this->ldap->Add(&this->orinterface, new_dn, attributes);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,13 +125,13 @@ public:
|
||||
if (!this->binddn.empty())
|
||||
{
|
||||
auto bdn = Anope::Template(this->binddn, {
|
||||
{ "account", u->Account()->display },
|
||||
{ "account", this->ldap->EscapeDN(u->Account()->display) },
|
||||
});
|
||||
this->ldap->Bind(NULL, bdn, this->password.c_str());
|
||||
}
|
||||
|
||||
auto af = Anope::Template(this->filter, {
|
||||
{ "account", u->Account()->display },
|
||||
{ "account", this->ldap->EscapeSF(u->Account()->display) },
|
||||
});
|
||||
this->ldap->Search(new IdentifyInterface(this, u), this->basedn, af);
|
||||
}
|
||||
|
||||
@@ -61,16 +61,17 @@ public:
|
||||
return na;
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
if (!u || !na || !NickServ::service)
|
||||
return;
|
||||
return false;
|
||||
|
||||
/* If they identified or don't exist anymore, don't kill them. */
|
||||
if (u->Account() == na->nc || u->timestamp > ts)
|
||||
return;
|
||||
return false;
|
||||
|
||||
NickServ::service->Collide(u, na);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -90,10 +91,11 @@ public:
|
||||
n->Extend<bool>("HELD");
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
if (na)
|
||||
na->Shrink<bool>("HELD");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -133,8 +135,9 @@ public:
|
||||
NickServReleases.erase(this->nick);
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -145,8 +145,9 @@ public:
|
||||
}
|
||||
|
||||
NickAlias *target, *na = NickAlias::Find(source.GetNick());
|
||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
|
||||
auto maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases");
|
||||
auto &modconf = Config->GetModule(this->owner);
|
||||
time_t reg_delay = modconf.Get<time_t>("delay", Config->GetModule("nickserv").Get<time_t>("regdelay", "5m"));
|
||||
auto maxaliases = modconf.Get<unsigned>("maxaliases");
|
||||
if (!(target = NickAlias::Find(nick)))
|
||||
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
|
||||
else if (user && Anope::CurTime < user->lastnickreg + reg_delay)
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
}
|
||||
|
||||
time_t nickregdelay = Config->GetModule(this->owner).Get<time_t>("nickregdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay");
|
||||
time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay", "15m");
|
||||
if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay)
|
||||
{
|
||||
auto waitperiod = (u->timestamp + nickregdelay) - Anope::CurTime;
|
||||
@@ -275,18 +275,28 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
auto *passcode = nc->GetExt<Anope::string>("passcode");
|
||||
if (!passcode)
|
||||
if (!nc->HasExt("UNCONFIRMED"))
|
||||
{
|
||||
source.Reply(_("There is no registration confirmation pending for %s."),
|
||||
na->nick.c_str());
|
||||
return;
|
||||
}
|
||||
if (!code.empty() && !code.equals_cs(*passcode))
|
||||
|
||||
if (!code.empty())
|
||||
{
|
||||
source.Reply(_("The registration confirmation code you specified for %s is incorrect."),
|
||||
na->nick.c_str());
|
||||
return;
|
||||
auto *passcode = nc->GetExt<Anope::string>("passcode");
|
||||
if (passcode && !code.equals_cs(*passcode))
|
||||
{
|
||||
source.Reply(_("The registration confirmation code you specified for %s is incorrect."),
|
||||
na->nick.c_str());
|
||||
return;
|
||||
}
|
||||
else if (!passcode)
|
||||
{
|
||||
source.Reply(_("The registration of %s can only be confirmed by an administrator."),
|
||||
na->nick.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nc->Shrink<Anope::string>("passcode");
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
SASLService(Module *o)
|
||||
: SASL::Service(o)
|
||||
, Timer(o, 60, true)
|
||||
, Timer(o, 60)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ public:
|
||||
this->SendMessage(session, "M", buf.empty() ? "" : buf.substr(1));
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
for (auto it = badpasswords.begin(); it != badpasswords.end(); )
|
||||
{
|
||||
@@ -240,6 +240,7 @@ public:
|
||||
sessions.erase(uid);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -26,14 +26,15 @@ struct CommandData final
|
||||
Anope::string pattern;
|
||||
Anope::string syntax;
|
||||
Anope::string title;
|
||||
time_t priority = 0;
|
||||
bool swhois = false;
|
||||
};
|
||||
|
||||
static Anope::map<CommandData> command_data;
|
||||
|
||||
|
||||
struct NSMiscData;
|
||||
static Anope::map<ExtensibleItem<NSMiscData> *> items;
|
||||
static std::vector<std::pair<time_t, ExtensibleItem<NSMiscData> *>> items_by_priority;
|
||||
|
||||
static ExtensibleItem<NSMiscData> *GetItem(const Anope::string &name)
|
||||
{
|
||||
@@ -132,7 +133,7 @@ static void CheckSWhois(User* u, const Anope::string &name, ExtensibleItem<NSMis
|
||||
auto *nc = u->Account();
|
||||
auto *data = nc ? ext->Get(nc) : nullptr;
|
||||
if (data)
|
||||
IRCD->SendSWhois(nickserv, u, name, Anope::Format("%s: %s", GetTitle(ext), data->data.c_str()));
|
||||
IRCD->SendSWhois(nickserv, u, name, it->second.priority, Anope::Format("%s: %s", GetTitle(ext), data->data.c_str()));
|
||||
else
|
||||
IRCD->SendSWhoisDel(nickserv, u, name, "");
|
||||
}
|
||||
@@ -327,9 +328,11 @@ public:
|
||||
void OnReload(Configuration::Conf &conf) override
|
||||
{
|
||||
command_data.clear();
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
items_by_priority.clear();
|
||||
|
||||
time_t default_priority = 0;
|
||||
for (const auto &[_, block] : conf.GetBlocks("command"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("command", i);
|
||||
const Anope::string &cmd = block.Get<const Anope::string>("command");
|
||||
if (cmd != "nickserv/set/misc" && cmd != "nickserv/saset/misc")
|
||||
continue;
|
||||
@@ -341,7 +344,7 @@ public:
|
||||
|
||||
// Force creation of the extension item.
|
||||
const auto extname = GetAttribute(cname);
|
||||
GetItem(extname);
|
||||
auto item = GetItem(extname);
|
||||
|
||||
auto &data = command_data[extname];
|
||||
if (cmd == "nickserv/saset/misc")
|
||||
@@ -350,12 +353,22 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
default_priority += 1000;
|
||||
|
||||
data.set_description = desc;
|
||||
data.pattern = block.Get<const Anope::string>("misc_pattern");
|
||||
data.syntax = block.Get<const Anope::string>("misc_syntax");
|
||||
data.title = block.Get<const Anope::string>("misc_title");
|
||||
data.priority = block.Get<time_t>("misc_priority", "0");
|
||||
if (data.priority <= 0)
|
||||
{
|
||||
// If no priority is specified, go by order processed
|
||||
data.priority = default_priority;
|
||||
}
|
||||
data.swhois = block.Get<bool>("misc_swhois");
|
||||
items_by_priority.emplace_back(data.priority, item);
|
||||
}
|
||||
std::sort(items_by_priority.begin(), items_by_priority.end());
|
||||
}
|
||||
|
||||
void OnUserLogin(User *u) override
|
||||
@@ -374,7 +387,7 @@ public:
|
||||
|
||||
void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool) override
|
||||
{
|
||||
for (const auto &[_, e] : items)
|
||||
for (const auto &[_, e] : items_by_priority)
|
||||
{
|
||||
NSMiscData *data = e->Get(na->nc);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
for (unsigned i = 0; !show_blocks[i].empty(); ++i)
|
||||
{
|
||||
const auto &block = Config->GetBlock(show_blocks[i]);
|
||||
const Configuration::Block::item_map &items = block.GetItems();
|
||||
const auto &items = block.GetItems();
|
||||
|
||||
ListFormatter lflist(source.GetAccount());
|
||||
lflist.AddColumn(_("Name")).AddColumn(_("Value"));
|
||||
@@ -84,10 +84,9 @@ public:
|
||||
lflist.AddColumn(_("Module Name")).AddColumn(_("Name")).AddColumn(_("Value"));
|
||||
lflist.SetFlexible(_("\002{}{module_name}}:{name}\002 = {value}"));
|
||||
|
||||
for (int i = 0; i < Config->CountBlock("module"); ++i)
|
||||
for (const auto &[_, block] : Config->GetBlocks("module"))
|
||||
{
|
||||
const auto &block = Config->GetBlock("module", i);
|
||||
const Configuration::Block::item_map &items = block.GetItems();
|
||||
const auto &items = block.GetItems();
|
||||
|
||||
if (items.size() <= 1)
|
||||
continue;
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
timeout = NULL;
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
if (DConfig.defaultlevel != level)
|
||||
{
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
|
||||
runDefCon();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -529,10 +529,8 @@ public:
|
||||
fileforbids.clear();
|
||||
|
||||
const auto &modconf = conf.GetModule(this);
|
||||
for (auto i = 0; i < modconf.CountBlock("file"); ++i)
|
||||
for (const auto &[_, fileblock] : modconf.GetBlocks("file"))
|
||||
{
|
||||
const auto &fileblock = modconf.GetBlock("file", i);
|
||||
|
||||
const auto reasonstr = fileblock.Get<const Anope::string>("reason");
|
||||
|
||||
const auto typestr = fileblock.Get<const Anope::string>("type");
|
||||
|
||||
@@ -587,7 +587,7 @@ public:
|
||||
Uplink::Send(source, "SVSPART", u->GetUID(), chan);
|
||||
}
|
||||
|
||||
void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, const Anope::string &message) override
|
||||
void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, time_t priority, const Anope::string &message) override
|
||||
{
|
||||
if (!IRCD->CanSendMultipleSWhois)
|
||||
{
|
||||
@@ -598,7 +598,7 @@ public:
|
||||
{
|
||||
// New style SWHOIS.
|
||||
Uplink::Send("METADATA", target->GetUID(), "specialwhois", Anope::Format("+ @%s s %ld :%s",
|
||||
tag.c_str(), Anope::CurTime, message.c_str()));
|
||||
tag.c_str(), priority ? priority : Anope::CurTime, message.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -346,10 +346,10 @@ private:
|
||||
Uplink::Send("SENDUMODE", 'o', "From " + source.GetName() + ": " + buf);
|
||||
}
|
||||
|
||||
void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, const Anope::string &message) override
|
||||
void SendSWhois(const MessageSource &source, User *target, const Anope::string &tag, time_t priority, const Anope::string &message) override
|
||||
{
|
||||
const auto utag = tag.empty() ? source.GetName() : tag;
|
||||
Uplink::Send(source, "SWHOIS", target->GetUID(), "+", utag, 0, message);
|
||||
Uplink::Send(source, "SWHOIS", target->GetUID(), "+", utag, priority, message);
|
||||
}
|
||||
|
||||
void SendSWhoisDel(const MessageSource &source, User *target, const Anope::string &tag, const Anope::string &message) override
|
||||
|
||||
@@ -218,11 +218,11 @@ class ModuleProxyScan final
|
||||
{
|
||||
public:
|
||||
ConnectionTimeout(Module *c, time_t timeout)
|
||||
: Timer(c, timeout, true)
|
||||
: Timer(c, timeout)
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
for (auto it = ProxyConnect::proxies.begin(), it_end = ProxyConnect::proxies.end(); it != it_end;)
|
||||
{
|
||||
@@ -232,6 +232,7 @@ class ModuleProxyScan final
|
||||
if (p->created + this->GetSecs() < Anope::CurTime)
|
||||
delete p;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} connectionTimeout;
|
||||
|
||||
@@ -308,9 +309,9 @@ public:
|
||||
}
|
||||
|
||||
this->proxyscans.clear();
|
||||
for (int i = 0; i < config.CountBlock("proxyscan"); ++i)
|
||||
|
||||
for (const auto &[_, block] : config.GetBlocks("proxyscan"))
|
||||
{
|
||||
const auto &block = config.GetBlock("proxyscan", i);
|
||||
ProxyCheck p;
|
||||
Anope::string token;
|
||||
|
||||
|
||||
+1
-3
@@ -173,10 +173,8 @@ public:
|
||||
{
|
||||
Rewrite::rewrites.clear();
|
||||
|
||||
for (int i = 0; i < conf.CountBlock("command"); ++i)
|
||||
for (const auto &[_, block] : conf.GetBlocks("command"))
|
||||
{
|
||||
const auto &block = conf.GetBlock("command", i);
|
||||
|
||||
if (!block.Get<bool>("rewrite"))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -313,10 +313,9 @@ public:
|
||||
throw ConfigException("Unable to find http reference, is httpd loaded?");
|
||||
|
||||
jsonrpcinterface.tokens.clear();
|
||||
for (int i = 0; i < modconf.CountBlock("token"); ++i)
|
||||
{
|
||||
const auto &block = modconf.GetBlock("token", i);
|
||||
|
||||
for (const auto &[_, block] : modconf.GetBlocks("token"))
|
||||
{
|
||||
RPC::Token token;
|
||||
token.token = block.Get<const Anope::string>("token");
|
||||
if (!token.token.empty())
|
||||
|
||||
@@ -94,6 +94,27 @@ const std::list<AccessProvider *>& AccessProvider::GetProviders()
|
||||
return Providers;
|
||||
}
|
||||
|
||||
void AccessProvider::SendAccess(CommandSource &source, const Anope::string& pname)
|
||||
{
|
||||
auto *p = PrivilegeManager::FindPrivilege(pname);
|
||||
if (!p)
|
||||
return; // Privilege missing.
|
||||
|
||||
Anope::map<Anope::string> access;
|
||||
for (auto *service : Service::GetServices("AccessProvider"))
|
||||
{
|
||||
auto *accessprovider = static_cast<AccessProvider *>(service);
|
||||
accessprovider->GetAccess(source, p, access);
|
||||
}
|
||||
|
||||
if (access.empty())
|
||||
return; // No access systems???
|
||||
|
||||
source.Reply(_("By default, the \002%s\002 command is limited to:"), source.command.c_str());
|
||||
for (const auto& [system, privilege] : access)
|
||||
source.Reply(" \002%s\002: %s", source.Translate(system), privilege.c_str());
|
||||
}
|
||||
|
||||
ChanAccess::ChanAccess(AccessProvider *p)
|
||||
: Serializable(CHANACCESS_TYPE)
|
||||
, provider(p)
|
||||
|
||||
+34
-47
@@ -38,28 +38,37 @@ const Anope::string &Configuration::Block::GetName() const
|
||||
return name;
|
||||
}
|
||||
|
||||
int Configuration::Block::CountBlock(const Anope::string &bname) const
|
||||
size_t Configuration::Block::CountBlock(const Anope::string &bname) const
|
||||
{
|
||||
return blocks.count(bname);
|
||||
}
|
||||
|
||||
const Configuration::Block &Configuration::Block::GetBlock(const Anope::string &bname, int num) const
|
||||
Configuration::Block::BlockList Configuration::Block::GetBlocks(const Anope::string &bname) const
|
||||
{
|
||||
std::pair<block_map::const_iterator, block_map::const_iterator> it = blocks.equal_range(bname);
|
||||
return Anope::equal_range(blocks, bname);
|
||||
}
|
||||
|
||||
for (int i = 0; it.first != it.second; ++it.first, ++i)
|
||||
const Configuration::Block &Configuration::Block::GetBlock(const Anope::string &bname, size_t num) const
|
||||
{
|
||||
auto it = blocks.equal_range(bname);
|
||||
|
||||
for (size_t i = 0; it.first != it.second; ++it.first, ++i)
|
||||
{
|
||||
if (i == num)
|
||||
return it.first->second;
|
||||
}
|
||||
return EmptyBlock;
|
||||
}
|
||||
|
||||
Configuration::Block *Configuration::Block::GetMutableBlock(const Anope::string &bname, int num)
|
||||
Configuration::Block *Configuration::Block::GetMutableBlock(const Anope::string &bname, size_t num)
|
||||
{
|
||||
std::pair<block_map::iterator, block_map::iterator> it = blocks.equal_range(bname);
|
||||
auto it = blocks.equal_range(bname);
|
||||
|
||||
for (int i = 0; it.first != it.second; ++it.first, ++i)
|
||||
for (size_t i = 0; it.first != it.second; ++it.first, ++i)
|
||||
{
|
||||
if (i == num)
|
||||
return &it.first->second;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -69,7 +78,7 @@ bool Configuration::Block::Set(const Anope::string &tag, const Anope::string &va
|
||||
return true;
|
||||
}
|
||||
|
||||
const Configuration::Block::item_map &Configuration::Block::GetItems() const
|
||||
const Configuration::Block::ItemMap &Configuration::Block::GetItems() const
|
||||
{
|
||||
return items;
|
||||
}
|
||||
@@ -125,10 +134,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
|
||||
this->LoadConf(ServicesConf);
|
||||
|
||||
for (int i = 0; i < this->CountBlock("include"); ++i)
|
||||
for (const auto &[_, include] : this->GetBlocks("include"))
|
||||
{
|
||||
const auto &include = this->GetBlock("include", i);
|
||||
|
||||
const Anope::string &type = include.Get<const Anope::string>("type"),
|
||||
&file = include.Get<const Anope::string>("name");
|
||||
|
||||
@@ -205,10 +212,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
this->TimeoutCheck = options.Get<time_t>("timeoutcheck");
|
||||
this->NickChars = networkinfo.Get<Anope::string>("nick_chars");
|
||||
|
||||
for (int i = 0; i < this->CountBlock("uplink"); ++i)
|
||||
for (const auto &[_, uplink] : this->GetBlocks("uplink"))
|
||||
{
|
||||
const auto &uplink = this->GetBlock("uplink", i);
|
||||
|
||||
int protocol;
|
||||
const Anope::string &protocolstr = uplink.Get<const Anope::string>("protocol", "ipv4");
|
||||
if (protocolstr == "ipv4")
|
||||
@@ -238,10 +243,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
this->Uplinks.emplace_back(host, port, password, protocol);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("module"); ++i)
|
||||
for (const auto &[_, module] : this->GetBlocks("module"))
|
||||
{
|
||||
const auto &module = this->GetBlock("module", i);
|
||||
|
||||
const Anope::string &modname = module.Get<const Anope::string>("name");
|
||||
|
||||
ValidateNotEmptyOrSpaces("module", "name", modname);
|
||||
@@ -249,10 +252,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
this->ModulesAutoLoad.push_back(modname);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("opertype"); ++i)
|
||||
for (const auto &[_, opertype] : this->GetBlocks("opertype"))
|
||||
{
|
||||
const auto &opertype = this->GetBlock("opertype", i);
|
||||
|
||||
const Anope::string &oname = opertype.Get<const Anope::string>("name"),
|
||||
&modes = opertype.Get<const Anope::string>("modes"),
|
||||
&inherits = opertype.Get<const Anope::string>("inherits"),
|
||||
@@ -292,10 +293,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
this->MyOperTypes.push_back(ot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("oper"); ++i)
|
||||
for (const auto &[_, oper] : this->GetBlocks("oper"))
|
||||
{
|
||||
const auto &oper = this->GetBlock("oper", i);
|
||||
|
||||
const Anope::string &nname = oper.Get<const Anope::string>("name"),
|
||||
&type = oper.Get<const Anope::string>("type"),
|
||||
&password = oper.Get<const Anope::string>("password"),
|
||||
@@ -330,10 +329,9 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
|
||||
for (const auto &[_, bi] : *BotListByNick)
|
||||
bi->conf = false;
|
||||
for (int i = 0; i < this->CountBlock("service"); ++i)
|
||||
{
|
||||
const auto &service = this->GetBlock("service", i);
|
||||
|
||||
for (const auto &[_, service] : this->GetBlocks("service"))
|
||||
{
|
||||
const Anope::string &nick = service.Get<const Anope::string>("nick"),
|
||||
&user = service.Get<const Anope::string>("user", nick.lower()),
|
||||
&host = service.Get<const Anope::string>("host", servername),
|
||||
@@ -421,10 +419,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("log"); ++i)
|
||||
for (const auto &[_, log] : this->GetBlocks("log"))
|
||||
{
|
||||
const auto &log = this->GetBlock("log", i);
|
||||
|
||||
int logage = log.Get<int>("logage");
|
||||
bool rawio = log.Get<bool>("rawio");
|
||||
bool debug = log.Get<bool>("debug");
|
||||
@@ -447,10 +443,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
|
||||
for (const auto &[_, bi] : *BotListByNick)
|
||||
bi->commands.clear();
|
||||
for (int i = 0; i < this->CountBlock("command"); ++i)
|
||||
for (const auto &[_, command] : this->GetBlocks("command"))
|
||||
{
|
||||
const auto &command = this->GetBlock("command", i);
|
||||
|
||||
const Anope::string &service = command.Get<const Anope::string>("service"),
|
||||
&nname = command.Get<const Anope::string>("name"),
|
||||
&cmd = command.Get<const Anope::string>("command"),
|
||||
@@ -472,10 +466,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
}
|
||||
|
||||
PrivilegeManager::ClearPrivileges();
|
||||
for (int i = 0; i < this->CountBlock("privilege"); ++i)
|
||||
for (const auto &[_, privilege] : this->GetBlocks("privilege"))
|
||||
{
|
||||
const auto &privilege = this->GetBlock("privilege", i);
|
||||
|
||||
const Anope::string &nname = privilege.Get<const Anope::string>("name"),
|
||||
&desc = privilege.Get<const Anope::string>("desc");
|
||||
int rank = privilege.Get<int>("rank");
|
||||
@@ -483,10 +475,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
PrivilegeManager::AddPrivilege(Privilege(nname, desc, rank));
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("fantasy"); ++i)
|
||||
for (const auto &[_, fantasy] : this->GetBlocks("fantasy"))
|
||||
{
|
||||
const auto &fantasy = this->GetBlock("fantasy", i);
|
||||
|
||||
const Anope::string &nname = fantasy.Get<const Anope::string>("name"),
|
||||
&service = fantasy.Get<const Anope::string>("command"),
|
||||
&permission = fantasy.Get<const Anope::string>("permission"),
|
||||
@@ -504,10 +494,8 @@ Configuration::Conf::Conf() : Configuration::Block("")
|
||||
c.require_privilege = fantasy.Get<bool>("require_privilege", "yes");
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("command_group"); ++i)
|
||||
for (const auto &[_, command_group] : this->GetBlocks("command_group"))
|
||||
{
|
||||
const auto &command_group = this->GetBlock("command_group", i);
|
||||
|
||||
const Anope::string &nname = command_group.Get<const Anope::string>("name"),
|
||||
&description = command_group.Get<const Anope::string>("description");
|
||||
|
||||
@@ -655,7 +643,7 @@ Configuration::Block &Configuration::Conf::GetModule(const Anope::string &mname)
|
||||
auto *&block = modules[mname];
|
||||
|
||||
/* Search for the block */
|
||||
for (std::pair<block_map::iterator, block_map::iterator> iters = blocks.equal_range("module"); iters.first != iters.second; ++iters.first)
|
||||
for (auto iters = blocks.equal_range("module"); iters.first != iters.second; ++iters.first)
|
||||
{
|
||||
auto &b = iters.first->second;
|
||||
|
||||
@@ -688,7 +676,7 @@ const Configuration::Block &Configuration::Conf::GetCommand(CommandSource &sourc
|
||||
{
|
||||
const Anope::string &block_name = source.c ? "fantasy" : "command";
|
||||
|
||||
for (std::pair<block_map::iterator, block_map::iterator> iters = blocks.equal_range(block_name); iters.first != iters.second; ++iters.first)
|
||||
for (auto iters = blocks.equal_range(block_name); iters.first != iters.second; ++iters.first)
|
||||
{
|
||||
auto &b = iters.first->second;
|
||||
|
||||
@@ -782,7 +770,7 @@ void Configuration::Conf::LoadConf(Configuration::File &file)
|
||||
|
||||
Anope::string itemname, wordbuffer;
|
||||
std::stack<Configuration::Block *> block_stack;
|
||||
int linenumber = 0;
|
||||
unsigned linenumber = 0;
|
||||
bool in_word = false, in_quote = false, in_comment = false;
|
||||
|
||||
Log(LOG_DEBUG) << "Start to read conf " << file.GetPath();
|
||||
@@ -984,7 +972,7 @@ void Configuration::Conf::LoadConf(Configuration::File &file)
|
||||
}
|
||||
}
|
||||
|
||||
Anope::string Configuration::Conf::ReplaceVars(const Anope::string &str, const Configuration::File &file, int linenumber)
|
||||
Anope::string Configuration::Conf::ReplaceVars(const Anope::string &str, const Configuration::File &file, unsigned linenumber)
|
||||
{
|
||||
Anope::string ret;
|
||||
for (auto it = str.begin(); it != str.end(); )
|
||||
@@ -1020,9 +1008,8 @@ Anope::string Configuration::Conf::ReplaceVars(const Anope::string &str, const C
|
||||
}
|
||||
|
||||
auto found = false;
|
||||
for (int i = 0; i < this->CountBlock("define"); ++i)
|
||||
for (const auto &[_, define] : this->GetBlocks("define"))
|
||||
{
|
||||
const auto &define = this->GetBlock("define", i);
|
||||
const auto defname = define.Get<const Anope::string>("name");
|
||||
if (defname == var)
|
||||
{
|
||||
|
||||
+2
-2
@@ -537,8 +537,8 @@ bool Anope::Init(int ac, char **av)
|
||||
|
||||
/* load modules */
|
||||
Log() << "Loading modules...";
|
||||
for (int i = 0; i < Config->CountBlock("module"); ++i)
|
||||
ModuleManager::LoadModule(Config->GetBlock("module", i).Get<const Anope::string>("name"), NULL);
|
||||
for (const auto &[_, block] : Config->GetBlocks("module"))
|
||||
ModuleManager::LoadModule(block.Get<const Anope::string>("name"), NULL);
|
||||
|
||||
#ifndef _WIN32
|
||||
/* If we're root, issue a warning now */
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ void Language::InitLanguages()
|
||||
Languages.push_back(language);
|
||||
}
|
||||
#else
|
||||
Log() << "Unable to initialize languages, gettext is not installed";
|
||||
Log() << "Unable to initialize languages, gettext and/or libintl were not installed at build time";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -50,13 +50,14 @@ class UpdateTimer final
|
||||
{
|
||||
public:
|
||||
UpdateTimer(time_t timeout)
|
||||
: Timer(timeout, true)
|
||||
: Timer(timeout)
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
Anope::SaveDatabases();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,13 +66,14 @@ class ExpireTimer final
|
||||
{
|
||||
public:
|
||||
ExpireTimer(time_t timeout)
|
||||
: Timer(timeout, true)
|
||||
: Timer(timeout)
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
FOREACH_MOD(OnExpireTick, ());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -686,7 +686,9 @@ Anope::string Anope::strftime(time_t t, const NickCore *nc, bool short_output)
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
strftime(buf, sizeof(buf), "%c", (nc ? localtime(&t) : gmtime(&t)));
|
||||
const auto *ts = nc ? localtime(&t) : gmtime(&t);
|
||||
if (!ts || !strftime(buf, sizeof(buf), "%c", ts))
|
||||
snprintf(buf, sizeof(buf), "(invalid timestamp)");
|
||||
|
||||
if (nc)
|
||||
{
|
||||
@@ -963,7 +965,7 @@ Anope::string Anope::VersionBuildString()
|
||||
flags += "G";
|
||||
#endif
|
||||
#if REPRODUCIBLE_BUILD
|
||||
flags += "R"
|
||||
flags += "R";
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
flags += "W";
|
||||
|
||||
@@ -88,10 +88,11 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Generate the filename for the temporary copy of the module */
|
||||
auto pbuf = Anope::ExpandData("runtime/" + modname + DLL_EXT ".XXXXXX");
|
||||
auto pbuf = Anope::ExpandData("runtime/" + modname + "." + Anope::ToString(Anope::CurTime) + DLL_EXT);
|
||||
if (!fs::copy_file(modpath.str(), pbuf.str(), fs::copy_options::overwrite_existing, ec) || ec)
|
||||
{
|
||||
Log(LOG_TERMINAL) << "Error while loading " << modname << ": " << ec.message();
|
||||
Log(LOG_TERMINAL) << "Error while copying " << modname << " from " << modpath
|
||||
<< " to " << pbuf << ": " << ec.message();
|
||||
return MOD_ERR_FILE_IO;
|
||||
}
|
||||
#else
|
||||
|
||||
+4
-16
@@ -17,20 +17,15 @@
|
||||
|
||||
std::multimap<time_t, Timer *> TimerManager::Timers;
|
||||
|
||||
Timer::Timer(time_t time_from_now, bool repeating)
|
||||
: trigger(Anope::CurTime + std::abs(time_from_now))
|
||||
, secs(time_from_now)
|
||||
, repeat(repeating)
|
||||
Timer::Timer(time_t time_from_now)
|
||||
: Timer(nullptr, time_from_now)
|
||||
{
|
||||
if (time_from_now)
|
||||
TimerManager::AddTimer(this);
|
||||
}
|
||||
|
||||
Timer::Timer(Module *creator, time_t time_from_now, bool repeating)
|
||||
Timer::Timer(Module *creator, time_t time_from_now)
|
||||
: owner(creator)
|
||||
, trigger(Anope::CurTime + std::abs(time_from_now))
|
||||
, secs(time_from_now)
|
||||
, repeat(repeating)
|
||||
{
|
||||
if (time_from_now)
|
||||
TimerManager::AddTimer(this);
|
||||
@@ -53,11 +48,6 @@ time_t Timer::GetTimer() const
|
||||
return trigger;
|
||||
}
|
||||
|
||||
bool Timer::GetRepeat() const
|
||||
{
|
||||
return repeat;
|
||||
}
|
||||
|
||||
void Timer::SetSecs(time_t t)
|
||||
{
|
||||
TimerManager::DelTimer(this);
|
||||
@@ -104,9 +94,7 @@ void TimerManager::TickTimers()
|
||||
if (t->GetTimer() > Anope::CurTime)
|
||||
break;
|
||||
|
||||
t->Tick();
|
||||
|
||||
if (t->GetRepeat())
|
||||
if (t->Tick())
|
||||
t->SetTimer(Anope::CurTime + t->GetSecs());
|
||||
else
|
||||
delete t;
|
||||
|
||||
@@ -47,11 +47,19 @@ algorithm = sys.argv[1]
|
||||
password = sys.argv[2] if len(sys.argv) >= 3 else getpass.getpass()
|
||||
|
||||
def do_argon2(variant, password):
|
||||
ph = argon2.PasswordHasher(type=variant)
|
||||
ph = argon2.PasswordHasher(
|
||||
time_cost=int(os.getenv("ARGON2_TIME_COST", 3)),
|
||||
memory_cost=int(os.getenv("ARGON2_TIME_COST", 131_072)),
|
||||
parallelism=int(os.getenv("ARGON2_PARALLELISM", 1)),
|
||||
hash_len=int(os.getenv("ARGON2_SALT_LENGTH", 32)),
|
||||
salt_len=int(os.getenv("ARGON2_HASH_LENGTH", 32)),
|
||||
type=variant,
|
||||
)
|
||||
return ph.hash(password)
|
||||
|
||||
def do_bcrypt(password):
|
||||
salt = bcrypt.gensalt(16)
|
||||
rounds = int(os.getenv("BCRYPT_ROUNDS", 10))
|
||||
salt = bcrypt.gensalt(rounds)
|
||||
return bcrypt.hashpw(password.encode('utf-8'), salt).decode('utf-8')
|
||||
|
||||
def do_hmac(digest, password):
|
||||
@@ -112,5 +120,8 @@ if config:
|
||||
token = "{password_hash}"
|
||||
token_hash = "{algorithm}"
|
||||
""").lstrip())
|
||||
else:
|
||||
print(f"The {algorithm} algorithm can not be used in an oper or a jsonrpc/xmlrpc token.")
|
||||
print()
|
||||
|
||||
print(f"Make sure you have the {module} module loaded!");
|
||||
|
||||
+2
-1
@@ -29,7 +29,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void Tick() override
|
||||
bool Tick() override
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
{
|
||||
Log(LOG_TERMINAL) << "Unable to connect to uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].str() << "): " << ex.GetReason();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -2,5 +2,5 @@
|
||||
|
||||
VERSION_MAJOR=2
|
||||
VERSION_MINOR=1
|
||||
VERSION_PATCH=24
|
||||
VERSION_EXTRA=""
|
||||
VERSION_PATCH=25
|
||||
VERSION_EXTRA="-git"
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
# Last updated: 2026-05-16
|
||||
|
||||
[requires]
|
||||
argon2/20190702
|
||||
libgettext/0.26
|
||||
libmysqlclient/8.1.0
|
||||
openssl/3.6.1
|
||||
openssl/3.6.2
|
||||
pcre2/10.44
|
||||
sqlite3/3.51.0
|
||||
sqlite3/3.53.1
|
||||
tre/cci.20230717
|
||||
|
||||
[tool_requires]
|
||||
gettext/0.26
|
||||
gettext/1.0
|
||||
|
||||
[options]
|
||||
*/*:shared=True
|
||||
|
||||
Reference in New Issue
Block a user