Mercurial > wow > libmoduledbshare-1-0
comparison LibModuleDBShare-1.0/LibModuleDBShare-1.0.lua @ 41:047d80e6aadc
Fixed issue causing data to sometimes not record when logging out.
| author | Andrew Knoll <andrewtknoll@gmail.com> |
|---|---|
| date | Wed, 10 Apr 2013 14:13:06 -0400 |
| parents | e1053178ddbf |
| children | 71f3aad48c72 |
comparison
equal
deleted
inserted
replaced
| 40:e1053178ddbf | 41:047d80e6aadc |
|---|---|
| 147 group.syncDB.RegisterCallback(group, "OnProfileChanged", "OnProfileChanged"); | 147 group.syncDB.RegisterCallback(group, "OnProfileChanged", "OnProfileChanged"); |
| 148 group.syncDB.RegisterCallback(group, "OnProfileDeleted", "OnProfileDeleted"); | 148 group.syncDB.RegisterCallback(group, "OnProfileDeleted", "OnProfileDeleted"); |
| 149 group.syncDB.RegisterCallback(group, "OnProfileCopied", "OnProfileCopied"); | 149 group.syncDB.RegisterCallback(group, "OnProfileCopied", "OnProfileCopied"); |
| 150 group.syncDB.RegisterCallback(group, "OnProfileReset", "OnProfileReset"); | 150 group.syncDB.RegisterCallback(group, "OnProfileReset", "OnProfileReset"); |
| 151 group.syncDB.RegisterCallback(group, "OnDatabaseShutdown", "OnSyncShutdown"); | 151 group.syncDB.RegisterCallback(group, "OnDatabaseShutdown", "OnSyncShutdown"); |
| 152 initialDB.RegisterCallback(group, "OnDatabaseShutdown", "OnMemberShutdown"); | 152 group.members[initialDB].RegisterCallback(group, "OnDatabaseShutdown", "OnMemberShutdown"); -- register the namespace, not the base db |
| 153 group.squelchCallbacks = false; | 153 group.squelchCallbacks = false; |
| 154 LibModuleDBShare.groups[groupName] = group; | 154 LibModuleDBShare.groups[groupName] = group; |
| 155 return group; | 155 return group; |
| 156 end | 156 end |
| 157 | 157 |
| 211 newDB:SetProfile(syncProfile); | 211 newDB:SetProfile(syncProfile); |
| 212 self.squelchCallbacks = false; | 212 self.squelchCallbacks = false; |
| 213 end | 213 end |
| 214 -- add to members list | 214 -- add to members list |
| 215 self.members[newDB] = namespace; | 215 self.members[newDB] = namespace; |
| 216 newDB.RegisterCallback(self, "OnDatabaseShutdown", "OnMemberShutdown"); | 216 namespace.RegisterCallback(self, "OnDatabaseShutdown", "OnMemberShutdown"); -- register the namespace, not the base db |
| 217 end | 217 end |
| 218 | 218 |
| 219 -- LibDualSpec support | 219 -- LibDualSpec support |
| 220 | 220 |
| 221 --- Checks to see if this group uses LibDualSpec. | 221 --- Checks to see if this group uses LibDualSpec. |
| 406 | 406 |
| 407 function DBGroup:OnMemberShutdown(callback, db) | 407 function DBGroup:OnMemberShutdown(callback, db) |
| 408 if not timestamp then -- ensure uniform timestamps to minimize | 408 if not timestamp then -- ensure uniform timestamps to minimize |
| 409 timestamp = time(); -- calls to SetProfile in NewGroup | 409 timestamp = time(); -- calls to SetProfile in NewGroup |
| 410 end | 410 end |
| 411 self.members[db].char.logoutTimestamp = timestamp; | 411 db.char.logoutTimestamp = timestamp; -- namespace is registered for callback, not base db |
| 412 if self.usesDualSpec then | 412 if self.usesDualSpec then |
| 413 if not altProfile then | 413 if not altProfile then |
| 414 altProfile = self.syncDB:GetDualSpecProfile(); | 414 altProfile = self.syncDB:GetDualSpecProfile(); |
| 415 dualSpecEnabled = self.syncDB:IsDualSpecEnabled(); | 415 dualSpecEnabled = self.syncDB:IsDualSpecEnabled(); |
| 416 activeSpecGroup = GetActiveSpecGroup(); | 416 activeSpecGroup = GetActiveSpecGroup(); |
| 417 end | 417 end |
| 418 self.members[db].char.altProfile = altProfile; | 418 db.char.altProfile = altProfile; |
| 419 self.members[db].char.dualSpecEnabled = dualSpecEnabled; | 419 db.char.dualSpecEnabled = dualSpecEnabled; |
| 420 self.members[db].char.activeSpecGroup = activeSpecGroup; | 420 db.char.activeSpecGroup = activeSpecGroup; |
| 421 end | 421 end |
| 422 end | 422 end |
| 423 | 423 |
| 424 -- update existing groups | 424 -- update existing groups |
| 425 for groupName, group in pairs(LibModuleDBShare.groups) do | 425 for groupName, group in pairs(LibModuleDBShare.groups) do |
