# HG changeset patch # User wobin # Date 1239964951 -36000 # Node ID d1383f2d9b435ea0291e12cd095bd6a8e7e2b746 # Parent 1cc6e4710e2e39655661991178c7cac005733546 more on the tests and the framework towards the viewer diff -r 1cc6e4710e2e -r d1383f2d9b43 Squawk.lua --- a/Squawk.lua Fri Apr 17 15:59:51 2009 +1000 +++ b/Squawk.lua Fri Apr 17 20:42:31 2009 +1000 @@ -26,6 +26,7 @@ function Squawk:OnInitialize() Model.db = LibStub("AceDB-3.0"):New("SquawkDB", defaults) + Model.Squawks = Model.db.profile.Squawks Settings.Follower = Model.db.profile.Follower Settings.Following = Model.db.profile.Following Settings.Blocked = Model.db.profile.Blocked @@ -147,7 +148,7 @@ end function Controller:AddANewSquawk(Name, Message) - table.insert(Model.db.Squawks, Squawk:new(Message, Name)) + table.insert(Model.Squawks, Squawk:new(Message, Name)) View:UpdateSquawkList() end @@ -190,6 +191,7 @@ function View:UpdateSquawkList() self:Print("Updated Squawk List") + self:ShowMeMySquawks() end function View:NotifyOfPending(Name) @@ -203,3 +205,30 @@ function View:NotifyOfNewFollower(Name) self:Print(Name.." is now following you") end + +function View:ShowMeMySquawks() + for _,squawk from ipairs(Model.Squawks) do + self:Print(squawk.Message) + end +end + +function View:ShowMeMyFollowers() + self:Print("My followers are:") + for name,_ in pairs(Settings.Follower) do + self:Print(name) + end +end + +function View:ShowMeWhoImFollowing() + self:Print("I am following:") + for name,_ in pairs(Settings.Following) do + self:Print(name) + end +end + +function View:ShowMeWhoIveBlocked() + self:Print("I've blocked:") + for name, in pairs(Settings.Blocked) do + self:Print(name) + end +end diff -r 1cc6e4710e2e -r d1383f2d9b43 Tests.lua --- a/Tests.lua Fri Apr 17 15:59:51 2009 +1000 +++ b/Tests.lua Fri Apr 17 20:42:31 2009 +1000 @@ -5,5 +5,37 @@ --[[ --Tests we need to do: -- --- - +-- Add a follower +-- Remove a follower +-- Request to follow someone +-- Recieve a request from a follower +-- Send a Squawk +-- Recieve a direct Squawk +-- Send a Squawk to the Guild +-- Recieve a Squawk from the Guild --]] +-- + +SquawkTester = LibStub("AceAddon-3.0", "AceComm-3.0", "AceConsole-3.0") + +local Test = SquawkTester + +function Test:OnInitialize() + self:RegisterComm("Squawk", ReceiveMessage) + self:RegisterSlashCommand("TestSquawk", "RunTests") +end + +function Test:RunTests() + +end + +function Test:AddFollower() + +end + +function Test:ReceiveMessage(Prefix, Message, Distribution, Sender) +end + +function Test:SendMessageDirectly(Message) + +end