From 971788e42fbdce52a6dcf201e52afd690506c3a9 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 11 Feb 2015 16:52:39 +0100 Subject: Allow enabling/disabling caps via GenericCap::SetActive() --- include/modules/cap.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/modules/cap.h') diff --git a/include/modules/cap.h b/include/modules/cap.h index cc1cb8d8c..fae7fff15 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -40,11 +40,14 @@ class CapEvent : public Event class GenericCap { + bool active; + public: LocalIntExt ext; const std::string cap; GenericCap(Module* parent, const std::string& Cap) - : ext("cap_" + Cap, ExtensionItem::EXT_USER, parent) + : active(true) + , ext("cap_" + Cap, ExtensionItem::EXT_USER, parent) , cap(Cap) { } @@ -54,6 +57,9 @@ class GenericCap if (ev.id != "cap_request") return; + if (!active) + return; + CapEvent *data = static_cast(&ev); if (data->type == CapEvent::CAPEVENT_REQ) { @@ -87,4 +93,7 @@ class GenericCap ext.set(data->user, 0); } } + + void SetActive(bool newstate) { active = newstate; } + bool IsActive() const { return active; } }; -- cgit v1.3.1-10-gc9f91