Mercurial > wow > libmoduledbshare-1-0
changeset 23:91ae8cfc63f2
Added OnDatabaseShutdown callbacks to all member DBs.
Corrected character-specific DB field from 'character' to 'char.'
| author | Andrew Knoll <andrewtknoll@gmail.com> |
|---|---|
| date | Fri, 15 Mar 2013 21:09:34 -0400 |
| parents | 4f5fba631b99 |
| children | efdeebcef96e |
| files | LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua |
| diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua Fri Mar 15 20:42:26 2013 -0400 +++ b/LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua Fri Mar 15 21:09:34 2013 -0400 @@ -66,8 +66,8 @@ end group.syncDB:SetProfile(initialDB:GetCurrentProfile()); group.members[initialDB] = true; - if type(initialDB.character.logoutTimestamp) == "number" then - group.profileTimestamp = initialDB.character.logoutTimestamp; + if type(initialDB.char.logoutTimestamp) == "number" then + group.profileTimestamp = initialDB.char.logoutTimestamp; else group.profileTimestamp = 0; end @@ -79,6 +79,7 @@ group.syncDB.RegisterCallback(group, "OnProfileDeleted", "OnProfileDeleted"); group.syncDB.RegisterCallback(group, "OnProfileCopied", "OnProfileCopied"); group.syncDB.RegisterCallback(group, "OnProfileReset", "OnProfileReset"); + initialDB.RegisterCallback(group, "OnDatabaseShutdown", "OnDatabaseShutdown"); group.squelchCallbacks = false; LibModuleDBShare.groups[groupName] = group; return group; @@ -110,7 +111,7 @@ self.syncDB:SetProfile(profile); end -- set current profile based on timestamps - if type(newDB.character.logoutTimestamp) == "number" and newDB.character.logoutTimestamp > self.profileTimestamp then + if type(newDB.char.logoutTimestamp) == "number" and newDB.char.logoutTimestamp > self.profileTimestamp then self.squelchCallbacks = false; self.syncDB:SetProfile(newDB:GetCurrentProfile()); self.profileTimestamp = newDB.character.logoutTimestamp; @@ -121,6 +122,7 @@ end -- add to members list self.members[newDB] = true; + newDB.RegisterCallback(self, "OnDatabaseShutdown", "OnDatabaseShutdown"); end -- callback handlers (new profiles are handled by OnProfileChanged) @@ -150,3 +152,7 @@ print("Profile Reset"); print(self.name); end + +function DBGroup:OnDatabaseShutdown(callback, db) + print("Database Shutdown"); +end
