diff options
Diffstat (limited to 'indra/newview/llnotificationhandler.h')
-rw-r--r-- | indra/newview/llnotificationhandler.h | 165 |
1 files changed, 162 insertions, 3 deletions
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index cd4e640ec4..99a1fedcf3 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -36,9 +36,13 @@ #include "llwindow.h" -#include "llnotifications.h" +//#include "llnotificationsutil.h" #include "llchannelmanager.h" #include "llchat.h" +#include "llinstantmessage.h" +#include "llnotificationptr.h" + +class LLIMFloater; namespace LLNotificationsUI { @@ -53,7 +57,8 @@ typedef enum e_notification_type NT_GROUPCHAT, NT_NEARBYCHAT, NT_ALERT, - NT_ALERTMODAL + NT_ALERTMODAL, + NT_OFFER } ENotificationType; /** @@ -119,9 +124,17 @@ protected: class LLSysHandler : public LLEventHandler { public: + LLSysHandler(); virtual ~LLSysHandler() {}; virtual bool processNotification(const LLSD& notify)=0; + +protected : + static void init(); + void removeExclusiveNotifications(const LLNotificationPtr& notif); + + typedef std::list< std::set<std::string> > exclusive_notif_sets; + static exclusive_notif_sets sExclusiveNotificationGroups; }; /** @@ -132,7 +145,7 @@ class LLChatHandler : public LLEventHandler public: virtual ~LLChatHandler() {}; - virtual void processChat(const LLChat& chat_msg)=0; + virtual void processChat(const LLChat& chat_msg, const LLSD &args)=0; }; /** @@ -168,6 +181,7 @@ public: protected: virtual void onDeleteToast(LLToast* toast); + virtual void onRejectToast(const LLUUID& id); virtual void initChannel(); }; @@ -208,6 +222,9 @@ public: protected: virtual void onDeleteToast(LLToast* toast); virtual void initChannel(); + + // own handlers + void onRejectToast(LLUUID& id); }; /** @@ -231,6 +248,148 @@ protected: bool mIsModal; }; +/** + * Handler for offers notices. + * It manages life time of offer notices. + */ +class LLOfferHandler : public LLSysHandler +{ +public: + LLOfferHandler(e_notification_type type, const LLSD& id); + virtual ~LLOfferHandler(); + + // base interface functions + virtual bool processNotification(const LLSD& notify); + +protected: + virtual void onDeleteToast(LLToast* toast); + virtual void initChannel(); + + // own handlers + void onRejectToast(LLUUID& id); +}; + +class LLHandlerUtil +{ +public: + /** + * Checks sufficient conditions to log notification message to IM session. + */ + static bool canLogToIM(const LLNotificationPtr& notification); + + /** + * Checks sufficient conditions to log notification message to nearby chat session. + */ + static bool canLogToNearbyChat(const LLNotificationPtr& notification); + + /** + * Checks sufficient conditions to spawn IM session. + */ + static bool canSpawnIMSession(const LLNotificationPtr& notification); + + /** + * Checks sufficient conditions to add notification toast panel IM floater. + */ + static bool canAddNotifPanelToIM(const LLNotificationPtr& notification); + + /** + * Checks whether notification can be used multiple times or not. + */ + static bool isNotificationReusable(const LLNotificationPtr& notification); + + /** + * Checks if passed notification can create IM session and be written into it. + * + * This method uses canLogToIM() & canSpawnIMSession(). + */ + static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); + + /** + * Checks if passed notification can create toast. + */ + static bool canSpawnToast(const LLNotificationPtr& notification); + + /** + * Determines whether IM floater is opened. + */ + static bool isIMFloaterOpened(const LLNotificationPtr& notification); + + /** + * Determines whether IM floater is focused. + */ + static bool isIMFloaterFocused(const LLNotificationPtr& notification); + + /** + * Writes notification message to IM session. + */ + static void logToIM(const EInstantMessage& session_type, + const std::string& session_name, const std::string& from_name, + const std::string& message, const LLUUID& session_owner_id, + const LLUUID& from_id); + + /** + * Writes notification message to IM p2p session. + */ + static void logToIMP2P(const LLNotificationPtr& notification); + + /** + * Writes notification message to IM p2p session. + */ + static void logToIMP2P(const LLNotificationPtr& notification, bool to_file_only); + + /** + * Writes group notice notification message to IM group session. + */ + static void logGroupNoticeToIMGroup(const LLNotificationPtr& notification); + + /** + * Writes notification message to nearby chat. + */ + static void logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type); + + /** + * Spawns IM session. + */ + static LLUUID spawnIMSession(const std::string& name, const LLUUID& from_id); + + /** + * Returns name from the notification's substitution. + * + * Methods gets "NAME" or "[NAME]" from the substitution map. + * + * @param notification - Notification which substitution's name will be returned. + */ + static std::string getSubstitutionName(const LLNotificationPtr& notification); + + /** + * Adds notification panel to the IM floater. + */ + static void addNotifPanelToIM(const LLNotificationPtr& notification); + + /** + * Updates messages of IM floater. + */ + static void updateIMFLoaterMesages(const LLUUID& session_id); + + /** + * Updates messages of visible IM floater. + */ + static void updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification); + + /** + * Decrements counter of IM messages. + */ + static void decIMMesageCounter(const LLNotificationPtr& notification); + +private: + + /** + * Find IM floater based on "from_id" + */ + static LLIMFloater* findIMFloater(const LLNotificationPtr& notification); + +}; + } #endif |