summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-18 00:30:13 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-08-18 15:16:12 +0300
commitb33d4053eca36480098f764c7b7ad8f3516641ea (patch)
tree296395fdc11741c4e4b71cee8f126352989dad39 /indra/newview
parentd4e63aead64cf4910fcee9590af72ba8bc68ceb5 (diff)
#1841 Fix viewer attempting to parse joystick key string into an llsd
Key already is an LLSD::String and needs no further parsing. This parsing was added for command line handling and should be done explicitly in command line's parser. Also extended event listeners, there should be no ambiguity in what kind of data we are passing.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llcommandlineparser.cpp5
-rw-r--r--indra/newview/llviewercontrollistener.cpp35
-rw-r--r--indra/newview/llviewercontrollistener.h1
3 files changed, 41 insertions, 0 deletions
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index 0734b12531..84d3ff90d5 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -611,6 +611,11 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
ctrl->setValue(llsdArray, false);
}
+ else if (ctrl->isType(TYPE_LLSD))
+ {
+ // Command-line LLSD should support a notation format string
+ ctrl->setValueFromNotation(onevalue(option, value), false);
+ }
else
{
ctrl->setValue(onevalue(option, value), false);
diff --git a/indra/newview/llviewercontrollistener.cpp b/indra/newview/llviewercontrollistener.cpp
index 6f77e21fcc..f8e829deb9 100644
--- a/indra/newview/llviewercontrollistener.cpp
+++ b/indra/newview/llviewercontrollistener.cpp
@@ -65,6 +65,11 @@ LLViewerControlListener::LLViewerControlListener()
grouphelp + replyhelp,
&LLViewerControlListener::set,
LLSDMap("group", LLSD())("key", LLSD()));
+ add("set_notation",
+ std::string("Set [\"group\"] TYPE_LLSD control [\"key\"] by parsing [\"value\"] as LLSD notation.\n") +
+ grouphelp + replyhelp,
+ &LLViewerControlListener::set_notation,
+ LLSDMap("group", LLSD())("key", LLSD())("value", LLSD()));
add("toggle",
std::string("Toggle [\"group\"] control [\"key\"], if boolean\n") + grouphelp + replyhelp,
&LLViewerControlListener::toggle,
@@ -150,6 +155,36 @@ void LLViewerControlListener::set(LLSD const & request)
}
//static
+void LLViewerControlListener::set_notation(LLSD const& request)
+{
+ Info info(request);
+ if (!info.control)
+ return;
+
+ if (!info.control->isType(TYPE_LLSD))
+ {
+ info.response.error(STRINGIZE("set_notation requires a TYPE_LLSD control, but '"
+ << info.key << "' in group '" << info.groupname
+ << "' has type "
+ << LLControlGroup::typeEnumToString(info.control->type())));
+ return;
+ }
+
+ if (!request["value"].isString())
+ {
+ info.response.error(STRINGIZE("set_notation requires [\"value\"] to be a string "
+ "containing LLSD notation, but received type: "
+ << LLSD::typeString(request["value"].type())));
+ return;
+ }
+
+ if (!info.control->setValueFromNotation(request["value"].asString()))
+ {
+ info.response.error(STRINGIZE("set_notation failed to parse notation"));
+ }
+}
+
+//static
void LLViewerControlListener::toggle(LLSD const & request)
{
Info info(request);
diff --git a/indra/newview/llviewercontrollistener.h b/indra/newview/llviewercontrollistener.h
index 346acac439..c5a3a31baf 100644
--- a/indra/newview/llviewercontrollistener.h
+++ b/indra/newview/llviewercontrollistener.h
@@ -41,6 +41,7 @@ public:
private:
static void set(LLSD const & event_data);
+ static void set_notation(LLSD const & event_data);
static void toggle(LLSD const & event_data);
static void get(LLSD const & event_data);
static void groups(LLSD const & event_data);