Quantcast

- Fix tainted function call.

Christopher Rosell [10-09-10 - 16:55]
- Fix tainted function call.
- Added Moniker_BNGetFriendInfo() and Moniker_BNGetFriendInfoByID() for
  addons that wish to be nickname aware.
Filename
Moniker.toc
moniker.lua
diff --git a/Moniker.toc b/Moniker.toc
index 43d7abd..933dce4 100644
--- a/Moniker.toc
+++ b/Moniker.toc
@@ -1,4 +1,4 @@
-## Interface: 30300
+## Interface: 40000
 ## Title: Moniker
 ## Notes: Give your RealID friends nicknames
 ## Version: 1.5
diff --git a/moniker.lua b/moniker.lua
index 1eeb75d..f10e914 100644
--- a/moniker.lua
+++ b/moniker.lua
@@ -89,7 +89,9 @@ function addon:UpdatePopup()
 end

 function addon:Update()
-	FriendsFrame_Update()
+	if not InCombatLockdown() then
+		FriendsFrame_Update()
+	end
 end

 function addon:SetDBBackend(dbtype)
@@ -133,4 +135,30 @@ function addon:IterNicknames()
 	return pairs(self.nicks)
 end

+function Moniker_BNGetFriendInfo(...)
+	local pid, firstname, lastname = BNGetFriendInfo(...)
+	local name = firstname.." "..lastname
+	local nickname = addon:GetNickname(name)
+
+	if nickname then
+		firstname = nickname
+		lastname = ""
+	end
+
+	return pid, firstname, lastname, select(4, BNGetFriendInfo(...))
+end
+
+function Moniker_BNGetFriendInfoByID(...)
+	local pid, firstname, lastname = BNGetFriendInfoByID(...)
+	local name = firstname.." "..lastname
+	local nickname = addon:GetNickname(name)
+
+	if nickname then
+		firstname = nickname
+		lastname = ""
+	end
+
+	return pid, firstname, lastname, select(4, BNGetFriendInfoByID(...))
+end
+
 addon:Initialize()