From 4c06db7081a629ab439d71ec1c66f72656ed096c Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 14 Mar 2019 18:29:24 +0100 Subject: [PATCH] whisperproxy: cache functions and use game locales --- modules/whisperproxy.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/whisperproxy.lua b/modules/whisperproxy.lua index 892fffa8..96ec8c9b 100644 --- a/modules/whisperproxy.lua +++ b/modules/whisperproxy.lua @@ -36,17 +36,19 @@ pfUI:RegisterModule("whisperproxy", function () end end + local proxyOK = { OKAY, function() + pfUI.chat.whisperproxy.forwardto = this:GetParent().input:GetText() + ToggleProxy() + end } + + local proxyCancel = { CANCEL, function() + pfUI.chat.whisperproxy.forwardto = "" + end } + proxy:RegisterForClicks("LeftButtonUp", "RightButtonUp") proxy:SetScript("OnClick", function() if proxy.forwardto == "" or arg1 == "RightButton" then - CreateQuestionDialog(T["Please enter a name of a character who should receive your whispers:"], - function() - pfUI.chat.whisperproxy.forwardto = this:GetParent().input:GetText() - ToggleProxy() - end, - function() - pfUI.chat.whisperproxy.forwardto = "" - end, true) + CreateQuestionDialog(T["Please enter a name of a character who should receive your whispers:"], proxyOK, proxyCancel, true) else ToggleProxy() end @@ -72,4 +74,4 @@ pfUI:RegisterModule("whisperproxy", function () -- attach module to the pfUI tree pfUI.chat.whisperproxy = proxy -end) \ No newline at end of file +end)