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

Compare commits

...

49 Commits

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

I assume that `mail` is the word that should replace `yes`
2024-09-01 09:41:32 +01:00
Sadie Powell 82993c8d1e Update the changelogs. 2024-08-30 14:49:43 +01:00
Sadie Powell d352718a39 Fix parsing named extbans on InspIRCd. 2024-08-30 14:49:39 +01:00
Sadie Powell d44632e57d Use CMake's -B option instead of cding to the build directory. 2024-08-30 14:48:31 +01:00
Sadie Powell 80451011dd Remove pointless semicolons in the config for the webcpanel module. 2024-08-29 13:40:39 +01:00
Sadie Powell b4e673b2f4 Refactor ns_getemail slightly. 2024-08-29 13:21:18 +01:00
Sadie Powell 58a78e9aa5 Allow server admins to require that a display nick drops last.
Closes #348.
2024-08-29 13:14:39 +01:00
Sadie Powell 6da4a148fa Fix translating mail:memo_message. 2024-08-24 12:27:05 +01:00
Sadie Powell a3edb09eda Use CanClearBans/SendClearBans when enforcing smartjoin. 2024-08-22 00:29:30 +01:00
Sadie Powell 27beb8f877 Improve the CTCP version output. 2024-08-21 15:38:35 +01:00
Sadie Powell 136680f917 Fix the grammar of some info messages. 2024-08-18 03:17:33 +01:00
Sadie Powell 378ae21ac7 Add account identifier to nickserv/info output. 2024-08-18 01:19:39 +01:00
Sadie Powell e35a86661d Remove support for MinGW.
All of our builds are fully native on Windows so there's no need
for this anymore.
2024-08-15 12:14:06 +01:00
Sadie Powell 528b5938ec Automatically determine SQL column type from the field.
Also add more column types to ensure we are storing data in the
best format in the database.
2024-08-14 05:47:55 +01:00
Sadie Powell 03bee17063 Remove the unused KeySet method in Serialize::Data. 2024-08-14 00:10:12 +01:00
Sadie Powell fe18050c49 Fix parsing SVSMODE and SVS2MODE messages on UnrealIRCd.
At some point UnrealIRCd made an undocumented change to the protocol
where the last parameter on a server-source message would not be a
timestamp. This behaviour is preserved for MODE.
2024-08-09 20:39:46 +01:00
Wilson Birney aa0496f69b Add <cstring> include to services.h to fix build on some musl systems.
Co-authored-by: blackbeard420 <blackbeard@blackbeard420.me>
2024-08-06 11:00:47 +01:00
Sadie Powell 4ee22ab05e Merge branch '2.0' into 2.1. 2024-07-28 22:50:30 +01:00
Sadie Powell 63ad540e55 Add a note to LANGUAGE about rebuilding from scratch. 2024-07-20 19:25:58 +01:00
Sadie Powell a1165eea94 Fix the type of the InspIRCd IJOIN chants when converting. 2024-07-20 19:25:58 +01:00
Sadie Powell bfca74f6b3 Bump for 2.0.17-git. 2024-07-19 13:24:41 +01:00
Sadie Powell 3acf74483c Release 2.0.16. 2024-07-19 12:49:56 +01:00
Sadie Powell a3ec8329f4 Document the previous commit. 2024-07-19 12:48:44 +01:00
Sadie Powell 7d0184ca34 Merge branch '2.0' into 2.1. 2024-07-19 01:43:41 +01:00
Sadie Powell 31bc597c81 Send the vhost/vident before the account name on InspIRCd.
This fixes IRCd-side account cloaks causing CHGHOST spam.
2024-07-19 01:11:32 +01:00
Sadie Powell e0b687f289 Merge branch '2.0' into 2.1. 2024-07-14 16:42:26 +01:00
Sadie Powell 2de0dddb1c Fix joining channels with keys on InspIRCd v3. 2024-07-14 16:39:37 +01:00
Sadie Powell ff65b68dfa Fix the name of the key parameter in SendSVSJoin. 2024-07-14 15:21:00 +01:00
Sadie Powell 94456a6063 Fix sending global messages to remotely linked servers. 2024-07-14 11:44:22 +01:00
Sadie Powell 41ea346551 Update the change log. 2024-07-11 01:13:59 +01:00
Sadie Powell 439ad3e736 Make it clear that inspircd3 also works with InspIRCd 4. 2024-07-11 01:13:59 +01:00
Sadie Powell 347d82f59b Qualify a use of auto in db_atheme. 2024-07-08 00:53:47 +01:00
Sadie Powell fe68f40634 Remove some obsolete echo compatibility wrappers. 2024-07-08 00:53:47 +01:00
ItsOnlyBinary 08b1344056 Add UNIX socket support to mysql module.
Ref: #419
2024-07-04 13:13:56 +01:00
Sadie Powell ff67a80a71 Bump for 2.1.8-git. 2024-07-01 10:08:16 +01:00
71 changed files with 623 additions and 451 deletions
+2 -18
View File
@@ -31,12 +31,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs OUTPUT_VARIABLE LINES OUTPUT_STRIP_TRAILING_WHITESPACE)
# Find only the part after "libraries: "
string(REGEX REPLACE ".*\nlibraries: (.*)$" "\\1" LINE "${LINES}")
# Replace the colons in the list with semicolons (only when not on MinGW, which uses semicolons already), and if on MinGW, just copy the line
if(NOT MINGW)
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
else()
set(LIBRARIES "${LINE}")
endif()
# Replace the colons in the list with semicolons
string(REGEX REPLACE ":" ";" LIBRARIES ${LINE})
# Iterate through the libraries
foreach(LIBRARY ${LIBRARIES})
# Check if the first character is an equal sign, and skip that library directory as it is (I believe) the primary default and shows up later in the list anyways
@@ -106,13 +102,6 @@ if(NOT MSVC)
endif()
endif()
# If running under MinGW, we have to force the resource compiler settings (hopefully this will be fixed in a later version of CMake)
if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> <SOURCE>")
endif()
# Include the checking functions used later in this CMakeLists.txt
include(CheckFunctionExists)
include(CheckTypeSize)
@@ -189,11 +178,6 @@ if(CMAKE_THREAD_LIBS_INIT)
list(APPEND LINK_LIBS ${CMAKE_THREAD_LIBS_INIT})
endif()
# Under MinGW, the -shared flag isn't properly set in the module-specific linker flags, add it from the C flags for shared libraries
if(MINGW)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}")
endif()
if(NOT PROGRAM_NAME)
set(PROGRAM_NAME anope)
endif()
+18 -43
View File
@@ -13,10 +13,6 @@
#
###########################################################################
echo2 () {
$ECHO2 "$*$ECHO2SUF" # these are defined later
}
exists () { # because some shells don't have test -e
if [ -f $1 -o -d $1 -o -p $1 -o -c $1 -o -b $1 ] ; then
return 0
@@ -42,7 +38,6 @@ Run_Build_System () {
WITH_PERM=""
EXTRA_INCLUDE=""
EXTRA_LIBS=""
GEN_TYPE=""
if [ "$INSTDIR" != "" ] ; then
WITH_INST="-DINSTDIR:STRING=$INSTDIR"
@@ -70,45 +65,25 @@ Run_Build_System () {
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
fi
if [ "$SOURCE_DIR" = "." ] ; then
pwdsave=`pwd`
test -d build || mkdir build
cd "build"
REAL_SOURCE_DIR=".."
else
REAL_SOURCE_DIR="$SOURCE_DIR"
fi
BUILD_PATHS="-B ${SOURCE_DIR}/build ${SOURCE_DIR}"
echo "cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR"
CMAKE="cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $BUILD_PATHS"
echo $CMAKE
$CMAKE
cmake $GEN_TYPE $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $EXTRA_INCLUDE $EXTRA_LIBS $EXTRA_CONFIG_ARGS $REAL_SOURCE_DIR
if [ $? -ne 0 ]; then
echo "You should fix these issues and then run ./Config -quick to rerun CMake."
exit 1
fi
echo ""
if [ "$SOURCE_DIR" = "." ] ; then
echo "Now cd build, then run make to build Anope."
cd "$pwdsave"
else
if [ "$PWD" = "${SOURCE_DIR}/build" ]; then
echo "Now run make to build Anope."
else
echo "Now cd build, then run make to build Anope."
fi
}
ECHO2SUF=''
if [ "`echo -n a ; echo -n b`" = "ab" ] ; then
ECHO2='echo -n'
elif [ "`echo 'a\c' ; echo 'b\c'`" = "ab" ] ; then
ECHO2='echo' ; ECHO2SUF='\c'
elif [ "`printf 'a' 2>&1 ; printf 'b' 2>&1`" = "ab" ] ; then
ECHO2='printf "%s"'
else
# oh well...
ECHO2='echo'
fi
export ECHO2 ECHO2SUF
###########################################################################
# Init values
###########################################################################
@@ -121,7 +96,7 @@ EXTRA_INCLUDE_DIRS=
EXTRA_LIB_DIRS=
EXTRA_CONFIG_ARGS=
CAN_QUICK="no"
SOURCE_DIR=`dirname $0`
SOURCE_DIR="$(cd "$(dirname "$0")" && pwd)"
###########################################################################
# Check out the options
@@ -138,7 +113,7 @@ while [ $# -ge 1 ] ; do
exit 0
elif [ $1 = "-devel" ] ; then
DEBUG="yes"
INSTDIR="$PWD/run"
INSTDIR="$SOURCE_DIR/run"
elif [ $1 = "-nocache" ] ; then
IGNORE_CACHE="1"
elif [ $1 = "-nointro" ] ; then
@@ -199,7 +174,7 @@ export ok INPUT
ok=0
echo "In what directory should Anope be installed?"
while [ $ok -eq 0 ] ; do
echo2 "[$INSTDIR] "
echo -n "[$INSTDIR] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
INPUT=$INSTDIR
@@ -209,7 +184,7 @@ while [ $ok -eq 0 ] ; do
echo "$INPUT exists, but is not a directory!"
else
echo "$INPUT does not exist. Create it?"
echo2 "[y] "
echo -n "[y] "
read YN
if [ "$YN" != "n" ] ; then
if mkdir -p $INPUT ; then
@@ -238,7 +213,7 @@ else
echo "should not force files to be owned by a particular group, just press"
echo "Return.)"
fi
echo2 "[$RUNGROUP] "
echo -n "[$RUNGROUP] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "none" ] ; then
@@ -263,7 +238,7 @@ ok=0
echo "What should the default umask for data files be (in octal)?"
echo "(077 = only accessible by owner; 007 = accessible by owner and group)"
while [ $ok -eq 0 ] ; do
echo2 "[$UMASK] "
echo -n "[$UMASK] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
INPUT=$UMASK
@@ -287,7 +262,7 @@ if [ "$DEBUG" = "yes" ] ; then
TEMP_YN="y"
fi
echo "Would you like to build a debug version of Anope?"
echo2 "[$TEMP_YN] "
echo -n "[$TEMP_YN] "
read YN
if [ "$YN" ] ; then
if [ "$YN" = "y" ] ; then
@@ -305,7 +280,7 @@ echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "Separate directories with semicolons."
echo "If you need no extra include directories, enter NONE in all caps."
echo2 "[$EXTRA_INCLUDE_DIRS] "
echo -n "[$EXTRA_INCLUDE_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -323,7 +298,7 @@ echo "You may only need to do this if CMake is unable to locate"
echo "missing dependencies without hints."
echo "Separate directories with semicolons."
echo "If you need no extra library directories, enter NONE in all caps."
echo2 "[$EXTRA_LIB_DIRS] "
echo -n "[$EXTRA_LIB_DIRS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -338,7 +313,7 @@ echo ""
echo "Are there any extra arguments you wish to pass to CMake?"
echo "If you need no extra arguments to CMake, enter NONE in all caps."
echo2 "[$EXTRA_CONFIG_ARGS] "
echo -n "[$EXTRA_CONFIG_ARGS] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
if [ "$INPUT" = "NONE" ] ; then
@@ -355,7 +330,7 @@ echo ""
# Store values
################################################################################
echo2 "Saving configuration results in config.cache... "
echo -n "Saving configuration results in config.cache... "
cat <<EOT >$SOURCE_DIR/config.cache
INSTDIR="$INSTDIR"
+2 -9
View File
@@ -414,12 +414,6 @@ options
*/
readtimeout = 5s
/*
* Sets the interval between sending warning messages for program errors via
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/*
* Sets the (maximum) frequency at which the timeout list is checked. This,
* combined with readtimeout above, determines how accurately timed events,
@@ -746,6 +740,7 @@ log
* nickserv/cert - Can modify other users certificate lists
* nickserv/confirm - Can confirm other users nicknames
* nickserv/drop - Can drop other users nicks
* nickserv/drop/display - Allows dropping display nicks when preservedisplay is enabled
* nickserv/drop/override - Allows dropping nicks without using a confirmation code
* nickserv/recover - Can recover other users nicks
* operserv/config - Can modify services's configuration
@@ -822,8 +817,6 @@ opertype
*
* This can be used to automatically oper users who identify for services operator accounts, and is
* useful for setting modes such as Plexus's user mode +N.
*
* Note that some IRCds, such as InspIRCd, do not allow directly setting +o, and this will not work.
*/
#modes = "+o"
}
@@ -915,7 +908,7 @@ mail
* If set, this option enables the mail commands in Anope. You may choose
* to disable it if you have no Sendmail-compatible mailer installed. Whilst
* this directive (and entire block) is optional, it is required if
* nickserv:registration is set to yes.
* nickserv:registration is set to mail.
*/
usemail = yes
+5 -4
View File
@@ -372,6 +372,7 @@ module { name = "help" }
username = "anope"
password = "mypassword"
port = 3306
socket = ""
}
}
@@ -754,7 +755,7 @@ module { name = "sasl" }
name = "sqlite/main"
/* The database name, it will be created if it does not exist. */
database = "anope.db"
database = "anope.sqlite"
}
}
@@ -772,16 +773,16 @@ module { name = "sasl" }
name = "webcpanel"
/* Web server to use. */
server = "httpd/main";
server = "httpd/main"
/*
* The directory containing the webcpanel templates. This is relative to the
* data directory.
*/
template_dir = "webcpanel/templates/default";
template_dir = "webcpanel/templates/default"
/* Page title. */
title = "Anope IRC Services";
title = "Anope IRC Services"
}
/*
+8 -2
View File
@@ -124,9 +124,9 @@ module
/*
* The length of time before a nick's registration expires.
*
* This directive is optional, but recommended. If not set, the default is 90 days.
* This directive is optional, but recommended. If not set, the default is one year.
*/
expire = 90d
expire = 1y
/*
* Prevents the use of the ACCESS and CERT (excluding their LIST subcommand), DROP, FORBID, SUSPEND
@@ -219,6 +219,12 @@ module
* This directive is optional. If not set it defaults to 50.
*/
maxpasslen = 50
/*
* Whether all of the secondary nicks of a nick group have to expire or be
dropped before the display nick can expire or be dropped.
*/
preservedisplay = no
}
/*
-6
View File
@@ -371,12 +371,6 @@ options
*/
readtimeout = 5s
/*
* Sets the interval between sending warning messages for program errors via
* WALLOPS/GLOBOPS.
*/
warningtimeout = 4h
/*
* If set, Anope will only show /stats o to IRC Operators. This directive
* is optional.
+23
View File
@@ -1,3 +1,26 @@
Anope Version 2.1.9
-------------------
Bumped the minimum supported version of UnrealIRCd to 6.
Fixed granting IRC operator status to services operators.
Fixed making users an IRC operator on InspIRCd.
Fixed nonicknameownership on InspIRCd v4.
Fixed some messages not being translatable.
Fixed the Argon2 module not having test vectors.
Increased the default nickname expiry period to one year.
Anope Version 2.1.8
-------------------
Added account identifiers to the nickserv/info output.
Added support for bool, float, and uint SQL columns.
Added the ability to automatically determine SQL column types based on the native type.
Added UNIX socket support to mysql module.
Changed smartjoin to use SendClearBans where available.
Dropped support for MinGW in favour of native builds.
Fixed parsing named extbans on InspIRCd.
Fixed parsing SVSMODE and SVS2MODE from UnrealIRCd.
Fixed sending global messages to remotely linked servers.
Removed the services server name from the CTCP version response.
Anope Version 2.1.7
-------------------
Added importing of akick reasons, forbid reasons, opers and session exceptions to db_atheme.
+9
View File
@@ -1,3 +1,12 @@
Anope Version 2.1.9
-------------------
No significant changes.
Anope Version 2.1.8
-------------------
Added module:preservedisplay to the nickserv module.
Added the nickserv/drop/display oper privilege.
Anope Version 2.1.7
-------------------
Moved nickserv/set/language and nickserv/saset/language to the ns_set_language module.
+2
View File
@@ -19,6 +19,8 @@ Anope Multi Language Support
Then execute:
dpkg-reconfigure locales
If you have already built Anope you will need to delete the build directory and rebuild from scratch.
Building Anope on Windows with gettext support is explained in docs/WIN32.txt
2) Adding a new language
+1 -1
View File
@@ -173,7 +173,7 @@ Table of Contents
* Plexus 3 or later
* Ratbox 2.0.6 or later
* Solanum (all versions)
* UnrealIRCd 4 or later
* UnrealIRCd 6 or later
Anope could also work with some of the daemons derived by the ones listed
above, but there's no support for them if they work or don't work.
+2 -3
View File
@@ -173,7 +173,7 @@ public:
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
T *t = this->Get(e);
data[this->name] << *t;
data.Store(this->name, *t);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
@@ -194,8 +194,7 @@ public:
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override
{
data.SetType(this->name, Serialize::Data::DT_INT);
data[this->name] << true;
data.Store(this->name, true);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
+1 -1
View File
@@ -108,7 +108,7 @@ namespace Language
#define CHAN_SETTING_CHANGED _("%s for %s set to %s.")
#define CHAN_SETTING_UNSET _("%s for %s unset.")
#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.")
#define CHAN_INFO_HEADER _("Information for channel \002%s\002:")
#define CHAN_INFO_HEADER _("Information about channel \002%s\002:")
#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.")
#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \
"Type \002%s%s READ %s %zu\002 to read it.")
+2 -2
View File
@@ -16,8 +16,8 @@ struct MyOper final
void Serialize(Serialize::Data &data) const override
{
data["name"] << this->name;
data["type"] << this->ot->GetName();
data.Store("name", this->name);
data.Store("type", this->ot->GetName());
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+6 -6
View File
@@ -62,12 +62,12 @@ static ServiceReference<SessionService> session_service("SessionService", "sessi
void Exception::Serialize(Serialize::Data &data) const
{
data["mask"] << this->mask;
data["limit"] << this->limit;
data["who"] << this->who;
data["reason"] << this->reason;
data["time"] << this->time;
data["expires"] << this->expires;
data.Store("mask", this->mask);
data.Store("limit", this->limit);
data.Store("who", this->who);
data.Store("reason", this->reason);
data.Store("time", this->time);
data.Store("expires", this->expires);
}
Serializable *Exception::Unserialize(Serializable *obj, Serialize::Data &data)
+6 -14
View File
@@ -19,7 +19,7 @@ namespace SQL
public:
typedef std::map<Anope::string, std::stringstream *> Map;
Map data;
std::map<Anope::string, Type> types;
std::map<Anope::string, Serialize::DataType> types;
~Data()
{
@@ -34,14 +34,6 @@ namespace SQL
return *ss;
}
std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (const auto &[key, _] : this->data)
keys.insert(key);
return keys;
}
size_t Hash() const override
{
size_t hash = 0;
@@ -68,17 +60,17 @@ namespace SQL
this->data.clear();
}
void SetType(const Anope::string &key, Type t) override
void SetType(const Anope::string &key, Serialize::DataType dt) override
{
this->types[key] = t;
this->types[key] = dt;
}
Type GetType(const Anope::string &key) const override
Serialize::DataType GetType(const Anope::string &key) const override
{
std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
auto it = this->types.find(key);
if (it != this->types.end())
return it->second;
return DT_TEXT;
return Serialize::DataType::TEXT;
}
};
+2 -2
View File
@@ -240,9 +240,9 @@ public:
* @param bi The source of the message
* @param u The user to join
* @param chan The channel to join the user to
* @param param Channel key?
* @param key Channel key
*/
virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) { }
virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) { }
/** Force parts a user that isn't ours from a channel.
* @param source The source of the message
+30 -9
View File
@@ -18,23 +18,44 @@
namespace Serialize
{
enum class DataType
: uint8_t
{
BOOL,
FLOAT,
INT,
TEXT,
UINT,
};
class Data
{
public:
enum Type
{
DT_TEXT,
DT_INT
};
virtual ~Data() = default;
virtual std::iostream &operator[](const Anope::string &key) = 0;
virtual std::set<Anope::string> KeySet() const { throw CoreException("Not supported"); }
template <typename T>
void Store(const Anope::string &key, const T &value)
{
using Type = std::remove_cv_t<std::remove_reference_t<T>>;
if constexpr (std::is_same_v<Type, bool>)
SetType(key, DataType::BOOL);
else if constexpr (std::is_floating_point_v<Type>)
SetType(key, DataType::FLOAT);
else if constexpr (std::is_integral_v<Type> && std::is_signed_v<Type>)
SetType(key, DataType::INT);
else if constexpr (std::is_integral_v<Type> && std::is_unsigned_v<Type>)
SetType(key, DataType::UINT);
this->operator[](key) << value;
}
virtual size_t Hash() const { throw CoreException("Not supported"); }
virtual void SetType(const Anope::string &key, Type t) { }
virtual Type GetType(const Anope::string &key) const { return DT_TEXT; }
virtual void SetType(const Anope::string &key, DataType dt) { }
virtual DataType GetType(const Anope::string &key) const { return DataType::TEXT; }
};
extern void RegisterTypes();
+1
View File
@@ -16,6 +16,7 @@
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
+21 -6
View File
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Anope\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-23 14:15+0100\n"
"PO-Revision-Date: 2024-06-23 14:16+0100\n"
"POT-Creation-Date: 2024-09-26 13:24+0100\n"
"PO-Revision-Date: 2024-09-26 13:25+0100\n"
"Last-Translator: Sadie Powell <sadie@witchery.services>\n"
"Language-Team: English\n"
"Language: en_US\n"
@@ -1812,6 +1812,9 @@ msgstr "Account"
msgid "Account %s has already reached the maximum number of simultaneous logins (%u)."
msgstr "Account %s has already reached the maximum number of simultaneous logins (%u)."
msgid "Account id"
msgstr "Account id"
msgid "Account registered"
msgstr "Account registered"
@@ -2954,6 +2957,14 @@ msgstr ""
"become the new founder, but if the access list is empty, the\n"
"channel will be dropped."
#, c-format
msgid "Changing your usermodes to %s"
msgstr "Changing your usermodes to %s"
#, c-format
msgid "Changing your vhost to %s"
msgstr "Changing your vhost to %s"
msgid "Channel"
msgstr "Channel"
@@ -4194,12 +4205,12 @@ msgid "Info about a loaded module"
msgstr "Info about a loaded module"
#, c-format
msgid "Information for bot %s:"
msgstr "Information for bot %s:"
msgid "Information about bot %s:"
msgstr "Information about bot %s:"
#, c-format
msgid "Information for channel %s:"
msgstr "Information for channel %s:"
msgid "Information about channel %s:"
msgstr "Information about channel %s:"
#, c-format
msgid "Invalid duration %s, using %d days."
@@ -8491,6 +8502,10 @@ msgstr "You may not change the email of other Services Operators."
msgid "You may not change the password of other Services Operators."
msgstr "You may not change the password of other Services Operators."
#, c-format
msgid "You may not drop %s as it is the display nick for the account."
msgstr "You may not drop %s as it is the display nick for the account."
msgid "You may not drop other Services Operators' nicknames."
msgstr "You may not drop other Services Operators' nicknames."
+13 -5
View File
@@ -57,12 +57,20 @@ public:
BotInfo *bi = user->server == Me ? dynamic_cast<BotInfo *>(user) : NULL;
if (bi && Config->GetModule(this)->Get<bool>("smartjoin"))
{
/* We check for bans */
for (const auto &entry : c->GetModeList("BAN"))
if (IRCD->CanClearBans)
{
Entry ban("BAN", entry);
if (ban.Matches(user))
c->RemoveMode(NULL, "BAN", ban.GetMask());
// We can ask the IRCd to clear bans.
IRCD->SendClearBans(bi, c, bi);
}
else
{
// We have to check for bans.
for (const auto &entry : c->GetModeList("BAN"))
{
Entry ban("BAN", entry);
if (ban.Matches(user))
c->RemoveMode(NULL, "BAN", ban.GetMask());
}
}
Anope::string Limit;
+3 -3
View File
@@ -21,9 +21,9 @@ struct BadWordImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << this->chan;
data["word"] << this->word;
data.SetType("type", Serialize::Data::DT_INT); data["type"] << this->type;
data.Store("ci", this->chan);
data.Store("word", this->word);
data.Store("type", this->type);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &);
+1 -1
View File
@@ -50,7 +50,7 @@ public:
if (bi)
{
source.Reply(_("Information for bot \002%s\002:"), bi->nick.c_str());
source.Reply(_("Information about bot \002%s\002:"), bi->nick.c_str());
info[_("Mask")] = bi->GetIdent() + "@" + bi->host;
info[_("Real name")] = bi->realname;
info[_("Created")] = Anope::strftime(bi->created, source.GetAccount());
+21 -18
View File
@@ -53,25 +53,28 @@ struct KickerDataImpl final
if (kd == NULL)
return;
data.SetType("kickerdata:amsgs", Serialize::Data::DT_INT); data["kickerdata:amsgs"] << kd->amsgs;
data.SetType("kickerdata:badwords", Serialize::Data::DT_INT); data["kickerdata:badwords"] << kd->badwords;
data.SetType("kickerdata:bolds", Serialize::Data::DT_INT); data["kickerdata:bolds"] << kd->bolds;
data.SetType("kickerdata:caps", Serialize::Data::DT_INT); data["kickerdata:caps"] << kd->caps;
data.SetType("kickerdata:colors", Serialize::Data::DT_INT); data["kickerdata:colors"] << kd->colors;
data.SetType("kickerdata:flood", Serialize::Data::DT_INT); data["kickerdata:flood"] << kd->flood;
data.SetType("kickerdata:italics", Serialize::Data::DT_INT); data["kickerdata:italics"] << kd->italics;
data.SetType("kickerdata:repeat", Serialize::Data::DT_INT); data["kickerdata:repeat"] << kd->repeat;
data.SetType("kickerdata:reverses", Serialize::Data::DT_INT); data["kickerdata:reverses"] << kd->reverses;
data.SetType("kickerdata:underlines", Serialize::Data::DT_INT); data["kickerdata:underlines"] << kd->underlines;
data.SetType("capsmin", Serialize::Data::DT_INT); data["capsmin"] << kd->capsmin;
data.SetType("capspercent", Serialize::Data::DT_INT); data["capspercent"] << kd->capspercent;
data.SetType("floodlines", Serialize::Data::DT_INT); data["floodlines"] << kd->floodlines;
data.SetType("floodsecs", Serialize::Data::DT_INT); data["floodsecs"] << kd->floodsecs;
data.SetType("repeattimes", Serialize::Data::DT_INT); data["repeattimes"] << kd->repeattimes;
data.SetType("dontkickops", Serialize::Data::DT_INT); data["dontkickops"] << kd->dontkickops;
data.SetType("dontkickvoices", Serialize::Data::DT_INT); data["dontkickvoices"] << kd->dontkickvoices;
data.Store("kickerdata:amsgs", kd->amsgs);
data.Store("kickerdata:badwords", kd->badwords);
data.Store("kickerdata:bolds", kd->bolds);
data.Store("kickerdata:caps", kd->caps);
data.Store("kickerdata:colors", kd->colors);
data.Store("kickerdata:flood", kd->flood);
data.Store("kickerdata:italics", kd->italics);
data.Store("kickerdata:repeat", kd->repeat);
data.Store("kickerdata:reverses", kd->reverses);
data.Store("kickerdata:underlines", kd->underlines);
data.Store("capsmin", kd->capsmin);
data.Store("capspercent", kd->capspercent);
data.Store("floodlines", kd->floodlines);
data.Store("floodsecs", kd->floodsecs);
data.Store("repeattimes", kd->repeattimes);
data.Store("dontkickops", kd->dontkickops);
data.Store("dontkickvoices", kd->dontkickvoices);
std::ostringstream oss;
for (auto ttbtype : kd->ttb)
data["ttb"] << ttbtype << " ";
oss << ttbtype << " ";
data.Store("ttb", oss.str());
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
+4 -4
View File
@@ -32,10 +32,10 @@ struct EntryMsgImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << this->chan;
data["creator"] << this->creator;
data["message"] << this->message;
data.SetType("when", Serialize::Data::DT_INT); data["when"] << this->when;
data.Store("ci", this->chan);
data.Store("creator", this->creator);
data.Store("message", this->message);
data.Store("when", this->when);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+8 -8
View File
@@ -37,14 +37,14 @@ struct LogSettingImpl final
void Serialize(Serialize::Data &data) const override
{
data["ci"] << chan;
data["service_name"] << service_name;
data["command_service"] << command_service;
data["command_name"] << command_name;
data["method"] << method;
data["extra"] << extra;
data["creator"] << creator;
data.SetType("created", Serialize::Data::DT_INT); data["created"] << created;
data.Store("ci", chan);
data.Store("service_name", service_name);
data.Store("command_service", command_service);
data.Store("command_name", command_name);
data.Store("method", method);
data.Store("extra", extra);
data.Store("creator", creator);
data.Store("created", created);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+6 -6
View File
@@ -205,12 +205,12 @@ struct ModeLocksImpl final
void ModeLockImpl::Serialize(Serialize::Data &data) const
{
data["ci"] << this->ci;
data["set"] << this->set;
data["name"] << this->name;
data["param"] << this->param;
data["setter"] << this->setter;
data.SetType("created", Serialize::Data::DT_INT); data["created"] << this->created;
data.Store("ci", this->ci);
data.Store("set", this->set);
data.Store("name", this->name);
data.Store("param", this->param);
data.Store("setter", this->setter);
data.Store("created", this->created);
}
Serializable *ModeLockImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+7 -7
View File
@@ -46,13 +46,13 @@ struct SeenInfo final
void Serialize(Serialize::Data &data) const override
{
data["nick"] << nick;
data["vhost"] << vhost;
data["type"] << type;
data["nick2"] << nick2;
data["channel"] << channel;
data["message"] << message;
data.SetType("last", Serialize::Data::DT_INT); data["last"] << last;
data.Store("nick", nick);
data.Store("vhost", vhost);
data.Store("type", type);
data.Store("nick2", nick2);
data.Store("channel", channel);
data.Store("message", message);
data.Store("last", last);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+1 -1
View File
@@ -1068,7 +1068,7 @@ class CSSet final
if (!last_value.empty())
modes += "," + last_value;
}
data["last_modes"] << modes;
data.Store("last_modes", modes);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
+3 -3
View File
@@ -46,9 +46,9 @@ struct CSMiscData final
void Serialize(Serialize::Data &sdata) const override
{
sdata["ci"] << this->object;
sdata["name"] << this->name;
sdata["data"] << this->data;
sdata.Store("ci", this->object);
sdata.Store("name", this->name);
sdata.Store("data", this->data);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+5 -5
View File
@@ -20,11 +20,11 @@ struct CSSuspendInfo final
void Serialize(Serialize::Data &data) const override
{
data["chan"] << what;
data["by"] << by;
data["reason"] << reason;
data["time"] << when;
data["expires"] << expires;
data.Store("chan", what);
data.Store("by", by);
data.Store("reason", reason);
data.Store("time", when);
data.Store("expires", expires);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+1 -1
View File
@@ -1393,7 +1393,7 @@ private:
return false;
}
auto ot = OperType::Find(type);
auto *ot = OperType::Find(type);
if (!ot)
{
// Attempt to convert oper types.
-8
View File
@@ -71,14 +71,6 @@ public:
return this->ss;
}
std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (const auto &[key, _]: this->data)
keys.insert(key);
return keys;
}
size_t Hash() const override
{
size_t hash = 0;
-8
View File
@@ -34,14 +34,6 @@ public:
return *stream;
}
std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (const auto &[key, _] : this->data)
keys.insert(key);
return keys;
}
size_t Hash() const override
{
size_t hash = 0;
+12 -1
View File
@@ -139,8 +139,19 @@ public:
, argon2dprovider(this, Argon2_d)
, argon2iprovider(this, Argon2_i)
, argon2idprovider(this, Argon2_id)
{
argon2dprovider.Check({
{ "$argon2d$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$fNS8JrvE8EqKwQ", "" },
{ "$argon2d$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$hTvpprMF0TwszQ", "The quick brown fox jumps over the lazy dog" },
});
argon2iprovider.Check({
{ "$argon2i$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$neE6hYxRp4TCJA", "" },
{ "$argon2i$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$/JAt4FdP1MFD+A", "The quick brown fox jumps over the lazy dog" },
});
argon2idprovider.Check({
{ "$argon2id$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$wuNeHixFDS6Tkg", "" },
{ "$argon2id$v=19$m=10,t=10,p=1$VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw$Po8RcmxZ7vHmdg", "The quick brown fox jumps over the lazy dog" },
});
}
void OnReload(Configuration::Conf *conf) override
+60 -21
View File
@@ -121,6 +121,7 @@ class MySQLService final
Anope::string user;
Anope::string password;
unsigned int port;
Anope::string socket;
MYSQL *sql = nullptr;
@@ -136,7 +137,7 @@ public:
*/
std::mutex Lock;
MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, unsigned int po);
MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, unsigned int po, const Anope::string &so);
~MySQLService();
@@ -157,6 +158,29 @@ public:
Anope::string BuildQuery(const Query &q);
Anope::string FromUnixtime(time_t) override;
Anope::string GetColumnType(Serialize::DataType dt)
{
switch (dt)
{
case Serialize::DataType::BOOL:
return "TINYINT NOT NULL";
case Serialize::DataType::FLOAT:
return "DOUBLE PRECISION NOT NULL";
case Serialize::DataType::INT:
return "BIGINT NOT NULL";
case Serialize::DataType::TEXT:
return "TEXT";
case Serialize::DataType::UINT:
return "BIGINT UNSIGNED NOT NULL";
}
return "TEXT"; // Should never be reached
}
};
/** The SQL thread used to execute queries
@@ -248,13 +272,14 @@ public:
const Anope::string &user = block->Get<const Anope::string>("username", "anope");
const Anope::string &password = block->Get<const Anope::string>("password");
unsigned int port = block->Get<unsigned int>("port", "3306");
const Anope::string &socket = block->Get<const Anope::string>("socket");
try
{
auto *ss = new MySQLService(this, connname, database, server, user, password, port);
auto *ss = new MySQLService(this, connname, database, server, user, password, port, socket);
this->MySQLServices.emplace(connname, ss);
Log(LOG_NORMAL, "mysql") << "MySQL: Successfully connected to server " << connname << " (" << server << ")";
Log(LOG_NORMAL, "mysql") << "MySQL: Successfully connected to server " << connname << " (" << (socket.empty() ? server + ":" + port : socket) << ")";
}
catch (const SQL::Exception &ex)
{
@@ -309,13 +334,14 @@ public:
}
};
MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, unsigned int po)
MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, unsigned int po, const Anope::string &so)
: Provider(o, n)
, database(d)
, server(s)
, user(u)
, password(p)
, port(po)
, socket(so)
{
Connect();
}
@@ -407,17 +433,13 @@ std::vector<Query> MySQLService::CreateTable(const Anope::string &table, const D
if (known_cols.empty())
{
Anope::string query_text = "CREATE TABLE `" + table + "` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT,"
Anope::string query_text = "CREATE TABLE `" + table + "` (`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,"
" `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP";
for (const auto &[column, _] : data.data)
{
known_cols.insert(column);
query_text += ", `" + column + "` ";
if (data.GetType(column) == Serialize::Data::DT_INT)
query_text += "int";
else
query_text += "text";
query_text += ", `" + column + "` " + GetColumnType(data.GetType(column));
}
query_text += ", PRIMARY KEY (`id`), KEY `timestamp_idx` (`timestamp`)) ROW_FORMAT=DYNAMIC";
queries.push_back(query_text);
@@ -431,11 +453,7 @@ std::vector<Query> MySQLService::CreateTable(const Anope::string &table, const D
known_cols.insert(column);
Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + column + "` ";
if (data.GetType(column) == Serialize::Data::DT_INT)
query_text += "int";
else
query_text += "text";
Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + column + "` " + GetColumnType(data.GetType(column));
queries.push_back(query_text);
}
@@ -471,11 +489,29 @@ Query MySQLService::BuildInsert(const Anope::string &table, unsigned int id, Dat
Anope::string buf;
*value >> buf;
bool escape = true;
if (buf.empty())
auto escape = true;
switch (data.GetType(field))
{
buf = "NULL";
escape = false;
case Serialize::DataType::BOOL:
case Serialize::DataType::FLOAT:
case Serialize::DataType::INT:
case Serialize::DataType::UINT:
{
if (buf.empty())
buf = "0";
escape = false;
break;
}
case Serialize::DataType::TEXT:
{
if (buf.empty())
{
buf = "NULL";
escape = false;
}
break;
}
}
query.SetValue(field, buf, escape);
@@ -496,12 +532,15 @@ void MySQLService::Connect()
const unsigned int timeout = 1;
mysql_options(this->sql, MYSQL_OPT_CONNECT_TIMEOUT, reinterpret_cast<const char *>(&timeout));
bool connect = mysql_real_connect(this->sql, this->server.c_str(), this->user.c_str(), this->password.c_str(), this->database.c_str(), this->port, NULL, CLIENT_MULTI_RESULTS);
bool connect = mysql_real_connect(this->sql, this->server.c_str(), this->user.c_str(), this->password.c_str(), this->database.c_str(), this->port, this->socket.empty() ? nullptr : this->socket.c_str(), CLIENT_MULTI_RESULTS);
if (!connect)
throw SQL::Exception("Unable to connect to MySQL service " + this->name + ": " + mysql_error(this->sql));
Log(LOG_DEBUG) << "Successfully connected to MySQL service " << this->name << " at " << this->server << ":" << this->port;
if (this->socket.empty())
Log(LOG_DEBUG) << "Successfully connected to MySQL service " << this->name << " at " << this->server << ":" << this->port;
else
Log(LOG_DEBUG) << "Successfully connected to MySQL service " << this->name << " at " << this->socket;
}
+54 -11
View File
@@ -68,6 +68,31 @@ public:
Anope::string BuildQuery(const Query &q);
Anope::string FromUnixtime(time_t) override;
Anope::string GetColumnType(Serialize::DataType dt)
{
switch (dt)
{
case Serialize::DataType::BOOL:
return "INTEGER";
case Serialize::DataType::FLOAT:
return "REAL";
case Serialize::DataType::INT:
return "INTEGER";
case Serialize::DataType::TEXT:
return "TEXT";
// SQLite lacks support for 64-bit unsigned integers so we have to
// store them as text columns instead.
case Serialize::DataType::UINT:
return "TEXT";
}
return "TEXT"; // Should never be reached
}
};
class ModuleSQLite final
@@ -237,11 +262,7 @@ std::vector<Query> SQLiteService::CreateTable(const Anope::string &table, const
{
known_cols.insert(column);
query_text += ", `" + column + "` ";
if (data.GetType(column) == Serialize::Data::DT_INT)
query_text += "int(11)";
else
query_text += "text";
query_text += ", `" + column + "` " + GetColumnType(data.GetType(column));
}
query_text += ")";
@@ -266,11 +287,7 @@ std::vector<Query> SQLiteService::CreateTable(const Anope::string &table, const
known_cols.insert(column);
Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + column + "` ";
if (data.GetType(column) == Serialize::Data::DT_INT)
query_text += "int(11)";
else
query_text += "text";
Anope::string query_text = "ALTER TABLE `" + table + "` ADD `" + column + "` " + GetColumnType(data.GetType(column));;
queries.push_back(query_text);
}
@@ -307,7 +324,33 @@ Query SQLiteService::BuildInsert(const Anope::string &table, unsigned int id, Da
{
Anope::string buf;
*value >> buf;
query.SetValue(field, buf);
auto escape = true;
switch (data.GetType(field))
{
case Serialize::DataType::BOOL:
case Serialize::DataType::FLOAT:
case Serialize::DataType::INT:
{
if (buf.empty())
buf = "0";
escape = false;
break;
}
case Serialize::DataType::TEXT:
case Serialize::DataType::UINT:
{
if (buf.empty())
{
buf = "NULL";
escape = false;
}
break;
}
}
query.SetValue(field, buf, escape);
}
return query;
-3
View File
@@ -137,9 +137,6 @@ public:
if (!sender)
return false;
if (!server)
server = Servers::GetUplink();
Anope::string line;
if (source && !Config->GetModule(this)->Get<bool>("anonymousglobal"))
{
+4 -4
View File
@@ -32,10 +32,10 @@ struct HostRequestImpl final
void Serialize(Serialize::Data &data) const override
{
data["nick"] << this->nick;
data["ident"] << this->ident;
data["host"] << this->host;
data.SetType("time", Serialize::Data::DT_INT); data["time"] << this->time;
data.Store("nick", this->nick);
data.Store("ident", this->ident);
data.Store("host", this->host);
data.Store("time", this->time);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+1 -1
View File
@@ -20,7 +20,7 @@ class MemoServCore final
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
Anope::string subject = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_subject").c_str()),
message = Language::Translate(Config->GetBlock("mail")->Get<const Anope::string>("memo_message").c_str());
message = Language::Translate(nc, Config->GetBlock("mail")->Get<const Anope::string>("memo_message").c_str());
subject = subject.replace_all_cs("%n", nc->display);
subject = subject.replace_all_cs("%s", m->sender);
+5 -2
View File
@@ -486,7 +486,7 @@ public:
"Services Operators can also drop any nickname without needing\n"
"to identify for the nick, and may view the access list for\n"
"any nickname."));
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d");
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
if (nickserv_expire >= 86400)
source.Reply(_(" \n"
"Accounts that are not used anymore are subject to\n"
@@ -536,6 +536,9 @@ public:
if (nickserv_expire && Anope::CurTime - na->last_seen >= nickserv_expire)
expire = true;
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay"))
expire = false;
FOREACH_MOD(OnPreNickExpire, (na, expire));
if (expire)
@@ -551,7 +554,7 @@ public:
{
if (!na->nc->HasExt("UNCONFIRMED"))
{
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d");
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y");
if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime))
info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount());
}
+4 -4
View File
@@ -40,14 +40,14 @@ struct AJoinEntry final
}
}
void Serialize(Serialize::Data &sd) const override
void Serialize(Serialize::Data &data) const override
{
if (!this->owner)
return;
sd["owner"] << this->owner->display;
sd["channel"] << this->channel;
sd["key"] << this->key;
data.Store("owner", this->owner->display);
data.Store("channel", this->channel);
data.Store("key", this->key);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &sd)
+3 -1
View File
@@ -168,8 +168,10 @@ public:
if (c == NULL || !c->GetCertCount())
return;
std::ostringstream oss;
for (unsigned i = 0; i < c->GetCertCount(); ++i)
data["cert"] << c->GetCert(i) << " ";
oss << c->GetCert(i) << " ";
data.Store("cert", oss.str());
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
+6
View File
@@ -57,6 +57,12 @@ public:
return;
}
if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display"))
{
source.Reply(_("You may not drop \002%s\002 as it is the display nick for the account."), na->nick.c_str());
return;
}
auto *code = dropcode.Get(na);
if (params.size() < 2 || ((!code || !code->equals_ci(params[1])) && (!source.HasPriv("nickserv/drop/override") || params[1] != "OVERRIDE")))
{
+11 -7
View File
@@ -15,11 +15,12 @@
#include "module.h"
class CommandNSGetEMail final
class CommandNSGetEmail final
: public Command
{
public:
CommandNSGetEMail(Module *creator) : Command(creator, "nickserv/getemail", 1, 1)
CommandNSGetEmail(Module *creator)
: Command(creator, "nickserv/getemail", 1, 1)
{
this->SetDesc(_("Matches and returns all users that registered using given email"));
this->SetSyntax(_("\037email\037"));
@@ -59,16 +60,19 @@ public:
}
};
class NSGetEMail final
class NSGetEmail final
: public Module
{
CommandNSGetEMail commandnsgetemail;
private:
CommandNSGetEmail commandnsgetemail;
public:
NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
commandnsgetemail(this)
NSGetEmail(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, VENDOR)
, commandnsgetemail(this)
{
}
};
MODULE_INIT(NSGetEMail)
MODULE_INIT(NSGetEmail)
+1
View File
@@ -89,6 +89,7 @@ public:
InfoFormatter info(source.nc);
info[_("Account")] = na->nc->display;
info[_("Account id")] = Anope::ToString(na->nc->GetId());
if (nick_online)
{
bool shown = false;
+1 -1
View File
@@ -1108,7 +1108,7 @@ class NSSet final
if (!last_value.empty())
modes += "," + last_value;
}
data["last_modes"] << modes;
data.Store("last_modes", modes);
}
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override
+3 -3
View File
@@ -46,9 +46,9 @@ struct NSMiscData final
void Serialize(Serialize::Data &sdata) const override
{
sdata["nc"] << this->object;
sdata["name"] << this->name;
sdata["data"] << this->data;
sdata.Store("nc", this->object);
sdata.Store("name", this->name);
sdata.Store("data", this->data);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+5 -5
View File
@@ -22,11 +22,11 @@ struct NSSuspendInfo final
void Serialize(Serialize::Data &data) const override
{
data["nick"] << what;
data["by"] << by;
data["reason"] << reason;
data["time"] << when;
data["expires"] << expires;
data.Store("nick", what);
data.Store("by", by);
data.Store("reason", reason);
data.Store("time", when);
data.Store("expires", expires);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+7 -7
View File
@@ -39,10 +39,10 @@ struct DNSZone final
void Serialize(Serialize::Data &data) const override
{
data["name"] << name;
data.Store("name", name);
unsigned count = 0;
for (const auto &server : servers)
data["server" + Anope::ToString(count++)] << server;
data.Store("server" + Anope::ToString(count++), server);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
@@ -144,14 +144,14 @@ public:
void Serialize(Serialize::Data &data) const override
{
data["server_name"] << server_name;
data.Store("server_name", server_name);
for (unsigned i = 0; i < ips.size(); ++i)
data["ip" + Anope::ToString(i)] << ips[i];
data["limit"] << limit;
data["pooled"] << pooled;
data.Store("ip" + Anope::ToString(i), ips[i]);
data.Store("limit", limit);
data.Store("pooled", pooled);
unsigned count = 0;
for (const auto &zone : zones)
data["zone" + Anope::ToString(count++)] << zone;
data.Store("zone" + Anope::ToString(count++), zone);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+6 -6
View File
@@ -25,12 +25,12 @@ struct ForbidDataImpl final
void ForbidDataImpl::Serialize(Serialize::Data &data) const
{
data["mask"] << this->mask;
data["creator"] << this->creator;
data["reason"] << this->reason;
data["created"] << this->created;
data["expires"] << this->expires;
data["type"] << this->type;
data.Store("mask", this->mask);
data.Store("creator", this->creator);
data.Store("reason", this->reason);
data.Store("created", this->created);
data.Store("expires", this->expires);
data.Store("type", this->type);
}
Serializable *ForbidDataImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+4 -4
View File
@@ -30,10 +30,10 @@ IgnoreDataImpl::~IgnoreDataImpl()
void IgnoreDataImpl::Serialize(Serialize::Data &data) const
{
data["mask"] << this->mask;
data["creator"] << this->creator;
data["reason"] << this->reason;
data["time"] << this->time;
data.Store("mask", this->mask);
data.Store("creator", this->creator);
data.Store("reason", this->reason);
data.Store("time", this->time);
}
Serializable *IgnoreDataImpl::Unserialize(Serializable *obj, Serialize::Data &data)
+4 -4
View File
@@ -28,10 +28,10 @@ struct OperInfoImpl final
void Serialize(Serialize::Data &data) const override
{
data["target"] << target;
data["info"] << info;
data["adder"] << adder;
data["created"] << created;
data.Store("target", target);
data.Store("info", info);
data.Store("adder", adder);
data.Store("created", created);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data);
+4 -4
View File
@@ -69,10 +69,10 @@ struct MyNewsItem final
{
void Serialize(Serialize::Data &data) const override
{
data["type"] << this->type;
data["text"] << this->text;
data["who"] << this->who;
data["time"] << this->time;
data.Store("type", this->type);
data.Store("text", this->text);
data.Store("who", this->who);
data.Store("time", this->time);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+2 -2
View File
@@ -24,8 +24,8 @@ struct Stats final
void Serialize(Serialize::Data &data) const override
{
data["maxusercnt"] << MaxUserCount;
data["maxusertime"] << MaxUserTime;
data.Store("maxusercnt", MaxUserCount);
data.Store("maxusertime", MaxUserTime);
}
static Serializable *Unserialize(Serializable *obj, Serialize::Data &data)
+1 -1
View File
@@ -238,7 +238,7 @@ public:
Uplink::Send("SVSNICK", u->GetUID(), u->timestamp, newnick, when);
}
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override
{
Uplink::Send(source, "SVSJOIN", u->GetUID(), chan);
}
+46 -15
View File
@@ -42,6 +42,22 @@ namespace
// The version of the InspIRCd protocol that we are using.
size_t spanningtree_proto_ver = 1205;
bool IsExtBan(const Anope::string &str, bool &inverted, Anope::string &name, Anope::string &value)
{
auto startpos = 0;
if (!str.empty() && str[0] == '!')
startpos++;
auto endpos = str.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", startpos);
if (endpos == Anope::string::npos || str[endpos] != ':' || endpos+1 == str.length())
return false;
inverted = !!startpos;
name = str.substr(startpos, endpos - startpos);
value = str.substr(endpos + 1);
return true;
}
// Parses a module name in the format "m_foo.so=bar" to {foo, bar}.
void ParseModule(const Anope::string &module, Anope::string &modname, Anope::string &moddata)
{
@@ -86,7 +102,7 @@ class InspIRCdProto final
private:
static Anope::string GetAccountNicks(NickAlias* na)
{
if (!na)
if (!na || Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
return {};
Anope::string nicks;
@@ -509,9 +525,12 @@ public:
SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason());
}
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &other) override
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override
{
Uplink::Send(source, "SVSJOIN", u->GetUID(), chan);
if (key.empty())
Uplink::Send(source, "SVSJOIN", u->GetUID(), chan);
else
Uplink::Send(source, "SVSJOIN", u->GetUID(), chan, key);
}
void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &param) override
@@ -562,8 +581,11 @@ public:
void SendLogin(User *u, NickAlias *na) override
{
/* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */
if (!na->nc->HasExt("UNCONFIRMED"))
SendAccount(u->GetUID(), na);
if (na->nc->HasExt("UNCONFIRMED"))
return;
IRCD->SendVHost(u, na->GetVHostIdent(), na->GetVHostHost());
SendAccount(u->GetUID(), na);
}
void SendLogout(User *u) override
@@ -615,9 +637,22 @@ public:
}
}
void SendOper(User *u) override
{
if (spanningtree_proto_ver < 1206)
return; // We can't force an oper on this version.
const Anope::map<Anope::string> tags = {
{ "~automatic", "" },
};
Uplink::Send(tags, "SVSOPER", u->GetUID(), u->Account()->o->ot->GetName());
}
bool IsExtbanValid(const Anope::string &mask) override
{
return mask.length() >= 3 && mask[1] == ':';
bool inverted;
Anope::string name, value;
return IsExtBan(mask, inverted, name, value);
}
bool IsIdentValid(const Anope::string &ident) override
@@ -698,19 +733,15 @@ namespace InspIRCdExtBan
if (cm->type != MODE_LIST)
return cm;
auto startpos = 0;
if (param[0] == '!')
startpos++;
auto endpos = param.find_first_not_of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", startpos);
if (endpos == Anope::string::npos || param[endpos] != ':')
bool inverted;
Anope::string name, value;
if (!IsExtBan(param, inverted, name, value))
return cm;
auto name = param.substr(startpos, endpos - startpos);
if (param.length() >= endpos || (name.length() == 1 ? name[0] != xbchar : name != xbname))
if (name.length() == 1 ? name[0] != xbchar : name != xbname)
return cm;
param.erase(0, endpos);
param = value;
return this;
}
};
+1 -1
View File
@@ -164,7 +164,7 @@ public:
Uplink::Send(source, "ENCAP", '*', "TOPIC", c->name, c->topic_setter, c->topic_ts, c->topic);
}
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &key) override
{
Uplink::Send(source, "ENCAP", '*', "SVSJOIN", user->GetUID(), chan);
}
+73 -44
View File
@@ -23,7 +23,10 @@ public:
PrimitiveExtensibleItem<ModData> ClientModData;
PrimitiveExtensibleItem<ModData> ChannelModData;
UnrealIRCdProto(Module *creator) : IRCDProto(creator, "UnrealIRCd 4+"), ClientModData(creator, "ClientModData"), ChannelModData(creator, "ChannelModData")
UnrealIRCdProto(Module *creator)
: IRCDProto(creator, "UnrealIRCd 6+")
, ClientModData(creator, "ClientModData")
, ChannelModData(creator, "ChannelModData")
{
DefaultPseudoclientModes = "+BioqS";
CanSVSNick = true;
@@ -216,21 +219,15 @@ private:
void SendConnect() override
{
/*
NICKv2 = Nick Version 2
VHP = Sends hidden host
UMODE2 = sends UMODE2 on user modes
NICKIP = Sends IP on NICK
SJ3 = Supports SJOIN
NOQUIT = No Quit
TKLEXT = Extended TKL we don't use it but best to have it
MLOCK = Supports the MLOCK server command
VL = Version Info
SID = SID/UID mode
*/
Uplink::Send("PASS", Config->Uplinks[Anope::CurrentUplink].password);
Uplink::Send("PROTOCTL", "NICKv2", "VHP", "UMODE2", "NICKIP", "SJOIN", "SJOIN2", "SJ3", "NOQUIT", "TKLEXT", "MLOCK", "SID", "MTAGS", "BIGLINES");
// BIGLINES: enable sending lines up to 16384 characters in length.
// EAUTH: communicates information about the local server.
// MLOCK: enable receiving the MLOCK message when a mode lock changes.
// MTAGS: enable receiving IRCv3 message tags.
// SID: communicates the unique identifier of the local server.
// VHP: enable receiving the vhost in UID.
Uplink::Send("PROTOCTL", "BIGLINES", "MLOCK", "MTAGS", "VHP");
Uplink::Send("PROTOCTL", "EAUTH=" + Me->GetName() + ",,,Anope-" + Anope::VersionShort());
Uplink::Send("PROTOCTL", "SID=" + Me->GetSID());
@@ -299,12 +296,12 @@ private:
/* In older Unreal SVSJOIN and SVSNLINE tokens were mixed so SVSJOIN and SVSNLINE are broken
when coming from a none TOKEN'd server
*/
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
void SendSVSJoin(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &key) override
{
if (!param.empty())
Uplink::Send("SVSJOIN", user->GetUID(), chan, param);
else
if (key.empty())
Uplink::Send("SVSJOIN", user->GetUID(), chan);
else
Uplink::Send("SVSJOIN", user->GetUID(), chan, key);
}
void SendSVSPart(const MessageSource &source, User *user, const Anope::string &chan, const Anope::string &param) override
@@ -353,11 +350,8 @@ private:
void SendLogin(User *u, NickAlias *na) override
{
/* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */
if (Servers::Capab.count("ESVID") > 0 && !na->nc->HasExt("UNCONFIRMED"))
if (!na->nc->HasExt("UNCONFIRMED"))
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", na->nc->display);
else
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d", u->signon);
}
void SendLogout(User *u) override
@@ -448,9 +442,7 @@ private:
bool IsTagValid(const Anope::string &tname, const Anope::string &tvalue) override
{
if (Servers::Capab.count("MTAGS"))
return true;
return false;
return !!Servers::Capab.count("MTAGS");
}
};
@@ -1143,19 +1135,27 @@ struct IRCDMessageMD final
struct IRCDMessageMode final
: IRCDMessage
{
IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); }
bool server_ts;
IRCDMessageMode(Module *creator, const Anope::string &mname, bool sts)
: IRCDMessage(creator, mname, 2)
, server_ts(sts)
{
SetFlag(FLAG_SOFT_LIMIT);
}
void Run(MessageSource &source, const std::vector<Anope::string> &params, const Anope::map<Anope::string> &tags) override
{
bool server_source = source.GetServer() != NULL;
auto final_is_ts = server_ts && source.GetServer() != NULL;
Anope::string modes = params[1];
for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i)
for (unsigned i = 2; i < params.size() - (final_is_ts ? 1 : 0); ++i)
modes += " " + params[i];
if (IRCD->IsChannelValid(params[0]))
{
Channel *c = Channel::Find(params[0]);
auto ts = server_source ? IRCD->ExtractTimestamp(params.back()) : 0;
auto ts = final_is_ts ? IRCD->ExtractTimestamp(params.back()) : 0;
if (c)
c->SetModesInternal(source, modes, ts);
@@ -1690,20 +1690,51 @@ class ProtoUnreal final
IRCDMessageUmode2 message_umode2;
public:
ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this),
message_kill(this), message_svskill(this, "SVSKILL"), message_motd(this), message_notice(this), message_part(this), message_ping(this),
message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this),
message_version(this), message_whois(this),
message_capab(this), message_chghost(this), message_chgident(this), message_chgname(this),
message_md(this, ircd_proto.ClientModData, ircd_proto.ChannelModData),message_mode(this, "MODE"),
message_svsmode(this, "SVSMODE"), message_svs2mode(this, "SVS2MODE"), message_netinfo(this), message_nick(this), message_pong(this),
message_sasl(this), message_sdesc(this), message_sethost(this), message_setident(this), message_setname(this), message_server(this),
message_sid(this), message_sjoin(this), message_svslogin(this), message_topic(this), message_uid(this), message_umode2(this)
ProtoUnreal(const Anope::string &modname, const Anope::string &creator)
: Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
, message_away(this)
, message_error(this)
, message_invite(this)
, message_join(this)
, message_kick(this)
, message_kill(this)
, message_svskill(this, "SVSKILL")
, message_motd(this)
, message_notice(this)
, message_part(this)
, message_ping(this)
, message_privmsg(this)
, message_quit(this)
, message_squit(this)
, message_stats(this)
, message_time(this)
, message_version(this)
, message_whois(this)
, message_capab(this)
, message_chghost(this)
, message_chgident(this)
, message_chgname(this)
, message_md(this, ircd_proto.ClientModData, ircd_proto.ChannelModData)
, message_mode(this, "MODE", true)
, message_svsmode(this, "SVSMODE", false)
, message_svs2mode(this, "SVS2MODE", false)
, message_netinfo(this)
, message_nick(this)
, message_pong(this)
, message_sasl(this)
, message_sdesc(this)
, message_sethost(this)
, message_setident(this)
, message_setname(this)
, message_server(this)
, message_sid(this)
, message_sjoin(this)
, message_svslogin(this)
, message_topic(this)
, message_uid(this)
, message_umode2(this)
{
}
void Prioritize() override
@@ -1714,8 +1745,6 @@ public:
void OnUserNickChange(User *u, const Anope::string &) override
{
u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED"));
if (Servers::Capab.count("ESVID") == 0)
IRCD->SendLogout(u);
}
void OnChannelSync(Channel *c) override
+2 -12
View File
@@ -30,18 +30,8 @@ if(WIN32)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc LANGUAGE RC)
# Add the resource file to the list of sources
list(APPEND SRC_SRCS ${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc)
# For MinGW, we have to change the compile flags
if(MINGW)
set(RC_CFLAGS "-DMINGW -Ocoff -I${Anope_SOURCE_DIR}/include")
# If any sort of debugging is being enabled, add a _DEBUG define to the flags for the resource compiler
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")
set(RC_CFLAGS "${RC_CFLAGS} -D_DEBUG")
endif()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "${RC_CFLAGS}")
# For anything else, assumingly Visual Studio at this point, use a different set of compile flags
else()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
endif()
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/win32/win32.rc COMPILE_FLAGS "/i\"${Anope_SOURCE_DIR}/include\"")
endif()
# If compiling with Visual Studio, create a static library out of win32/win32_memory.cpp to be included with everything else, needed to override its override of new/delete operators
+8 -8
View File
@@ -160,14 +160,14 @@ NickCore *ChanAccess::GetAccount() const
void ChanAccess::Serialize(Serialize::Data &data) const
{
data["provider"] << this->provider->name;
data["ci"] << this->ci->name;
data["mask"] << this->Mask();
data["creator"] << this->creator;
data["description"] << this->description;
data.SetType("last_seen", Serialize::Data::DT_INT); data["last_seen"] << this->last_seen;
data.SetType("created", Serialize::Data::DT_INT); data["created"] << this->created;
data["data"] << this->AccessSerialize();
data.Store("provider", this->provider->name);
data.Store("ci", this->ci->name);
data.Store("mask", this->Mask());
data.Store("creator", this->creator);
data.Store("description", this->description);
data.Store("last_seen", this->last_seen);
data.Store("created", this->created);
data.Store("data", this->AccessSerialize());
}
Serializable *ChanAccess::Unserialize(Serializable *obj, Serialize::Data &data)
+6 -6
View File
@@ -75,12 +75,12 @@ BotInfo::~BotInfo()
void BotInfo::Serialize(Serialize::Data &data) const
{
data["nick"] << this->nick;
data["user"] << this->ident;
data["host"] << this->host;
data["realname"] << this->realname;
data["created"] << this->created;
data["oper_only"] << this->oper_only;
data.Store("nick", this->nick);
data.Store("user", this->ident);
data.Store("host", this->host);
data.Store("realname", this->realname);
data.Store("created", this->created);
data.Store("oper_only", this->oper_only);
Extensible::ExtensibleSerialize(this, this, data);
}
-1
View File
@@ -179,7 +179,6 @@ Conf::Conf() : Block("")
ValidateNotEmpty("serverinfo", "motd", serverinfo->Get<const Anope::string>("motd"));
ValidateNotZero("options", "readtimeout", options->Get<time_t>("readtimeout"));
ValidateNotZero("options", "warningtimeout", options->Get<time_t>("warningtimeout"));
ValidateNotZero("networkinfo", "nicklen", networkinfo->Get<unsigned>("nicklen", "1"));
ValidateNotZero("networkinfo", "userlen", networkinfo->Get<unsigned>("userlen", "1"));
+6 -6
View File
@@ -36,12 +36,12 @@ Memo::~Memo()
void Memo::Serialize(Serialize::Data &data) const
{
data["owner"] << this->owner;
data.SetType("time", Serialize::Data::DT_INT); data["time"] << this->time;
data["sender"] << this->sender;
data["text"] << this->text;
data["unread"] << this->unread;
data["receipt"] << this->receipt;
data.Store("owner", this->owner);
data.Store("time", this->time);
data.Store("sender", this->sender);
data.Store("text", this->text);
data.Store("unread", this->unread);
data.Store("receipt", this->receipt);
}
Serializable *Memo::Unserialize(Serializable *obj, Serialize::Data &data)
+2 -1
View File
@@ -352,7 +352,8 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> &param
else if (ctcpname.equals_ci("VERSION"))
{
Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
IRCD->SendNotice(bi, u->nick, Anope::FormatCTCP("VERSION", Anope::printf("Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Me->GetName().c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "(none)", Anope::VersionBuildString().c_str())));
IRCD->SendNotice(bi, u->nick, Anope::FormatCTCP("VERSION", Anope::printf("Anope-%s %s -- %s -- %s", Anope::Version().c_str(),
Anope::VersionBuildString().c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "(none)")));
}
return;
}
+12 -12
View File
@@ -141,21 +141,21 @@ NickAlias *NickAlias::Find(const Anope::string &nick)
void NickAlias::Serialize(Serialize::Data &data) const
{
data["nick"] << this->nick;
data["last_quit"] << this->last_quit;
data["last_realname"] << this->last_realname;
data["last_usermask"] << this->last_usermask;
data["last_realhost"] << this->last_realhost;
data.SetType("time_registered", Serialize::Data::DT_INT); data["time_registered"] << this->time_registered;
data.SetType("last_seen", Serialize::Data::DT_INT); data["last_seen"] << this->last_seen;
data["nc"] << this->nc->display;
data.Store("nick", this->nick);
data.Store("last_quit", this->last_quit);
data.Store("last_realname", this->last_realname);
data.Store("last_usermask", this->last_usermask);
data.Store("last_realhost", this->last_realhost);
data.Store("time_registered", this->time_registered);
data.Store("last_seen", this->last_seen);
data.Store("nc", this->nc->display);
if (this->HasVHost())
{
data["vhost_ident"] << this->GetVHostIdent();
data["vhost_host"] << this->GetVHostHost();
data["vhost_creator"] << this->GetVHostCreator();
data["vhost_time"] << this->GetVHostCreated();
data.Store("vhost_ident", this->GetVHostIdent());
data.Store("vhost_host", this->GetVHostHost());
data.Store("vhost_creator", this->GetVHostCreator());
data.Store("vhost_time", this->GetVHostCreated());
}
Extensible::ExtensibleSerialize(this, this, data);
+12 -9
View File
@@ -68,17 +68,20 @@ NickCore::~NickCore()
void NickCore::Serialize(Serialize::Data &data) const
{
data["display"] << this->display;
data["uniqueid"] << this->id;
data["pass"] << this->pass;
data["email"] << this->email;
data["language"] << this->language;
data.SetType("lastmail", Serialize::Data::DT_INT); data["lastmail"] << this->lastmail;
data.SetType("time_registered", Serialize::Data::DT_INT); data["time_registered"] << this->time_registered;
data.Store("display", this->display);
data.Store("uniqueid", this->id);
data.Store("pass", this->pass);
data.Store("email", this->email);
data.Store("language", this->language);
data.Store("lastmail", this->lastmail);
data.Store("time_registered", this->time_registered);
data.Store("memomax", this->memos.memomax);
data["memomax"] << this->memos.memomax;
std::ostringstream oss;
for (const auto &ignore : this->memos.ignores)
data["memoignores"] << ignore << " ";
oss << ignore << " ";
data.Store("memoignores", oss.str());
Extensible::ExtensibleSerialize(this, this, data);
}
+25 -22
View File
@@ -40,15 +40,15 @@ AutoKick::~AutoKick()
void AutoKick::Serialize(Serialize::Data &data) const
{
data["ci"] << this->ci->name;
data.Store("ci", this->ci->name);
if (this->nc)
data["nc"] << this->nc->display;
data.Store("nc", this->nc->display);
else
data["mask"] << this->mask;
data["reason"] << this->reason;
data["creator"] << this->creator;
data.SetType("addtime", Serialize::Data::DT_INT); data["addtime"] << this->addtime;
data.SetType("last_used", Serialize::Data::DT_INT); data["last_used"] << this->last_used;
data.Store("mask", this->mask);
data.Store("reason", this->reason);
data.Store("creator", this->creator);
data.Store("addtime", this->addtime);
data.Store("last_used", this->last_used);
}
Serializable *AutoKick::Unserialize(Serializable *obj, Serialize::Data &data)
@@ -180,30 +180,33 @@ ChannelInfo::~ChannelInfo()
void ChannelInfo::Serialize(Serialize::Data &data) const
{
data["name"] << this->name;
data.Store("name", this->name);
if (this->founder)
data["founder"] << this->founder->display;
data.Store("founder", this->founder->display);
if (this->successor)
data["successor"] << this->successor->display;
data["description"] << this->desc;
data.SetType("time_registered", Serialize::Data::DT_INT); data["time_registered"] << this->time_registered;
data.SetType("last_used", Serialize::Data::DT_INT); data["last_used"] << this->last_used;
data["last_topic"] << this->last_topic;
data["last_topic_setter"] << this->last_topic_setter;
data.SetType("last_topic_time", Serialize::Data::DT_INT); data["last_topic_time"] << this->last_topic_time;
data.SetType("bantype", Serialize::Data::DT_INT); data["bantype"] << this->bantype;
data.Store("successor", this->successor->display);
data.Store("description", this->desc);
data.Store("time_registered", this->time_registered);
data.Store("last_used", this->last_used);
data.Store("last_topic", this->last_topic);
data.Store("last_topic_setter", this->last_topic_setter);
data.Store("last_topic_time", this->last_topic_time);
data.Store("bantype", this->bantype);
{
Anope::string levels_buffer;
for (const auto &[name, level] : this->levels)
levels_buffer += name + " " + Anope::ToString(level) + " ";
data["levels"] << levels_buffer;
data.Store("levels", levels_buffer);
}
if (this->bi)
data["bi"] << this->bi->nick;
data.SetType("banexpire", Serialize::Data::DT_INT); data["banexpire"] << this->banexpire;
data["memomax"] << this->memos.memomax;
data.Store("bi", this->bi->nick);
data.Store("banexpire", this->banexpire);
data.Store("memomax", this->memos.memomax);
std::ostringstream oss;
for (const auto &ignore : this->memos.ignores)
data["memoignores"] << ignore << " ";
oss << ignore << " ";
data.Store("memoignores", oss.str());
Extensible::ExtensibleSerialize(this, this, data);
}
+10 -8
View File
@@ -378,15 +378,16 @@ void User::Identify(NickAlias *na)
{
if (!this->nc->o->ot->modes.empty())
{
this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
UserMode *um = ModeManager::FindUserModeByName("OPER");
auto *um = ModeManager::FindUserModeByName("OPER");
if (um && !this->HasMode("OPER") && this->nc->o->ot->modes.find(um->mchar) != Anope::string::npos)
IRCD->SendOper(this);
this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, _("Changing your usermodes to \002%s\002"), this->nc->o->ot->modes.c_str());
}
if (IRCD->CanSetVHost && !this->nc->o->vhost.empty())
{
this->SendMessage(NULL, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str());
this->SendMessage(NULL, _("Changing your vhost to \002%s\002"), this->nc->o->vhost.c_str());
this->SetDisplayedHost(this->nc->o->vhost);
IRCD->SendVHost(this, "", this->nc->o->vhost);
}
@@ -548,15 +549,16 @@ void User::SetModeInternal(const MessageSource &source, UserMode *um, const Anop
{
if (!this->nc->o->ot->modes.empty())
{
this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str());
UserMode *oper = ModeManager::FindUserModeByName("OPER");
auto *oper = ModeManager::FindUserModeByName("OPER");
if (oper && !this->HasMode("OPER") && this->nc->o->ot->modes.find(oper->mchar) != Anope::string::npos)
IRCD->SendOper(this);
this->SetModes(NULL, this->nc->o->ot->modes);
this->SendMessage(NULL, _("Changing your usermodes to \002%s\002"), this->nc->o->ot->modes.c_str());
}
if (IRCD->CanSetVHost && !this->nc->o->vhost.empty())
{
this->SendMessage(NULL, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str());
this->SendMessage(NULL, _("Changing your vhost to \002%s\002"), this->nc->o->vhost.c_str());
this->SetDisplayedHost(this->nc->o->vhost);
IRCD->SendVHost(this, "", this->nc->o->vhost);
}
+1 -1
View File
@@ -2,5 +2,5 @@
VERSION_MAJOR=2
VERSION_MINOR=1
VERSION_PATCH=7
VERSION_PATCH=9
VERSION_EXTRA=""
-2
View File
@@ -34,9 +34,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VER_ANOPE VERSIONINFO
FILEVERSION @VERSION_COMMA@
PRODUCTVERSION @VERSION_COMMA@
#ifndef MINGW
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#endif
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
+7 -7
View File
@@ -153,14 +153,14 @@ bool XLine::IsRegex() const
void XLine::Serialize(Serialize::Data &data) const
{
data["mask"] << this->mask;
data["by"] << this->by;
data["created"] << this->created;
data["expires"] << this->expires;
data["reason"] << this->reason;
data["uid"] << this->id;
data.Store("mask", this->mask);
data.Store("by", this->by);
data.Store("created", this->created);
data.Store("expires", this->expires);
data.Store("reason", this->reason);
data.Store("uid", this->id);
if (this->manager)
data["manager"] << this->manager->name;
data.Store("manager", this->manager->name);
}
Serializable *XLine::Unserialize(Serializable *obj, Serialize::Data &data)