From 4bce7d9abf2b82f9142bd60f9e53c7e04e006106 Mon Sep 17 00:00:00 2001 From: Christopher Rosell Date: Fri, 15 Oct 2010 21:51:47 +0200 Subject: [PATCH] Updated for 4.0.1. Blizzard made some changes that prevents addons from accessing the real name of the friends, therefore the addon had to be signifigantly altered. - Nicknames can now only be stored in notes instead of SV. - Many frames that showed the nickname is only able to display the real name. --- Moniker.toc | 9 - config.lua | 27 - hooks.lua | 98 +- libs/AceConfig-3.0/AceConfig-3.0.lua | 57 - libs/AceConfig-3.0/AceConfig-3.0.xml | 8 - .../AceConfigCmd-3.0/AceConfigCmd-3.0.lua | 787 -------- .../AceConfigCmd-3.0/AceConfigCmd-3.0.xml | 4 - .../AceConfigDialog-3.0/AceConfigDialog-3.0.lua | 1895 -------------------- .../AceConfigDialog-3.0/AceConfigDialog-3.0.xml | 4 - .../AceConfigRegistry-3.0.lua | 344 ---- .../AceConfigRegistry-3.0.xml | 4 - libs/AceGUI-3.0/AceGUI-3.0.lua | 863 --------- libs/AceGUI-3.0/AceGUI-3.0.xml | 26 - .../widgets/AceGUIWidget-BlizOptionsGroup.lua | 153 -- libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua | 104 -- libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua | 301 ---- .../widgets/AceGUIWidget-ColorPicker.lua | 181 -- .../widgets/AceGUIWidget-DropDown-Items.lua | 459 ----- libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua | 705 -------- .../widgets/AceGUIWidget-DropDownGroup.lua | 178 -- libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua | 233 --- libs/AceGUI-3.0/widgets/AceGUIWidget-Frame.lua | 305 ---- libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua | 76 - libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua | 149 -- .../widgets/AceGUIWidget-InlineGroup.lua | 138 -- .../widgets/AceGUIWidget-InteractiveLabel.lua | 219 --- .../AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua | 230 --- libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua | 158 -- .../widgets/AceGUIWidget-MultiLineEditBox.lua | 309 ---- .../widgets/AceGUIWidget-ScrollFrame.lua | 241 --- .../widgets/AceGUIWidget-SimpleGroup.lua | 99 - libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua | 282 --- libs/AceGUI-3.0/widgets/AceGUIWidget-TabGroup.lua | 387 ---- libs/AceGUI-3.0/widgets/AceGUIWidget-TreeGroup.lua | 746 -------- libs/AceGUI-3.0/widgets/AceGUIWidget-Window.lua | 328 ---- libs/CallbackHandler-1.0/CallbackHandler-1.0.lua | 240 --- libs/CallbackHandler-1.0/CallbackHandler-1.0.xml | 4 - libs/LibStub-1.0/LibStub-1.0.lua | 30 - libs/LibStub-1.0/LibStub-1.0.xml | 4 - libs/tekKonfigAboutPanel.lua | 115 -- moniker.lua | 91 +- 41 files changed, 38 insertions(+), 10553 deletions(-) delete mode 100644 config.lua delete mode 100644 libs/AceConfig-3.0/AceConfig-3.0.lua delete mode 100644 libs/AceConfig-3.0/AceConfig-3.0.xml delete mode 100644 libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua delete mode 100644 libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.xml delete mode 100644 libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua delete mode 100644 libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.xml delete mode 100644 libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua delete mode 100644 libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.xml delete mode 100644 libs/AceGUI-3.0/AceGUI-3.0.lua delete mode 100644 libs/AceGUI-3.0/AceGUI-3.0.xml delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-BlizOptionsGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-DropDownGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Frame.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-InlineGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-ScrollFrame.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-SimpleGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-TabGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-TreeGroup.lua delete mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Window.lua delete mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0.lua delete mode 100644 libs/CallbackHandler-1.0/CallbackHandler-1.0.xml delete mode 100644 libs/LibStub-1.0/LibStub-1.0.lua delete mode 100644 libs/LibStub-1.0/LibStub-1.0.xml delete mode 100644 libs/tekKonfigAboutPanel.lua diff --git a/Moniker.toc b/Moniker.toc index 933dce4..778934b 100644 --- a/Moniker.toc +++ b/Moniker.toc @@ -9,16 +9,7 @@ ## LoadManagers: AddonLoader ## X-LoadOn-Always: delayed -## SavedVariables: MonikerDB, MonikerConfig - -libs\LibStub-1.0\LibStub-1.0.xml -libs\CallbackHandler-1.0\CallbackHandler-1.0.xml -libs\AceGUI-3.0\AceGUI-3.0.xml -libs\AceConfig-3.0\AceConfig-3.0.xml -libs\tekKonfigAboutPanel.lua - locale\enGB.lua -config.lua hooks.lua moniker.lua diff --git a/config.lua b/config.lua deleted file mode 100644 index d746c59..0000000 --- a/config.lua +++ /dev/null @@ -1,27 +0,0 @@ -local addonname, addon = ... -local L = addon.L - -local options = { - type = "group", - name = addonname, - - - args = { - backends = { - name = "Nickname source", - type = 'multiselect', - - values = { [1] = L["Saved variables"], [2] = L["Notes"] }, - get = function(info, key) return addon.config.dbbackend == key end, - set = function(info, key, val) addon.config.dbbackend = key end - } - } -} - - -function addon:CreateConfig() - LibStub("AceConfig-3.0"):RegisterOptionsTable("Moniker-General", options) - LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Moniker-General", addonname) - - LibStub("tekKonfig-AboutPanel").new(addonname, addonname) -end diff --git a/hooks.lua b/hooks.lua index af58fa7..02bfe20 100644 --- a/hooks.lua +++ b/hooks.lua @@ -18,7 +18,7 @@ end local function ReplaceLink(text) return text:gsub("|HBNplayer:(.-):(.-):(.-):(.-):(.-)|h%[(.+)%]|h", function(a1, a2, a3, a4, a5, a6) - return ("|HBNplayer:%s:%s:%s:%s:%s|h[%s]|h"):format(a1, a2, a3, a4, a5, addon:GetNickname(a6) or a6) + return ("|HBNplayer:%s:%s:%s:%s:%s|h[%s]|h"):format(a1, a2, a3, a4, a5, addon:GetNicknameByPID(a1) or a6) end) end @@ -26,14 +26,6 @@ function addon.hooks.chat() local origs = {} local function AddMessage(self, text, ...) - if text:find"You are now in a conversation with" then - for orig, nick in addon:IterNicknames() do - if text:find(orig, nil, true) then - text = text:replace(orig, nick) - end - end - end - return origs[self](self, ReplaceLink(text), ...) end @@ -49,17 +41,6 @@ function addon.hooks.chat() ReplaceText(_G[frame:GetName().."Tab"]) end) - hooksecurefunc("ChatEdit_UpdateHeader", function(editbox) - local event = editbox:GetAttribute"chatType" - local header = _G[editbox:GetName().."Header"] - local target = editbox:GetAttribute"tellTarget" - - if event == "BN_WHISPER" then - header:SetFormattedText(CHAT_BN_WHISPER_SEND, addon:GetNickname(target) or target) - editbox:SetTextInsets(15 + header:GetWidth(), 13, 0, 0) - end - end) - for i = 1, NUM_CHAT_WINDOWS do HookChatFrame(_G["ChatFrame"..i]) end @@ -75,25 +56,24 @@ function addon.hooks.friendsframe() ReplaceText(BNToastFrameTopLine) end) - hooksecurefunc("FriendsFrameTooltip_Show", function(self) - ReplaceText(FriendsTooltipHeader) - end) + hooksecurefunc("HybridScrollFrame_Update", function(self) + if self == FriendsFrameFriendsScrollFrame then + local buttons = FriendsFrameFriendsScrollFrame.buttons - -- Hook friends frame and it's subframes - hooksecurefunc("FriendsFrame_SetButton", function(button, index, firstbutton) - if button.buttonType == FRIENDS_BUTTON_TYPE_BNET then - ReplaceText(button.name) + for i, button in ipairs(buttons) do + if button.buttonType == FRIENDS_BUTTON_TYPE_BNET then + ReplaceText(button.name) + end + end end end) - hooksecurefunc("FriendsFrame_ShowBNDropdown", function(...) - ReplaceText(DropDownList1Button1) + hooksecurefunc("FriendsFrameTooltip_Show", function(self) + ReplaceText(FriendsTooltipHeader) end) - hooksecurefunc(FriendsFrameFriendsScrollFrame, "buttonFunc", function(button, index, firstbutton) - if button.buttonType == FRIENDS_BUTTON_TYPE_BNET then - ReplaceText(button.name) - end + hooksecurefunc("FriendsFrame_ShowBNDropdown", function(...) + ReplaceText(DropDownList1Button1) end) hooksecurefunc("FriendsFriendsList_Update", function() @@ -122,55 +102,3 @@ function addon.hooks.friendsframe() addon:Update() end - -function addon.hooks.popup() - StaticPopupDialogs["BN_RENAME_FRIEND"] = { - text = L["Set a nickname for %s"], - button1 = ACCEPT, - button2 = CANCEL, - hasEditBox = 1, - hideOnEscape = 1, - timeout = 0, - exclusive = 1, - whileDead = 1, - - OnAccept = function(self) - local name = self.editBox:GetText() - addon:SetNickname(self.data, name) - end, - - OnShow = function(self) - local name = addon:GetNickname(self.data) or "" - - self.editBox:SetText(name) - self.editBox:SetFocus() - end, - - EditBoxOnEnterPressed = function(self) - local parent = self:GetParent() - local name = parent.editBox:GetText() - - addon:SetNickname(parent.data, name) - parent:Hide() - end, - - EditBoxOnEscapePressed = function(self) - self:GetParent():Hide() - end, - } - - UnitPopupButtons["BN_RENAME"] = { text = PET_RENAME, dist = 0 } - - -- Handle right click menu - hooksecurefunc("UnitPopup_OnClick", function(self) - local dropdown = UIDROPDOWNMENU_INIT_MENU - local button = self.value - - if button == "BN_RENAME" then - local pid, firstname, lastname = BNGetFriendInfoByID(dropdown.presenceID) - local name = firstname.." "..lastname - - StaticPopup_Show("BN_RENAME_FRIEND", name, nil, name) - end - end) -end diff --git a/libs/AceConfig-3.0/AceConfig-3.0.lua b/libs/AceConfig-3.0/AceConfig-3.0.lua deleted file mode 100644 index b66022d..0000000 --- a/libs/AceConfig-3.0/AceConfig-3.0.lua +++ /dev/null @@ -1,57 +0,0 @@ ---- AceConfig-3.0 wrapper library. --- Provides an API to register an options table with the config registry, --- as well as associate it with a slash command. --- @class file --- @name AceConfig-3.0 --- @release $Id: AceConfig-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $ - ---[[ -AceConfig-3.0 - -Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole. - -]] - -local MAJOR, MINOR = "AceConfig-3.0", 2 -local AceConfig = LibStub:NewLibrary(MAJOR, MINOR) - -if not AceConfig then return end - -local cfgreg = LibStub("AceConfigRegistry-3.0") -local cfgcmd = LibStub("AceConfigCmd-3.0") -local cfgdlg = LibStub("AceConfigDialog-3.0") ---TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0") - --- Lua APIs -local pcall, error, type, pairs = pcall, error, type, pairs - --- ------------------------------------------------------------------- --- :RegisterOptionsTable(appName, options, slashcmd, persist) --- --- - appName - (string) application name --- - options - table or function ref, see AceConfigRegistry --- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command - ---- Register a option table with the AceConfig registry. --- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. --- @paramsig appName, options [, slashcmd] --- @param appName The application name for the config table. --- @param options The option table (or a function to generate one on demand) --- @param slashcmd A slash command to register for the option table, or a table of slash commands. --- @usage --- local AceConfig = LibStub("AceConfig-3.0") --- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"}) -function AceConfig:RegisterOptionsTable(appName, options, slashcmd) - local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options) - if not ok then error(msg, 2) end - - if slashcmd then - if type(slashcmd) == "table" then - for _,cmd in pairs(slashcmd) do - cfgcmd:CreateChatCommand(cmd, appName) - end - else - cfgcmd:CreateChatCommand(slashcmd, appName) - end - end -end diff --git a/libs/AceConfig-3.0/AceConfig-3.0.xml b/libs/AceConfig-3.0/AceConfig-3.0.xml deleted file mode 100644 index d9eb96a..0000000 --- a/libs/AceConfig-3.0/AceConfig-3.0.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -