Mercurial > wow > squawk
comparison Squawk.lua @ 4:d1383f2d9b43
more on the tests and the framework towards the viewer
author | wobin |
---|---|
date | Fri, 17 Apr 2009 20:42:31 +1000 |
parents | 1cc6e4710e2e |
children | 50ef3ed9d0da |
comparison
equal
deleted
inserted
replaced
3:1cc6e4710e2e | 4:d1383f2d9b43 |
---|---|
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 function Squawk:OnInitialize() | 27 function Squawk:OnInitialize() |
28 Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults) | 28 Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults) |
29 Model.Squawks = Model.db.profile.Squawks | |
29 Settings.Follower = Model.db.profile.Follower | 30 Settings.Follower = Model.db.profile.Follower |
30 Settings.Following = Model.db.profile.Following | 31 Settings.Following = Model.db.profile.Following |
31 Settings.Blocked = Model.db.profile.Blocked | 32 Settings.Blocked = Model.db.profile.Blocked |
32 Settings.Private = Model.db.profile.Private | 33 Settings.Private = Model.db.profile.Private |
33 | 34 |
145 Settings:AddFollowing(Name) | 146 Settings:AddFollowing(Name) |
146 View:NotifyOfNewFollowing(Name) | 147 View:NotifyOfNewFollowing(Name) |
147 end | 148 end |
148 | 149 |
149 function Controller:AddANewSquawk(Name, Message) | 150 function Controller:AddANewSquawk(Name, Message) |
150 table.insert(Model.db.Squawks, Squawk:new(Message, Name)) | 151 table.insert(Model.Squawks, Squawk:new(Message, Name)) |
151 View:UpdateSquawkList() | 152 View:UpdateSquawkList() |
152 end | 153 end |
153 | 154 |
154 function Controller:SendNewSquawk(Message) | 155 function Controller:SendNewSquawk(Message) |
155 if not Model:IsPrivate() then | 156 if not Model:IsPrivate() then |
188 end | 189 end |
189 -- View -- | 190 -- View -- |
190 | 191 |
191 function View:UpdateSquawkList() | 192 function View:UpdateSquawkList() |
192 self:Print("Updated Squawk List") | 193 self:Print("Updated Squawk List") |
194 self:ShowMeMySquawks() | |
193 end | 195 end |
194 | 196 |
195 function View:NotifyOfPending(Name) | 197 function View:NotifyOfPending(Name) |
196 self:Print(Name.." will have to approve your request") | 198 self:Print(Name.." will have to approve your request") |
197 end | 199 end |
201 end | 203 end |
202 | 204 |
203 function View:NotifyOfNewFollower(Name) | 205 function View:NotifyOfNewFollower(Name) |
204 self:Print(Name.." is now following you") | 206 self:Print(Name.." is now following you") |
205 end | 207 end |
208 | |
209 function View:ShowMeMySquawks() | |
210 for _,squawk from ipairs(Model.Squawks) do | |
211 self:Print(squawk.Message) | |
212 end | |
213 end | |
214 | |
215 function View:ShowMeMyFollowers() | |
216 self:Print("My followers are:") | |
217 for name,_ in pairs(Settings.Follower) do | |
218 self:Print(name) | |
219 end | |
220 end | |
221 | |
222 function View:ShowMeWhoImFollowing() | |
223 self:Print("I am following:") | |
224 for name,_ in pairs(Settings.Following) do | |
225 self:Print(name) | |
226 end | |
227 end | |
228 | |
229 function View:ShowMeWhoIveBlocked() | |
230 self:Print("I've blocked:") | |
231 for name, in pairs(Settings.Blocked) do | |
232 self:Print(name) | |
233 end | |
234 end |