summaryrefslogtreecommitdiff
path: root/include/modules
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-05 15:35:05 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-05 15:35:05 +0100
commitbc388aa97c1e8ab4ebea729d116e868cff11e137 (patch)
tree171016fc53e182831beb166d1ee16f0d76451cc7 /include/modules
parent259b1113944a01aeb450265f03fb97a283e8ef15 (diff)
m_cap Add Capability::OnRequest() hook
Diffstat (limited to 'include/modules')
-rw-r--r--include/modules/cap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/modules/cap.h b/include/modules/cap.h
index 9dd44a4aa..4ca3911a5 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -65,6 +65,8 @@ namespace Cap
*
* The cap module must be loaded for the capability to work. The IsRegistered() method can be used to query whether the cap is actually online or not.
* The capability can be deactivated and reactivated with the SetActive() method. Deactivated caps behave as if they don't exist.
+ *
+ * It is possible to implement special behavior by inheriting from this class and overriding some of its methods.
*/
class Capability : public ServiceProvider, private dynamic_reference_base::CaptureHook
{
@@ -187,5 +189,15 @@ namespace Cap
* @return True if the cap is registered in the manager, false otherwise
*/
bool IsRegistered() const { return (extitem != NULL); }
+
+ /** Called when a user requests to turn this capability on or off.
+ * @param user User requesting to change the state of the cap
+ * @param add True if requesting to turn the cap on, false if requesting to turn it off
+ * @return True to allow the request, false to reject it
+ */
+ virtual bool OnRequest(LocalUser* user, bool add)
+ {
+ return true;
+ }
};
}