From dc169e9d588d5536ca13f64f22e2a8aaea34604b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 18 Jun 2021 17:36:34 +0100 Subject: Avoid unnecessarily looking up the ban mode. We already have a ChanModeReference for this there's no need to look it up again. --- src/modules/m_timedbans.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 6cc5d01e6..23dbf46c1 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -118,7 +118,7 @@ class CommandTban : public Command } Modes::ChangeList setban; - setban.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask); + setban.push_add(*banmode, mask); // Pass the user (instead of ServerInstance->FakeClient) to ModeHandler::Process() to // make it so that the user sets the mode themselves ServerInstance->Modes->Process(user, channel, NULL, setban); -- cgit v1.3.1-10-gc9f91 From 193cd02c6b155e417144a700ba12551e06c76950 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 18 Jun 2021 18:03:44 +0100 Subject: Fix unsetting timed bans with excessively long masks. --- src/modules/m_timedbans.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/modules') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 23dbf46c1..97074a686 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -128,6 +128,19 @@ class CommandTban : public Command return CMD_FAILURE; } + // Attempt to find the actual set ban mask. + const Modes::ChangeList::List& list = ServerInstance->Modes->GetLastChangeList().getlist(); + for (Modes::ChangeList::List::const_iterator iter = list.begin(); iter != list.end(); ++iter) + { + const Modes::Change& mc = *iter; + if (mc.mh == *banmode) + { + // We found the actual mask. + mask = mc.param; + break; + } + } + T.mask = mask; T.setter = user->nick; T.expire = expire + (IS_REMOTE(user) ? 5 : 0); -- cgit v1.3.1-10-gc9f91 From 9c89a923f80680c1261d35557b609a6d4387525e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 19 Jun 2021 00:19:36 +0100 Subject: Use RPL_WHOISCHANNELS instead of a raw numeric in hidechans. --- src/modules/m_hidechans.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 423398b73..19d6d3089 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -62,7 +62,7 @@ class ModuleHideChans : public Module, public Whois::LineEventListener return MOD_RES_PASSTHRU; /* don't touch anything except 319 */ - if (numeric.GetNumeric() != 319) + if (numeric.GetNumeric() != RPL_WHOISCHANNELS) return MOD_RES_PASSTHRU; /* don't touch if -I */ -- cgit v1.3.1-10-gc9f91 From ab31e370020653a280e0d06945eab2c110f25a2d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 19 Jun 2021 19:47:52 +0100 Subject: Fix building the sha256 module on Haiku. --- src/modules/m_sha256.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp index 5cb55468a..b8d8ff269 100644 --- a/src/modules/m_sha256.cpp +++ b/src/modules/m_sha256.cpp @@ -26,6 +26,7 @@ /// $CompilerFlags: -Ivendor_directory("sha2") /// $CompilerFlags: require_compiler("GCC") -Wno-long-long + #ifdef __GNUC__ # pragma GCC diagnostic push #endif @@ -37,15 +38,25 @@ # pragma GCC diagnostic ignored "-Wlong-long" #endif -#include "inspircd.h" -#include "modules/hash.h" +// Fix a collision between the Haiku uint64 typedef and the +// one from the sha2 library. +#ifdef __HAIKU__ +# define uint64 sha2_uint64 +#endif #include +#ifdef __HAIKU__ +# undef uint64 +#endif + #ifdef __GNUC__ # pragma GCC diagnostic pop #endif +#include "inspircd.h" +#include "modules/hash.h" + class HashSHA256 : public HashProvider { public: -- cgit v1.3.1-10-gc9f91