diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-13 12:46:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-13 12:46:12 +0000 |
commit | e0ed9d34c0c21d3436e855fa1d32a0f824583116 (patch) | |
tree | 3af99c54d25ea730df7c32a5e37dd83087d4986e /plugins/Db3x_mmap/src/dbevents.cpp | |
parent | 787fc82cd195c9d7c5f359c3a04e93c9ca797655 (diff) |
another atavism died: DBEF_FIRST
git-svn-id: http://svn.miranda-ng.org/main/trunk@8590 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbevents.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbevents.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 9ed871c5f1..7513348cad 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -85,21 +85,17 @@ STDMETHODIMP_(HANDLE) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) dbe.ofsModuleName = GetModuleNameOfs(dbei->szModule);
// find where to put it - sort by timestamp
if (dbc.eventCount == 0) {
- dbe.ofsPrev = ofsContact;
- dbe.ofsNext = 0;
- dbe.flags |= DBEF_FIRST;
+ dbe.ofsPrev = dbe.ofsNext = 0;
dbc.ofsFirstEvent = dbc.ofsLastEvent = ofsNew;
}
else {
DBEvent *dbeTest = (DBEvent*)DBRead(dbc.ofsFirstEvent, sizeof(DBEvent), NULL);
// Should new event be placed before first event in chain?
if (dbe.timestamp < dbeTest->timestamp) {
- dbe.ofsPrev = ofsContact;
+ dbe.ofsPrev = 0;
dbe.ofsNext = dbc.ofsFirstEvent;
- dbe.flags |= DBEF_FIRST;
dbc.ofsFirstEvent = ofsNew;
dbeTest = (DBEvent*)DBRead(dbe.ofsNext, sizeof(DBEvent), NULL);
- dbeTest->flags &= ~DBEF_FIRST;
dbeTest->ofsPrev = ofsNew;
DBWrite(dbe.ofsNext, dbeTest, sizeof(DBEvent));
}
@@ -187,7 +183,7 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteEvent(MCONTACT contactID, HANDLE hDbEvent) }
DWORD ofsThis = dbeNext->ofsNext;
dbeNext = (DBEvent*)DBRead(ofsThis, sizeof(DBEvent), NULL);
- if (!(dbeNext->flags & (DBEF_READ | DBEF_SENT))) {
+ if (!(dbeNext->flags & NOT_UNREAD)) {
dbc.ofsFirstUnread = ofsThis;
dbc.tsFirstUnread = dbeNext->timestamp;
break;
@@ -196,13 +192,12 @@ STDMETHODIMP_(BOOL) CDb3Mmap::DeleteEvent(MCONTACT contactID, HANDLE hDbEvent) }
//get previous and next events in chain and change offsets
- if (dbe.flags & DBEF_FIRST) {
+ if (dbe.ofsPrev == 0) {
if (dbe.ofsNext == 0)
dbc.ofsFirstEvent = dbc.ofsLastEvent = 0;
else {
DBEvent *dbeNext = (DBEvent*)DBRead(dbe.ofsNext, sizeof(DBEvent), NULL);
- dbeNext->flags |= DBEF_FIRST;
- dbeNext->ofsPrev = dbe.ofsPrev;
+ dbeNext->ofsPrev = 0;
DBWrite(dbe.ofsNext, dbeNext, sizeof(DBEvent));
dbc.ofsFirstEvent = dbe.ofsNext;
}
@@ -499,6 +494,11 @@ void CDb3Mmap::ConvertContactEvents(DBContact *dbc) memcpy(&pNew->ofsPrev, &pOld.ofsPrev, offsetof(DBEvent_094, blob) - sizeof(DWORD));
memcpy(&pNew->blob, pBlob, pNew->cbBlob);
+ if (pNew->flags & 1) {
+ pNew->flags &= ~1;
+ pNew->ofsPrev = 0;
+ }
+
if (ofsPrev == 0) // first event
dbc->ofsFirstEvent = ofsNew, pNew->ofsPrev = 0;
else {
|