summaryrefslogtreecommitdiff
path: root/indra/newview/lluilistener.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-01 16:52:44 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-01 16:52:44 -0400
commitfdb7207aa0d1f25ed3e14fbc4e8615e8383e508c (patch)
treeea55aac81fd391c0b13e71928d3db9967e775d68 /indra/newview/lluilistener.cpp
parentc65cf07b12c1e3c24dc47cce3593bb7c82c21f39 (diff)
Add UI.callables() and corresponding entry point.
Diffstat (limited to 'indra/newview/lluilistener.cpp')
-rw-r--r--indra/newview/lluilistener.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index c73c93859a..2b2187a73b 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -55,6 +55,13 @@ LLUIListener::LLUIListener():
&LLUIListener::call,
llsd::map("function", LLSD(), "reply", LLSD()));
+ add("callables",
+ "Return a list [\"callables\"] of dicts {name, access} of functions registered to\n"
+ "invoke with \"call\".\n"
+ "access has values \"allow\", \"block\" or \"throttle\".",
+ &LLUIListener::callables,
+ llsd::map("reply", LLSD::String()));
+
add("getValue",
"For the UI control identified by the path in [\"path\"], return the control's\n"
"current value as [\"value\"] reply.",
@@ -131,6 +138,42 @@ void LLUIListener::call(const LLSD& event)
(info->callback_func)(NULL, event["parameter"]);
}
+void LLUIListener::callables(const LLSD& event) const
+{
+ Response response(LLSD(), event);
+
+ using Registry = LLUICtrl::CommitCallbackRegistry;
+ using Method = Registry::Registrar& (*)();
+ static Method registrars[] =
+ {
+ &Registry::defaultRegistrar,
+ &Registry::currentRegistrar,
+ };
+ LLSD list;
+ for (auto method : registrars)
+ {
+ auto& registrar{ (*method)() };
+ for (auto it = registrar.beginItems(), end = registrar.endItems(); it != end; ++it)
+ {
+ LLSD entry{ llsd::map("name", it->first) };
+ switch (it->second.handle_untrusted)
+ {
+ case LLUICtrl::CommitCallbackInfo::UNTRUSTED_ALLOW:
+ entry["access"] = "allow";
+ break;
+ case LLUICtrl::CommitCallbackInfo::UNTRUSTED_BLOCK:
+ entry["access"] = "block";
+ break;
+ case LLUICtrl::CommitCallbackInfo::UNTRUSTED_THROTTLE:
+ entry["access"] = "throttle";
+ break;
+ }
+ list.append(entry);
+ }
+ }
+ response["callables"] = list;
+}
+
void LLUIListener::getValue(const LLSD&event) const
{
Response response(LLSD(), event);