From a4e20e993250022872e5f4add8fb49004f9f7dbf Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 21 Apr 2010 14:29:31 +0300 Subject: 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 --- indra/newview/llviewermessage.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermessage.h') diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 7c021dc05f..72ad3c8926 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -40,6 +40,7 @@ #include "lluuid.h" #include "message.h" #include "stdenums.h" +#include "llnotifications.h" // // Forward declarations @@ -210,11 +211,10 @@ bool highlight_offered_item(const LLUUID& item_id); void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid); -struct LLOfferInfo +class LLOfferInfo : public LLNotificationResponderInterface { - LLOfferInfo() - : mFromGroup(FALSE), mFromObject(FALSE), - mIM(IM_NOTHING_SPECIAL), mType(LLAssetType::AT_NONE) {}; +public: + LLOfferInfo(); LLOfferInfo(const LLSD& sd); LLOfferInfo(const LLOfferInfo& info); @@ -232,12 +232,27 @@ struct LLOfferInfo std::string mFromName; std::string mDesc; LLHost mHost; + bool mPersist; + + // LLNotificationResponderInterface implementation + /*virtual*/ LLSD asLLSD(); + /*virtual*/ void fromLLSD(const LLSD& params); + /*virtual*/ void handleRespond(const LLSD& notification, const LLSD& response); - LLSD asLLSD(); void send_auto_receive_response(void); + + // TODO - replace all references with handleRespond() bool inventory_offer_callback(const LLSD& notification, const LLSD& response); bool inventory_task_offer_callback(const LLSD& notification, const LLSD& response); +private: + + void initRespondFunctionMap(); + + typedef boost::function respond_function_t; + typedef std::map respond_function_map_t; + + respond_function_map_t mRespondFunctions; }; void process_feature_disabled_message(LLMessageSystem* msg, void**); -- cgit v1.2.3