From 89f7335a52ec9955432dbe8bfa5903f605b7362c Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Thu, 15 Nov 2012 17:34:34 -0800
Subject: [PATCH] CHUI-489: Found a bug in last commit for this issue. The
 sound notification (for inventory/teleport offer) would be played for the
 toast popup as well as once the conversations floater was opened. And also
 when a button was clicked in the conversation floater to 'accept' or 'deny'
 the offer. Now only playing the sound notification when the initial offer has
 been made.

---
 indra/newview/llnotificationofferhandler.cpp | 17 +++++++++++++++++
 indra/newview/lltoastnotifypanel.cpp         | 15 +--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 6e641575fa9..8b7cac9f4b3 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -117,6 +117,23 @@ bool LLOfferHandler::processNotification(const LLNotificationPtr& notification)
 			LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
 			if(channel)
 				channel->addToast(p);
+
+            bool playSound = true;
+
+            //Play notification sound for inventory offer and teleport offer based upon chat preference
+            if((notification->getName() == "UserGiveItem"
+                && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE)
+                ||  notification->getName() == "TeleportOffered"
+                && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE)
+            {
+                playSound = false;
+            }
+
+            if(playSound)
+            {
+                notification->playSound();
+            }
+
 		}
 
 		if (notification->canLogToIM())
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 8672dc479d6..844d7314d97 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -494,20 +494,7 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images )
 	// adjust panel's height to the text size
 	snapToMessageHeight(mTextBox, MAX_LENGTH);
 
-    bool playSound = true;
-
-    if((mNotification->getName() == "UserGiveItem"
-            && gSavedSettings.getBOOL("PlaySoundInventoryOffer") == FALSE)
-        ||  mNotification->getName() == "TeleportOffered"
-            && gSavedSettings.getBOOL("PlaySoundTeleportOffer") == FALSE)
-    {
-        playSound = false;
-    }
-
-    if(playSound)
-    {
-        mNotification->playSound();
-    }
+
 }
 
 
-- 
GitLab