aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ircv3.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-18 23:39:53 +0000
committerGravatar Sadie Powell2026-03-18 23:39:53 +0000
commit61ef67e8210e93f48ba7819aebb93e0810137709 (patch)
tree2caf9053eb31c22fc0a9b0dd13eab0a82160029a /modules/ircv3.cpp
parentFix a minor crash on shut down after copying a dynamic reference. (diff)
parentImplement the IRCv3 no-implicit-names specification. (diff)
Merge branch 'insp4' into master.
Diffstat (limited to 'modules/ircv3.cpp')
-rw-r--r--modules/ircv3.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/ircv3.cpp b/modules/ircv3.cpp
index b77db39ef..c2441db91 100644
--- a/modules/ircv3.cpp
+++ b/modules/ircv3.cpp
@@ -24,6 +24,7 @@
#include "modules/away.h"
#include "modules/cap.h"
#include "modules/ircv3.h"
+#include "modules/names.h"
#include "modules/monitor.h"
class AwayMessage final
@@ -120,9 +121,12 @@ class ModuleIRCv3 final
: public Module
, public Account::EventListener
, public Away::EventListener
+ , public Names::EventListener
{
private:
+ bool active = false;
Cap::Capability cap_accountnotify;
+ Cap::Capability cap_noimplicitnames;
JoinHook joinhook;
ClientProtocol::EventProvider accountprotoev;
Monitor::API monitorapi;
@@ -133,7 +137,9 @@ public:
: Module(VF_VENDOR, "Provides the IRCv3 account-notify, away-notify, extended-join, and standard-replies client capabilities.")
, Account::EventListener(this)
, Away::EventListener(this)
+ , Names::EventListener(this)
, cap_accountnotify(this, "account-notify")
+ , cap_noimplicitnames(this, "no-implicit-names")
, joinhook(this)
, accountprotoev(this, "ACCOUNT")
, monitorapi(this)
@@ -145,6 +151,7 @@ public:
{
const auto& conf = ServerInstance->Config->ConfValue("ircv3");
cap_accountnotify.SetActive(conf->getBool("accountnotify", true));
+ cap_noimplicitnames.SetActive(conf->getBool("noimplicitnames", true));
joinhook.awaycap.SetActive(conf->getBool("awaynotify", true));
joinhook.extendedjoincap.SetActive(conf->getBool("extendedjoin", true));
stdrplcap.SetActive(conf->getBool("standardreplies", true));
@@ -182,6 +189,24 @@ public:
// Back from away: n!u@h AWAY
OnUserAway(user, prevstate);
}
+
+ void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except) override
+ {
+ active = true;
+ }
+
+ void OnPostJoin(Membership* memb) override
+ {
+ // The core_channel module prioritises this method to the front so this is safe.
+ active = false;
+ }
+
+ ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) override
+ {
+ if (active && cap_noimplicitnames.IsEnabled(issuer))
+ return MOD_RES_DENY;
+ return MOD_RES_PASSTHRU;
+ }
};
MODULE_INIT(ModuleIRCv3)