summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-02-18 10:56:26 -0500
committerNat Goodspeed <nat@lindenlab.com>2011-02-18 10:56:26 -0500
commit4ef02bc1b6cf5e044d2cf57725eac1a4ccd7580d (patch)
tree97b7612d5467e3d206ac7b5bb04f084b644db6fd /indra/newview
parent89258376ffc3d1e6d9e40a9136e4901e643187c8 (diff)
Introduce and use new sendReply() function for LLEventAPI methods.
Each LLEventAPI method that generates a reply needs to extract the name of the reply LLEventPump from the request, typically from a ["reply"] key, copy the ["reqid"] value from request to reply, locate the reply LLEventPump and send the enriched reply object. Encapsulate in sendReply() function before we proliferate doing all that by hand too many more times.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llsidetraylistener.cpp15
-rw-r--r--indra/newview/llviewerwindowlistener.cpp5
2 files changed, 6 insertions, 14 deletions
diff --git a/indra/newview/llsidetraylistener.cpp b/indra/newview/llsidetraylistener.cpp
index 185bf1d6a7..6db13e517d 100644
--- a/indra/newview/llsidetraylistener.cpp
+++ b/indra/newview/llsidetraylistener.cpp
@@ -37,16 +37,12 @@ LLSideTrayListener::LLSideTrayListener(const Getter& getter):
void LLSideTrayListener::getCollapsed(const LLSD& event) const
{
- LLReqID reqID(event);
- LLSD reply(reqID.makeResponse());
- reply["open"] = ! mGetter()->getCollapsed();
- LLEventPumps::instance().obtain(event["reply"]).post(reply);
+ sendReply(LLSDMap("open", ! mGetter()->getCollapsed()), event);
}
void LLSideTrayListener::getTabs(const LLSD& event) const
{
- LLReqID reqID(event);
- LLSD reply(reqID.makeResponse());
+ LLSD reply;
LLSideTray* tray = mGetter();
LLSD::Integer ord(0);
@@ -68,7 +64,7 @@ void LLSideTrayListener::getTabs(const LLSD& event) const
reply[child->getName()] = info;
}
- LLEventPumps::instance().obtain(event["reply"]).post(reply);
+ sendReply(reply, event);
}
static LLSD getTabInfo(LLPanel* tab)
@@ -133,8 +129,7 @@ static LLSD getTabInfo(LLPanel* tab)
void LLSideTrayListener::getPanels(const LLSD& event) const
{
- LLReqID reqID(event);
- LLSD reply(reqID.makeResponse());
+ LLSD reply;
LLSideTray* tray = mGetter();
// Iterate through the attached tabs.
@@ -163,5 +158,5 @@ void LLSideTrayListener::getPanels(const LLSD& event) const
reply[tab->getName()] = getTabInfo(tab).with("attached", false).with("ord", ord);
}
- LLEventPumps::instance().obtain(event["reply"]).post(reply);
+ sendReply(reply, event);
}
diff --git a/indra/newview/llviewerwindowlistener.cpp b/indra/newview/llviewerwindowlistener.cpp
index 0b52948680..1fe5fc9800 100644
--- a/indra/newview/llviewerwindowlistener.cpp
+++ b/indra/newview/llviewerwindowlistener.cpp
@@ -65,7 +65,6 @@ LLViewerWindowListener::LLViewerWindowListener(LLViewerWindow* llviewerwindow):
void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
{
- LLReqID reqid(event);
typedef std::map<LLSD::String, LLViewerWindow::ESnapshotType> TypeMap;
TypeMap types;
#define tp(name) types[#name] = LLViewerWindow::SNAPSHOT_TYPE_##name
@@ -98,9 +97,7 @@ void LLViewerWindowListener::saveSnapshot(const LLSD& event) const
type = found->second;
}
bool ok = mViewerWindow->saveSnapshot(event["filename"], width, height, showui, rebuild, type);
- LLSD response(reqid.makeResponse());
- response["ok"] = ok;
- LLEventPumps::instance().obtain(event["reply"]).post(response);
+ sendReply(LLSDMap("ok", ok), event);
}
void LLViewerWindowListener::requestReshape(LLSD const & event_data) const