summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llmenugl.h4
-rw-r--r--indra/llui/lluictrl.cpp2
-rw-r--r--indra/llui/lluictrl.h10
-rw-r--r--indra/newview/lllocationinputctrl.cpp2
-rw-r--r--indra/newview/lluilistener.cpp18
-rw-r--r--indra/newview/llviewermenu.cpp2
-rw-r--r--indra/newview/scripts/lua/LLDebugSettings.lua7
-rw-r--r--indra/newview/scripts/lua/UI.lua5
-rw-r--r--indra/newview/scripts/lua/leap.lua12
-rw-r--r--indra/newview/scripts/lua/util.lua7
10 files changed, 31 insertions, 38 deletions
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 79f83b5773..98b76c08ff 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -950,11 +950,11 @@ public:
LLUICtrl::EnableCallbackRegistry::currentRegistrar().add(name, boost::bind(&view_listener_t::handleEvent, listener, _2));
}
- typedef LLUICtrl::LLCommitCallbackInfo cb_info;
+ typedef LLUICtrl::CommitCallbackInfo cb_info;
static void addCommit(view_listener_t *listener, const std::string &name, cb_info::EUntrustedCall handle_untrusted = cb_info::UNTRUSTED_ALLOW)
{
LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add(name,
- cb_info(boost::bind(&view_listener_t::handleEvent, listener, _2), handle_untrusted));
+ cb_info([listener](LLUICtrl*, const LLSD& param){ return listener->handleEvent(param); }, handle_untrusted));
}
static void addMenu(view_listener_t *listener, const std::string &name, cb_info::EUntrustedCall handle_untrusted = cb_info::UNTRUSTED_ALLOW)
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 0fa43081ba..6082a8f771 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -284,7 +284,7 @@ LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCa
std::string function_name = cb.function_name;
setFunctionName(function_name);
commit_callback_t* func = (CommitCallbackRegistry::getValue(function_name));
- LLUICtrl::LLCommitCallbackInfo *info = LLUICtrl::SharedCommitCallbackRegistry::getValue(function_name);
+ LLUICtrl::CommitCallbackInfo *info = LLUICtrl::SharedCommitCallbackRegistry::getValue(function_name);
if (func)
{
if (cb.parameter.isProvided())
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 790c483aee..e507178d89 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -284,7 +284,7 @@ public:
LLSINGLETON_EMPTY_CTOR(EnableCallbackRegistry);
};
- struct LLCommitCallbackInfo
+ struct CommitCallbackInfo
{
enum EUntrustedCall
{
@@ -293,16 +293,16 @@ public:
UNTRUSTED_THROTTLE
};
- LLCommitCallbackInfo(commit_callback_t func = NULL, EUntrustedCall handle_untrusted = UNTRUSTED_ALLOW)
- : callback_func(func), mHandleUntrusted(handle_untrusted)
+ CommitCallbackInfo(commit_callback_t func = {}, EUntrustedCall handle_untrusted = UNTRUSTED_ALLOW)
+ : callback_func(func), handle_untrusted(handle_untrusted)
{}
public:
- EUntrustedCall mHandleUntrusted;
commit_callback_t callback_func;
+ EUntrustedCall handle_untrusted;
};
- class SharedCommitCallbackRegistry : public CallbackRegistry<LLCommitCallbackInfo, SharedCommitCallbackRegistry>
+ class SharedCommitCallbackRegistry : public CallbackRegistry<CommitCallbackInfo, SharedCommitCallbackRegistry>
{
LLSINGLETON_EMPTY_CTOR(SharedCommitCallbackRegistry);
};
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index d31f4bbcfa..67ad63b7fb 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -377,7 +377,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
addChild(mParcelIcon[SEE_AVATARS_ICON]);
// Register callbacks and load the location field context menu (NB: the order matters).
- LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add("Navbar.Action", LLUICtrl::LLCommitCallbackInfo(boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2)));
+ LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add("Navbar.Action", LLUICtrl::CommitCallbackInfo(boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2)));
LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Navbar.EnableMenuItem", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemEnabled, this, _2));
setPrearrangeCallback(boost::bind(&LLLocationInputCtrl::onLocationPrearrange, this, _2));
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 40f276b478..604f766ab2 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -50,32 +50,30 @@ LLUIListener::LLUIListener():
"Invoke the operation named by [\"function\"], passing [\"parameter\"],\n"
"as if from a user gesture on a menu -- or a button click.",
&LLUIListener::call,
- LLSD().with("function", LLSD()));
+ llsd::map("function", LLSD(), "reply", LLSD()));
add("getValue",
"For the UI control identified by the path in [\"path\"], return the control's\n"
"current value as [\"value\"] reply.",
&LLUIListener::getValue,
- LLSDMap("path", LLSD())("reply", LLSD()));
+ llsd::map("path", LLSD(), "reply", LLSD()));
}
-typedef LLUICtrl::LLCommitCallbackInfo cb_info;
+typedef LLUICtrl::CommitCallbackInfo cb_info;
void LLUIListener::call(const LLSD& event)
{
Response response(LLSD(), event);
- LLUICtrl::LLCommitCallbackInfo *info = LLUICtrl::SharedCommitCallbackRegistry::getValue(event["function"]);
+ LLUICtrl::CommitCallbackInfo *info = LLUICtrl::SharedCommitCallbackRegistry::getValue(event["function"]);
if (!info )
{
- response.error(STRINGIZE("Function " << std::quoted(event["function"].asString()) << "was not found"));
- return;
+ return response.error(stringize("Function ", std::quoted(event["function"].asString()), " was not found"));
}
- if (info->mHandleUntrusted == cb_info::UNTRUSTED_BLOCK)
+ if (info->handle_untrusted == cb_info::UNTRUSTED_BLOCK)
{
- response.error(STRINGIZE("Function " << std::quoted(event["function"].asString()) << " is not allowed to be called from the script"));
- return;
+ return response.error(stringize("Function ", std::quoted(event["function"].asString()), " is not allowed to be called from the script"));
}
F64 cur_time = LLTimer::getElapsedSeconds();
- bool is_untrusted_throttle = info->mHandleUntrusted == cb_info::UNTRUSTED_THROTTLE;
+ bool is_untrusted_throttle = info->handle_untrusted == cb_info::UNTRUSTED_THROTTLE;
//Separate UNTRUSTED_THROTTLE and UNTRUSTED_ALLOW functions to have different timeout
F64 time_delta = is_untrusted_throttle ? mLastUntrustedThrottle + THROTTLE_PERIOD : mLastMinThrottle + MIN_THROTTLE;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 4452f0ebda..557197ccf0 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -9395,7 +9395,7 @@ void initialize_edit_menu()
}
-typedef LLUICtrl::LLCommitCallbackInfo cb_info;
+typedef LLUICtrl::CommitCallbackInfo cb_info;
#define COMMIT_ADD(func_name, func) LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add(func_name, cb_info(func))
#define COMMIT_ADD_TRUSTED(func_name, func) LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add(func_name, cb_info(func, cb_info::UNTRUSTED_BLOCK))
#define COMMIT_ADD_THROTTLE(func_name, func) LLUICtrl::SharedCommitCallbackRegistry::currentRegistrar().add(func_name, cb_info(func, cb_info::UNTRUSTED_THROTTLE))
diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua
index 06a8a63727..c250019a00 100644
--- a/indra/newview/scripts/lua/LLDebugSettings.lua
+++ b/indra/newview/scripts/lua/LLDebugSettings.lua
@@ -1,18 +1,17 @@
leap = require 'leap'
-util = require 'util'
local LLDebugSettings = {}
function LLDebugSettings.set(name, value)
- util.check_response(leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}))
+ leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value})
end
function LLDebugSettings.toggle(name)
- util.check_response(leap.request('LLViewerControl', {op='toggle', group='Global', key=name}))
+ leap.request('LLViewerControl', {op='toggle', group='Global', key=name})
end
function LLDebugSettings.get(name)
- return util.check_response(leap.request('LLViewerControl', {op='get', group='Global', key=name}))['value']
+ return leap.request('LLViewerControl', {op='get', group='Global', key=name})['value']
end
return LLDebugSettings
diff --git a/indra/newview/scripts/lua/UI.lua b/indra/newview/scripts/lua/UI.lua
index 6101c7a312..24f822bbd9 100644
--- a/indra/newview/scripts/lua/UI.lua
+++ b/indra/newview/scripts/lua/UI.lua
@@ -1,17 +1,16 @@
-- Engage the UI LLEventAPI
leap = require 'leap'
-util = require 'util'
local UI = {}
function UI.call(func, parameter)
-- 'call' is fire-and-forget
- util.check_response(leap.request('UI', {op='call', ['function']=func, parameter=parameter}))
+ leap.request('UI', {op='call', ['function']=func, parameter=parameter})
end
function UI.getValue(path)
- return util.check_response(leap.request('UI', {op='getValue', path=path}))['value']
+ return leap.request('UI', {op='getValue', path=path})['value']
end
return UI
diff --git a/indra/newview/scripts/lua/leap.lua b/indra/newview/scripts/lua/leap.lua
index ade91789f0..cfb7377523 100644
--- a/indra/newview/scripts/lua/leap.lua
+++ b/indra/newview/scripts/lua/leap.lua
@@ -161,10 +161,12 @@ function leap.request(pump, data)
dbg('leap.request(%s, %s) got %s: %s', pump, data, ok, response)
-- kill off temporary WaitForReqid object, even if error
pending[reqid] = nil
- if ok then
- return response
- else
+ if not ok then
error(response)
+ elseif response.error then
+ error(response.error)
+ else
+ return response
end
end
@@ -186,7 +188,7 @@ function leap.generate(pump, data, checklast)
local ok, response, resumed_with
repeat
ok, response = pcall(waitfor.wait, waitfor)
- if not ok then
+ if (not ok) or response.error then
break
end
-- can resume(false) to terminate generate() and clean up
@@ -196,6 +198,8 @@ function leap.generate(pump, data, checklast)
pending[reqid] = nil
if not ok then
error(response)
+ elseif response.error then
+ error(response.error)
end
end
diff --git a/indra/newview/scripts/lua/util.lua b/indra/newview/scripts/lua/util.lua
index 404efdf09e..a2191288f6 100644
--- a/indra/newview/scripts/lua/util.lua
+++ b/indra/newview/scripts/lua/util.lua
@@ -41,11 +41,4 @@ function util.equal(t1, t2)
return util.empty(temp)
end
-function util.check_response(res)
- if res.error then
- error(res.error)
- end
- return res
-end
-
return util