summaryrefslogtreecommitdiff
path: root/plugins/HistoryPlusPlus/hpp_events.pas
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-21 14:06:02 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-21 14:06:02 +0300
commit497feba423271790e7b2b644b61df3934af06f9e (patch)
tree5c73189981470d1bd09ea7f8caad0f4ed5ad08a0 /plugins/HistoryPlusPlus/hpp_events.pas
parent0b305d1a7e0dbd30c7acbe5f4a93a511620df934 (diff)
fixes #3494 (Import: not possible to import mContats files)
Diffstat (limited to 'plugins/HistoryPlusPlus/hpp_events.pas')
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas35
1 files changed, 35 insertions, 0 deletions
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;