view Squawk.lua @ 22:8df5d8ef2e27 tip

switch back to LibQTip-1.0 as LQTC is depreciated Fixed up the line resizing as LQT does this automatically now
author wobin
date Wed, 22 Jul 2009 23:16:42 +1000
parents 22178ac75587
children
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 = {},
		Squawkers = {},
		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
	Model.Squawks.Squawkers = Model.db.profile.Squawkers
	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
	Settings.Trendsetter = Model.db.profile.Trendsetter
	
	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)

	Controller.Name = UnitName("player")
	_, Controller.Class = UnitClass("player")

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

	-- Now setup the SquawkTrends channel if opted in
	if Settings.Trendsetter then
		if #{GetChannelList()} > 17 then -- if we have a spare channel to use...
			View:Print("Due to custom channel limitation, Squawk cannot transmit/recieve trending details")
		end
	end

end