summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/delphi/m_core.inc1
-rw-r--r--include/m_core.h2
-rw-r--r--plugins/!NotAdopted/Chess4Net/MI/MirandaINC/m_database.inc1
-rw-r--r--plugins/BasicHistory/src/EventList.cpp3
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp20
-rw-r--r--plugins/Db3x_mmap/src/dbtool/eventchain.cpp21
-rw-r--r--plugins/HistoryPlusPlus/HistoryForm.pas1
-rw-r--r--plugins/HistoryPlusPlus/hpp_externalgrid.pas1
-rw-r--r--plugins/Import/src/import.cpp3
-rw-r--r--plugins/ImportTXT/ImportThrd.pas2
10 files changed, 20 insertions, 35 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index dc999a0d7c..5f7f54538d 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -81,7 +81,6 @@ type
end;
const
- DBEF_FIRST = 1; // internally only, do not use
DBEF_SENT = 2; // if set, the event was sent by the user, otherwise it was received
DBEF_READ = 4; // event has been read by the user -- only needed for history
DBEF_RTL = 8; // event contains the right-to-left aligned text
diff --git a/include/m_core.h b/include/m_core.h
index 59a77f57b0..98231d041e 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -87,8 +87,6 @@ typedef struct {
};
} DBVARIANT;
-#define DBEF_FIRST 1 // this is the first event in the chain;
- // internal only: *do not* use this flag
#define DBEF_SENT 2 // this event was sent by the user. If not set this
// event was received.
#define DBEF_READ 4 // event has been read by the user. It does not need
diff --git a/plugins/!NotAdopted/Chess4Net/MI/MirandaINC/m_database.inc b/plugins/!NotAdopted/Chess4Net/MI/MirandaINC/m_database.inc
index e559ad0780..913fb92d80 100644
--- a/plugins/!NotAdopted/Chess4Net/MI/MirandaINC/m_database.inc
+++ b/plugins/!NotAdopted/Chess4Net/MI/MirandaINC/m_database.inc
@@ -310,7 +310,6 @@ const
DBEVENTINFO.timestamp is in GMT, as returned by time()
}
- DBEF_FIRST = 1; // internally only, do not use
DBEF_SENT = 2; // if set, the event was sent by the user, otherwise it was received
DBEF_READ = 4; // event has been read by the user -- only needed for history
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index b3648456a7..6a822b8312 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -553,7 +553,6 @@ void EventList::MargeMessages(const std::vector<IImport::ExternalMessage>& messa
for (std::list<EventTempIndex>::iterator it = tempList.begin(); it != tempList.end(); ++it) {
if (it->isExternal) {
IImport::ExternalMessage& msg = importedMessages[it->exIdx];
- dbei.flags = msg.flags & (~(DBEF_FIRST));
dbei.flags |= DBEF_READ;
dbei.timestamp = msg.timestamp;
// For now I do not convert event data from string to blob, and event type must be message to handle it properly
@@ -604,7 +603,7 @@ bool EventList::GetEventData(const EventIndex& ev, EventData& data)
void EventList::GetExtEventDBei(const EventIndex& ev)
{
IImport::ExternalMessage& em = importedMessages[ev.exIdx];
- gdbei.flags = (em.flags & (~(DBEF_FIRST))) | 0x800;
+ gdbei.flags = em.flags | 0x800;
gdbei.eventType = em.eventType;
gdbei.timestamp = em.timestamp;
}
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 {
diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
index ee3cb7b854..fd988fe2cc 100644
--- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
+++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "..\commonheaders.h"
-#define DBEF_ALL (DBEF_FIRST | DBEF_READ | DBEF_SENT | DBEF_RTL | DBEF_UTF | DBEF_ENCRYPTED)
+#define DBEF_ALL (DBEF_READ | DBEF_SENT | DBEF_RTL | DBEF_UTF | DBEF_ENCRYPTED)
static BOOL backLookup;
static DWORD ofsThisEvent, ofsPrevEvent;
@@ -174,17 +174,15 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime)
}
if (firstTime) {
- if (!(dbeOld.flags & DBEF_FIRST)) {
+ if (dbeOld.ofsPrev != 0)
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("First event not marked as such: correcting"));
- dbeOld.flags |= DBEF_FIRST;
- }
- dbeOld.ofsPrev = ofsContact;
+
+ dbeOld.ofsPrev = 0;
lastTimestamp = dbeOld.timestamp;
}
- else if (dbeOld.flags & DBEF_FIRST) {
- cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Event marked as first which is not: correcting"));
- dbeOld.flags &= ~DBEF_FIRST;
- }
+
+ if (dbeOld.flags & 1)
+ dbeOld.flags &= ~1;
if (dbeOld.flags & ~DBEF_ALL) {
cb->pfnAddLogMessage(STATUS_WARNING, TranslateT("Extra flags found in event: removing"));
@@ -309,8 +307,7 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime)
// insert before FIRST
if (found == 1 && !cb->bCheckOnly) {
- dbeNew->flags |= DBEF_FIRST;
- dbeNew->ofsPrev = ofsContact;
+ dbeNew->ofsPrev = 0;
dbeNew->ofsNext = dbc->ofsFirstEvent;
ofsDestThis = WriteEvent(dbeNew);
@@ -325,8 +322,6 @@ int CDb3Mmap::WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime)
WriteOfsNextToPrevious(0, dbc, ofsDestThis);
// fix next event
WriteSegment(dbeNew->ofsNext + offsetof(DBEvent, ofsPrev), &ofsDestThis, sizeof(DWORD));
- dbeTmp.flags &= ~DBEF_FIRST;
- WriteSegment(dbeNew->ofsNext + offsetof(DBEvent, flags), &dbeTmp.flags, sizeof(DWORD));
}
else if (found == 2 && !cb->bCheckOnly) {
dbeNew->ofsPrev = ofsTmp;
diff --git a/plugins/HistoryPlusPlus/HistoryForm.pas b/plugins/HistoryPlusPlus/HistoryForm.pas
index 218f404be5..0f2255092b 100644
--- a/plugins/HistoryPlusPlus/HistoryForm.pas
+++ b/plugins/HistoryPlusPlus/HistoryForm.pas
@@ -3964,7 +3964,6 @@ begin
begin
DBEventInfo := GetEventInfo(hDBEvent);
DBEventInfo.szModule := nil;
- DBEventInfo.flags := DBEventInfo.flags and not DBEF_FIRST;
Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
end;
if Item.Size > 0 then
diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
index 7001eda5e5..98dd52d235 100644
--- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas
+++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
@@ -1269,7 +1269,6 @@ begin
begin
DBEventInfo := GetEventInfo(hDBEvent);
DBEventInfo.szModule := nil;
- DBEventInfo.flags := DBEventInfo.flags and not DBEF_FIRST;
Item.Size := Cardinal(DBEventInfo.cbSize) + Cardinal(DBEventInfo.cbBlob);
end;
end;
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index cc005be35d..a6411c4621 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -336,7 +336,6 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
int i = 0, skipAll = 0;
DWORD cbAlloc = 4096;
BYTE* eventBuf = (PBYTE)mir_alloc(cbAlloc);
- bool bIsVoidContact = dstDb->GetEventCount(hDst) == 0;
// Get the start of the event chain
HANDLE hEvent = srcDb->FindFirstEvent(hContact);
@@ -406,8 +405,6 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
// Check for duplicate entries
if (!IsDuplicateEvent((MCONTACT)hDst, dbei)) {
// Add dbevent
- if (!bIsVoidContact)
- dbei.flags &= ~DBEF_FIRST;
if (dstDb->AddEvent(hDst, &dbei) != NULL)
nMessagesCount++;
else
diff --git a/plugins/ImportTXT/ImportThrd.pas b/plugins/ImportTXT/ImportThrd.pas
index 31e185bf90..24a92156a8 100644
--- a/plugins/ImportTXT/ImportThrd.pas
+++ b/plugins/ImportTXT/ImportThrd.pas
@@ -139,7 +139,7 @@ begin
db_event_get(hExistingDbEvent, @dbeiExisting);
// compare event
if (dbei.timestamp = dbeiExisting.timestamp) and
- ((dbei.flags) = (dbeiExisting.flags and not DBEF_FIRST)) and
+ ((dbei.flags) = (dbeiExisting.flags)) and
// fix for first event
(dbei.eventType = dbeiExisting.eventType) and
(dbei.cbBlob = dbeiExisting.cbBlob) then