summaryrefslogtreecommitdiff
path: root/include/modules/cap.h
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-02-11 16:52:39 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-02-11 16:52:39 +0100
commit971788e42fbdce52a6dcf201e52afd690506c3a9 (patch)
tree77b66ba257d46a31443162986b1d222102dfb16c /include/modules/cap.h
parent8c2135aad0b2bbd8afca21a6c0664a9e4182dc9b (diff)
Allow enabling/disabling caps via GenericCap::SetActive()
Diffstat (limited to 'include/modules/cap.h')
-rw-r--r--include/modules/cap.h11
1 files changed, 10 insertions, 1 deletions
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<CapEvent*>(&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; }
};