From 8ef5c350f08aed38b2d64f8770298baf74f03afe Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 2 Jun 2021 03:43:27 +0100 Subject: Send the CHARSET token if using a non-ascii casemapping. --- src/modules/m_codepage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 45fdb3d83..f299b92fa 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -67,6 +67,9 @@ class ModuleCodepage // The IsNick handler which was set before this module was loaded. const TR1NS::function origisnick; + // The character set used for the codepage. + std::string charset; + template void RehashHashmap(T& hashmap) { @@ -138,7 +141,9 @@ class ModuleCodepage void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - const std::string name = ServerInstance->Config->ConfValue("codepage")->getString("name"); + ConfigTag* codepagetag = ServerInstance->Config->ConfValue("codepage"); + + const std::string name = codepagetag->getString("name"); if (name.empty()) throw ModuleException(" is a required field!"); @@ -200,6 +205,7 @@ class ModuleCodepage lower, lower, upper, upper); } + charset = codepagetag->getString("charset"); std::swap(allowedchars, newallowedchars); std::swap(allowedfrontchars, newallowedfrontchars); std::swap(casemap, newcasemap); @@ -214,6 +220,12 @@ class ModuleCodepage ServerInstance->ISupport.Build(); } + void On005Numeric(std::map& tokens) CXX11_OVERRIDE + { + if (!charset.empty()) + tokens["CHARSET"] = charset; + } + Version GetVersion() CXX11_OVERRIDE { std::stringstream linkdata; -- cgit v1.3.1-10-gc9f91 From 722c63ad53dea99829cf010786354e21016aadef Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 4 Jun 2021 01:58:33 +0100 Subject: Broadcast the limits for list modes on server link. This allows services to not overflow the limit. --- src/modules/m_spanningtree/main.cpp | 1 + src/modules/m_spanningtree/netburst.cpp | 1 + src/modules/m_spanningtree/utils.cpp | 22 ++++++++++++++++++++++ src/modules/m_spanningtree/utils.h | 3 +++ 4 files changed, 27 insertions(+) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 507897a4e..a2a9173eb 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -511,6 +511,7 @@ void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by params.add(memb); params.finalize(); params.Broadcast(); + Utils->SendListLimits(memb->chan, NULL); } else { diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index ac68efb96..d8ea30060 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -258,6 +258,7 @@ void TreeSocket::SyncChannel(Channel* chan, BurstState& bs) if (chan->topicset != 0) this->WriteLine(CommandFTopic::Builder(chan)); + Utils->SendListLimits(chan, this); SendListModes(chan); for (Extensible::ExtensibleStore::const_iterator i = chan->GetExtList().begin(); i != chan->GetExtList().end(); i++) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 809963625..84d96e098 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" +#include "listmode.h" #include "main.h" #include "utils.h" @@ -374,3 +375,24 @@ void SpanningTreeUtilities::SendChannelMessage(User* source, Channel* target, co Sock->WriteLine(msg); } } + +void SpanningTreeUtilities::SendListLimits(Channel* chan, TreeSocket* sock) +{ + std::stringstream buffer; + const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes(); + for (ModeParser::ListModeList::const_iterator i = listmodes.begin(); i != listmodes.end(); ++i) + { + ListModeBase* lm = *i; + buffer << lm->GetModeChar() << " " << lm->GetLimit(chan) << " "; + } + + std::string bufferstr = buffer.str(); + if (bufferstr.empty()) + return; // Should never happen. + + bufferstr.erase(bufferstr.end() - 1); + if (sock) + sock->WriteLine(CommandMetadata::Builder(chan, "maxlist", bufferstr)); + else + CommandMetadata::Builder(chan, "maxlist", bufferstr).Broadcast(); +} diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 26e6e7c22..262c285ef 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -176,6 +176,9 @@ class SpanningTreeUtilities : public classbase /** Sends a PRIVMSG or a NOTICE to a channel obeying an exempt list and an optional prefix */ void SendChannelMessage(User* source, Channel* target, const std::string& text, char status, const ClientProtocol::TagMap& tags, const CUList& exempt_list, const char* message_type, TreeSocket* omit = NULL); + + /** Send the channel list mode limits to either the specified server or all servers if NULL. */ + void SendListLimits(Channel* chan, TreeSocket* sock = NULL); }; inline void SpanningTreeUtilities::DoOneToMany(const CmdBuilder& params) -- cgit v1.3.1-10-gc9f91 From 71841b747d41a8efca1998aa950c89b034f8d46d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 7 Jun 2021 04:33:14 +0100 Subject: Migrate Windows builds to installing their dependencies via Conan. --- src/modules/extra/m_mysql.cpp | 2 +- src/modules/extra/m_regex_pcre.cpp | 2 +- win/conanfile.txt | 34 ++++++++++++++++++++++++++++++++++ win/modules/CMakeLists.txt | 24 ++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 win/conanfile.txt (limited to 'src/modules') diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 377ffee7e..64a460f77 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -56,7 +56,7 @@ #endif #ifdef _WIN32 -# pragma comment(lib, "libmysql.lib") +# pragma comment(lib, "mysqlclient.lib") #endif /* VERSION 3 API: With nonblocking (threaded) requests */ diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 17cc65bd3..6c5ecb83f 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -38,7 +38,7 @@ #include "modules/regex.h" #ifdef _WIN32 -# pragma comment(lib, "libpcre.lib") +# pragma comment(lib, "pcre.lib") #endif class PCRERegex : public Regex diff --git a/win/conanfile.txt b/win/conanfile.txt new file mode 100644 index 000000000..61a25f345 --- /dev/null +++ b/win/conanfile.txt @@ -0,0 +1,34 @@ +# Last updated: 2020-06-07 +# +# Modules we can't legally ship: geo_maxmind, ssl_mbedtls, ssl_openssl +# Modules which don't apply to Windows: regex_posix, sslrehashsgnal +# Modules without packages: ldap, regex_tre, ssl_gnutls + +[requires] +argon2/20190702 +# libmaxminddb/1.6.0 +libpq/13.2 +# mbedtls/2.25.0 +mysql-connector-c/6.1.11 +# openssl/1.1.1k +pcre/8.44 +re2/20210401 +sqlite3/3.35.5 + +[options] +argon2:shared=True +# libmaxminddb:shared=True +libpq:shared=True +# mbedtls:shared=True +mysql-connector:shared=True +# openssl:shared=True +pcre:shared=True +re2:shared=True +sqlite3:shared=True + +[imports] +., *.dll -> extradll @ keep_path=False +., *.lib -> extralib @ keep_path=False + +[generators] +cmake diff --git a/win/modules/CMakeLists.txt b/win/modules/CMakeLists.txt index 2c2617e2b..a2c70e352 100644 --- a/win/modules/CMakeLists.txt +++ b/win/modules/CMakeLists.txt @@ -2,6 +2,26 @@ # so copy the file out of extra/ file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_stdlib.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") +if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_argon2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_pgsql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_mysql.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_pcre.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_regex_re2.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + file(COPY "${INSPIRCD_BASE}/src/modules/extra/m_sqlite3.cpp" DESTINATION "${INSPIRCD_BASE}/src/modules/") + + include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") + link_directories("${CMAKE_BINARY_DIR}/extradll" "${CMAKE_BINARY_DIR}/extralib") + + file(GLOB EXTRA_DLLS "${CMAKE_BINARY_DIR}/extradll/*.dll") + install(FILES ${EXTRA_DLLS} DESTINATION .) + + conan_basic_setup(TARGETS) +else() + message("Unable to build extras: conanbuildinfo.cmake does not exist in the build directory!") +endif() + + file(GLOB INSPIRCD_MODULES "${INSPIRCD_BASE}/src/coremods/core_*" "${INSPIRCD_BASE}/src/modules/m_*") list(SORT INSPIRCD_MODULES) @@ -31,6 +51,10 @@ foreach(MODULE_NAME ${INSPIRCD_MODULES}) add_dependencies(${SO_NAME} win32_memory) endif(MSVC) + if(CONAN_CXX_FLAGS) + conan_target_link_libraries("${SO_NAME}") + endif() + set_target_properties(${SO_NAME} PROPERTIES PREFIX "" SUFFIX "" -- cgit v1.3.1-10-gc9f91