summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-04-02 11:13:37 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-04-02 11:13:37 -0400
commit233de4561c25df24dd787079ed7d7d98cbc40ff2 (patch)
tree5b3977aeb535a20d8678257187f9cef17b8f60f9
parentf45ae0def221b4e1911e83f2da528174cf1d8a0d (diff)
Give LLLeapListener's "listen" operation a "tweak" argument.
If specified as true, "tweak" means to tweak the specified "listener" name for uniqueness. This avoids LLEventPump::listen()'s DupListenerName exception, which causes the "listen" operation to return "status" as false.
-rw-r--r--indra/llcommon/llleaplistener.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/indra/llcommon/llleaplistener.cpp b/indra/llcommon/llleaplistener.cpp
index 55e4752c5d..e8a4775b67 100644
--- a/indra/llcommon/llleaplistener.cpp
+++ b/indra/llcommon/llleaplistener.cpp
@@ -80,11 +80,13 @@ LLLeapListener::LLLeapListener(const std::string_view& caller, const Callback& c
add("listen",
"Listen to an existing LLEventPump named [\"source\"], with listener name\n"
"[\"listener\"].\n"
+ "If [\"tweak\"] is specified as true, tweak listener name for uniqueness.\n"
"By default, send events on [\"source\"] to the plugin, decorated\n"
"with [\"pump\"]=[\"source\"].\n"
"If [\"dest\"] specified, send undecorated events on [\"source\"] to the\n"
"LLEventPump named [\"dest\"].\n"
- "Returns [\"status\"] boolean indicating whether the connection was made.",
+ "Returns [\"status\"] boolean indicating whether the connection was made,\n"
+ "plus [\"listener\"] reporting (possibly tweaked) listener name.",
&LLLeapListener::listen,
need_source_listener);
add("stoplistening",
@@ -119,6 +121,7 @@ LLLeapListener::~LLLeapListener()
// value_type, and Bad Things would happen if you copied an
// LLTempBoundListener. (Destruction of the original would disconnect the
// listener, invalidating every stored connection.)
+ LL_DEBUGS("LLLeapListener") << "~LLLeapListener(\"" << mCaller << "\")" << LL_ENDL;
for (ListenersMap::value_type& pair : mListeners)
{
pair.second.disconnect();
@@ -155,6 +158,11 @@ void LLLeapListener::listen(const LLSD& request)
std::string source_name = request["source"];
std::string dest_name = request["dest"];
std::string listener_name = request["listener"];
+ if (request["tweak"].asBoolean())
+ {
+ listener_name = LLEventPump::inventName(listener_name);
+ }
+ reply["listener"] = listener_name;
LLEventPump & source = LLEventPumps::instance().obtain(source_name);