summaryrefslogtreecommitdiff
path: root/indra/llui/llfloaterreglistener.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-03 20:50:18 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-03 20:50:18 -0400
commita8dd7135f0423384dbbb1e3b98514149c6a69e6b (patch)
tree0f9df11661863df2ba031eeee0e589a8f92b8a2e /indra/llui/llfloaterreglistener.cpp
parentf3896d37ca625a4f7060ee5139a8825c2f6e6a74 (diff)
Use Lua result-set logic for "LLFloaterReg"s "getFloaterNames" op.
This is the query that produced so many results that, before we lifted the infinite-loop interrupt limit, inspect(result) hit the limit and terminated.
Diffstat (limited to 'indra/llui/llfloaterreglistener.cpp')
-rw-r--r--indra/llui/llfloaterreglistener.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index e17f9f4dd6..bd8d87086e 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -38,6 +38,7 @@
#include "llfloater.h"
#include "llbutton.h"
#include "llluafloater.h"
+#include "resultset.h"
LLFloaterRegListener::LLFloaterRegListener():
LLEventAPI("LLFloaterReg",
@@ -82,9 +83,9 @@ LLFloaterRegListener::LLFloaterRegListener():
&LLFloaterRegListener::getLuaFloaterEvents);
add("getFloaterNames",
- "Return the table of all registered floaters",
+ "Return result set key [\"floaters\"] for names of all registered floaters",
&LLFloaterRegListener::getFloaterNames,
- llsd::map("reply", LLSD()));
+ llsd::map("reply", LLSD::String()));
}
void LLFloaterRegListener::getBuildMap(const LLSD& event) const
@@ -126,10 +127,22 @@ void LLFloaterRegListener::instanceVisible(const LLSD& event) const
event);
}
+struct NameResultSet: public LL::ResultSet
+{
+ NameResultSet():
+ LL::ResultSet("floaters"),
+ mNames(LLFloaterReg::getFloaterNames())
+ {}
+ LLSD mNames;
+
+ int getLength() const override { return narrow(mNames.size()); }
+ LLSD getSingle(int index) const override { return mNames[index]; }
+};
void LLFloaterRegListener::getFloaterNames(const LLSD &event) const
{
- Response response(llsd::map("floaters", LLFloaterReg::getFloaterNames()), event);
+ auto nameresult = new NameResultSet;
+ sendReply(llsd::map("floaters", nameresult->getKeyLength()), event);
}
void LLFloaterRegListener::clickButton(const LLSD& event) const
@@ -178,4 +191,3 @@ void LLFloaterRegListener::getLuaFloaterEvents(const LLSD &event) const
{
Response response(llsd::map("events", LLLuaFloater::getEventsData()), event);
}
-