diff options
Diffstat (limited to 'plugins/Db3x_mmap/src/dbtool/eventchain.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbtool/eventchain.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp index 362f86436d..ff5defe281 100644 --- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp +++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp @@ -31,7 +31,7 @@ static DWORD ofsThisEvent, ofsPrevEvent; static DWORD ofsDestPrevEvent;
static DWORD eventCount;
static DWORD lastTimestamp;
-static DWORD ofsFirstUnread, timestampFirstUnread;
+static DWORD ofsFirstUnread, tsFirstUnread;
static DWORD memsize = 0;
static DBEvent* memblock = NULL;
static DBEvent* dbePrevEvent = NULL;
@@ -87,12 +87,12 @@ void CDb3Mmap::FinishUp(DWORD ofsLast, DBContact *dbc) dbc->eventCount = eventCount;
dbc->ofsLastEvent = ofsLast;
if (cb->bMarkRead) {
- dbc->ofsFirstUnreadEvent = 0;
- dbc->timestampFirstUnread = 0;
+ dbc->ofsFirstUnread = 0;
+ dbc->tsFirstUnread = 0;
}
else {
- dbc->ofsFirstUnreadEvent = ofsFirstUnread;
- dbc->timestampFirstUnread = timestampFirstUnread;
+ dbc->ofsFirstUnread = ofsFirstUnread;
+ dbc->tsFirstUnread = tsFirstUnread;
}
if (memsize && memblock) {
free(memblock);
@@ -128,13 +128,13 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) eventCount = 0;
backLookup = 0;
lastTimestamp = 0;
- ofsFirstUnread = timestampFirstUnread = 0;
+ ofsFirstUnread = tsFirstUnread = 0;
if (cb->bEraseHistory) {
dbc->eventCount = 0;
dbc->ofsFirstEvent = 0;
dbc->ofsLastEvent = 0;
- dbc->ofsFirstUnreadEvent = 0;
- dbc->timestampFirstUnread = 0;
+ dbc->ofsFirstUnread = 0;
+ dbc->tsFirstUnread = 0;
return ERROR_NO_MORE_ITEMS;
}
}
@@ -194,7 +194,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!(dbeOld.flags & (DBEF_READ | DBEF_SENT))) {
if (cb->bMarkRead) dbeOld.flags |= DBEF_READ;
else if (ofsFirstUnread == 0) {
- if (dbc->ofsFirstUnreadEvent != ofsThisEvent || dbc->timestampFirstUnread != dbeOld.timestamp)
+ if (dbc->ofsFirstUnread != ofsThisEvent || dbc->tsFirstUnread != dbeOld.timestamp)
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("First unread event marked wrong: fixing"));
isUnread = 1;
}
@@ -235,7 +235,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) dbeNew->ofsPrev = ofsDestPrevEvent;
dbeNew->ofsNext = 0;
- if (dbeOld.eventType == EVENTTYPE_MESSAGE && cb->bConvertUtf && !(dbeOld.flags & DBEF_ENCRYPTED)) {
+ if (dbeOld.wEventType == EVENTTYPE_MESSAGE && cb->bConvertUtf && !(dbeOld.flags & DBEF_ENCRYPTED)) {
DWORD oldSize = dbeNew->cbBlob;
BYTE* pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob);
memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob);
@@ -249,10 +249,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (dbePrev) {
if (dbePrev->cbBlob == dbeNew->cbBlob &&
- dbePrev->ofsModuleName == dbeNew->ofsModuleName &&
- dbePrev->eventType == dbeNew->eventType &&
- (dbePrev->flags & DBEF_SENT) == (dbeNew->flags & DBEF_SENT) &&
- !memcmp(dbePrev->blob, dbeNew->blob, dbeNew->cbBlob))
+ dbePrev->ofsModuleName == dbeNew->ofsModuleName &&
+ dbePrev->wEventType == dbeNew->wEventType &&
+ (dbePrev->flags & DBEF_SENT) == (dbeNew->flags & DBEF_SENT) && !memcmp(dbePrev->blob, dbeNew->blob, dbeNew->cbBlob))
{
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Duplicate event was found: skipping"));
if (dbc->eventCount)
@@ -316,9 +315,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!ofsDestThis)
return ERROR_HANDLE_DISK_FULL;
- if (isUnread && timestampFirstUnread >= dbeNew->timestamp) {
+ if (isUnread && tsFirstUnread >= dbeNew->timestamp) {
ofsFirstUnread = ofsDestThis;
- timestampFirstUnread = dbeNew->timestamp;
+ tsFirstUnread = dbeNew->timestamp;
}
// fix first event
WriteOfsNextToPrevious(0, dbc, ofsDestThis);
@@ -335,9 +334,9 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (!ofsDestThis)
return ERROR_HANDLE_DISK_FULL;
- if (isUnread && timestampFirstUnread >= dbeNew->timestamp) {
+ if (isUnread && tsFirstUnread >= dbeNew->timestamp) {
ofsFirstUnread = ofsDestThis;
- timestampFirstUnread = dbeNew->timestamp;
+ tsFirstUnread = dbeNew->timestamp;
}
// fix previous event
WriteOfsNextToPrevious(dbeNew->ofsPrev, dbc, ofsDestThis);
@@ -363,7 +362,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime) if (isUnread) {
ofsFirstUnread = ofsDestThis;
- timestampFirstUnread = dbeOld.timestamp;
+ tsFirstUnread = dbeOld.timestamp;
}
eventCount++;
|