aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_chgname.cpp2
-rw-r--r--src/modules/m_commonchans.cpp25
-rw-r--r--src/modules/m_connectban.cpp2
-rw-r--r--src/modules/m_customprefix.cpp2
-rw-r--r--src/modules/m_deaf.cpp2
-rw-r--r--src/modules/m_geoban.cpp13
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
8 files changed, 40 insertions, 10 deletions
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index ea5ebe16e..dd2353186 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -263,7 +263,7 @@ public:
* Unlike Asuka, I define a clone as coming from the same host. --w00t
*/
const UserManager::CloneCounts& clonecount = ServerInstance->Users.GetCloneCounts(u);
- context.Write("member", InspIRCd::Format("%u %s%s (%s)", clonecount.global,
+ context.Write("member", InspIRCd::Format("%u %s%s (%s\x0F)", clonecount.global,
memb->GetAllPrefixChars().c_str(), u->GetFullHost().c_str(),
u->GetRealName().c_str()));
}
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index ea3ef35c8..9bba0b5c6 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -63,7 +63,7 @@ public:
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 CmdResult::SUCCESS;
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index 067aeb994..a9137598a 100644
--- a/src/modules/m_commonchans.cpp
+++ b/src/modules/m_commonchans.cpp
@@ -31,16 +31,24 @@ class ModuleCommonChans final
private:
SimpleUserMode mode;
+ 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->IsService())
+ return true; // Source is an oper or a service.
+
+ return false;
+ }
+
ModResult HandleMessage(User* user, const MessageTarget& target)
{
if (target.type != MessageTarget::TYPE_USER)
return MOD_RES_PASSTHRU;
User* targetuser = target.Get<User>();
- if (!targetuser->IsModeSet(mode) || user->SharesChannelWith(targetuser))
- return MOD_RES_PASSTHRU;
-
- if (user->HasPrivPermission("users/ignore-commonchans") || user->server->IsService())
+ if (IsExempt(user, targetuser))
return MOD_RES_PASSTHRU;
user->WriteNumeric(Numerics::CannotSendTo(targetuser, "messages", &mode));
@@ -55,6 +63,15 @@ public:
{
}
+ ModResult OnUserPreInvite(User* source, User* dest, Channel* channel, time_t timeout) override
+ {
+ if (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) override
{
return HandleMessage(user, target);
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index 989d1be5b..cee68a5fb 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -105,7 +105,7 @@ public:
threshold = tag->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", 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)
diff --git a/src/modules/m_customprefix.cpp b/src/modules/m_customprefix.cpp
index fb2b58bd3..74abde099 100644
--- a/src/modules/m_customprefix.cpp
+++ b/src/modules/m_customprefix.cpp
@@ -32,7 +32,7 @@ public:
: PrefixMode(parent, Name, Letter, 0, Prefix)
, tag(Tag)
{
- unsigned int rank = static_cast<unsigned int>(tag->getUInt("rank", 0, 0, UINT_MAX));
+ unsigned int rank = static_cast<unsigned int>(tag->getUInt("rank", 1, 1, UINT_MAX));
unsigned int setrank = static_cast<unsigned int>(tag->getUInt("ranktoset", prefixrank, rank, UINT_MAX));
unsigned int unsetrank = static_cast<unsigned int>(tag->getUInt("ranktounset", setrank, setrank, UINT_MAX));
bool depriv = tag->getBool("depriv", true);
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp
index 8fc42b942..c16e3f5f0 100644
--- a/src/modules/m_deaf.cpp
+++ b/src/modules/m_deaf.cpp
@@ -121,7 +121,7 @@ private:
if (!source->HasPrivPermission("users/ignore-privdeaf"))
return MOD_RES_DENY;
- return MOD_RES_ALLOW;
+ return MOD_RES_PASSTHRU;
}
public:
diff --git a/src/modules/m_geoban.cpp b/src/modules/m_geoban.cpp
index ab3194cf2..47a2524c6 100644
--- a/src/modules/m_geoban.cpp
+++ b/src/modules/m_geoban.cpp
@@ -21,6 +21,7 @@
#include "inspircd.h"
#include "modules/extban.h"
#include "modules/geolocation.h"
+#include "modules/who.h"
#include "modules/whois.h"
class CountryExtBan final
@@ -48,6 +49,7 @@ public:
class ModuleGeoBan final
: public Module
+ , public Who::MatchEventListener
, public Whois::EventListener
{
private:
@@ -57,12 +59,23 @@ private:
public:
ModuleGeoBan()
: Module(VF_VENDOR | VF_OPTCOMMON, "Adds extended ban G: (country) which matches against two letter country codes.")
+ , Who::MatchEventListener(this)
, Whois::EventListener(this)
, geoapi(this)
, extban(this, geoapi)
{
}
+ ModResult OnWhoMatch(const Who::Request& request, LocalUser* source, User* user) 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) override
{
if (whois.GetTarget()->server->IsService())
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index 26d87dff2..5e45bcf7a 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -133,7 +133,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));