remove smiley functions from chat (icon string not compatible)

This commit is contained in:
Crum
2018-01-25 13:59:19 -06:00
parent 2e26b39fb0
commit fc00704afd
3 changed files with 23 additions and 132 deletions
+11 -110
View File
@@ -85,63 +85,6 @@ local hyperlinkTypes = {
["talent"] = true, ["talent"] = true,
} }
local smileyPack = {
["Angry"] = [[Interface\AddOns\ElvUI\media\textures\smileys\angry.blp]],
["Grin"] = [[Interface\AddOns\ElvUI\media\textures\smileys\grin.blp]],
["Hmm"] = [[Interface\AddOns\ElvUI\media\textures\smileys\hmm.blp]],
["MiddleFinger"] = [[Interface\AddOns\ElvUI\media\textures\smileys\middle_finger.blp]],
["Sad"] = [[Interface\AddOns\ElvUI\media\textures\smileys\sad.blp]],
["Surprise"] = [[Interface\AddOns\ElvUI\media\textures\smileys\surprise.blp]],
["Tongue"] = [[Interface\AddOns\ElvUI\media\textures\smileys\tongue.blp]],
["Cry"] = [[Interface\AddOns\ElvUI\media\textures\smileys\weepy.blp]],
["Wink"] = [[Interface\AddOns\ElvUI\media\textures\smileys\winky.blp]],
["Happy"] = [[Interface\AddOns\ElvUI\media\textures\smileys\happy.blp]],
["Heart"] = [[Interface\AddOns\ElvUI\media\textures\smileys\heart.blp]],
["BrokenHeart"] = [[Interface\AddOns\ElvUI\media\textures\smileys\broken_heart.blp]],
}
local smileyKeys = {
["%:%-%@"] = "Angry",
["%:%@"] = "Angry",
["%:%-%)"]="Happy",
["%:%)"]="Happy",
["%:D"]="Grin",
["%:%-D"]="Grin",
["%;%-D"]="Grin",
["%;D"]="Grin",
["%=D"]="Grin",
["xD"]="Grin",
["XD"]="Grin",
["%:%-%("]="Sad",
["%:%("]="Sad",
["%:o"]="Surprise",
["%:%-o"]="Surprise",
["%:%-O"]="Surprise",
["%:O"]="Surprise",
["%:%-0"]="Surprise",
["%:P"]="Tongue",
["%:%-P"]="Tongue",
["%:p"]="Tongue",
["%:%-p"]="Tongue",
["%=P"]="Tongue",
["%=p"]="Tongue",
["%;%-p"]="Tongue",
["%;p"]="Tongue",
["%;P"]="Tongue",
["%;%-P"]="Tongue",
["%;%-%)"]="Wink",
["%;%)"]="Wink",
["%:S"]="Hmm",
["%:%-S"]="Hmm",
["%:%,%("]="Cry",
["%:%,%-%("]="Cry",
["%:%'%("]="Cry",
["%:%'%-%("]="Cry",
["%:%F"]="MiddleFinger",
["<3"]="Heart",
["</3"]="BrokenHeart",
}
local specialChatIcons = { local specialChatIcons = {
-- ["Smolderforge"] = { -- ["Smolderforge"] = {
-- ["Loaal"] = "|TInterface\\AddOns\\ElvUI\\media\\textures\\ElvUI_Chat_Logo:13:22|t", -- ["Loaal"] = "|TInterface\\AddOns\\ElvUI\\media\\textures\\ElvUI_Chat_Logo:13:22|t",
@@ -265,41 +208,6 @@ function CH:GetGroupDistribution()
return "/s " return "/s "
end end
function CH:InsertEmotions(msg)
for k,v in pairs(smileyKeys) do
-- msg = gsub(msg,k,"|T"..smileyPack[v]..":16|t")
end
return msg
end
function CH:GetSmileyReplacementText(msg)
if not msg or not self.db.emotionIcons or find(msg, "/run") or find(msg, "/dump") or find(msg, "/script") then return msg end
local outstr = ""
local origlen = strlen(msg)
local startpos = 1
local endpos
while(startpos <= origlen) do
endpos = origlen
local pos = find(msg,"|H",startpos,true)
if pos ~= nil then
endpos = pos
end
outstr = outstr .. CH:InsertEmotions(strsub(msg,startpos,endpos)) --run replacement on this bit
startpos = endpos + 1
if pos ~= nil then
endpos = find(msg,"|h]|r",startpos,-1) or find(msg,"|h",startpos,-1)
endpos = endpos or origlen
if startpos < endpos then
outstr = outstr .. strsub(msg,startpos,endpos) --don't run replacement on this bit
startpos = endpos + 1
end
end
end
return outstr
end
function CH:StyleChat(frame) function CH:StyleChat(frame)
local name = frame:GetName() local name = frame:GetName()
E:FontTemplate(_G[name.."TabText"], LSM:Fetch("font", self.db.tabFont), self.db.tabFontSize, self.db.tabFontOutline) E:FontTemplate(_G[name.."TabText"], LSM:Fetch("font", self.db.tabFont), self.db.tabFontSize, self.db.tabFontOutline)
@@ -671,34 +579,27 @@ function CH.FindURL(msg, ...)
if not CH.db.url then if not CH.db.url then
msg = CH:CheckKeyword(msg) msg = CH:CheckKeyword(msg)
msg = CH:GetSmileyReplacementText(msg)
return false, msg, unpack(arg) return false, msg, unpack(arg)
end end
local text, tag = msg, strmatch(msg, "{(.-)}") msg = gsub(gsub(msg, "(%S)(|c.-|H.-|h.-|h|r)", '%1 %2'), "(|c.-|H.-|h.-|h|r)(%S)", "%1 %2")
if tag and ICON_TAG_LIST[strlower(tag)] then
text = gsub(gsub(text, "(%S)({.-})", "%1 %2"), "({.-})(%S)", "%1 %2")
end
text = gsub(gsub(text, "(%S)(|c.-|H.-|h.-|h|r)", '%1 %2'), "(|c.-|H.-|h.-|h|r)(%S)", "%1 %2")
-- http://example.com -- http://example.com
local newMsg, found = gsub(text, "(%a+)://(%S+)%s?", CH:PrintURL("%1://%2")) local newMsg, found = gsub(msg, "(%a+)://(%S+)%s?", CH:PrintURL("%1://%2"))
if found > 0 then return false, CH:GetSmileyReplacementText(CH:CheckKeyword(newMsg)), unpack(arg) end if found > 0 then return false, CH:CheckKeyword(newMsg), unpack(arg) end
-- www.example.com -- www.example.com
newMsg, found = gsub(text, "www%.([_A-Za-z0-9-]+)%.(%S+)%s?", CH:PrintURL("www.%1.%2")) newMsg, found = gsub(msg, "www%.([_A-Za-z0-9-]+)%.(%S+)%s?", CH:PrintURL("www.%1.%2"))
if found > 0 then return false, CH:GetSmileyReplacementText(CH:CheckKeyword(newMsg)), unpack(arg) end if found > 0 then return false, CH:CheckKeyword(newMsg), unpack(arg) end
-- example@example.com -- example@example.com
newMsg, found = gsub(text, "([_A-Za-z0-9-%.]+)@([_A-Za-z0-9-]+)(%.+)([_A-Za-z0-9-%.]+)%s?", CH:PrintURL("%1@%2%3%4")) newMsg, found = gsub(msg, "([_A-Za-z0-9-%.]+)@([_A-Za-z0-9-]+)(%.+)([_A-Za-z0-9-%.]+)%s?", CH:PrintURL("%1@%2%3%4"))
if found > 0 then return false, CH:GetSmileyReplacementText(CH:CheckKeyword(newMsg)), unpack(arg) end if found > 0 then return false, CH:CheckKeyword(newMsg), unpack(arg) end
-- IP address with port 1.1.1.1:1 -- IP address with port 1.1.1.1:1
newMsg, found = gsub(text, "(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)(:%d+)%s?", CH:PrintURL("%1.%2.%3.%4%5")) newMsg, found = gsub(msg, "(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)(:%d+)%s?", CH:PrintURL("%1.%2.%3.%4%5"))
if found > 0 then return false, CH:GetSmileyReplacementText(CH:CheckKeyword(newMsg)), unpack(arg) end if found > 0 then return false, CH:CheckKeyword(newMsg), unpack(arg) end
-- IP address 1.1.1.1 -- IP address 1.1.1.1
newMsg, found = gsub(text, "(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%s?", CH:PrintURL("%1.%2.%3.%4")) newMsg, found = gsub(msg, "(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%s?", CH:PrintURL("%1.%2.%3.%4"))
if found > 0 then return false, CH:GetSmileyReplacementText(CH:CheckKeyword(newMsg)), unpack(arg) end if found > 0 then return false, CH:CheckKeyword(newMsg), unpack(arg) end
msg = CH:CheckKeyword(msg) msg = CH:CheckKeyword(msg)
msg = CH:GetSmileyReplacementText(msg)
return false, msg, unpack(arg) return false, msg, unpack(arg)
end end
-1
View File
@@ -400,7 +400,6 @@ P["chat"] = {
["font"] = "PT Sans Narrow", ["font"] = "PT Sans Narrow",
["fontOutline"] = "NONE", ["fontOutline"] = "NONE",
["sticky"] = true, ["sticky"] = true,
["emotionIcons"] = true,
["keywordSound"] = "None", ["keywordSound"] = "None",
["whisperSound"] = "Whisper Alert", ["whisperSound"] = "Whisper Alert",
["noAlertInCombat"] = false, ["noAlertInCombat"] = false,
+12 -21
View File
@@ -75,17 +75,8 @@ E.Options.args.chat = {
CH:UpdateFading(); CH:UpdateFading();
end end
}, },
emotionIcons = {
order = 6,
type = "toggle",
name = L["Emotion Icons"],
desc = L["Display emotion icons in chat."],
set = function(info, value)
E.db.chat[ info[getn(info)] ] = value;
end
},
fadeUndockedTabs = { fadeUndockedTabs = {
order = 7, order = 6,
type = "toggle", type = "toggle",
name = L["Fade Undocked Tabs"], name = L["Fade Undocked Tabs"],
desc = L["Fades the text on chat tabs that are not docked at the left or right chat panel."], desc = L["Fades the text on chat tabs that are not docked at the left or right chat panel."],
@@ -95,7 +86,7 @@ E.Options.args.chat = {
end end
}, },
fadeTabsNoBackdrop = { fadeTabsNoBackdrop = {
order = 8, order = 7,
type = "toggle", type = "toggle",
name = L["Fade Tabs No Backdrop"], name = L["Fade Tabs No Backdrop"],
desc = L["Fades the text on chat tabs that are docked in a panel where the backdrop is disabled."], desc = L["Fades the text on chat tabs that are docked in a panel where the backdrop is disabled."],
@@ -105,13 +96,13 @@ E.Options.args.chat = {
end end
}, },
chatHistory = { chatHistory = {
order = 9, order = 8,
type = "toggle", type = "toggle",
name = L["Chat History"], name = L["Chat History"],
desc = L["Log the main chat frames history. So when you reloadui or log in and out you see the history from your last session."] desc = L["Log the main chat frames history. So when you reloadui or log in and out you see the history from your last session."]
}, },
useAltKey = { useAltKey = {
order = 10, order = 9,
type = "toggle", type = "toggle",
name = L["Use Alt Key"], name = L["Use Alt Key"],
desc = L["Require holding the Alt key down to move cursor or cycle through messages in the editbox."], desc = L["Require holding the Alt key down to move cursor or cycle through messages in the editbox."],
@@ -121,12 +112,12 @@ E.Options.args.chat = {
end end
}, },
spacer = { spacer = {
order = 11, order = 10,
type = "description", type = "description",
name = " ", name = " ",
}, },
throttleInterval = { throttleInterval = {
order = 12, order = 11,
type = "range", type = "range",
name = L["Spam Interval"], 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."], desc = L["Prevent the same messages from displaying in chat more than once within this set amount of seconds, set to zero to disable."],
@@ -139,7 +130,7 @@ E.Options.args.chat = {
end end
}, },
scrollDownInterval = { scrollDownInterval = {
order = 13, order = 12,
type = "range", type = "range",
name = L["Scroll Interval"], name = L["Scroll Interval"],
desc = L["Number of time in seconds to scroll down to the bottom of the chat window if you are not scrolled down completely."], desc = L["Number of time in seconds to scroll down to the bottom of the chat window if you are not scrolled down completely."],
@@ -149,14 +140,14 @@ E.Options.args.chat = {
end end
}, },
numAllowedCombatRepeat = { numAllowedCombatRepeat = {
order = 14, order = 13,
type = "range", type = "range",
name = L["Allowed Combat Repeat"], name = L["Allowed Combat Repeat"],
desc = L["Number of repeat characters while in combat before the chat editbox is automatically closed."], desc = L["Number of repeat characters while in combat before the chat editbox is automatically closed."],
min = 2, max = 10, step = 1 min = 2, max = 10, step = 1
}, },
numScrollMessages = { numScrollMessages = {
order = 15, order = 14,
type = "range", type = "range",
name = L["Scroll Messages"], name = L["Scroll Messages"],
desc = L["Number of messages you scroll for each step."], desc = L["Number of messages you scroll for each step."],
@@ -168,7 +159,7 @@ E.Options.args.chat = {
name = " ", name = " ",
}, },
timeStampFormat = { timeStampFormat = {
order = 17, order = 15,
type = "select", type = "select",
name = L["Chat Timestamps"], name = L["Chat Timestamps"],
desc = "OPTION_TOOLTIP_TIMESTAMPS", desc = "OPTION_TOOLTIP_TIMESTAMPS",
@@ -183,13 +174,13 @@ E.Options.args.chat = {
} }
}, },
useCustomTimeColor = { useCustomTimeColor = {
order = 18, order = 16,
type = "toggle", type = "toggle",
name = L["Custom Timestamp Color"], name = L["Custom Timestamp Color"],
disabled = function() return not E.db.chat.timeStampFormat == "NONE"; end disabled = function() return not E.db.chat.timeStampFormat == "NONE"; end
}, },
customTimeColor = { customTimeColor = {
order = 19, order = 17,
type = "color", type = "color",
hasAlpha = false, hasAlpha = false,
name = L["Timestamp Color"], name = L["Timestamp Color"],