From 3bb01023e8fa11c773365b880cffe0084dfbbc79 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Mon, 21 Mar 2022 12:38:41 -0600 Subject: m_deaf: Correct default return in HandleUser(). --- src/modules/m_deaf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 74018d245..f49553f0b 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -122,7 +122,7 @@ class ModuleDeaf if (!source->HasPrivPermission("users/ignore-privdeaf")) return MOD_RES_DENY; - return MOD_RES_ALLOW; + return MOD_RES_PASSTHRU; } public: -- cgit v1.3.1-10-gc9f91 From 8addeb78b7ec6ed8d30a39adee28eab45a5273c7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 21 Mar 2022 21:38:45 +0000 Subject: Fix real name formatting bleeding into IRC messages. --- src/modules/m_check.cpp | 2 +- src/modules/m_chgname.cpp | 2 +- src/modules/m_spanningtree/uid.cpp | 2 +- src/users.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 91f976a2c..0934f006d 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -276,7 +276,7 @@ class CommandCheck : public Command * Unlike Asuka, I define a clone as coming from the same host. --w00t */ const UserManager::CloneCounts& clonecount = ServerInstance->Users->GetCloneCounts(i->first); - context.Write("member", InspIRCd::Format("%u %s%s (%s)", clonecount.global, + context.Write("member", InspIRCd::Format("%u %s%s (%s\x0F)", clonecount.global, i->second->GetAllPrefixChars().c_str(), i->first->GetFullHost().c_str(), i->first->GetRealName().c_str())); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index dfd3c7d3b..abc549971 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -64,7 +64,7 @@ class CommandChgname : public Command if (IS_LOCAL(dest)) { dest->ChangeRealName(parameters[1]); - ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s'", user->nick.c_str(), dest->nick.c_str(), dest->GetRealName().c_str()); + ServerInstance->SNO->WriteGlobalSno('a', "%s used CHGNAME to change %s's real name to '%s\x0F'", user->nick.c_str(), dest->nick.c_str(), dest->GetRealName().c_str()); } return CMD_SUCCESS; diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index cc5acccf9..f8ba7f994 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -130,7 +130,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params dosend = false; if (dosend) - ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", remoteserver->GetName().c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->GetRealName().c_str()); + ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s\x0F]", remoteserver->GetName().c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->GetRealName().c_str()); FOREACH_MOD(OnPostConnect, (_new)); diff --git a/src/users.cpp b/src/users.cpp index 32056e1ea..f45217410 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -611,7 +611,7 @@ void LocalUser::FullConnect() FOREACH_MOD(OnPostConnect, (this)); - ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]", + ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s\x0F]", this->server_sa.port(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->GetRealName().c_str()); ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding NEGATIVE hit for " + this->GetIPString()); ServerInstance->BanCache.AddHit(this->GetIPString(), "", ""); -- cgit v1.3.1-10-gc9f91 From c87703e2a7805fd7566ba39b9dfdf6e836166e11 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 22 Mar 2022 15:27:39 +0000 Subject: Rename to . --- docs/conf/modules.conf.example | 6 +++--- src/modules/m_connectban.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 11e9ae5d4..310a25510 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -693,8 +693,8 @@ # banmessage - The message to give users when Z-lining them for connecting # too much. # -# duration - The time period to ban users who connect to much for. Defaults -# to 10 minutes. +# banduration - The time period to ban users who connect to much for. Defaults +# to 10 minutes. # # ipv4cidr - The IPv4 CIDR mask (1-32) to treat connecting users as coming # from the same host. Defaults to 32. @@ -710,7 +710,7 @@ # #getUInt("threshold", 10, 1); bootwait = tag->getDuration("bootwait", 60*2); splitwait = tag->getDuration("splitwait", 60*2); - banduration = tag->getDuration("duration", 10*60, 1); + banduration = tag->getDuration("banduration", tag->getDuration("duration", 10*60), 1); banmessage = tag->getString("banmessage", "Your IP range has been attempting to connect too many times in too short a duration. Wait a while, and you will be able to connect."); if (status.initial) -- cgit v1.3.1-10-gc9f91 From 770b8ec19239140dbc690308c3855284b3da346e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 23 Mar 2022 14:33:57 +0000 Subject: Add support for blocking invites to the commonchans module. --- docs/conf/modules.conf.example | 4 ++++ src/modules/m_commonchans.cpp | 32 ++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 77efff761..0d9f76d2e 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -632,6 +632,10 @@ # that users must share a common channel with you to PRIVMSG or NOTICE # you. # +# +# You can also require a common channel for inviting to another channel +# by uncommenting this: +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Auto join on connect module: Allows you to force users to join one diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 66c56bafc..9b97bd66a 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -30,6 +30,18 @@ class ModuleCommonChans { private: SimpleUserModeHandler mode; + bool invite; + + bool IsExempt(User* source, User* target) + { + if (!target->IsModeSet(mode) || source->SharesChannelWith(target)) + return true; // Target doesn't have mode set or shares a common channel. + + if (source->HasPrivPermission("users/ignore-commonchans") || source->server->IsULine()) + return true; // Source is an oper or a uline. + + return false; + } ModResult HandleMessage(User* user, const MessageTarget& target) { @@ -37,10 +49,7 @@ class ModuleCommonChans return MOD_RES_PASSTHRU; User* targetuser = target.Get(); - if (!targetuser->IsModeSet(mode) || user->SharesChannelWith(targetuser)) - return MOD_RES_PASSTHRU; - - if (user->HasPrivPermission("users/ignore-commonchans") || user->server->IsULine()) + if (IsExempt(user, targetuser)) return MOD_RES_PASSTHRU; user->WriteNumeric(Numerics::CannotSendTo(targetuser, "messages", &mode)); @@ -59,6 +68,21 @@ class ModuleCommonChans return Version("Adds user mode c (deaf_commonchan) which requires users to have a common channel before they can privately message each other.", VF_VENDOR); } + void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE + { + ConfigTag* tag = ServerInstance->Config->ConfValue("commonchans"); + invite = tag->getBool("invite"); + } + + ModResult OnUserPreInvite(User* source, User* dest, Channel* channel, time_t timeout) CXX11_OVERRIDE + { + if (!invite || IsExempt(source, dest)) + return MOD_RES_PASSTHRU; + + source->WriteNumeric(Numerics::CannotSendTo(dest, "invites", &mode)); + return MOD_RES_DENY; + } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE { return HandleMessage(user, target); -- cgit v1.3.1-10-gc9f91 From d9be3ed77fac2601d813b2c85e2d9e1a02d61668 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 24 Mar 2022 02:33:59 +0000 Subject: Add support for matching against geolocation data with WHO. Closes #1969. --- src/modules/m_geoban.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_geoban.cpp b/src/modules/m_geoban.cpp index 7e44ffa1f..1e0e6cd74 100644 --- a/src/modules/m_geoban.cpp +++ b/src/modules/m_geoban.cpp @@ -20,10 +20,12 @@ #include "inspircd.h" #include "modules/geolocation.h" +#include "modules/who.h" #include "modules/whois.h" class ModuleGeoBan : public Module + , public Who::MatchEventListener , public Whois::EventListener { private: @@ -31,7 +33,8 @@ class ModuleGeoBan public: ModuleGeoBan() - : Whois::EventListener(this) + : Who::MatchEventListener(this) + , Whois::EventListener(this) , geoapi(this) { } @@ -60,6 +63,16 @@ class ModuleGeoBan return MOD_RES_PASSTHRU; } + ModResult OnWhoMatch(const Who::Request& request, LocalUser* source, User* user) CXX11_OVERRIDE + { + if (!request.flags['G']) + return MOD_RES_PASSTHRU; + + Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : NULL; + const std::string code = location ? location->GetCode() : "XX"; + return InspIRCd::Match(code, request.matchtext, ascii_case_insensitive_map) ? MOD_RES_ALLOW : MOD_RES_DENY; + } + void OnWhois(Whois::Context& whois) CXX11_OVERRIDE { if (whois.GetTarget()->server->IsULine()) -- cgit v1.3.1-10-gc9f91