From 497feba423271790e7b2b644b61df3934af06f9e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 21 Apr 2023 14:06:02 +0300 Subject: fixes #3494 (Import: not possible to import mContats files) --- plugins/HistoryPlusPlus/hpp_events.pas | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'plugins/HistoryPlusPlus/hpp_events.pas') diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas index 2996009325..004095c98f 100644 --- a/plugins/HistoryPlusPlus/hpp_events.pas +++ b/plugins/HistoryPlusPlus/hpp_events.pas @@ -101,6 +101,7 @@ function TimestampToDateTime(const Timestamp: DWord): TDateTime; function TimestampToString(const Timestamp: DWord): String; // general routine function ReadEvent(hDBEvent: THandle; UseCP: Cardinal = CP_ACP): THistoryItem; +function GetOldEventInfo(hDBEvent: THANDLE): TOldDBEventInfo; function GetEventInfo(hDBEvent: THANDLE): TDBEventInfo; function GetEventTimestamp(hDBEvent: THandle): DWord; function GetEventMessageType(hDBEvent: THandle): TMessageTypes; @@ -405,6 +406,40 @@ begin Result.cbBlob := 0; end; +function GetOldEventInfo(hDBEvent: THANDLE): TOldDBEventInfo; +var + BlobSize: integer; + dbei: TDBEventInfo; +begin + ZeroMemory(@Result, SizeOf(Result)); + BlobSize := db_event_getBlobSize(hDBEvent); + if BlobSize > 0 then + begin + EventBuffer.Allocate(BlobSize+2); // cheat, for possible crash avoid + Result.pBlob := EventBuffer.Buffer; + end + else + BlobSize := 0; + + dbei.cbBlob := BlobSize; + dbei.pBlob := Result.pBlob; + if db_event_get(hDBEvent, @dbei) = 0 then + begin + Result.cbBlob := BlobSize; + if BlobSize > 0 then + begin + PAnsiChar(Result.pBlob)[BlobSize ]:=#0; + PAnsiChar(Result.pBlob)[BlobSize+1]:=#0; + end; + end + else + Result.cbBlob := 0; + + Result.flags := dbei.flags; + Result.timestamp := dbei.timestamp; + Result.eventType := dbei.eventType; +end; + function GetMessageType(EventInfo: TDBEventInfo; var EventIndex: Integer): TMessageTypes; var i: Integer; -- cgit v1.2.3