вобщем соединил уже, осталось вместо слешкоманд добавить интерфейс какойнибудь для редактирования списка.
PHP код:
local IgnoreWisper = CreateFrame("Frame")
IgnoreWisper:SetScript("OnEvent", function() if not ignorewisper then ignorewisper= {["ТетяМотя"]=true,["ДядяСвета"]=true} end end)
IgnoreWisper:RegisterEvent("VARIABLES_LOADED")
local function filter(self,event,msg,sender,...)
local otvet = "Для тебя личка закрыта"
if event == "CHAT_MSG_WHISPER_INFORM" and msg == otvet then return true end
print(ignorewisper[sender])
if ignorewisper[sender] == true then SendChatMessage(otvet,"WHISPER",nil,sender) return true end
end
for _,event in pairs({"CHAT_MSG_SAY","CHAT_MSG_WHISPER","CHAT_MSG_WHISPER_INFORM","CHAT_MSG_YELL","CHAT_MSG_CHANNEL"}) do
ChatFrame_AddMessageEventFilter(event, filter)
end
SLASH_IGNOREWISPER1 = "/iw"
SlashCmdList["IGNOREWISPER"] = function(cmd)
local cmd,arg=string.split(" ",cmd,2)
if not cmd or cmd == "" then for k in pairs(ignorewisper) do print(k) end
elseif cmd == "delite" and ignorewisper[arg] == true then ignorewisper[arg] = nil print(arg.." :удален из игнора")
end
end
local function vtablo(self,name)
if ignorewisper[name] then ignorewisper[name] = nil print(name.." :удален из игнора")
else ignorewisper[name] = true print(name.." :добавлен в игнор") end
end
hooksecurefunc("ToggleDropDownMenu", function(level, value, dropDownFrame)
if dropDownFrame.which == "FRIEND" then
local info = UIDropDownMenu_CreateInfo()
info.text="Добавить в игнор"
info.owner=dropDownFrame.which
info.level=1
info.notCheckable=1
info.func = vtablo
info.arg1 = dropDownFrame.name
UIDropDownMenu_AddButton(info)
end
end)