Quantcast

Add editbox whisper hook.

Christopher Rosell [07-04-10 - 14:26]
Add editbox whisper hook.
Filename
Moniker.lua
Moniker.toc
diff --git a/Moniker.lua b/Moniker.lua
index 4f7cd4d..325b58e 100644
--- a/Moniker.lua
+++ b/Moniker.lua
@@ -72,7 +72,7 @@ StaticPopupDialogs["BN_RENAME_FRIEND"] = {
 	end,
 }

-addon:RegisterEvent'ADDON_LOADED'
+addon:RegisterEvent"ADDON_LOADED"
 addon:SetScript('OnEvent', function(self, e, addon)
 	if addon ~= addonname then return end

@@ -114,7 +114,7 @@ addon:SetScript('OnEvent', function(self, e, addon)
 	setfenv(BNConversationInvite_Update, env)

 	hooksecurefunc("UnitPopup_OnClick", function(self)
-		local dropdown = UIDROPDOWNMENU_INIT_MENU;
+		local dropdown = UIDROPDOWNMENU_INIT_MENU
 		local button = self.value

 		if button == "BN_RENAME" then
@@ -136,6 +136,16 @@ addon:SetScript('OnEvent', function(self, e, addon)
 		end
 	end)

+	hooksecurefunc("ChatEdit_UpdateHeader", function(editbox)
+		local event = editbox:GetAttribute"chatType"
+		local header = _G[editbox:GetName().."Header"]
+
+		if event == "BN_WHISPER" then
+			header:SetFormattedText(CHAT_BN_WHISPER_SEND, GetNickname(editbox:GetAttribute"tellTarget"))
+			editbox:SetTextInsets(15 + header:GetWidth(), 13, 0, 0)
+		end
+	end)
+
 	for i = 1, NUM_CHAT_WINDOWS do
 		HookChatFrame(_G['ChatFrame'..i])
 	end
diff --git a/Moniker.toc b/Moniker.toc
index 472b0fc..2017b6d 100644
--- a/Moniker.toc
+++ b/Moniker.toc
@@ -1,7 +1,7 @@
 ## Interface: 30300
 ## Title: Moniker
 ## Notes: Give your RealID friends nicknames
-## Version: 1.1
+## Version: 1.2
 ## Author: Christopher Rosell
 ## X-Email: chrippa@gmail.com
 ## X-Category: Social