diff options
| author | 2022-11-16 16:29:12 +0000 | |
|---|---|---|
| committer | 2022-11-16 16:29:12 +0000 | |
| commit | 92739a57f6020f07fcc27b80f19869bd85369dcb (patch) | |
| tree | a1c19b2ee89521c2ecb023ad8920491ddd82adfc /src/modules/m_monitor.cpp | |
| parent | Release v4.0.0 alpha 16. (diff) | |
| parent | Update the Windows dependencies. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_monitor.cpp')
| -rw-r--r-- | src/modules/m_monitor.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp index abc546ba4..e008bcd76 100644 --- a/src/modules/m_monitor.cpp +++ b/src/modules/m_monitor.cpp @@ -20,7 +20,9 @@ #include "inspircd.h" +#include "modules/cap.h" #include "modules/isupport.h" +#include "modules/monitor.h" #include "numericbuilder.h" namespace IRCv3::Monitor @@ -359,10 +361,12 @@ public: class ModuleMonitor final : public Module , public ISupport::EventListener + , public Monitor::APIBase { private: IRCv3::Monitor::Manager manager; CommandMonitor cmd; + Cap::Capability extendedcap; void SendAlert(unsigned int numeric, const std::string& nick) { @@ -378,8 +382,10 @@ public: ModuleMonitor() : Module(VF_VENDOR, "Adds the /MONITOR command which allows users to find out when their friends are connected to the server.") , ISupport::EventListener(this) + , Monitor::APIBase(this) , manager(this, "monitor") , cmd(this, manager) + , extendedcap(this, "extended-monitor") { } @@ -416,6 +422,20 @@ public: { tokens["MONITOR"] = ConvToStr(cmd.maxmonitor); } + + void ForEachWatcher(User* user, Monitor::ForEachHandler& handler, bool extended_only) override + { + const IRCv3::Monitor::WatcherList* list = manager.GetWatcherList(user->nick); + if (!list) + return; + + for (IRCv3::Monitor::WatcherList::const_iterator i = list->begin(); i != list->end(); ++i) + { + LocalUser* curr = *i; + if (!extended_only || extendedcap.IsEnabled(curr)) + handler.Execute(curr); + } + } }; MODULE_INIT(ModuleMonitor) |
