WoWInterface SVN AutoDND

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

trunk/AutoDND/AutoDND.lua New file
0,0 → 1,59
AutoDNDSV = {
enabled = false,
message = "",
}
local DELAY = 0.1
local sv
local timer
local oldSendChatMessage = SendChatMessage
 
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:Hide()
 
local function GoDND()
oldSendChatMessage(sv.message, "DND")
f:RegisterEvent("CHAT_MSG_SYSTEM")
end
 
f:SetScript("OnEvent", function(_, event, arg1)
if event == "PLAYER_LOGIN" then
sv = AutoDNDSV
if sv.enabled and not UnitIsDND("player") then
GoDND()
end
elseif arg1 == CLEARED_AFK then
timer = 0
f:Show()
end
end)
 
f:SetScript("OnUpdate", function(_, elapsed)
timer = timer + elapsed
if timer >= DELAY then
GoDND()
f:Hide()
end
end)
 
function SendChatMessage(message, chatType, ...)
if chatType == "DND" then
if UnitIsDND("player") and message == "" then
sv.enabled = false
oldSendChatMessage(message, chatType, ...)
f:UnregisterEvent("CHAT_MSG_SYSTEM")
f:Hide()
elseif UnitIsAFK("player") then
sv.message = message
sv.enabled = true
f:RegisterEvent("CHAT_MSG_SYSTEM")
oldSendChatMessage("", "AFK", ...)
else
sv.message = message
sv.enabled = true
GoDND()
end
else
oldSendChatMessage(message, chatType, ...)
end
end
trunk/AutoDND/AutoDND.toc New file
0,0 → 1,8
## Interface: 20100
## Title: AutoDND
## Notes: Allows you to remain DND across logins and returns you to DND after going AFK
## Author: Cogwheel
## Version: 1.0.3
## SavedVariables: AutoDNDSV
 
AutoDND.lua
trunk/AutoDND/Readme.txt New file
0,0 → 1,23
AutoDND v1.0.3
By Cogwheel
 
AutoDND keeps you DND until you specify otherwise. In the default UI, DND status
does not persist across logins and WoW removes your DND flag when you go AFK.
This addon will return you to DND status on login and after leaving AFK,
remembering the message you specify. Just use /dnd like you normally would, and
AutoDND will do the rest.
 
v1.0.3
- Fixed a bug where AutoDND was not disabling itself after leaving DND
 
v1.0.2
- Uses the global string for the AFK message so it should be compatible with
non-English locales.
 
v1.0.1
- Correctly handles going DND while AFK if not already DND
- Hooks SendChatMessage instead of SlashCmdList["CHAT_DND"] to more easily
coexist with other DND-triggering addons.
 
v1.0
- Initial Release