changeset 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
files Squawk.lua Tests.lua
diffstat 2 files changed, 63 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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