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/llnotifications.h | 13 ++++++++++++- indra/llui/llnotificationslistener.cpp | 8 ++++---- indra/llui/llnotificationslistener.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 93cdcbeefd..c534267fca 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -799,8 +799,19 @@ private: LLNotificationComparator mComparator; }; +// An interface class to provide a clean linker seam to the LLNotifications class. +// Extend this interface as needed for your use of LLNotifications. +class LLNotificationsInterface +{ +public: + virtual LLNotificationPtr add(const std::string& name, + const LLSD& substitutions, + const LLSD& payload, + LLNotificationFunctorRegistry::ResponseFunctor functor) = 0; +}; class LLNotifications : + public LLNotificationsInterface, public LLSingleton, public LLNotificationChannelBase { @@ -824,7 +835,7 @@ public: const LLSD& substitutions, const LLSD& payload, const std::string& functor_name); - LLNotificationPtr add(const std::string& name, + /* virtual */ LLNotificationPtr add(const std::string& name, const LLSD& substitutions, const LLSD& payload, LLNotificationFunctorRegistry::ResponseFunctor functor); 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); } diff --git a/indra/llui/llnotificationslistener.h b/indra/llui/llnotificationslistener.h index d11aed1b52..6f71a7c781 100644 --- a/indra/llui/llnotificationslistener.h +++ b/indra/llui/llnotificationslistener.h @@ -27,7 +27,7 @@ public: private: void NotificationResponder(const std::string& replypump, const LLSD& notification, - const LLSD& response); + const LLSD& response) const; LLNotifications & mNotifications; }; -- cgit v1.2.3