diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-21 14:29:31 +0300 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-21 14:29:31 +0300 |
commit | a4e20e993250022872e5f4add8fb49004f9f7dbf (patch) | |
tree | 22fd1e7bcebd1d1fb214a5b328ac47b48f50a400 /indra/llui/llnotifications.h | |
parent | 6b722079c4207eeb96aef3305ed2538933b06358 (diff) |
Implemented EXT-6783(normal sub task) - Implement saving of unread notifications.
Utilized old save and load notification code.
Main concern was with notifications that have complex responder - UserGiveItem, ObjectGiveItem. Those responders are object with own fields that need to persist through sessions.
Notifications that should be saved are marked with persist="true" in notifications.xml
Notifications using functor responders are saved automatically.
Notifications using object responders need additional tuning. Responder object should be a) serializable(implement LLNotificationResponderInterface), b) registered with LLResponderRegistry.
At this point following notifications persist through sessions: UserGiveItem, ObjectGiveItem, TeleportOffered, FrienshipOffered.
Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/211/
--HG--
branch : notifications
Diffstat (limited to 'indra/llui/llnotifications.h')
-rw-r--r-- | indra/llui/llnotifications.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 1799ca65b7..c942a32512 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -116,8 +116,23 @@ typedef enum e_notification_priority NOTIFICATION_PRIORITY_CRITICAL } ENotificationPriority; +class LLNotificationResponderInterface +{ +public: + LLNotificationResponderInterface(){}; + virtual ~LLNotificationResponderInterface(){}; + + virtual void handleRespond(const LLSD& notification, const LLSD& response) = 0; + + virtual LLSD asLLSD() = 0; + + virtual void fromLLSD(const LLSD& params) = 0; +}; + typedef boost::function<void (const LLSD&, const LLSD&)> LLNotificationResponder; +typedef boost::shared_ptr<LLNotificationResponderInterface> LLNotificationResponderPtr; + typedef LLFunctorRegistry<LLNotificationResponder> LLNotificationFunctorRegistry; typedef LLFunctorRegistration<LLNotificationResponder> LLNotificationFunctorRegistration; @@ -303,10 +318,12 @@ public: { Alternative<std::string> name; Alternative<LLNotificationFunctorRegistry::ResponseFunctor> function; + Alternative<LLNotificationResponderPtr> responder; Functor() : name("functor_name"), - function("functor") + function("functor"), + responder("responder") {} }; Optional<Functor> functor; @@ -349,12 +366,13 @@ private: bool mIgnored; ENotificationPriority mPriority; LLNotificationFormPtr mForm; - void* mResponderObj; + void* mResponderObj; // TODO - refactor/remove this field bool mIsReusable; - + LLNotificationResponderPtr mResponder; + // a reference to the template LLNotificationTemplatePtr mTemplatep; - + /* We want to be able to store and reload notifications so that they can survive a shutdown/restart of the client. So we can't simply pass in callbacks; @@ -393,6 +411,8 @@ public: void setResponseFunctor(const LLNotificationFunctorRegistry::ResponseFunctor& cb); + void setResponseFunctor(const LLNotificationResponderPtr& responder); + typedef enum e_response_template_type { WITHOUT_DEFAULT_BUTTON, @@ -459,7 +479,12 @@ public: { return mTemplatep->mName; } - + + bool isPersistent() const + { + return mTemplatep->mPersist; + } + const LLUUID& id() const { return mId; |