summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules/cap.h10
-rw-r--r--src/modules/m_cap.cpp3
2 files changed, 13 insertions, 0 deletions
diff --git a/include/modules/cap.h b/include/modules/cap.h
index 4ca3911a5..a00089260 100644
--- a/include/modules/cap.h
+++ b/include/modules/cap.h
@@ -199,5 +199,15 @@ namespace Cap
{
return true;
}
+
+ /** Called when a user requests a list of all capabilities and this capability is about to be included in the list.
+ * The default behavior always includes the cap in the list.
+ * @param user User querying a list capabilities
+ * @return True to add this cap to the list sent to the user, false to not list it
+ */
+ virtual bool OnList(LocalUser* user)
+ {
+ return true;
+ }
};
}
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index bb5a506c9..2b4055e3c 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -149,6 +149,9 @@ class Cap::ManagerImpl : public Cap::Manager
if (!(show_caps & cap->GetMask()))
continue;
+ if ((show_all) && (!cap->OnList(user)))
+ continue;
+
if (minus_prefix)
out.push_back('-');
out.append(cap->GetName()).push_back(' ');