Quantcast

chat whisper bug fixed

Munglunch [04-02-15 - 17:56]
chat whisper bug fixed
Filename
SVUI_Chat/Loader.lua
SVUI_Chat/SVUI_Chat.lua
diff --git a/SVUI_Chat/Loader.lua b/SVUI_Chat/Loader.lua
index 67dbce4..59e1924 100644
--- a/SVUI_Chat/Loader.lua
+++ b/SVUI_Chat/Loader.lua
@@ -1,7 +1,7 @@
 --[[
 ##########################################################
 S V U I   By: Munglunch
-##########################################################
+##########################################################
 LOCALIZED LUA FUNCTIONS
 ##########################################################
 ]]--
@@ -24,33 +24,32 @@ SV:AssignMedia("globalfont", "chatdialog", "SVUI_Font_Chat");
 SV:AssignMedia("globalfont", "chattab", "SVUI_Font_ChatTab");

 MOD.media = {}
-MOD.media.whisperSound = [[Interface\AddOns\SVUI_Chat\assets\whisper.mp3]];
 MOD.media.dockIcon = [[Interface\AddOns\SVUI_Chat\assets\DOCK-ICON-CHAT]];
 MOD.media.scrollIcon = [[Interface\AddOns\SVUI_Chat\assets\CHAT-SCROLL]];
 MOD.media.whisperIcon = [[Interface\AddOns\SVUI_Chat\assets\CHAT-WHISPER]];

 SV.defaults[Schema] = {
 	["docked"] = "BottomLeft",
-	["tabHeight"] = 20,
-	["tabWidth"] = 75,
-	["tabStyled"] = true,
-	["font"] = "SVUI Default Font",
-	["fontOutline"] = "OUTLINE",
-	["tabFont"] = "SVUI Tab Font",
-	["tabFontSize"] = 11,
-	["tabFontOutline"] = "OUTLINE",
-	["url"] = true,
-	["hyperlinkHover"] = true,
-	["throttleInterval"] = 45,
-	["fade"] = false,
-	["sticky"] = true,
-	["smileys"] = true,
+	["tabHeight"] = 20,
+	["tabWidth"] = 75,
+	["tabStyled"] = true,
+	["font"] = "SVUI Default Font",
+	["fontOutline"] = "OUTLINE",
+	["tabFont"] = "SVUI Tab Font",
+	["tabFontSize"] = 11,
+	["tabFontOutline"] = "OUTLINE",
+	["url"] = true,
+	["hyperlinkHover"] = true,
+	["throttleInterval"] = 45,
+	["fade"] = false,
+	["sticky"] = true,
+	["smileys"] = true,
 	["shortChannels"] = true,
-	["secretWordTone"] = "None",
-	["psst"] = "Whisper Alert",
-	["noWipe"] = false,
-	["timeStampFormat"] = "NONE",
-	["secretWords"] = "%MYNAME%, SVUI",
+	["secretWordTone"] = "None",
+	["psst"] = "Whisper Alert",
+	["noWipe"] = false,
+	["timeStampFormat"] = "NONE",
+	["secretWords"] = "%MYNAME%, SVUI",
 	["basicTools"] = true,
 	["bubbles"] = true,
 };
@@ -68,101 +67,101 @@ function MOD:LoadOptions()
 			desc = "Font used for chat tab labels."
 		},
 	};
-
+
 	SV:GenerateFontOptionGroup("Chat", 5, "Fonts used for the chat frame.", chatFonts)
-
+
 	SV.Options.args[Schema] = {
-		type = "group",
-		name = Schema,
-		get = function(a)return SV.db[Schema][a[#a]]end,
-		set = function(a,b)MOD:ChangeDBVar(b,a[#a]); end,
+		type = "group",
+		name = Schema,
+		get = function(a)return SV.db[Schema][a[#a]]end,
+		set = function(a,b)MOD:ChangeDBVar(b,a[#a]); end,
 		args = {
 			intro = {
-				order = 1,
-				type = "description",
+				order = 1,
+				type = "description",
 				name = L["CHAT_DESC"],
 				width = 'full'
 			},
 			common = {
-				order = 2,
-				type = "group",
-				name = L["General"],
-				guiInline = true,
+				order = 2,
+				type = "group",
+				name = L["General"],
+				guiInline = true,
 				args = {
 					sticky = {
-						order = 1,
-						type = "toggle",
-						name = L["Sticky Chat"],
+						order = 1,
+						type = "toggle",
+						name = L["Sticky Chat"],
 						desc = L["When opening the Chat Editbox to type a message having this option set means it will retain the last channel you spoke in. If this option is turned off opening the Chat Editbox should always default to the SAY channel."]
 					},
 					url = {
-						order = 2,
-						type = "toggle",
-						name = L["URL Links"],
+						order = 2,
+						type = "toggle",
+						name = L["URL Links"],
 						desc = L["Attempt to create URL links inside the chat."],
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
 					},
 					hyperlinkHover = {
-						order = 3,
-						type = "toggle",
-						name = L["Hyperlink Hover"],
-						desc = L["Display the hyperlink tooltip while hovering over a hyperlink."],
+						order = 3,
+						type = "toggle",
+						name = L["Hyperlink Hover"],
+						desc = L["Display the hyperlink tooltip while hovering over a hyperlink."],
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]); MOD:ToggleHyperlinks(b); end
 					},
 					smileys = {
-						order = 4,
-						type = "toggle",
-						name = L["Emotion Icons"],
+						order = 4,
+						type = "toggle",
+						name = L["Emotion Icons"],
 						desc = L["Display emotion icons in chat."]
 					},
 					tabStyled = {
-						order = 5,
-						type = "toggle",
+						order = 5,
+						type = "toggle",
 						name = L["Custom Tab Style"],
-						set = function(a,b) MOD:ChangeDBVar(b,a[#a]);SV:StaticPopup_Show("RL_CLIENT") end,
+						set = function(a,b) MOD:ChangeDBVar(b,a[#a]);SV:StaticPopup_Show("RL_CLIENT") end,
 					},
 					shortChannels = {
-						order = 6,
-						type = "toggle",
+						order = 6,
+						type = "toggle",
 						name = L["Abbreviation"],
 						desc = "Shortened channel names",
 					},
 					timeStampFormat = {
-						order = 7,
-						type = "select",
-						name = TIMESTAMPS_LABEL,
-						desc = OPTION_TOOLTIP_TIMESTAMPS,
+						order = 7,
+						type = "select",
+						name = TIMESTAMPS_LABEL,
+						desc = OPTION_TOOLTIP_TIMESTAMPS,
 						values = {
-							["NONE"] = NONE,
-							["%I:%M "] = "03:27",
-							["%I:%M:%S "] = "03:27:32",
-							["%I:%M %p "] = "03:27 PM",
-							["%I:%M:%S %p "] = "03:27:32 PM",
-							["%H:%M "] = "15:27",
+							["NONE"] = NONE,
+							["%I:%M "] = "03:27",
+							["%I:%M:%S "] = "03:27:32",
+							["%I:%M %p "] = "03:27 PM",
+							["%I:%M:%S %p "] = "03:27:32 PM",
+							["%H:%M "] = "15:27",
 							["%H:%M:%S "] = "15:27:32"
 						}
 					},
 					psst = {
-						order = 8,
-						type = "select",
-						dialogControl = "LSM30_Sound",
-						name = L["Whisper Alert"],
-						disabled = function()return not SV.db[Schema].psst end,
+						order = 8,
+						type = "select",
+						dialogControl = "LSM30_Sound",
+						name = L["Whisper Alert"],
+						disabled = function()return not SV.db[Schema].psst end,
 						values = AceGUIWidgetLSMlists.sound,
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
 					},
 					spacer2 = {
-						order = 9,
-						type = "description",
+						order = 9,
+						type = "description",
 						name = ""
 					},
 					throttleInterval = {
-						order = 10,
-						type = "range",
-						name = L["Spam Interval"],
-						desc = L["Prevent the same messages from displaying in chat more than once within this set amount of seconds, set to zero to disable."],
-						min = 0,
-						max = 120,
+						order = 10,
+						type = "range",
+						name = L["Spam Interval"],
+						desc = L["Prevent the same messages from displaying in chat more than once within this set amount of seconds, set to zero to disable."],
+						min = 0,
+						max = 120,
 						step = 1,
 						width = "full",
 						set = function(a,b) MOD:ChangeDBVar(b,a[#a]) end
@@ -179,4 +178,4 @@ function MOD:LoadOptions()
 			},
 		}
 	}
-end
\ No newline at end of file
+end
diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua
index f47d8cd..45b4ff9 100644
--- a/SVUI_Chat/SVUI_Chat.lua
+++ b/SVUI_Chat/SVUI_Chat.lua
@@ -144,6 +144,8 @@ local CHANNEL_STRINGS = {
 	[L["WorldDefense"]] 	= L["WorldDefense"],
 }

+local WHISPER_SOUND = [[Interface\AddOns\SVUI_!Core\assets\sounds\whisper.mp3]];
+
 local PLAYER_PATTERN = "|Hplayer:(.-)|h%[(.-)%]|h";
 local PLAYER_LINK    = "|Hplayer:%s|h%s|h"
 local PLAYER_BN_LINK = "|HBNplayer:%s|h%s%s|h"
@@ -251,12 +253,6 @@ do
 	end

 	local SVUI_ParseMessage = function(self, event, text, ...)
-		if ((event == "CHAT_MSG_WHISPER" or event == "CHAT_MSG_BN_WHISPER") and MOD.media.whisperSound) then
-			if text:sub(1, 3) == "OQ, " then
-				return false, text, ...
-			end
-			PlaySoundFile(MOD.media.whisperSound, "Master")
-		end
 		if(not CHAT_ALLOW_URL) then
 			text = SetEmoticon(text)
 			return false, text, ...
@@ -1047,12 +1043,14 @@ EVENTS
 ##########################################################
 ]]--
 function MOD:CHAT_MSG_WHISPER(event, ...)
+	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, "Master") end
 	if(self.db.general.saveChats) then
 		self:SAVE_CHAT_HISTORY(event, ...)
 	end
 end

 function MOD:CHAT_MSG_BN_WHISPER(event, ...)
+	if(not InCombatLockdown() and WHISPER_SOUND) then PlaySoundFile(WHISPER_SOUND, "Master") end
 	if(self.db.general.saveChats) then
 		self:SAVE_CHAT_HISTORY(event, ...)
 	end
@@ -1354,7 +1352,7 @@ function MOD:UpdateLocals()
 	TAB_SKINS = SV.db.Chat.tabStyled;
 	CHAT_ABBREV = SV.db.Chat.shortChannels;
 	CHAT_FADING = SV.db.Chat.fade;
-	MOD.media.whisperSound = LSM:Fetch("sound", SV.db.Chat.psst);
+	WHISPER_SOUND = LSM:Fetch("sound", SV.db.Chat.psst);
 	TIME_STAMP_MASK = SV.db.Chat.timeStampFormat;
 	if(CHAT_THROTTLE and CHAT_THROTTLE == 0) then
 		wipe(THROTTLE_CACHE)