From 429bd9b55c54164d133276ed5b1fd54e565eb1b4 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Wed, 8 Jul 2009 12:07:31 -0700 Subject: Added LLNotificationsListener to hook LLNotifications to the event system according to https://wiki.lindenlab.com/wiki/Incremental_Viewer_Automation/Event_API reviewed by palmer. --- indra/llui/llnotificationslistener.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 indra/llui/llnotificationslistener.cpp (limited to 'indra/llui/llnotificationslistener.cpp') diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp new file mode 100644 index 0000000000..d2d83bd6e3 --- /dev/null +++ b/indra/llui/llnotificationslistener.cpp @@ -0,0 +1,28 @@ +/** + * @file llnotificationslistener.cpp + * @author Brad Kittenbrink + * @date 2009-07-08 + * @brief Implementation for llnotificationslistener. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llnotificationslistener.h" + +#include "llnotifications.h" + +LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : + LLDispatchListener("LLNotifications", "op"), + mNotifications(notifications) +{ + add("requestAdd", &LLNotificationsListener::requestAdd); +} + +void LLNotificationsListener::requestAdd(const LLSD& event_data) const +{ + mNotifications.add(event_data["name"], event_data["substitutions"], event_data["payload"]); +} -- cgit v1.2.3 From bc852ca9276e19ce6cb75d189d58d783a7df5e6f Mon Sep 17 00:00:00 2001 From: "palmer@945battery-guestB-224.lindenlab.com" Date: Thu, 9 Jul 2009 16:18:04 -0700 Subject: Line ending changes and Build Params changes from login-api-svn-1 --- indra/llui/llnotificationslistener.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llui/llnotificationslistener.cpp') diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index d2d83bd6e3..d6e552ca5c 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -14,12 +14,12 @@ #include "llnotificationslistener.h" #include "llnotifications.h" - -LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : - LLDispatchListener("LLNotifications", "op"), - mNotifications(notifications) -{ - add("requestAdd", &LLNotificationsListener::requestAdd); + +LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : + LLDispatchListener("LLNotifications", "op"), + mNotifications(notifications) +{ + add("requestAdd", &LLNotificationsListener::requestAdd); } void LLNotificationsListener::requestAdd(const LLSD& event_data) const -- cgit v1.2.3 From db7f15df68cda2850c3d8a7ffcc59fc136de6f95 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 22 Jul 2009 14:53:55 -0700 Subject: Adding LLLoginInstance unit test --- indra/llui/llnotificationslistener.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'indra/llui/llnotificationslistener.cpp') diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index d6e552ca5c..6ebbee68ac 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -24,5 +24,32 @@ LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications void LLNotificationsListener::requestAdd(const LLSD& event_data) const { - mNotifications.add(event_data["name"], event_data["substitutions"], event_data["payload"]); + if(event_data.has("reply")) + { + mNotifications.add(event_data["name"], + event_data["substitutions"], + event_data["payload"], + boost::bind(&LLNotificationListener::Responder, + this, + event_data["reply"].asString(), + _1, _2 + ) + ); + } + else + { + mNotifications.add(event_data["name"], + event_data["substitutions"], + event_data["payload"]); + } +} + +void LLNotificationsListener::Responder(const std::string& reply_pump, + const LLSD& notification, + const LLSD& response) +{ + LLSD reponse_event; + reponse_event["notification"] = notification; + reponse_event["response"] = response; + mEventPumps.obtain(reply_pump).post(reponse_event); } -- cgit v1.2.3 From 9538328d5f7cf0f0be5dd77b8e27032e09104fff Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Fri, 24 Jul 2009 15:08:16 -0700 Subject: Adding LLLoginInstance unit test. - Added LLNotificationsInterface class. - Removed LLLoginInstance use of LLNotifications EventAPI --- indra/llui/llnotificationslistener.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llui/llnotificationslistener.cpp') diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index 6ebbee68ac..75f4d6177d 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -29,7 +29,7 @@ void LLNotificationsListener::requestAdd(const LLSD& event_data) const mNotifications.add(event_data["name"], event_data["substitutions"], event_data["payload"], - boost::bind(&LLNotificationListener::Responder, + boost::bind(&LLNotificationsListener::NotificationResponder, this, event_data["reply"].asString(), _1, _2 @@ -44,12 +44,12 @@ void LLNotificationsListener::requestAdd(const LLSD& event_data) const } } -void LLNotificationsListener::Responder(const std::string& reply_pump, +void LLNotificationsListener::NotificationResponder(const std::string& reply_pump, const LLSD& notification, - const LLSD& response) + const LLSD& response) const { LLSD reponse_event; reponse_event["notification"] = notification; reponse_event["response"] = response; - mEventPumps.obtain(reply_pump).post(reponse_event); + LLEventPumps::getInstance()->obtain(reply_pump).post(reponse_event); } -- cgit v1.2.3