summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-02-11 17:01:00 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-02-11 17:01:00 +0100
commitf3ef8a230cf3a0e3c3f75f7e37d2a1945e531754 (patch)
tree430bba5dae607abee736dcbb515e7f85cc1abf90 /include
parent971788e42fbdce52a6dcf201e52afd690506c3a9 (diff)
Convert the CAP event to use the new cross-module event system
Diffstat (limited to 'include')
-rw-r--r--include/modules/cap.h16
1 files changed, 8 insertions, 8 deletions
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<std::string> wanted;
std::vector<std::string> 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;