diff options
author | Alexei Arabadji <aarabadji@productengine.com> | 2010-06-18 17:52:54 +0300 |
---|---|---|
committer | Alexei Arabadji <aarabadji@productengine.com> | 2010-06-18 17:52:54 +0300 |
commit | 129da72326e0a314717652650ef6f4378d7794a0 (patch) | |
tree | 7bc2448a42b0f3b125ec9f0a3f53492f7d0f430c /indra/newview | |
parent | 2c5af9672c8b531762475c752dd1904a4024ff67 (diff) |
EXT-6710 FIXED Corrected 'ItemsShared' notification message and provided logging of 'item shared' message instead of spawning IM session and add message to it.
Details:
1 Corrected 'ItemsShared' notification message.
2 Avoided spawning session on item shared event.
3 Provided logging of item shared message.
4 Provided logging of 'IMSystemMessageTip' notification without opened related IM session.
reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/612/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llavataractions.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llgiveinventory.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llnotificationtiphandler.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 23 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 2 |
6 files changed, 41 insertions, 12 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 2dafe295fe..5bc3b3ac8d 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -550,11 +550,10 @@ namespace action_give_inventory // iterate through avatars for(S32 i = 0; i < count; ++i) { - const std::string& avatar_name = LLShareInfo::instance().mAvatarNames[i]; const LLUUID& avatar_uuid = LLShareInfo::instance().mAvatarUuids[i]; - // Start up IM before give the item - const LLUUID session_id = gIMMgr->addSession(avatar_name, IM_NOTHING_SPECIAL, avatar_uuid); + // We souldn't open IM session, just calculate session ID for logging purpose. See EXT-6710 + const LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, avatar_uuid); uuid_set_t::const_iterator it = inventory_selected_uuids.begin(); const uuid_set_t::const_iterator it_end = inventory_selected_uuids.end(); diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index aebf1b4c26..6470e9d6fe 100644 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -300,15 +300,15 @@ void LLGiveInventory::logInventoryOffer(const LLUUID& to_agent, const LLUUID &im // compute id of possible IM session with agent that has "to_agent" id LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, to_agent); // If this item was given by drag-and-drop into an IM panel, log this action in the IM panel chat. + LLSD args; + args["user_id"] = to_agent; if (im_session_id.notNull()) { - LLSD args; gIMMgr->addSystemMessage(im_session_id, "inventory_item_offered", args); } // If this item was given by drag-and-drop on avatar while IM panel was open, log this action in the IM panel chat. else if (LLIMModel::getInstance()->findIMSession(session_id)) { - LLSD args; gIMMgr->addSystemMessage(session_id, "inventory_item_offered", args); } // If this item was given by drag-and-drop on avatar while IM panel wasn't open, log this action to IM history. diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 2c1983b6d2..ddfcd68e38 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2311,12 +2311,20 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess } else // going to IM session { + message = LLTrans::getString(message_name + "-im"); + message.setArgs(args); if (hasSession(session_id)) { - message = LLTrans::getString(message_name + "-im"); - message.setArgs(args); gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } + // log message to file + else + { + std::string session_name; + // since we select user to share item with - his name is already in cache + gCacheName->getFullName(args["user_id"], session_name); + LLIMModel::instance().logToFile(session_name, SYSTEM_FROM, LLUUID::null, message.getString()); + } } } diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index df6f04b6ea..a06a5770a2 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -106,11 +106,16 @@ bool LLTipHandler::processNotification(const LLSD& notify) } } + std::string session_name = notification->getPayload()["SESSION_NAME"]; const std::string name = notification->getSubstitutions()["NAME"]; + if (session_name.empty()) + { + session_name = name; + } LLUUID from_id = notification->getPayload()["from_id"]; if (LLHandlerUtil::canLogToIM(notification)) { - LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name, + LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name, notification->getMessage(), from_id, from_id); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d81fa5ee1c..bf4eb6ec33 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1980,6 +1980,18 @@ static bool parse_lure_bucket(const std::string& bucket, return true; } +class LLPostponedIMSystemTipNotification: public LLPostponedNotification +{ +protected: + /* virtual */ + void modifyNotificationParams() + { + LLSD payload = mParams.payload; + payload["SESSION_NAME"] = mName; + mParams.payload = payload; + } +}; + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2050,14 +2062,19 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD args; LLSD payload; + LLNotification::Params params; + switch(dialog) { case IM_CONSOLE_AND_CHAT_HISTORY: - // *TODO: Translate args["MESSAGE"] = message; - payload["SESSION_NAME"] = name; + args["NAME"] = name; payload["from_id"] = from_id; - LLNotificationsUtil::add("IMSystemMessageTip",args, payload); + + params.name = "IMSystemMessageTip"; + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false); break; case IM_NOTHING_SPECIAL: diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 673c095826..88732fee7d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6209,7 +6209,7 @@ With the following Residents: icon="notifytip.tga" name="ItemsShared" type="notifytip"> -Items are successfully shared. +Items successfully shared. </notification> <notification icon="notifytip.tga" |