WoWInterface SVN remindme

Compare Revisions

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

Rev 1 → Rev 2

trunk/core.lua New file
0,0 → 1,70
local addon = LibStub("AceAddon-3.0"):NewAddon("RemindMe", "AceConsole-3.0", "AceTimer-3.0", "LibSink-2.0")
 
function addon:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("RemindMeDB", {
profile = {
reminders = {},
sink = {sink20OutputSink="ChatFrame"},
},
})
self:SetSinkStorage(self.db.profile.sink)
 
self.menu = {
name = "RemindMe", type = "group",
args = {
output = self:GetSinkAce3OptionsDataTable(),
},
}
local acreg = LibStub("AceConfigRegistry-3.0")
acreg:RegisterOptionsTable("RemindMe", self.menu)
acreg:RegisterOptionsTable("RemindMe Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db))
 
local acdia = LibStub("AceConfigDialog-3.0")
acdia:AddToBlizOptions("RemindMe", "RemindMe")
acdia:AddToBlizOptions("RemindMe Profiles", "Profiles", "RemindMe")
 
self:RegisterChatCommand("remindme", "SetReminder")
self:RegisterChatCommand("rm", "SetReminder", nil, true)
end
 
function addon:OnEnable()
self:ScheduleRepeatingTimer("ReminderCheck", 10)
end
 
local unit_conversions = {
s = 1,
m = 60,
h = 60 * 60,
d = 60 * 60 * 24,
}
local function time_parse(t)
-- t is a string, in the form [number][unit], where unit is m/h/d
-- unit will default to m if not present
-- returns the number of seconds in the future this will be
local n, u = t:match("^(%d+%.?%d*)([smhd]?)$")
if not n then return end
if not unit_conversions[u] then u = 'm' end
addon:Print( n, u)
return tonumber(n) * unit_conversions[u]
end
 
function addon:ReminderCheck()
local now = time()
for when, message in pairs(self.db.profile.reminders) do
if when < now then
self:Pour("Reminder: " .. message)
self.db.profile.reminders[when] = nil
end
end
end
 
function addon:SetReminder(arg)
local when, message = arg:match("^([%d.mhd]+)%s*(.*)$")
when = time_parse(when)
if not (when and message) then
self:Print("Usage: /remindme [number][unit:s/m/h/d] [message]")
return
end
self:Print("Reminder set for ".. when .. " seconds.")
self.db.profile.reminders[time() + when] = message
end
Property changes : Added: svn:eol-style + native
trunk/embeds.xml New file
0,0 → 1,15
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
 
<Script file="lib\LibStub\LibStub.lua"/>
<Include file="lib\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
<Include file="lib\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="lib\AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="lib\AceDB-3.0\AceDB-3.0.xml"/>
<Include file="lib\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
<Include file="lib\AceTimer-3.0\AceTimer-3.0.xml"/>
<Include file="lib\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="lib\AceConfig-3.0\AceConfig-3.0.xml"/>
<Include file="lib\LibSink-2.0\lib.xml"/>
 
</Ui>
Property changes : Added: svn:eol-style + native
trunk/RemindMe.toc New file
0,0 → 1,13
## Interface: 20400
## Title: RemindMe
## Author: SunTyger
## Notes: Remind me later
## Version: 1
## X-Category: Misc
## LoadOnDemand: 0
## OptionalDeps: Ace3
## SavedVariables: RemindMeDB
 
embeds.xml
 
core.lua
\ No newline at end of file Property changes : Added: svn:eol-style + native