From f3ef8a230cf3a0e3c3f75f7e37d2a1945e531754 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 11 Feb 2015 17:01:00 +0100 Subject: Convert the CAP event to use the new cross-module event system --- include/modules/cap.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/modules/cap.h') diff --git a/include/modules/cap.h b/include/modules/cap.h index fae7fff15..7aa60cd21 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -20,7 +20,9 @@ #pragma once -class CapEvent : public Event +#include "event.h" + +class CapEvent { public: enum CapEventType @@ -35,10 +37,10 @@ class CapEvent : public Event std::vector wanted; std::vector ack; User* user; - CapEvent(Module* sender, User* u, CapEventType capevtype) : Event(sender, "cap_request"), type(capevtype), user(u) {} + CapEvent(Module* sender, User* u, CapEventType capevtype) : type(capevtype), user(u) {} }; -class GenericCap +class GenericCap : public Events::ModuleEventListener { bool active; @@ -46,17 +48,15 @@ class GenericCap LocalIntExt ext; const std::string cap; GenericCap(Module* parent, const std::string& Cap) - : active(true) + : Events::ModuleEventListener(parent, "event/cap") + , active(true) , ext("cap_" + Cap, ExtensionItem::EXT_USER, parent) , cap(Cap) { } - void HandleEvent(Event& ev) + void OnCapEvent(CapEvent& ev) CXX11_OVERRIDE { - if (ev.id != "cap_request") - return; - if (!active) return; -- cgit v1.2.3