From 4992eaf27dd113df805f347811882e72df6d7a86 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 1 Apr 2010 15:24:36 +0300 Subject: fixed EXT-2801 Record "object return" notification into IM history, not chat history, * added class for LLPostponedNotification to rpovide possibility postpone adding notification to notifications system till sender avatar name will be received from cache name; * rolled back changes related to fix of EXT-4779; * avoided passing avatar id when logging 'Object Return' notification to nearby chat; eviewed by Vadim Savchuk at https://jira.secondlife.com/browse/EXT-6373 --HG-- branch : product-engine --- indra/llui/llnotifications.h | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 400491a154..707a84bdfe 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -104,6 +104,7 @@ #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" +#include "llcachename.h" typedef enum e_notification_priority @@ -949,6 +950,62 @@ private: boost::scoped_ptr mListener; }; +/** + * Abstract class for postponed notifications. + * Provides possibility to add notification after specified by id avatar or group will be + * received from cache name. The object of this type automatically well be deleted + * by cleanup method after respond will be received from cache name. + * + * To add custom postponed notification to the notification system client should: + * 1 create class derived from LLPostponedNotification; + * 2 call LLPostponedNotification::add method; + */ +class LLPostponedNotification +{ +public: + /** + * Performs hooking cache name callback which will add notification to notifications system. + * Type of added notification should be specified by template parameter T + * and non-private derived from LLPostponedNotification class, + * otherwise compilation error will occur. + */ + template + static void add(const LLNotification::Params& params, + const LLUUID& id, bool is_group) + { + // upcast T to the base type to restrict T derivation from LLPostponedNotification + LLPostponedNotification* thiz = new T(); + + thiz->mParams = params; + + gCacheName->get(id, is_group, boost::bind( + &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2, + _3, _4)); + } + +private: + void onCachedNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, bool is_group); + + void cleanup() + { + delete this; + } + +protected: + LLPostponedNotification() {} + ~LLPostponedNotification() {} + + /** + * Abstract method provides possibility to modify notification parameters and + * will be called after cache name retrieve information about avatar or group + * and before notification will be added to the notification system. + */ + virtual void modifyNotificationParams() = 0; + + LLNotification::Params mParams; + std::string mName; +}; #endif//LL_LLNOTIFICATIONS_H -- cgit v1.2.3 From 08a2242ceb9c94c74c31aa56dbfd42e204a7fd8e Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 1 Apr 2010 18:20:34 +0300 Subject: Fixed windows build --HG-- branch : product-engine --- indra/llui/llnotifications.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llnotifications.h') diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 707a84bdfe..1799ca65b7 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -994,7 +994,7 @@ private: protected: LLPostponedNotification() {} - ~LLPostponedNotification() {} + virtual ~LLPostponedNotification() {} /** * Abstract method provides possibility to modify notification parameters and -- cgit v1.2.3