From 88cce61b09d225df0bcd8aab9dbd2c5a01ee7e19 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 19 Nov 2009 11:21:20 +0200
Subject: related to EXT-700 '"Offer" notifications should be accessible via
 chiclet' made 'FriendshipAccepted' notification show correct avatar icon;
 avoided empty avatar name on 'OfferFriendship' notifiaction; avoided creating
 IM session on offer from objects;

--HG--
branch : product-engine
---
 indra/newview/llnotificationofferhandler.cpp       | 26 +++++++++++++++-------
 indra/newview/llviewermessage.cpp                  |  7 ++++--
 .../newview/skins/default/xui/en/notifications.xml |  9 ++++----
 3 files changed, 28 insertions(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 94e733913d..dea3a0c169 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -92,16 +92,26 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
 	{
 		// add message to IM
-		LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, notification->getPayload()["from_id"]);
-		if (!LLIMMgr::instance().hasSession(session_id))
+		const std::string
+				name =
+						notification->getSubstitutions().has("NAME") ? notification->getSubstitutions()["NAME"]
+								: notification->getSubstitutions()["[NAME]"];
+
+		// don't create IM session with objects
+		if (notification->getName() != "ObjectGiveItem"
+				&& notification->getName() != "ObjectGiveItemUnknownUser")
 		{
-			session_id = LLIMMgr::instance().addSession(
-					notification->getSubstitutions()["OBJECTFROMNAME"], IM_NOTHING_SPECIAL,
-					notification->getPayload()["from_id"]);
+			LLUUID from_id = notification->getPayload()["from_id"];
+			LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL,
+					from_id);
+			if (!LLIMMgr::instance().hasSession(session_id))
+			{
+				session_id = LLIMMgr::instance().addSession(name,
+						IM_NOTHING_SPECIAL, from_id);
+			}
+			LLIMMgr::instance().addMessage(session_id, LLUUID(), name,
+					notification->getMessage());
 		}
-		LLIMMgr::instance().addMessage(session_id, LLUUID(),
-				notification->getSubstitutions()["OBJECTFROMNAME"],
-				notification->getMessage());
 
 		LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 11b2f07f1b..8db6d5917a 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1372,7 +1372,8 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
 
 	payload["from_id"] = info->mFromID;
 	args["OBJECTFROMNAME"] = info->mFromName;
-	args["NAME"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
+	args["NAME"] = info->mFromName;
+	args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
 	std::string verb = "highlight?name=" + msg;
 	args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
 
@@ -2115,7 +2116,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			send_generic_message("requestonlinenotification", strings);
 			
 			args["NAME"] = name;
-			LLNotifications::instance().add("FriendshipAccepted", args);
+			LLSD payload;
+			payload["from_id"] = from_id;
+			LLNotifications::instance().add("FriendshipAccepted", args, payload);
 		}
 		break;
 
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 56cb54c975..4897a4c8ab 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4959,7 +4959,7 @@ No valid parcel could be found.
    icon="notify.tga"
    name="ObjectGiveItem"
    type="offer">
-An object named [OBJECTFROMNAME] owned by [NAME] has offered you [OBJECTTYPE]:
+An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has offered you [OBJECTTYPE]:
 [ITEM_SLURL]
     <form name="form">
       <button
@@ -4980,8 +4980,9 @@ An object named [OBJECTFROMNAME] owned by [NAME] has offered you [OBJECTTYPE]:
   <notification
    icon="notify.tga"
    name="ObjectGiveItemUnknownUser"
-   type="notify">
-An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you a [OBJECTTYPE] named [OBJECTNAME].
+   type="offer">
+An object named [OBJECTFROMNAME] owned by (an unknown Resident) has offered you [OBJECTTYPE]:
+[ITEM_SLURL]
     <form name="form">
       <button
        index="0"
@@ -5002,7 +5003,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you a
    icon="notify.tga"
    name="UserGiveItem"
    type="offer">
-[NAME] has offered you [OBJECTTYPE]:
+[NAME_SLURL] has offered you [OBJECTTYPE]:
 [ITEM_SLURL]
     <form name="form">
       <button
-- 
cgit v1.2.3