From b9bcc7846af839cf8a5190fb5ce910267a9dbbbe Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 17 Jun 2026 14:43:57 +0100 Subject: Allow modules to send the ISupport list to clients. --- include/modules/isupport.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include/modules') diff --git a/include/modules/isupport.h b/include/modules/isupport.h index 47d01c950..8999eb88b 100644 --- a/include/modules/isupport.h +++ b/include/modules/isupport.h @@ -21,6 +21,8 @@ namespace ISupport { + class API; + class APIBase; class EventListener; class EventProvider; @@ -34,6 +36,33 @@ enum RPL_ISUPPORT = 5, }; +/** Defines the interface for the ISupport API. */ +class ISupport::APIBase + : public DataProvider +{ +public: + APIBase(Module* mod) + : DataProvider(mod, "isupportapi") + { + } + + /** Sends a full ISupport numeric set to the specified user. + * @param user The user to send to. + */ + virtual void SendTo(LocalUser* user) const = 0; +}; + +/** Allows modules to send ISupport messages to users. */ +class ISupport::API final + : public dynamic_reference +{ +public: + API(Module* mod) + : dynamic_reference(mod, "isupportapi") + { + } +}; + class ISupport::EventListener : public Events::ModuleEventListener { -- cgit v1.3.1-10-gc9f91 From 9ff8807fd6966a8d30bdcb656041976a724a400d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 17 Jun 2026 15:02:43 +0100 Subject: Allow modules to control which clients receive an ISupport diff. --- include/modules/isupport.h | 4 ++++ src/coremods/core_info/core_info.cpp | 2 +- src/coremods/core_info/isupport.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'include/modules') diff --git a/include/modules/isupport.h b/include/modules/isupport.h index 8999eb88b..50753de49 100644 --- a/include/modules/isupport.h +++ b/include/modules/isupport.h @@ -75,6 +75,10 @@ protected: public: virtual void OnBuildISupport(TokenMap& tokens) { } virtual void OnBuildClassISupport(const std::shared_ptr& klass, TokenMap& tokens) { } + virtual ModResult OnSendISupportDiff(LocalUser* user, const TokenMap& tokens) + { + return MOD_RES_PASSTHRU; + } }; class ISupport::EventProvider final diff --git a/src/coremods/core_info/core_info.cpp b/src/coremods/core_info/core_info.cpp index 40630dc20..b72b553dd 100644 --- a/src/coremods/core_info/core_info.cpp +++ b/src/coremods/core_info/core_info.cpp @@ -184,7 +184,7 @@ public: // can't break the API in a stable release. For now we use this and // prioritise it to be after core_user checks whether the user needs // to die. - if (user->IsFullyConnected() && !user->quitting) + if (!user->quitting) isupport.ChangeClass(user, user->GetClass(), klass); } diff --git a/src/coremods/core_info/isupport.cpp b/src/coremods/core_info/isupport.cpp index 846fe67f0..1cb3c5672 100644 --- a/src/coremods/core_info/isupport.cpp +++ b/src/coremods/core_info/isupport.cpp @@ -129,7 +129,8 @@ void ISupportManager::Build() for (LocalUser* user : ServerInstance->Users.GetLocalUsers()) { const auto& klass = user->GetClass(); - if (!(user->connected & User::CONN_FULL)) + auto modres = isupportevprov.FirstResult(&ISupport::EventListener::OnSendISupportDiff, user, newtokens[klass]); + if (!modres.check(user->IsFullyConnected())) continue; // User hasn't received 005 yet. auto numerics = diffnumerics.find(klass); @@ -185,6 +186,10 @@ void ISupportManager::ChangeClass(LocalUser* user, const std::shared_ptrsecond, newtokens->second); + auto modres = isupportevprov.FirstResult(&ISupport::EventListener::OnSendISupportDiff, user, difftokens); + if (!modres.check(user->IsFullyConnected())) + return; // User hasn't received 005 yet. + std::vector diffnumerics; BuildNumerics(difftokens, diffnumerics); -- cgit v1.3.1-10-gc9f91