view 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
line wrap: on
line source
-- A Twitter client of sorts for World of Warcraft
-- Author: Wobin
-- Email: wobster@gmail.com
--
Squawk = LibStub("AceAddon-3.0"):NewAddon("Squawk")

Squawk.Model = {}
Squawk.View = {}
Squawk.Controller = {}

local Model = Squawk.Model
local View = Squawk.View
local Controller = Squawk.Controller

Model.UserSettings = {}
local Settings = Model.UserSettings

local defaults = {
	profile = {
		Squawks = {},
		Follower = {},
		Following = {},
		Pending = {},
		Requested = {},
		Blocked = {},
	}
}
local SquawkViewMeta = { __tostring = function() return "SquawkView" end }

function Squawk:OnInitialize()
	Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults)
	Model.Squawks.Main = Model.db.profile.Squawks
	Settings.Follower = Model.db.profile.Follower
	Settings.Following = Model.db.profile.Following
	Settings.Pending = Model.db.profile.Pending
	Settings.Requested = Model.db.profile.Requested
	Settings.Blocked = Model.db.profile.Blocked
	Settings.Private = Model.db.profile.Private
	
	LibStub("AceComm-3.0"):Embed(Controller)
	LibStub("AceTimer-3.0"):Embed(Controller)
	Controller:RegisterComm("Squawk", Controller.ReceiveMessage)
	LibStub("AceConsole-3.0"):Embed(View)
	setmetatable(View, SquawkViewMeta)

	Model.Squawks.Reload(Model.Squawks) -- Retrain the table lookups
end