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@19
|
21 Squawkers = {},
|
wobin@18
|
22 Follower = {},
|
wobin@18
|
23 Following = {},
|
wobin@18
|
24 Pending = {},
|
wobin@18
|
25 Requested = {},
|
wobin@18
|
26 Blocked = {},
|
wobin@18
|
27 }
|
wobin@18
|
28 }
|
wobin@18
|
29 local SquawkViewMeta = { __tostring = function() return "SquawkView" end }
|
wobin@18
|
30
|
wobin@18
|
31 function Squawk:OnInitialize()
|
wobin@18
|
32 Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults)
|
wobin@18
|
33 Model.Squawks.Main = Model.db.profile.Squawks
|
wobin@19
|
34 Model.Squawks.Squawkers = Model.db.profile.Squawkers
|
wobin@18
|
35 Settings.Follower = Model.db.profile.Follower
|
wobin@18
|
36 Settings.Following = Model.db.profile.Following
|
wobin@18
|
37 Settings.Pending = Model.db.profile.Pending
|
wobin@18
|
38 Settings.Requested = Model.db.profile.Requested
|
wobin@18
|
39 Settings.Blocked = Model.db.profile.Blocked
|
wobin@18
|
40 Settings.Private = Model.db.profile.Private
|
wobin@20
|
41 Settings.Trendsetter = Model.db.profile.Trendsetter
|
wobin@18
|
42
|
wobin@18
|
43 LibStub("AceComm-3.0"):Embed(Controller)
|
wobin@18
|
44 LibStub("AceTimer-3.0"):Embed(Controller)
|
wobin@18
|
45 Controller:RegisterComm("Squawk", Controller.ReceiveMessage)
|
wobin@18
|
46 LibStub("AceConsole-3.0"):Embed(View)
|
wobin@18
|
47 setmetatable(View, SquawkViewMeta)
|
wobin@18
|
48
|
wobin@19
|
49 Controller.Name = UnitName("player")
|
wobin@19
|
50 _, Controller.Class = UnitClass("player")
|
wobin@19
|
51
|
wobin@18
|
52 Model.Squawks.Reload(Model.Squawks) -- Retrain the table lookups
|
wobin@20
|
53
|
wobin@20
|
54 -- Now setup the SquawkTrends channel if opted in
|
wobin@20
|
55 if Settings.Trendsetter then
|
wobin@20
|
56 if #{GetChannelList()} > 17 then -- if we have a spare channel to use...
|
wobin@20
|
57 View:Print("Due to custom channel limitation, Squawk cannot transmit/recieve trending details")
|
wobin@20
|
58 end
|
wobin@20
|
59 end
|
wobin@20
|
60
|
wobin@18
|
61 end
|