diff options
| author | 2021-06-07 06:59:23 +0100 | |
|---|---|---|
| committer | 2021-06-07 07:15:39 +0100 | |
| commit | d7f967bdfc2931771350a459c7eb77fa52f45517 (patch) | |
| tree | 93597d65440b4e9166e02405cf2b8c7dd8d9d2ca /src/modules | |
| parent | Release v4.0.0 alpha 1. (diff) | |
| parent | Add CI support for Windows. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/extra/m_mysql.cpp | 2 | ||||
| -rw-r--r-- | src/modules/extra/m_regex_pcre.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_codepage.cpp | 17 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/main.cpp | 1 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 1 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 22 | ||||
| -rw-r--r-- | src/modules/m_spanningtree/utils.h | 3 |
7 files changed, 45 insertions, 3 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 8cba8b3c0..ed26f3ab6 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -49,7 +49,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 4f5ff0ca5..0419074b7 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -39,7 +39,7 @@ #include <pcre.h> #ifdef _WIN32 -# pragma comment(lib, "libpcre.lib") +# pragma comment(lib, "pcre.lib") #endif class PCREPattern final diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 74b8f138e..4d8281402 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/isupport.h" class Codepage { @@ -170,6 +171,7 @@ class SingleByteCodepage final class ModuleCodepage final : public Module + , public ISupport::EventListener { private: // The currently active codepage. @@ -184,6 +186,9 @@ class ModuleCodepage final // The IsNick handler which was set before this module was loaded. const std::function<bool(const std::string&)> origisnick; + // The character set used for the codepage. + std::string charset; + template <typename T> void RehashHashmap(T& hashmap) { @@ -231,6 +236,7 @@ class ModuleCodepage final public: ModuleCodepage() : Module(VF_VENDOR | VF_COMMON, "Allows the server administrator to define what characters are allowed in nicknames and how characters should be compared in a case insensitive way.") + , ISupport::EventListener(this) , codepage(nullptr) , origcasemap(national_case_insensitive_map) , origcasemapname(ServerInstance->Config->CaseMapping) @@ -252,7 +258,9 @@ class ModuleCodepage final void ReadConfig(ConfigStatus& status) override { - const std::string name = ServerInstance->Config->ConfValue("codepage")->getString("name"); + auto codepagetag = ServerInstance->Config->ConfValue("codepage"); + + const std::string name = codepagetag->getString("name"); if (name.empty()) throw ModuleException("<codepage:name> is a required field!"); @@ -306,6 +314,7 @@ class ModuleCodepage final lower, reinterpret_cast<unsigned char*>(&lower), upper, reinterpret_cast<unsigned char*>(&upper)); } + charset = codepagetag->getString("charset"); std::swap(codepage, newcodepage); ServerInstance->IsNick = [this](const std::string& nick) { return codepage->IsValidNick(nick); }; CheckInvalidNick(); @@ -316,6 +325,12 @@ class ModuleCodepage final CheckRehash(newcodepage->casemap); } + void OnBuildISupport(ISupport::TokenMap& tokens) override + { + if (!charset.empty()) + tokens["CHARSET"] = charset; + } + void GetLinkData(LinkData& data, std::string& compatdata) override { codepage->GetLinkData(data, compatdata); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 4df743b05..cf0288f07 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -526,6 +526,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 30476953d..8f0d17bbd 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -239,6 +239,7 @@ void TreeSocket::SyncChannel(Channel* chan, BurstState& bs) if (chan->topicset != 0) this->WriteLine(CommandFTopic::Builder(chan)); + Utils->SendListLimits(chan, this); SendListModes(chan); for (const auto& [item, value] : chan->GetExtList()) diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 50735dc1f..322488847 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" @@ -381,3 +382,24 @@ std::string SpanningTreeUtilities::BuildLinkString(uint16_t proto, Module* mod) } return buffer.str(); } + +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 0181cade6..0997d8772 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -179,6 +179,9 @@ class SpanningTreeUtilities : public Cullable // Builds link data to be sent to another server. std::string BuildLinkString(uint16_t protocol, Module* mod); + + /** Send the channel list mode limits to either the specified server or all servers if nullptr. */ + void SendListLimits(Channel* chan, TreeSocket* sock = nullptr); }; inline void SpanningTreeUtilities::DoOneToMany(const CmdBuilder& params) |
