annotate Squawk.lua @ 18:a3328fffef5c

Split of main file into components
author wobin
date Thu, 07 May 2009 02:52:23 +1000
parents 2a73deb7bc54
children 431f2fce08f2
rev   line source
wobin@18 1 -- A Twitter client of sorts for World of Warcraft
wobin@18 2 -- Author: Wobin
wobin@18 3 -- Email: wobster@gmail.com
wobin@18 4 --
wobin@18 5 Squawk = LibStub("AceAddon-3.0"):NewAddon("Squawk")
wobin@18 6
wobin@18 7 Squawk.Model = {}
wobin@18 8 Squawk.View = {}
wobin@18 9 Squawk.Controller = {}
wobin@18 10
wobin@18 11 local Model = Squawk.Model
wobin@18 12 local View = Squawk.View
wobin@18 13 local Controller = Squawk.Controller
wobin@18 14
wobin@18 15 Model.UserSettings = {}
wobin@18 16 local Settings = Model.UserSettings
wobin@18 17
wobin@18 18 local defaults = {
wobin@18 19 profile = {
wobin@18 20 Squawks = {},
wobin@18 21 Follower = {},
wobin@18 22 Following = {},
wobin@18 23 Pending = {},
wobin@18 24 Requested = {},
wobin@18 25 Blocked = {},
wobin@18 26 }
wobin@18 27 }
wobin@18 28 local SquawkViewMeta = { __tostring = function() return "SquawkView" end }
wobin@18 29
wobin@18 30 function Squawk:OnInitialize()
wobin@18 31 Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults)
wobin@18 32 Model.Squawks.Main = Model.db.profile.Squawks
wobin@18 33 Settings.Follower = Model.db.profile.Follower
wobin@18 34 Settings.Following = Model.db.profile.Following
wobin@18 35 Settings.Pending = Model.db.profile.Pending
wobin@18 36 Settings.Requested = Model.db.profile.Requested
wobin@18 37 Settings.Blocked = Model.db.profile.Blocked
wobin@18 38 Settings.Private = Model.db.profile.Private
wobin@18 39
wobin@18 40 LibStub("AceComm-3.0"):Embed(Controller)
wobin@18 41 LibStub("AceTimer-3.0"):Embed(Controller)
wobin@18 42 Controller:RegisterComm("Squawk", Controller.ReceiveMessage)
wobin@18 43 LibStub("AceConsole-3.0"):Embed(View)
wobin@18 44 setmetatable(View, SquawkViewMeta)
wobin@18 45
wobin@18 46 Model.Squawks.Reload(Model.Squawks) -- Retrain the table lookups
wobin@18 47 end