diff options
author | Alexey Kulakov <panda75@bk.ru> | 2012-07-03 07:22:09 +0000 |
---|---|---|
committer | Alexey Kulakov <panda75@bk.ru> | 2012-07-03 07:22:09 +0000 |
commit | 8b8845c8e142c2e70bc0c2785ddf3a91ad3f84bd (patch) | |
tree | 58d80918e28651c678069aa2ee768f801eca74db /plugins/ImportTXT/BRMSIP.inc | |
parent | 980bcaff693a86971750d6e9ffc8ba1e561b8b3a (diff) |
New core adaptation (Delphi 7 normal compilation)
API headers update
git-svn-id: http://svn.miranda-ng.org/main/trunk@731 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ImportTXT/BRMSIP.inc')
-rw-r--r-- | plugins/ImportTXT/BRMSIP.inc | 143 |
1 files changed, 76 insertions, 67 deletions
diff --git a/plugins/ImportTXT/BRMSIP.inc b/plugins/ImportTXT/BRMSIP.inc index 552a98af3b..8010a8973c 100644 --- a/plugins/ImportTXT/BRMSIP.inc +++ b/plugins/ImportTXT/BRMSIP.inc @@ -1,77 +1,86 @@ -{$ifdef BIN_IMPORT_}
-var rsz:integer;
+{$IFDEF BIN_IMPORT_}
+var
+ rsz: integer;
+
+{$ELSE}
-{$else}
begin
- pt:=integer(pFileText);
- i:=0;
- if FileLen>=$30 then
- if (StrLComp(PChar(pt),'midp-rms',8)=0) then
- begin
- if FileLen>=$48 then
- if (RLInteger(pt+$40)=$48) then
- begin
- fsz:=RLInteger(pt+$44);
- i:=$48;
- end;
- if (RLInteger(pt+$28)=$30) then
- begin
- fsz:=RLInteger(pt+$2C);
- i:=$30;
- end;
+ pt := uint_ptr(pFileText);
+ i := 0;
+ if FileLen >= $30 then
+ if (StrLComp(PAnsiChar(pt), 'midp-rms', 8) = 0) then
+ begin
+ if FileLen >= $48 then
+ if (RLInteger(pt + $40) = $48) then
+ begin
+ fsz := RLInteger(pt + $44);
+ i := $48;
+ end;
+ if (RLInteger(pt + $28) = $30) then
+ begin
+ fsz := RLInteger(pt + $2C);
+ i := $30;
+ end;
+
+ if (DContact.hContact = 0) or (DContact.hContact = INVALID_HANDLE_VALUE) then
+ if (fContact.hContact <> 0) and (fContact.hContact <> INVALID_HANDLE_VALUE) then
+ DContact := fContact;
+ if (DContact.hContact <> 0) and (DContact.hContact <> INVALID_HANDLE_VALUE) then
+ begin
+ proto := GetContactProto(DContact.hContact);
+ DoMessage(ITXT_THREAD_DEST_CONTACT, DContact.hContact, 0);
+ DoMessage(ITXT_THREAD_START, 0, 0);
+ DoMessage(ITXT_THREAD_MAXPROGRESS, 0, fsz);
+ while Cardinal(i) < fsz do
+ begin
+ fillchar(dbei, sizeof(dbei), 0);
+ dbei.cbSize := sizeof(dbei);
+ dbei.szModule := PAnsiChar(proto);
+ rsz := RLInteger(pt + i + $08);
+ if PByte(pt + i + $10)^ = $00 then
+ dbei.flags := DBEF_READ or DBEF_UTF
+ else
+ dbei.flags := DBEF_READ or DBEF_UTF or DBEF_SENT;
+ // в файлах лежат в utf8 и импортируются без изменений
+ dbei.eventType := EVENTTYPE_MESSAGE;
+ dbei.cbBlob := RLWord(pt + i + $13 + RLWord(pt + i + $11));
+ dbei.pBlob := Pointer(pt + i + $13 + RLWord(pt + i + $11) + $2);
+ dbei.timestamp := StrToTimeStamp
+ (Pointer(uint_ptr(pt + i) + $13 + RLWord(pt + i + $11) + $4 + dbei.cbBlob),
+ RLWord(uint_ptr(pt + i) + $13 + RLWord(pt + i + $11) + $2 + dbei.cbBlob));
+ inc(dbei.cbBlob);
- if (DContact.hContact=0) or (DContact.hContact=INVALID_HANDLE_VALUE) then
- if (fContact.hContact<>0) and (fContact.hContact<>INVALID_HANDLE_VALUE) then
- DContact:=fContact;
- if (DContact.hContact<>0) and (DContact.hContact<>INVALID_HANDLE_VALUE) then
- begin
- proto:=GetContactProto(DContact.hContact);
- DoMessage(ITXT_THREAD_DEST_CONTACT,DContact.hContact,0);
- DoMessage(ITXT_THREAD_START,0,0);
- DoMessage(ITXT_THREAD_MAXPROGRESS,0,fsz);
- while i<fsz do
- begin
- with dbei do
- begin
- fillchar(dbei,sizeof(dbei),0);
- cbSize:=sizeof(dbei);
- szModule:=PChar(proto);
- rsz:= RLInteger(pt+i+$08);
- if PByte(pt+i+$10)^=$00 then flags:=0
- else flags:=DBEF_SENT;
- flags:=flags or DBEF_READ or DBEF_UTF; //в файлах лежат в utf8 и импортируются без изменений
- eventType:= EVENTTYPE_MESSAGE;
- cbBlob:=RLWord(pt+i+$13+RLWord(pt+i+$11));
- pBlob:=Pointer(pt+i+$13+RLWord(pt+i+$11)+$2);
- timestamp:=StrToTimeStamp(pointer(pt+i+$13+RLWord(pt+i+$11)+$4+cbBlob),RLWord(pt+i+$13+RLWord(pt+i+$11)+$2+cbBlob));
- inc(cbBlob);
- end;
- try
- if not IsDuplicateEvent(DContact.hContact,dbei) then
- if pluginLink^.CallService(MS_DB_EVENT_ADD, wParam(DContact.hContact), lParam(@dbei))<>0 then Inc(AddedMessages)
- else begin
- s:= 'Error adding message to DB';
- DoMessage(ITXT_THREAD_ERROR,integer(PWideChar(s)),0); break; end
+ try
+ if not IsDuplicateEvent(DContact.hContact, dbei) then
+ if CallService(MS_DB_EVENT_ADD, wParam(DContact.hContact), lParam(@dbei))<>0 then
+ inc(AddedMessages)
+ else
+ begin
+ s := 'Error adding message to DB';
+ DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
+ break;
+ end
- else Inc(Duplicates);
- finally
- inc(i,rsz);
+ else
+ inc(Duplicates);
+ finally
+ inc(i, rsz);
+ end;
+ DoMessage(ITXT_THREAD_PROGRESS, i, 0);
end;
- DoMessage(ITXT_THREAD_PROGRESS,i,0);
- end;
- end
- else
- begin
- s:=TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR,integer(PWideChar(s)),0);
- end;
+ end
+ else
+ begin
+ s := TranslateWideString('Can''t determine destination contact');
+ DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
+ end;
end
- else
+ else
begin
- s:=WideFormat(TranslateWideString('Its not %s file'),['midp-rms']);
- DoMessage(ITXT_THREAD_ERROR,integer(PWideChar(s)),0);
+ s := WideFormat(TranslateWideString('Its not %s file'), ['midp-rms']);
+ DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
end
- else //file len
+ else // file len
end;
-{$endif}
+{$ENDIF}
|