diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llnotificationhandler.h | 5 | ||||
-rw-r--r-- | indra/newview/llnotificationhandlerutil.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llnotificationofferhandler.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 4 |
5 files changed, 46 insertions, 5 deletions
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index da8928321a..5c240aa54a 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -266,6 +266,11 @@ public: static bool canLogToIM(const LLNotificationPtr& notification); /** + * Checks sufficient conditions to spawn IM session. + */ + static bool canSpawnIMSession(const LLNotificationPtr& notification); + + /** * Writes notification message to IM session. */ static void logToIM(const EInstantMessage& session_type, diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 857b7e9796..0fbc6575e8 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -43,7 +43,10 @@ using namespace LLNotificationsUI; const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"), REVOKED_MODIFY_RIGHTS("RevokedModifyRights"), OBJECT_GIVE_ITEM( "ObjectGiveItem"), OBJECT_GIVE_ITEM_UNKNOWN_USER( - "ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"); + "ObjectGiveItemUnknownUser"), PAYMENT_RECIVED("PaymentRecived"), + ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"), + USER_GIVE_ITEM("UserGiveItem"), OFFER_FRIENDSHIP("OfferFriendship"), + FRIENDSHIP_ACCEPTED("FriendshipAccepted"); // static bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) @@ -54,6 +57,14 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification) } // static +bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) +{ + return ADD_FRIEND_WITH_MESSAGE == notification->getName() + || OFFER_FRIENDSHIP == notification->getName() + || FRIENDSHIP_ACCEPTED == notification->getName(); +} + +// static void LLHandlerUtil::logToIM(const EInstantMessage& session_type, const std::string& session_name, const std::string& from_name, const std::string& message, const LLUUID& session_owner_id, diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 4f353bf6a5..b7f95ae2fa 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -40,6 +40,7 @@ #include "llnotificationmanager.h" #include "llnotifications.h" #include "llscriptfloater.h" +#include "llimview.h" using namespace LLNotificationsUI; @@ -101,6 +102,26 @@ bool LLOfferHandler::processNotification(const LLSD& notify) } else { + if (LLHandlerUtil::canSpawnIMSession(notification)) + { + const std::string name = notification->getSubstitutions().has( + "NAME") ? notification->getSubstitutions()["NAME"] + : notification->getSubstitutions()["[NAME]"]; + + LLUUID from_id = notification->getPayload()["from_id"]; + + LLUUID session_id = LLIMMgr::computeSessionID( + IM_NOTHING_SPECIAL, from_id); + + LLIMModel::LLIMSession* session = + LLIMModel::instance().findIMSession(session_id); + if (session == NULL) + { + LLIMMgr::instance().addSession(name, IM_NOTHING_SPECIAL, + from_id); + } + } + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); LLToast::Params p; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 85b6051502..558382b0a7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2010,13 +2010,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_INVENTORY_ACCEPTED: { args["NAME"] = name; - LLNotificationsUtil::add("InventoryAccepted", args); + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("InventoryAccepted", args, payload); break; } case IM_INVENTORY_DECLINED: { args["NAME"] = name; - LLNotificationsUtil::add("InventoryDeclined", args); + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("InventoryDeclined", args, payload); break; } // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f48cc6d4bf..0d7351395a 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -4499,14 +4499,14 @@ You don't have permission to copy this. <notification icon="notifytip.tga" name="InventoryAccepted" - type="notifytip"> + type="offer"> [NAME] received your inventory offer. </notification> <notification icon="notifytip.tga" name="InventoryDeclined" - type="notifytip"> + type="offer"> [NAME] declined your inventory offer. </notification> |