summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src/dbevents.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Db3x_mmap/src/dbevents.cpp')
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp
index 5bbb4853cb..0de122623d 100644
--- a/plugins/Db3x_mmap/src/dbevents.cpp
+++ b/plugins/Db3x_mmap/src/dbevents.cpp
@@ -508,77 +508,3 @@ int CDb3Mmap::WipeContactHistory(DBContact *dbc)
dbc->eventCount = 0; dbc->ofsFirstEvent = dbc->ofsLastEvent = dbc->ofsFirstUnread = dbc->tsFirstUnread = 0;
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// events convertor for DB_095_1_VERSION
-
-void CDb3Mmap::ConvertContactEvents(DBContact *dbc)
-{
- BYTE *pBlob = (PBYTE)mir_alloc(65536);
- DWORD ofsPrev = 0;
-
- __try {
- for (DWORD ofsEvent = dbc->ofsFirstEvent; ofsEvent != 0;) {
- DBEvent_094 pOld = *(DBEvent_094*)DBRead(ofsEvent, sizeof(DBEvent_094), NULL);
- if (pOld.signature != DBEVENT_SIGNATURE)
- break;
-
- if (pOld.cbBlob >= 65536) {
- ofsEvent = pOld.ofsNext;
- continue;
- }
- memcpy(pBlob, m_pDbCache + ofsEvent + offsetof(DBEvent_094, blob), pOld.cbBlob);
-
- DWORD ofsNew = ReallocSpace(ofsEvent, offsetof(DBEvent_094, blob) + pOld.cbBlob, offsetof(DBEvent, blob) + pOld.cbBlob);
- DBEvent *pNew = (DBEvent*)&m_pDbCache[ofsNew];
- pNew->signature = pOld.signature;
- pNew->contactID = dbc->dwContactID;
- 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 {
- DBEvent *pPrev = (DBEvent*)&m_pDbCache[ofsPrev];
- pPrev->ofsNext = ofsNew, pNew->ofsPrev = ofsPrev;
- }
-
- if (dbc->ofsFirstUnread == ofsEvent)
- dbc->ofsFirstUnread = ofsNew;
- if (dbc->ofsLastEvent == ofsEvent)
- dbc->ofsLastEvent = ofsNew;
-
- ofsPrev = ofsNew;
- ofsEvent = pNew->ofsNext;
- }
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {}
-
- mir_free(pBlob);
-}
-
-void CDb3Mmap::ConvertEvents()
-{
- DBContact dbc = *(DBContact*)DBRead(m_dbHeader.ofsUser, sizeof(DBContact), NULL);
- ConvertContactEvents(&dbc);
- DBWrite(m_dbHeader.ofsUser, &dbc, sizeof(dbc));
-
- for (DWORD dwOffset = m_dbHeader.ofsFirstContact; dwOffset != 0;) {
- DBContact dbc = *(DBContact*)DBRead(dwOffset, sizeof(DBContact), NULL);
- ConvertContactEvents(&dbc);
- DBWrite(dwOffset, &dbc, sizeof(dbc));
-
- if (m_contactsMap.find((ConvertedContact*)&dbc.dwContactID) == NULL)
- m_contactsMap.insert(new ConvertedContact(dwOffset, dbc.dwContactID));
-
- dwOffset = dbc.ofsNext;
- }
-
- FlushViewOfFile(m_pDbCache, 0);
-}