Update LibVersionCheck to v0.04

Mere [07-30-13 - 21:26]
Update LibVersionCheck to v0.04
Filename
Libs/LibVersionCheck/RiftAddon.toc
Libs/LibVersionCheck/main.lua
diff --git a/Libs/LibVersionCheck/RiftAddon.toc b/Libs/LibVersionCheck/RiftAddon.toc
index 87867a3..7e1004e 100644
--- a/Libs/LibVersionCheck/RiftAddon.toc
+++ b/Libs/LibVersionCheck/RiftAddon.toc
@@ -9,7 +9,7 @@ Description = {
 }

 Email = "blohm@s.netic.de"
-Version = "0.03"
+Version = "0.04"
 Environment = "2.2"
 SavedVariables = {
    LibVersionCheckVersions = "global",
diff --git a/Libs/LibVersionCheck/main.lua b/Libs/LibVersionCheck/main.lua
index 0304b29..ef6b659 100644
--- a/Libs/LibVersionCheck/main.lua
+++ b/Libs/LibVersionCheck/main.lua
@@ -18,6 +18,14 @@ local function ignoreme()
 end


+-- new in 0.4: We remember (locally, not saved across relogs) which
+-- addons got registered. If a player had an addon installed, and removes
+-- it, we don't want to get a reminder about the new version. So when we
+-- check versions, and registeredAddons[] doesnt contain an addon, we
+-- set our version of that addon to 0.
+
+local registeredAddons={}
+
 -- Called when variables are fully loaded. To avoid problems if some
 -- addon calls us before our variables are there, we save the version
 -- info of that addon in Temp...., and copy it to the real table here.
@@ -160,7 +168,11 @@ end

 local function allAddonsLoaded(handle)
 	local anythingToShow=false
+	-- print("all loaded, checking versions")
 	for k, v in pairs(LibVersionCheckVersions) do
+		if not registeredAddons[k] then
+			v.myVersion="0"
+		end
 		if v.myVersion and v.newestVersion
 		and ""..v.myVersion ~= "0"
 		and ""..v.myVersion < ""..v.newestVersion then
@@ -256,13 +268,15 @@ function LibVersionCheck.register(addonName, addonVersion)
 		whereToStore[addonName]={}
 	end
 	whereToStore[addonName].myVersion=""..addonVersion
+	registeredAddons[addonName]=true
+	-- print(addonName .. " registers with version "..addonVersion)
 end



 Command.Message.Accept(nil, "LibVersionCheck")
 Command.Event.Attach(Event.Addon.SavedVariables.Load.End, varsLoaded,      "Event.Addon.SavedVariables.Load.End")
-Command.Event.Attach(Event.Addon.Startup.End, 		  allAddonsLoaded, "Event.Addon.Startup.End")
+Command.Event.Attach(Event.Addon.Startup.End, 		  allAddonsLoaded, "Event.Addon.Startup.End", -99)
 Command.Event.Attach(Event.Unit.Availability.Full, 	  unitAvailable,   "Event.Unit.Availability.Full")
 Command.Event.Attach(Event.Message.Receive, 	  	  gotMessage,      "Event.Message.Receive")
 Command.Event.Attach(Event.System.Update.Begin,   	  systemUpdate,    "Event.System.Update.Begin")