diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-29 13:49:40 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-29 13:49:40 +0300 |
commit | 0c1b97a6027e2341a2d68711e147d87be08ca411 (patch) | |
tree | 2374b410b13133bfbbe63c4a3190a75af93b187a | |
parent | 10a09ce7de1c3b87a99db2089399246fb44b71b4 (diff) |
ImportTXT moved to deprecated
58 files changed, 9 insertions, 4497 deletions
diff --git a/bin15/pascal64.bat b/bin15/pascal.bat index dbb8904480..66ae83396e 100644 --- a/bin15/pascal64.bat +++ b/bin15/pascal.bat @@ -1,27 +1,29 @@ -rem @echo off +@echo off + +if "%1" == "64" (set tp=64) pushd ..\plugins pushd Actman -call make.bat fpc64 15 +call make.bat fpc%tp% 15 if errorlevel 1 goto :Error popd pushd mRadio -call make.bat fpc64 15 +call make.bat fpc%tp% 15 if errorlevel 1 goto :Error popd pushd QuickSearch -call make.bat fpc64 15 +call make.bat fpc%tp% 15 if errorlevel 1 goto :Error popd pushd Watrack -call make.bat fpc64 15 +call make.bat fpc%tp% 15 if errorlevel 1 goto :Error cd icons -call makeicons.bat fpc64 15 +call makeicons.bat fpc%tp% 15 if errorlevel 1 goto :Error popd diff --git a/bin15/pascal32.bat b/bin15/pascal32.bat deleted file mode 100644 index fb789bf855..0000000000 --- a/bin15/pascal32.bat +++ /dev/null @@ -1,39 +0,0 @@ -@echo off - -pushd ..\plugins - -pushd Actman -call make.bat fpc 15 -if errorlevel 1 goto :Error -popd - -pushd ImportTXT -call make.bat fpc 15 -if errorlevel 1 goto :Error -popd - -pushd mRadio -call make.bat fpc 15 -if errorlevel 1 goto :Error -popd - -pushd QuickSearch -call make.bat fpc 15 -if errorlevel 1 goto :Error -popd - -pushd Watrack -call make.bat fpc 15 -if errorlevel 1 goto :Error -cd icons -call makeicons.bat fpc 15 -if errorlevel 1 goto :Error -popd - -popd -goto :eof - -:Error -echo ============================= FAIL! ============================= -pause -exit diff --git a/plugins/Actman/version.RES b/plugins/Actman/version.RES Binary files differnew file mode 100644 index 0000000000..aa7c19667f --- /dev/null +++ b/plugins/Actman/version.RES diff --git a/plugins/ImportTXT/BICQ5IP.inc b/plugins/ImportTXT/BICQ5IP.inc deleted file mode 100644 index 46ee251e59..0000000000 --- a/plugins/ImportTXT/BICQ5IP.inc +++ /dev/null @@ -1,98 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-
-var
- rhxml: HXML;
- curxml: HXML;
- chldxml: HXML;
- ptxt: PWideChar;
- txtlen: int;
- ic, tm: integer;
- res: LongBool;
-
-{$ELSE}
-
-begin
- 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);
- GetMem(ptxt, SizeOf(WideChar) * FileLen + 2);
- try
- ptxt := UTF8toWide(pFileText, ptxt, SizeOf(WideChar) * FileLen + 2);
- ptxt[FileLen + 1] := #0000;
- rhxml := xmlparseString(ptxt, @txtlen, 'root');
- finally
- freemem(ptxt);
- end;
- if (rhxml = 0) then
- exit;
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, xmlgetChildCount(rhxml));
- chldxml := xmlgetFirstChild(rhxml);
- if xmlgetName(chldxml) = 'version' then
- begin
- ic := 0;
- curxml := xmlgetNextChild(rhxml, 'event', @ic);
- while (curxml <> 0) do
- begin
- fillchar(dbei, SizeOf(dbei), 0);
- dbei.szModule := PAnsiChar(proto);
- if TryStrToInt(xmlgetText(xmlgetChildByPath(curxml, 'time', false)), tm)
- then
- dbei.timestamp := tm;
- if xmlgetText(xmlgetChildByPath(curxml, 'incoming', false)) = 'Yes' then
- dbei.flags := DBEF_READ or DBEF_UTF
- else
- dbei.flags := DBEF_READ or DBEF_UTF or DBEF_SENT;
-
- if xmlgetText(xmlgetChildByPath(curxml, 'type', false))^ = '2' then
- begin
- s := xmlgetText(xmlgetChildByPath(curxml, 'text', false)) + ': ' +
- xmlgetText(xmlgetChildByPath(curxml, 'data', false));
- dbei.eventType := EVENTTYPE_URL;
- end
- else
- begin
- s := xmlgetText(xmlgetChildByPath(curxml, 'text', false));
- dbei.eventType := EVENTTYPE_MESSAGE;
- end;
- try
- tempstr := WidetoUTF8(PWideChar(s), tempstr);
- dbei.cbBlob := lstrlena(tempstr) + 1;
- dbei.pBlob := PByte(tempstr);
- if not IsDuplicateEvent(DContact.hContact, dbei) then
- if db_event_add(wParam(DContact.hContact), @dbei) <> 0 then
- Inc(AddedMessages)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- break;
- end
-
- else
- Inc(Duplicates);
-
- finally
- freemem(tempstr);
- curxml := xmlgetNextChild(rhxml, 'event', @ic);
- DoMessage(ITXT_THREAD_PROGRESS, ic, 0);
- end;
- end;
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['ICQ5']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BICQ6IP(ADO).inc b/plugins/ImportTXT/BICQ6IP(ADO).inc deleted file mode 100644 index f713c48950..0000000000 --- a/plugins/ImportTXT/BICQ6IP(ADO).inc +++ /dev/null @@ -1,103 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-
-var
- QR1: TADOQuery;
-
-var
- OneContact: boolean;
- flags: integer;
- timestamp: LongWord;
- Msg: AnsiString;
- ADOConnection:TADOConnection;
-
-function FindUIDinDB(too: string): string;
-var
- QR2: TADOQuery;
-begin
- QR2 := TADOQuery.Create(nil);
- QR2.Connection := ADOConnection;
- QR2.SQL.Text := 'select to, UID from ChatHistory WHERE to=' + too;
- QR2.Open;
- QR2.First;
- result := QR2.FieldByName('UID').AsString;
- QR2.Close;
- QR2.Free;
-end;
-
-{$ELSE}
-
-begin
- DoUnMapFile;
- OneContact := (DContact.hContact <> 0) and (DContact.hContact <> INVALID_HANDLE_VALUE);
- try
-// coInitialize(nil);
- ADOConnection:=TADOConnection.Create(nil);
- ADOConnection.Connected:=false;
- ADOConnection.LoginPrompt:=false;
- ADOConnection.Provider:='Microsoft.Jet.OLEDB.4.0';
- ADOConnection.ConnectionString :=
- 'User ID=Admin;' +
- 'Data Source=' + FileName +
- ';Mode=Share Deny None;' +
- 'Extended Properties="";' +
- 'Locale Identifier=1033;' +
- 'Persist Security Info=False;';
-
- ADOConnection.Connected:=true;
-
- QR1 := TADOQuery.Create(nil);
- QR1.Connection := ADOConnection;
- QR1.SQL.Text := 'SELECT Messages.from, date, to, type, subType, subject FROM Messages';
- QR1.Open;
- if (QR1.FieldCount = 7) then
- begin
- DoMessage(ITXT_THREAD_START, 0, 0);
- QR1.First;
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, QR1.RecordCount);
- While not QR1.EOF do
- begin
- try
- if (QR1.FieldByName('type').AsString = 'Text') and
- (QR1.FieldByName('subType').AsString = 'IM') then
- begin
- UIDStr := FindUIDinDB(QR1.FieldByName('to').AsString);
- if not OneContact then
- begin
- DContact.ContactUID := UIDStr;
- TryDetermContact(DContact);
- end;
- if (DContact.hContact <> 0) and
- (DContact.hContact <> INVALID_HANDLE_VALUE) then
- begin
- if QR1.Fields[1].AsString = '' then
- flags := DBEF_READ or DBEF_UTF or DBEF_SENT
- else
- flags := DBEF_READ or DBEF_UTF;
- timestamp := DateTimeToTimeStamp(QR1.FieldByName('date').AsDateTime - 693594);
- Msg := QR1.FieldByName('subject').AsString;
- tempstr := ANSIToUTF8(PAnsiChar(Msg), tempstr, cp);
- Msg := tempstr;
- FreeMem(tempstr);
- AddMsgToDB(DContact.hContact, flags, timestamp, Msg, AddedMessages, Duplicates);
- end;
- end;
- except
- ShowException(ExceptObject, ExceptAddr)
- end;
- QR1.Next;
- DoMessage(ITXT_THREAD_PROGRESS, QR1.RecNo, 0);
- end; // for
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['ICQ6 mdb']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- finally
- QR1.Close;
- QR1.Free;
- ADOConnection.Close;
- ADOConnection.Free;
- end;
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BICQ6IP.inc b/plugins/ImportTXT/BICQ6IP.inc deleted file mode 100644 index 5728fe93e7..0000000000 --- a/plugins/ImportTXT/BICQ6IP.inc +++ /dev/null @@ -1,93 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-
-var
- DS: PDataSource;
- SS: PSession;
- QR1: PQuery;
-
-var
- OneContact: boolean;
- flags: integer;
- timestamp: LongWord;
- Msg: AnsiString;
-
-function FindUIDinDB(too: string): string;
-var
- QR2: PQuery;
-begin
- QR2 := NewQuery(SS);
- QR2.Text := 'select to, UID from ChatHistory WHERE to=' + too;
- QR2.Open;
- QR2.First;
- result := QR2.FieldByNameAsStr['UID'];
- QR2.Free;
-end;
-
-{$ELSE}
-
-begin
- DoUnMapFile;
- OneContact := (DContact.hContact <> 0) and (DContact.hContact <> INVALID_HANDLE_VALUE);
- try
- DS := NewDataSource('Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;' +
- 'Data Source=' + FileName +
- ';Mode=Share Deny None;' +
- 'Extended Properties="";' +
- 'Locale Identifier=1033;' +
- 'Persist Security Info=False;');
- SS := NewSession(DS);
- QR1 := NewQuery(SS);
- QR1.Text := 'SELECT Messages.from, date, to, type, subType, subject FROM Messages';
- QR1.Open;
- if (QR1.ColCount = 7) then
- begin
- DoMessage(ITXT_THREAD_START, 0, 0);
- QR1.First;
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, QR1.RowCount);
- While not QR1.EOF do
- begin
- try
- if (QR1.SFieldByName['type'] = 'Text') and
- (QR1.SFieldByName['subType'] = 'IM') then
- begin
- UIDStr := FindUIDinDB(QR1.FieldByNameAsStr['to']);
- if not OneContact then
- begin
- DContact.ContactUID := UIDStr;
- TryDetermContact(DContact);
- end;
- if (DContact.hContact <> 0) and
- (DContact.hContact <> INVALID_HANDLE_VALUE) then
- begin
- if QR1.SField[1] = '' then
- flags := DBEF_READ or DBEF_UTF or DBEF_SENT
- else
- flags := DBEF_READ or DBEF_UTF;
- timestamp := DateTimeToTimeStamp(QR1.DFieldByName['date'] - 693594);
- Msg := QR1.SFieldByName['subject'];
- tempstr := ANSIToUTF8(PAnsiChar(Msg), tempstr, cp);
- Msg := tempstr;
- FreeMem(tempstr);
- AddMsgToDB(DContact.hContact, flags, timestamp, Msg, AddedMessages, Duplicates);
- end;
- end;
- except
- ShowException(ExceptObject, ExceptAddr)
- end;
- QR1.Next;
- DoMessage(ITXT_THREAD_PROGRESS, QR1.CurIndex, 0);
- end; // for
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['ICQ6 mdb']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- finally
- DS.Free;
- DS := nil;
- SS := nil;
- QR1 := nil;
- end;
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BRMSIP.inc b/plugins/ImportTXT/BRMSIP.inc deleted file mode 100644 index a270102f8d..0000000000 --- a/plugins/ImportTXT/BRMSIP.inc +++ /dev/null @@ -1,85 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-var
- rsz: integer;
-
-{$ELSE}
-
-begin
- 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.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);
-
- try
- if not IsDuplicateEvent(DContact.hContact, dbei) then
- if db_event_add(DContact.hContact, @dbei) <> 0 then
- inc(AddedMessages)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- break;
- end
-
- else
- inc(Duplicates);
- finally
- inc(i, rsz);
- end;
- DoMessage(ITXT_THREAD_PROGRESS, i, 0);
- end;
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['midp-rms']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else // file len
-
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BbayanIP.inc b/plugins/ImportTXT/BbayanIP.inc deleted file mode 100644 index d0f1d5ab7b..0000000000 --- a/plugins/ImportTXT/BbayanIP.inc +++ /dev/null @@ -1,81 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-
-var
- j: integer;
-{$ELSE}
-
-begin
- pt := uint_ptr(pFileText);
- if FileLen >= 10 then
- if true { (PWORD(pt)^=$4248) and (PDWORD(pt+2)^=$FFFFFFFF) } then
- begin
- //
- 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);
- fsz := FileLen - 2; //
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, fsz);
- inc(pt, 2);
- i := 0;
- while Cardinal(i) < fsz do
- begin
- with dbei do
- begin
- fillchar(dbei, sizeof(dbei), 0);
- dbei.szModule := PAnsiChar(proto);
- dbei.timestamp := ImportTU.timestamp(
- RLWORD(pt + i + 5),
- PByte(pt + i + 4)^,
- PByte(pt + i + 3)^,
- PByte(pt + i)^,
- PByte(pt + i + 1)^,
- PByte(pt + i + 2)^);
-
- if PByte(pt + i + $7)^ = $00 then
- dbei.flags := DBEF_READ or DBEF_UTF
- else
- dbei.flags := DBEF_READ or DBEF_UTF or DBEF_SENT;
- dbei.eventType := EVENTTYPE_MESSAGE;
- dbei.cbBlob := (RLWORD(pt + i + $8) + 1) * sizeof(WideChar);
- s := '';
- for j := 0 to RLWORD(pt + i + $8) do
- s := s + WideChar(RLWORD(pt + i + $0A + (j * 2)));
-
- dbei.pBlob := PByte(WideToUTF8(PWideChar(s), PAnsiChar(pBlob)));
- end;
- if not IsDuplicateEvent(DContact.hContact, dbei) then
- if db_event_add(wParam(DContact.hContact), @dbei) <> 0 then
- inc(AddedMessages)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- break;
- end
-
- else
- inc(Duplicates);
- inc(i, dbei.cbBlob + $0C);
- FreeMem(dbei.pBlob);
- DoMessage(ITXT_THREAD_PROGRESS, i, 0);
- end;
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['bayanICQ']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else // file len
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BmContactIP.inc b/plugins/ImportTXT/BmContactIP.inc deleted file mode 100644 index cc81555d56..0000000000 --- a/plugins/ImportTXT/BmContactIP.inc +++ /dev/null @@ -1,60 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-{$ELSE}
-
-begin
- pt := uint_ptr(pFileText);
- if FileLen >= 10 then
- if (PWORD(pt)^ = $4248) and (PDWORD(pt + 2)^ = $FFFFFFFF) then
- begin
- //
- 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);
- fsz := PDWORD(pt + 6)^; //
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, fsz);
- inc(pt, 10);
- i := 0;
- while cardinal(i) < fsz do
- begin
- evSize := PInteger(pt + i)^;
- dbei.szModule := PAnsiChar(proto);
- dbei.timestamp := PDWORD(pt + i + $08)^;
- dbei.flags := PDWORD(pt + i + $0C)^;
- dbei.eventtype := PDWORD(pt + i + $10)^;
- dbei.cbBlob := PDWORD(pt + i + $14)^;
- dbei.pBlob := PBYTE(pt + i + evSize);
-
- if not IsDuplicateEvent(DContact.hContact, dbei) then
- if db_event_add(DContact.hContact, @dbei) <> 0 then
- inc(AddedMessages)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- break;
- end
- else
- inc(Duplicates);
- inc(i, evSize + integer(dbei.cbBlob));
- DoMessage(ITXT_THREAD_PROGRESS, i, 0);
- end;
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['mContact']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else // file len
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/BqhfIP.inc b/plugins/ImportTXT/BqhfIP.inc deleted file mode 100644 index cd99bbfaa3..0000000000 --- a/plugins/ImportTXT/BqhfIP.inc +++ /dev/null @@ -1,145 +0,0 @@ -{$IFDEF BIN_IMPORT_}
-
-var
- qhfver: byte;
- szMsgHd: word;
- UIDstr: UTF8String;
- UIDLen, NickLen: word;
- NickStr: UTF8String;
-
-function DecodeQHFMsg(ver: byte; adr: integer; cSize: word): AnsiString;
-
- function get1(c: AnsiChar): byte;
- begin
- if ShortInt(c) >= 0 then
- Result := byte(c)
- else
- Result := byte(c) + 256;
- end;
-
- function get2(b: byte): AnsiChar;
- begin
- if b < 128 then
- Result := AnsiChar(b)
- else
- Result := AnsiChar(b - 256);
- end;
-
-var
- i: integer;
-begin
- SetLength(Result, cSize);
- for i := 1 to cSize do
- begin
- Result[i] := PAnsiChar(adr + i - 1)^;
- if ver <> $01 then
- begin
- inc(Result[i], i);
- Result[i] := get2(255 - get1(Result[i]));
- end
- end;
-end;
-
-{$ELSE}
-
-begin
- pt := uint_ptr(pFileText);
- if FileLen >= $2E then
- if (PAnsiChar(pt)^ = 'Q') and (PAnsiChar(pt + 1)^ = 'H') and (PAnsiChar(pt + 2)^ = 'F') then
- begin
- qhfver := PByte(pt + 3)^;
- if qhfver >= $03 then
- szMsgHd := $23
- else
- szMsgHd := $21;
- fsz := RLInteger(pt + $04);
-
- UIDLen := RLWord(pt + $2C);
- SetLength(UIDstr, UIDLen);
- if qhfver <= 2 then
- lstrcpynA(PAnsiChar(UIDstr), PAnsiChar(pt + $2E), UIDLen)
- else
- lstrcpynA(PAnsiChar(UIDstr), PAnsiChar(pt + $2E), UIDLen + 1);
-
- NickLen := RLWord(pt + $2E + UIDLen);
- SetLength(NickStr, NickLen);
- if qhfver <= 2 then
- lstrcpynA(PAnsiChar(NickStr), PAnsiChar(pt + $2E + UIDLen + 2), UIDLen)
- else
- lstrcpynA(PAnsiChar(NickStr), PAnsiChar(pt + $2E + UIDLen + 2), UIDLen + 1);
-
- inc(pt, $2E + UIDLen + 2 + NickLen);
- if fsz <> FileLen - ($2E + UIDLen + 2 + NickLen) then
- fsz := FileLen - ($2E + UIDLen + 2 + NickLen);
-
- if (DContact.hContact = 0) or (DContact.hContact = INVALID_HANDLE_VALUE)
- then
- begin
- DContact.ContactUID := UIDstr;
- DContact.ContactNick := UTF8Decode{UTF8ToWideString}(NickStr);
- TryDetermContact(DContact);
- 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);
- i := 0;
- while Cardinal(i) < fsz do
- begin
- fillchar(dbei, sizeof(dbei), 0);
- dbei.szModule := PAnsiChar(proto);
- dbei.timestamp := RLInteger(pt + i + $12);
- dbei.timestamp := dbei.timestamp -
- (Cardinal(TimeZone_ToLocal(dbei.timestamp)) - dbei.timestamp); // GMT
- if PByte(pt + i + $1A)^ = $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 + szMsgHd - 2) + 1;
- // #0
- dbei.pBlob := AllocMem(dbei.cbBlob);
-
- try
- Move(DecodeQHFMsg(qhfver, pt + i + szMsgHd, dbei.cbBlob - 1)[1],
- dbei.pBlob^, dbei.cbBlob - 1);
- if not IsDuplicateEvent(DContact.hContact, dbei) then
- if db_event_add(DContact.hContact, @dbei) <> 0 then
- inc(AddedMessages)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- break;
- end
-
- else
- inc(Duplicates);
-
- finally
- inc(i, szMsgHd + dbei.cbBlob - 1);
- FreeMem(dbei.pBlob);
- end;
- DoMessage(ITXT_THREAD_PROGRESS, i, 0);
- end;
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
- end
- else
- begin
- s := WideFormat(TranslateWideString('It''s not %s file'), ['QHF']);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else // file len
-end;
-{$ENDIF}
diff --git a/plugins/ImportTXT/FileDlgs.pas b/plugins/ImportTXT/FileDlgs.pas deleted file mode 100644 index 970c005334..0000000000 --- a/plugins/ImportTXT/FileDlgs.pas +++ /dev/null @@ -1,133 +0,0 @@ -unit FileDlgs;
-
-interface
-
-uses windows,m_api;
-
-function OpenDialogExecute(hDlg:hWnd; flg:cardinal; var nFO:integer; const DefExt:string):WideString; //
-function FolderDialogExecute(hdlg:HWND; var nFO:integer; const DefExt:string):WideString; //
-
-implementation
-
-uses ActiveX, ShlObj, SysUtils, CommDlg;
-
-function OpenDialogExecute(hDlg:hWnd; flg:cardinal; var nFO:integer; const DefExt:string):WideString; //
-var
- OpenFilename:OpenFilenameW;
- TempFilename:WideString;
- Temp1,Temp2:WideString;
- res:bool;
-begin
- nFO:=0;
- FillChar(OpenFileName, SizeOf(OpenFileName), 0);
- with OpenFilename do
- begin
- lStructSize:=SizeOf(OpenFilename);
- hWndOwner:=hDlg;
- Temp1:=
- TranslateWideString('Default extension')+' (*.'+DefExt+')'+#0+'*.'+DefExt+#0+
- TranslateWideString('All files (*.*)')+#0+'*.*'+#0#0;
- lpstrFilter:=PWideChar(Temp1);
- nMaxFile:=MAX_PATH*16;
- SetLength(TempFilename, nMaxFile + 2);
- TempFilename[1]:=#0;
- lpstrFile :=PWideChar(TempFilename);
- Temp2:=TranslateWideString('Choose a file for import...');
- lpstrTitle:=PWideChar(Temp2);
- Flags:=flg or OFN_EXPLORER or OFN_ENABLESIZING or OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST or OFN_NOCHANGEDIR;
- end;
- res:=GetOpenFileNameW(@OpenFileName);
- if res then
- begin
- Result:=TempFilename;
- nFO:=OpenFilename.nFileOffset;
- end
- else
- Result:='';
-end;
-
-//***Awkward - author of this procedures************
-
-function StrDupW(var dst:PWideChar;src:PWideChar;len:integer=0):PWideChar;
-begin
- if (src=nil) or (src^=#0) then
- dst:=nil
- else
- begin
- if len=0 then
- len:=lstrlenw(src);
- GetMem(dst,(len+1)*SizeOf(WideChar));
- lstrcpynw(dst,src,len+1);
- end;
- result:=dst;
-end;
-
-function SelectDirectory(Caption:PWideChar;var Directory:PWideChar;
- Parent:HWND=0;newstyle:bool=false):Boolean;
-var
- BrowseInfo:BrowseInfoW;
- Buffer:array [0..MAX_PATH-1] of WideChar;
- ItemIDList:PItemIDList;
- ShellMalloc:IMalloc;
-begin
- Result:=False;
- FillChar(BrowseInfo,SizeOf(BrowseInfo),0);
- if (ShGetMalloc(ShellMalloc)=S_OK) and (ShellMalloc<>nil) then
- begin
- with BrowseInfo do
- begin
- hwndOwner :=Parent;
- pszDisplayName:=Buffer;
- lpszTitle :=Caption;
- ulFlags :=BIF_RETURNONLYFSDIRS;
- end;
- if newstyle then
- if CoInitializeEx(nil,COINIT_APARTMENTTHREADED)<>RPC_E_CHANGED_MODE then
- BrowseInfo.ulFlags:=BrowseInfo.ulFlags or BIF_NEWDIALOGSTYLE;
- try
- ItemIDList:=ShBrowseForFolderW(@BrowseInfo);
- Result:=ItemIDList<>nil;
- if Result then
- begin
- ShGetPathFromIDListW(ItemIDList,Buffer);
- StrDupW(Directory,Buffer);
- ShellMalloc.Free(ItemIDList);
- end;
- finally
- if newstyle then CoUninitialize;
- end;
- end;
-end;
-
-//*******************************************************************
-
-function FolderDialogExecute(hdlg:HWND; var nFO:integer; const DefExt:string):WideString; //
-var
- SR: _WIN32_FIND_DATAW;
- hFFF:THandle;
- tpwc:PWideChar;
- tws:WideString;
-begin
- if SelectDirectory(TranslateW('Select folder for import...'),tpwc,hdlg,true) then
- begin
- result:=tpwc;
- result:=result+#0;
- nFO:=length(result);
- tws:=tpwc;
- tws:=tws+'\*.'+DefExt;
- SR.dwFileAttributes:=faAnyFile;
- hFFF:=FindFirstFileW(PWideChar(tws),SR);
- if hFFF<>INVALID_HANDLE_VALUE then
- begin
- repeat
- result:=result+SR.cFileName;
- result:=result+#0;
- until not FindNextFileW(hFFF,SR);
- windows.FindClose(hFFF);
- result:=result+#0;
- end;
- end
- else result:='';
-end;
-
-end.
diff --git a/plugins/ImportTXT/General.pas b/plugins/ImportTXT/General.pas deleted file mode 100644 index 76a25be9ae..0000000000 --- a/plugins/ImportTXT/General.pas +++ /dev/null @@ -1,500 +0,0 @@ -unit general;
-
-interface
-
-uses
- Windows, Messages, SysUtils, IniFiles,
- m_api,
- ImportT,
- ImportTU;
-
-var
- cp: cardinal;
-
-var
- AppPath: array [0 .. MAX_PATH] of Char;
- TxtPatterns: array of RTxtPattern;
- Protocols: array of TDestProto;
- ProtoCount: integer;
- CheckForDuplicates: boolean;
- ShowDuplicates: boolean;
-
-const
- BIN_PROCEDURE_COUNT = 6; //
-
-const
-{$EXTERNALSYM PBM_SETRANGE}
- PBM_SETRANGE = WM_USER + 1;
-{$EXTERNALSYM PBM_SETPOS}
- PBM_SETPOS = WM_USER + 2;
-
-const
- IMPORT_TXT_MODULE = 'ImportTXT';
- IMPORT_TXT_SERVICE = IMPORT_TXT_MODULE + '/Import';
- IMPORT_WIZ_SERVICE = IMPORT_TXT_MODULE + '/Wizard';
-
- // keys
- IMPORT_TXT_AS = 'AutoStart';
- IMPORT_TXT_LP = 'LastPattern';
-
-type
- TOnAccountListChange = procedure();
-
-var
- OnAccountListChange: TOnAccountListChange;
-
-procedure ReadPatterns;
-procedure ExtractFilePath(fName: PAnsiChar);
-function GetContactProto(hContact: THandle): AnsiString;
-function GetContactByUID(const proto: AnsiString; const id: AnsiString): THandle;
-function GetContactByNick(const proto: AnsiString; const Nick: WideString): THandle;
-procedure EnumProtocols;
-function GetContactID(hContact: THandle; proto: AnsiString = ''; Contact: boolean = false): WideString;
-function GetContactNick(hContact: THandle; proto: AnsiString = ''; Contact: boolean = false): WideString;
-function DBReadByte(hContact: THandle; szModule: PAnsiChar; szSetting: PAnsiChar; default: byte = 0): byte;
-function DBWriteByte(hContact: THandle; szModule: PAnsiChar; szSetting: PAnsiChar; val: byte): integer;
-procedure SetLastPattern(lp: byte);
-function GetLastPattern: byte;
-function TimeStampToWStr(ts: DWORD): WideString;
-function StrToTimeStamp(STime: PAnsiChar; len: integer): DWORD;
-
-function RLWord(adr: integer): word;
-function RLInteger(adr: integer): integer;
-
-implementation
-
-procedure ExtractFilePath(fName: PAnsiChar);
-var
- p: PAnsiChar;
-begin
- p := fName;
- if p <> nil then
- begin
- while p^ <> #0 do
- inc(p);
- while p^ <> '\' do
- dec(p);
- inc(p);
- p^ := #0;
- end;
-end;
-
-function ReadPattern(const FileName: String): boolean;
-var
- TI: TIniFile;
- tempstr: String;
- pattern:pRTxtPattern;
-begin
- TI := TIniFile.Create(FileName);
- try
- if not TI.SectionExists('General') then
- exit;
-
- pattern:=@TxtPatterns[High(TxtPatterns)];
- // if "General" exists
- if TI.ValueExists('General', 'Name') then
- pattern^.Name := TI.ReadString('General', 'Name', '')
- else
- exit;
- if TI.ValueExists('General', 'Type') then
- pattern^.IType := TI.ReadInteger('General', 'Type', 1)
- else
- exit;
- case pattern^.IType of
- 1:
- begin
- if TI.ValueExists('General', 'Charset') then
- begin
- tempstr := TI.ReadString('General', 'Charset', 'UTF8');
- if tempstr = 'ANSI' then
- pattern^.Charset := inANSI
- else if tempstr = 'UTF8' then
- pattern^.Charset := inUTF8
- else if tempstr = 'UCS2' then
- pattern^.Charset := inUCS2
- else
- exit;
- end
- else
- exit;
- if pattern^.Charset = inANSI then
- begin
- pattern^.Codepage := TI.ReadInteger('General', 'Codepage', 0);
- if not IsValidCodePage(pattern^.Codepage) then
- pattern^.Codepage := 0;
- end;
- pattern^.UseHeader := TI.ReadInteger('General', 'UseHeader', 0);
- pattern^.UsePreMsg := TI.ReadBool('General', 'UsePreMsg', false);
- // Read message section
- if TI.SectionExists('Message') then
- begin
- if TI.ValueExists('Message', 'Pattern') then
- pattern^.Msg.Pattern := TI.ReadString('Message', 'Pattern', '')
- else
- exit;
- pattern^.Msg.Incoming := TI.ReadString('Message', 'In', '');
- pattern^.Msg.Outgoing := TI.ReadString('Message', 'Out', '');
- if TI.ValueExists('Message', 'Direction') then
- pattern^.Msg.Direction := TI.ReadInteger('Message', 'Direction', 0)
- else
- exit;
- if TI.ValueExists('Message', 'Day') then
- pattern^.Msg.Day := TI.ReadInteger('Message', 'Day', 0)
- else
- exit;
- if TI.ValueExists('Message', 'Month') then
- pattern^.Msg.Month := TI.ReadInteger('Message', 'Month', 0)
- else
- exit;
- if TI.ValueExists('Message', 'Year') then
- pattern^.Msg.Year := TI.ReadInteger('Message', 'Year', 0)
- else
- exit;
- if TI.ValueExists('Message', 'Hours') then
- pattern^.Msg.Hours := TI.ReadInteger('Message', 'Hours', 0)
- else
- exit;
- if TI.ValueExists('Message', 'Minutes') then
- pattern^.Msg.Minutes := TI.ReadInteger('Message', 'Minutes', 0)
- else
- exit;
- pattern^.Msg.Seconds := TI.ReadInteger('Message', 'Seconds', 0)
- end
- else
- exit;
- // if need read header section
- if (pattern^.UseHeader > 0) then
- if TI.SectionExists('Header') then
- begin
- if TI.ValueExists('Header', 'Pattern') then
- pattern^.Header.Pattern := TI.ReadString('Header', 'Pattern', '')
- else
- exit;
- if (not TI.ValueExists('Header', 'In')) and
- ((pattern^.UseHeader and 1) = 1) then
- exit;
- pattern^.Header.Incoming := TI.ReadInteger('Header', 'In', 0);
- pattern^.Header.Outgoing := TI.ReadInteger('Header', 'Out', 0);
- pattern^.Header.InNick := TI.ReadInteger('Header', 'InNick', 0);
- pattern^.Header.OutNick := TI.ReadInteger('Header', 'OutNick', 0);
- pattern^.Header.InUID := TI.ReadInteger('Header', 'InUID', 0);
- pattern^.Header.OutUID := TI.ReadInteger('Header', 'OutUID', 0);
- if ((pattern^.UseHeader and 2) = 2) then
- if (pattern^.Header.InNick = 0) and
- (pattern^.Header.InUID = 0) then
- exit;
- end
- else
- exit;
- // if nead read PreMessage section
- if pattern^.UsePreMsg then
- if TI.SectionExists('PreMessage') then
- begin
- pattern^.PreMsg.PreRN := TI.ReadInteger('PreMessage', 'PreRN', -1);
- pattern^.PreMsg.AfterRN := TI.ReadInteger('PreMessage', 'AfterRN', -1);
- pattern^.PreMsg.PreSP := TI.ReadInteger('PreMessage', 'PreSP', 0);
- pattern^.PreMsg.AfterSP := TI.ReadInteger('PreMessage', 'AfterSP', 0);
- end
- else
- exit;
- end; // 1
- 2:
- begin
- pattern^.BinProc := TI.ReadInteger('General', 'BinProcedure', 0);
- if (pattern^.BinProc > BIN_PROCEDURE_COUNT) then
- exit;
- end;
- end; // case
- pattern^.DefExtension := TI.ReadString('General', 'DefaultExtension', 'txt');
- pattern^.UseFileName := TI.ReadBool('General', 'UseFileName', false);
- // if nead read FileName section
- if pattern^.UseFileName then
- if TI.SectionExists('FileName') then
- begin
- if TI.ValueExists('FileName', 'Pattern') then
- pattern^.fName.Pattern := TI.ReadString('FileName', 'Pattern', '')
- else
- exit;
- pattern^.fName.InNick := TI.ReadInteger('FileName', 'InNick', 0);
- pattern^.fName.InUID := TI.ReadInteger('FileName', 'InUID', 0);
- if (pattern^.fName.InNick = 0) and (pattern^.fName.InUID = 0) then
- exit;
- pattern^.fName.OutNick := TI.ReadInteger('FileName', 'OutNick', 0);
- pattern^.fName.OutUID := TI.ReadInteger('FileName', 'OutUID', 0);
- end
- else
- exit;
- finally
- TI.Free;
- result := true;
- end;
- result := false;
-end;
-
-procedure ReadPatterns;
-var
- SR: TSearchRec;
- FileAttrs: integer;
- i: integer;
-begin
- FileAttrs := faAnyFile;
- i := 0;
- if FindFirst(AppPath + '\importtxt\*.ini', FileAttrs, SR) = 0 then
- begin
- repeat
- SetLength(TxtPatterns, i+1);
- if not ReadPattern(AppPath + '\importtxt\' + SR.Name) then
- inc(i);
- until FindNext(SR) <> 0;
- FindClose(SR);
- end;
- // cut unneded
- SetLength(TxtPatterns, i);
-end;
-
-function GetContactByUID(const proto: AnsiString; const id: AnsiString): THandle;
-var
- Contact: THandle;
- otherproto: AnsiString;
- idnum: integer;
- tempwstr: PWideChar;
- ws: WideString;
-begin
- if not TryStrToInt(id, idnum) then
- idnum := 0;
- tempwstr := UTF8ToWide(PAnsiChar(id), tempwstr);
- ws := tempwstr;
- FreeMem(tempwstr);
- Contact := db_find_first();
- while (Contact <> 0) do
- begin
- otherproto := Proto_GetProtoName(Contact);
- if otherproto = proto then
- begin
- tempwstr := Contact_GetInfo(CNF_UNIQUEID, Contact, PAnsiChar(otherproto));
- if (tempwstr <> nil) and (tempwstr = ws) then
- begin
- mir_free(tempwstr);
- break;
- end;
- mir_free(tempwstr);
- end; // if
- Contact := db_find_next(Contact);
- end; // while
- if Contact=0 then
- result := INVALID_HANDLE_VALUE
- else
- result := Contact;
-end;
-
-function GetContactByNick(const proto: AnsiString; const Nick: WideString): THandle;
-var
- Contact: THandle;
- otherproto: AnsiString;
- tmpwstr: PWideChar;
-begin
- result := INVALID_HANDLE_VALUE;
- Contact := db_find_first();
- while (Contact <> 0) do
- begin
- otherproto := Proto_GetProtoName(Contact);
- if otherproto = proto then
- begin
- tmpwstr := Contact_GetInfo(CNF_NICK, Contact, PAnsiChar(otherproto));
- if (tmpwstr <> nil) and (Nick = tmpwstr) then
- begin
- mir_free(tmpwstr);
- result := Contact;
- break;
- end; // if
- mir_free(tmpwstr);
- end; // if
- Contact := db_find_next(Contact);
- end; // while
-end;
-
-procedure EnumProtocols;
-var
- i, iProtoCount: integer;
- ppAccounts: ^PPROTOACCOUNT;
- temps: WideString;
-begin
- ProtoCount := 0;
- SetLength(Protocols, 30);
- Proto_EnumAccounts(iProtoCount, ppAccounts);
- for i := 1 to iProtoCount do
- begin
- temps := GetContactID(0, ppAccounts^^.szModuleName, false);
- if temps <> '' then
- begin
- Protocols[ProtoCount].ProtoName := ppAccounts^^.szModuleName;
- Protocols[ProtoCount].ProtoUID := temps;
- Protocols[ProtoCount].ProtoNick := GetContactNick(0, ppAccounts^^.szModuleName, false);
- inc(ProtoCount);
- end;
- inc(ppAccounts);
- end;
- SetLength(Protocols, ProtoCount);
-end;
-
-function GetContactProto(hContact: THandle): AnsiString;
-begin
- result := Proto_GetProtoName(hContact);
-end;
-
-function GetContactID(hContact: THandle; proto: AnsiString = '';
- Contact: boolean = false): WideString;
-var
- uid: PAnsiChar;
- dbv: TDBVARIANT;
- tempstr: PWideChar;
-begin
- result := '';
- if not((hContact = 0) and Contact) then
- begin
- if proto = '' then
- proto := GetContactProto(hContact);
- uid := Proto_GetUniqueId(PAnsiChar(proto));
- if uid <> nil then
- begin
- if db_get(hContact, PAnsiChar(proto), uid, @dbv) = 0 then
- begin
- case dbv._type of
- DBVT_BYTE:
- result := intToStr(dbv.bVal);
- DBVT_WORD:
- result := intToStr(dbv.wVal);
- DBVT_DWORD:
- result := intToStr(dbv.dVal);
- DBVT_ASCIIZ:
- begin
- tempstr := ANSIToWide(dbv.szVal.a, tempstr, cp);
- result := tempstr;
- FreeMem(tempstr);
- end;
- DBVT_UTF8:
- begin
- tempstr := UTF8ToWide(dbv.szVal.a, tempstr);
- result := tempstr;
- FreeMem(tempstr);
- end;
- DBVT_WCHAR:
- result := dbv.szVal.w;
- end;
- // free variant
- db_free(@dbv);
- end;
- end;
- end;
-end;
-
-function GetContactNick(hContact: THandle; proto: AnsiString = '';
- Contact: boolean = false): WideString;
-var
- dbv: TDBVARIANT;
- tempstr: PWideChar;
-begin
- result := '';
- if not((hContact = 0) and Contact) then
- begin
- if proto = '' then
- proto := GetContactProto(hContact);
- if db_get(hContact, PAnsiChar(proto), 'Nick', @dbv) = 0 then
- begin
- case dbv._type of
- DBVT_BYTE:
- result := intToStr(dbv.bVal);
- DBVT_WORD:
- result := intToStr(dbv.wVal);
- DBVT_DWORD:
- result := intToStr(dbv.dVal);
- DBVT_ASCIIZ:
- begin
- tempstr := ANSIToWide(dbv.szVal.a, tempstr, cp);
- result := tempstr;
- FreeMem(tempstr);
- end;
- DBVT_UTF8:
- begin
- tempstr := UTF8ToWide(dbv.szVal.a, tempstr);
- result := tempstr;
- FreeMem(tempstr);
- end;
- DBVT_WCHAR:
- result := dbv.szVal.w;
- end;
- // free variant
- db_free(@dbv);
- end;
- end;
-end;
-
-function DBReadByte(hContact: THandle; szModule: PAnsiChar;
- szSetting: PAnsiChar; default: byte = 0): byte;
-var
- dbv: TDBVARIANT;
-begin
- If db_get(hContact, szModule, szSetting, @dbv) <> 0 then
- result := default
- else
- result := dbv.bVal;
-end;
-
-function DBWriteByte(hContact: THandle; szModule: PAnsiChar; szSetting: PAnsiChar; val: byte): integer;
-begin
- result := db_set_b(hContact, szModule, szSetting, val);
-end;
-
-procedure SetLastPattern(lp: byte);
-begin
- DBWriteByte(0, IMPORT_TXT_MODULE, IMPORT_TXT_LP, lp);
-end;
-
-function GetLastPattern: byte;
-begin
- result := DBReadByte(0, IMPORT_TXT_MODULE, IMPORT_TXT_LP, 0);
- if result >= Length(TxtPatterns) then
- result := 0;
-end;
-
-function TimeStampToWStr(ts: DWORD): WideString;
-var
- s: WideString;
-begin
- SetLength(s, 20);
- TimeZone_ToStringW(ts, 'd s', PWideChar(s), 20);
- result := s;
-end;
-
-function StrToTimeStamp(STime: PAnsiChar; len: integer): DWORD;
-var
- hour, min, sec, Day, Month, Year: integer;
-begin
- sec := 0;
- Day := (ord(STime[0]) - $30) * 10 + (ord(STime[1]) - $30);
- Month := (ord(STime[3]) - $30) * 10 + (ord(STime[4]) - $30);
- Year := (ord(STime[6]) - $30) * 1000 + (ord(STime[7]) - $30) * 100 +
- (ord(STime[8]) - $30) * 10 + (ord(STime[9]) - $30);
- hour := (ord(STime[11]) - $30) * 10 + (ord(STime[12]) - $30);
- min := (ord(STime[14]) - $30) * 10 + (ord(STime[15]) - $30);
- if len > 15 then
- sec := (ord(STime[17]) - $30) * 10 + (ord(STime[18]) - $30);
- result := Timestamp(Year, Month, Day, hour, min, sec);
-end;
-
-function RLWord(adr: integer): word;
-begin
- result := PByte(adr + 1)^ + (PByte(adr)^ * $100);
-end;
-
-function RLInteger(adr: integer): integer;
-begin
- result := PByte(adr + 3)^ + (PByte(adr + 2)^ * $100) +
- (PByte(adr + 1)^ * $10000) + (PByte(adr)^ * $1000000);
-end;
-
-begin
- GetModuleFileName(hInstance, @AppPath[0], MAX_PATH);
- ExtractFilePath(@AppPath);
- ReadPatterns;
-end.
diff --git a/plugins/ImportTXT/ImpDlgRes.inc b/plugins/ImportTXT/ImpDlgRes.inc deleted file mode 100644 index b5ee3604ef..0000000000 --- a/plugins/ImportTXT/ImpDlgRes.inc +++ /dev/null @@ -1,13 +0,0 @@ -const
- IDD_IMPDIALOG = 101;
-
- IDSTART = 1001;
- IDC_FILENAME = 1002;
- IDC_BRWSBTN = 1003;
- IDC_TYPECOMBO = 1004;
- IDC_STATUSLIST = 1005;
- IDC_PROGRESS = 1006;
- IDC_CHKDUP = 1007;
- IDC_SHOWDUP = 1008;
-
- IDI_DEFAULT = 110;
diff --git a/plugins/ImportTXT/ImpTxtDlg.rc b/plugins/ImportTXT/ImpTxtDlg.rc deleted file mode 100644 index e1f3b19b74..0000000000 --- a/plugins/ImportTXT/ImpTxtDlg.rc +++ /dev/null @@ -1,18 +0,0 @@ -101 DIALOGEX 0, 0, 264, 220
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Import history to "
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-FONT 8, "MS Shell Dlg"
-BEGIN
- PUSHBUTTON "Start",1001,2,204,50,14
- PUSHBUTTON "Close",IDCLOSE,211,204,50,14
- LTEXT "Choose a file...",1002,3,3,240,11,SS_SUNKEN
- PUSHBUTTON "...",1003,244,3,17,11
- COMBOBOX 1004,3,16,258,80,CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
- LISTBOX 1005,3,42,258,150,LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL | WS_TABSTOP
- CONTROL "",1006,"msctls_progress32",0x1,3,194,258,8
- CHECKBOX "Check for duplicates", 1007, 3, 29, 105, 12, BS_AUTOCHECKBOX | WS_VISIBLE | WS_TABSTOP
- CHECKBOX "Show duplicates", 1008, 140, 29, 86, 12, BS_AUTOCHECKBOX | WS_VISIBLE | WS_TABSTOP
-END
-
-110 ICON "ico\def_ico.ico"
\ No newline at end of file diff --git a/plugins/ImportTXT/ImpTxtDlg.res b/plugins/ImportTXT/ImpTxtDlg.res Binary files differdeleted file mode 100644 index 75fd95ae0c..0000000000 --- a/plugins/ImportTXT/ImpTxtDlg.res +++ /dev/null diff --git a/plugins/ImportTXT/ImpTxtWiz.rc b/plugins/ImportTXT/ImpTxtWiz.rc deleted file mode 100644 index 617c23af55..0000000000 --- a/plugins/ImportTXT/ImpTxtWiz.rc +++ /dev/null @@ -1,64 +0,0 @@ -
-102 DIALOGEX 0, 0, 220, 143
-STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CAPTION | WS_SYSMENU
-CAPTION "Import Text Files Wizard"
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-FONT 8, "MS Shell Dlg"
-BEGIN
- DEFPUSHBUTTON "&Next >",IDOK,120,124,45,13
- PUSHBUTTON "Cancel",IDCANCEL,168,124,45,13
- PUSHBUTTON "< &Back",3,75,124,45,13
- CONTROL "",1011,"Static",SS_ETCHEDHORZ,5,116,210,1
-END
-
-103 DIALOGEX 0, 0, 220, 114
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "This wizard will help you import message history from some other clients and Miranda plugins, stored in text files.",1010,18,12,182,32
- LTEXT "Click ""Next"" to choose the information you wish to import, or click ""Cancel"" to exit the wizard and continue using Miranda.",1009,18,42,182,25
- CTEXT "It is recommended that you create a backup of your current Miranda profile before importing.",1008,18,78,182,21
-END
-
-104 DIALOGEX 0, 0, 220, 114
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "Choose type of imported files:",1010,6,76,208,8
- COMBOBOX 1007,5,90,208,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
-END
-
-105 DIALOGEX 0, 0, 220, 114
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "Select files or the whole directory for import:",1010,6,86,208,8
- LISTBOX 1002,5,12,208,55,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Files...",1001,157,96,56,14
- LTEXT "Path:",1009,6,73,24,8
- EDITTEXT 1003,31,71,182,12,ES_AUTOHSCROLL | WS_DISABLED
- LTEXT "Files:",1008,6,3,208,8
- PUSHBUTTON "Directory...",1005,101,96,56,14
-END
-
-106 DIALOGEX 0, 0, 220, 114
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- CHECKBOX "Check messages for duplicates", 1012, 6, 20, 140, 14, BS_AUTOCHECKBOX | WS_VISIBLE | WS_TABSTOP
- CHECKBOX "Show duplicates", 1013, 6, 32, 86, 14, BS_AUTOCHECKBOX | WS_VISIBLE | WS_TABSTOP
- LTEXT "All previous chosen files will try to import to this protocol.", 1010, 6, 46, 208, 10
- COMBOBOX 1007,5,66,208,30,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
- LTEXT "Select protocol or account:",1009,6,55,208,8
- CTEXT "Click ""Next"" to start Import or ""Cancel"" to Abort.",1008,6,96,208,8
-END
-
-107 DIALOGEX 0, 0, 220, 114
-STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
-FONT 8, "MS Shell Dlg"
-BEGIN
- LTEXT "Now importing...",1010,6,11,208,8
- CONTROL "Progress1",1004,"msctls_progress32",WS_BORDER | 0x1,5,24,208,10
- LISTBOX 1006,5,38,208,61,NOT LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL | WS_TABSTOP
-END
-
diff --git a/plugins/ImportTXT/ImpTxtWiz.res b/plugins/ImportTXT/ImpTxtWiz.res Binary files differdeleted file mode 100644 index 2164f8ebd1..0000000000 --- a/plugins/ImportTXT/ImpTxtWiz.res +++ /dev/null diff --git a/plugins/ImportTXT/ImpWizRes.inc b/plugins/ImportTXT/ImpWizRes.inc deleted file mode 100644 index 3770583df9..0000000000 --- a/plugins/ImportTXT/ImpWizRes.inc +++ /dev/null @@ -1,23 +0,0 @@ -const
- IDC_BACK = 3;
-
- IDD_IMPWIZARD = 102;
- IDD_IMPWIZARDINTRO = 103;
- IDD_IMPTYPE = 104;
- IDD_IMPFILES = 105;
- IDD_IMPDEST = 106;
- IDD_PROGRESS = 107;
-
- IDC_FILE = 1001;
- IDC_LIST = 1002;
- IDC_PATH = 1003;
- IDC_PROGRESS = 1004;
- IDC_DIR = 1005;
- IDC_STATUS = 1006;
- IDC_COMBO1 = 1007;
- IDC_STATIC3 = 1008;
- IDC_STATIC2 = 1009;
- IDC_STATIC1 = 1010;
- IDC_STATIC = 1011;
- IDC_CHKDUPW = 1012;
- IDC_SHOWDUPW = 1013;
diff --git a/plugins/ImportTXT/ImportT.pas b/plugins/ImportTXT/ImportT.pas deleted file mode 100644 index 7a9b9cc935..0000000000 --- a/plugins/ImportTXT/ImportT.pas +++ /dev/null @@ -1,87 +0,0 @@ -unit ImportT;
-interface
-
-uses windows;
-
-type
-
- RHeader = record
- Pattern:String;
- Incoming:integer;
- Outgoing:integer;
- InNick:integer;
- OutNick:integer;
- InUID:integer;
- OutUID:integer;
- end;
-
- RPreMessage = record
- PreRN:integer;
- AfterRN:integer;
- PreSP:integer;
- AfterSP:integer;
- end;
-
- RMessage = record
- Pattern:String;
- Incoming:String;
- Outgoing:String;
- Direction:integer;
- Day:integer;
- Month:integer;
- Year:integer;
- Hours:integer;
- Minutes:integer;
- Seconds:integer;
- end;
-
- RFileName = record
- Pattern:String;
- InNick:integer;
- OutNick:integer;
- InUID:integer;
- OutUID:integer;
- end;
-
- pRTxtPattern = ^RTxtPattern;
- RTxtPattern = record
- Name:String;
- IType:byte; //1 -text,2- binary, 3 - ...
- Charset:word;
- Codepage:Cardinal;
- DefExtension:String;
- BinProc:word;
- UseHeader:Byte;
- UseFileName:ByteBool;
- UsePreMsg:ByteBool;
- Msg:RMessage;
- Header:RHeader;
- PreMsg:RPreMessage;
- FName:RFileName;
- end;
-
-const
- inANSI = 1;
- inUTF8 = 2;
- inUCS2 = 3;
-
-type
- PDestProto = ^TDestProto;
- TDestProto = record
- ProtoName: AnsiString;
- ProtoUID: WideString;
- ProtoNick: WideString;
- end;
-
-type
- PDestContact = ^TDestContact;
- TDestContact = record
- hContact: THandle;
- ProtoName: AnsiString;
- ContactUID: AnsiString;
- ContactNick: WideString;
- end;
-
-implementation
-
-end.
diff --git a/plugins/ImportTXT/ImportTU.pas b/plugins/ImportTXT/ImportTU.pas deleted file mode 100644 index 2fac66ad55..0000000000 --- a/plugins/ImportTXT/ImportTU.pas +++ /dev/null @@ -1,268 +0,0 @@ -Unit ImportTU;
-
-interface
-
-Uses windows, // StrUtils,
- m_api;
-
-type
- PDayTable = ^TDayTable;
- TDayTable = array [1 .. 12] of Word;
-
-const
- MonthDays: array [Boolean] of TDayTable = (
- (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
- (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
-
-function Timestamp(Year, Month, Day, Hour, Min, Sec: Word; toGMT: Boolean = true): LongWord;
-{ function TimestampICQ(Year,Month,Day,Hour,Min,Sec:Word):LongWord; }
-function DateTimeToTimeStamp(const DateTime: TDateTime; toGMT: Boolean = true): DWord;
-
-{ ***** Authtor of this procedures Alexey Kulakov aka Awkward***** }
-function ChangeUnicode(str: PWideChar): PWideChar;
-function UTF8Len(src: PAnsiChar): integer;
-function WideToANSI(src: PWideChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-function ANSIToWide(src: PAnsiChar; var dst: PWideChar; cp: DWord = CP_ACP): PWideChar;
-function ANSIToUTF8(src: PAnsiChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-function UTF8toANSI(src: PAnsiChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-function UTF8toWide(src: PAnsiChar; var dst: PWideChar; len: cardinal = DWord(-1)): PWideChar;
-function WidetoUTF8(src: PWideChar; var dst: PAnsiChar): PAnsiChar;
-{ ***** }
-
-implementation
-
-uses SysUtils;
-
-function IsLeapYear(Year: Word): Boolean;
-begin
- Result := (Year mod 4 = 0) and ((Year mod 100 <> 0) or (Year mod 400 = 0));
-end;
-
-function Timestamp(Year, Month, Day, Hour, Min, Sec: Word; toGMT: Boolean = true): LongWord;
-var
- i: integer;
- DayTable: PDayTable;
- DT, D: LongWord;
-begin
- // fix for 2 digit year
- if Year > 0 then
- if Year < 90 then
- inc(Year, 2000)
- else if Year < 100 then
- inc(Year, 1900);
- //
- DayTable := @MonthDays[IsLeapYear(Year)];
- for i := 1 to Month - 1 do
- inc(Day, DayTable^[i]);
- i := Year - 1;
- D := i * 365 + i div 4 - i div 100 + i div 400 + Day -
- (1969 * 365 + 492 - 19 + 4 + 1);
- DT := (D * 24 * 60 * 60) + (Hour * 3600 + Min * 60 + Sec);
- // GMT... GMT
- if toGMT then
- Result := DT - (Longword(TimeZone_ToLocal(DT)) - DT)
- else
- Result := DT;
-end;
-
-function DateTimeToTimeStamp(const DateTime: TDateTime; toGMT: Boolean = true): DWord;
-begin
- Result := Round((DateTime - UnixDateDelta) * SecsPerDay);
- if toGMT then
- Result := Result - (Dword(TimeZone_ToLocal(Result)) - Result);
-end;
-
-function ChangeUnicode(str: PWideChar): PWideChar;
-var
- i, len: integer;
-begin
- Result := str;
- if str = nil then
- exit;
- if (Word(str^) = $FFFE) or (Word(str^) = $FEFF) then
- begin
- len := lstrlenw(str);
- if Word(str^) = $FFFE then
- begin
- i := len - 1;
- while i > 0 do // str^<>#0
- begin
- pword(str)^ := swap(pword(str)^);
- inc(str);
- dec(i);
- end;
- // str:=result;
- end;
- move((Result + 1)^, Result^, len * SizeOf(WideChar));
- end;
-end;
-
-function WideToANSI(src: PWideChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-var
- len, l: integer;
-begin
- if (src = nil) or (src^ = #0) then
- begin
- GetMem(dst, 1);
- dst^ := #0;
- end
- else
- begin
- l := lstrlenw(src);
- len := WideCharToMultiByte(cp, 0, src, l, NIL, 0, NIL, NIL) + 1;
- GetMem(dst, len);
- FillChar(dst^, len, 0);
- WideCharToMultiByte(cp, 0, src, l, dst, len, NIL, NIL);
- end;
- Result := dst;
-end;
-
-function ANSIToWide(src: PAnsiChar; var dst: PWideChar; cp: DWord = CP_ACP): PWideChar;
-var
- len, l: integer;
-begin
- if (src = nil) or (src^ = #0) then
- begin
- GetMem(dst, SizeOf(WideChar));
- dst^ := #0;
- end
- else
- begin
- l := lstrlena(src);
- len := MultiByteToWideChar(cp, 0, src, l, NIL, 0) + 1;
- GetMem(dst, len * SizeOf(WideChar));
- FillChar(dst^, len * SizeOf(WideChar), 0);
- MultiByteToWideChar(cp, 0, src, l, dst, len);
- end;
- Result := dst;
-end;
-
-function ANSIToUTF8(src: PAnsiChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-var
- tmp: PWideChar;
-begin
- ANSIToWide(src, tmp, cp);
- Result := WidetoUTF8(tmp, dst);
- FreeMem(tmp);
-end;
-
-function UTF8Len(src: PAnsiChar): integer; // w/o zero
-begin
- Result := 0;
- if src <> nil then
- begin
- while src^ <> #0 do
- begin
- if (ord(src^) and $80) = 0 then
- else if (ord(src^) and $E0) = $E0 then
- inc(src, 2)
- else
- inc(src);
- inc(Result);
- inc(src);
- end;
- end;
-end;
-
-function CalcUTF8Len(src: PWideChar): integer;
-begin
- Result := 0;
- if src <> nil then
- begin
- while src^ <> #0 do
- begin
- if src^ < #$0080 then
- else if src^ < #$0800 then
- inc(Result)
- else
- inc(Result, 2);
- inc(src);
- inc(Result);
- end;
- end;
-end;
-
-function UTF8toWide(src: PAnsiChar; var dst: PWideChar; len: cardinal = DWord(-1)): PWideChar;
-var
- w: Word;
- p: PWideChar;
-begin
- GetMem(dst, (UTF8Len(src) + 1) * SizeOf(WideChar));
- p := dst;
- if src <> nil then
- begin
- while (src^ <> #0) and (len > 0) do
- begin
- if ord(src^) < $80 then
- w := ord(src^)
- else if (ord(src^) and $E0) = $E0 then
- begin
- w := (ord(src^) and $1F) shl 12;
- inc(src);
- dec(len);
- w := w or (((ord(src^)) and $3F) shl 6);
- inc(src);
- dec(len);
- w := w or (ord(src^) and $3F);
- end
- else
- begin
- w := (ord(src^) and $3F) shl 6;
- inc(src);
- dec(len);
- w := w or (ord(src^) and $3F);
- end;
- p^ := WideChar(w);
- inc(p);
- inc(src);
- dec(len);
- end;
- end;
- p^ := #0;
- Result := dst;
-end;
-
-function UTF8toANSI(src: PAnsiChar; var dst: PAnsiChar; cp: DWord = CP_ACP): PAnsiChar;
-var
- tmp: PWideChar;
-begin
- UTF8toWide(src, tmp);
- Result := WideToANSI(tmp, dst, cp);
- FreeMem(tmp);
-end;
-
-function WidetoUTF8(src: PWideChar; var dst: PAnsiChar): PAnsiChar;
-var
- p: PAnsiChar;
-begin
- GetMem(dst, CalcUTF8Len(src) + 1);
- p := dst;
- if src <> nil then
- begin
- while src^ <> #0 do
- begin
- if src^ < #$0080 then
- p^ := AnsiChar(src^)
- else if src^ < #$0800 then
- begin
- p^ := AnsiChar($C0 or (ord(src^) shr 6));
- inc(p);
- p^ := AnsiChar($80 or (ord(src^) and $3F));
- end
- else
- begin
- p^ := AnsiChar($E0 or (ord(src^) shr 12));
- inc(p);
- p^ := AnsiChar($80 or ((ord(src^) shr 6) and $3F));
- inc(p);
- p^ := AnsiChar($80 or (ord(src^) and $3F));
- end;
- inc(p);
- inc(src);
- end;
- end;
- p^ := #0;
- Result := dst;
-end;
-
-end.
diff --git a/plugins/ImportTXT/ImportThrd.pas b/plugins/ImportTXT/ImportThrd.pas deleted file mode 100644 index 4315977a0a..0000000000 --- a/plugins/ImportTXT/ImportThrd.pas +++ /dev/null @@ -1,643 +0,0 @@ -unit ImportThrd;
-
-interface
-
-uses
- Classes,
- Windows,
- SysUtils,
- StrUtils,
- PerlRegEx,
- m_api,
- general,
- ImportT,
- ImportTU,
- KOLEdb {ADODB if want to use ADO};
-
-const
- ITXT_THREAD_BASE = $8000 + $2000; // WM_APP + $2000
- ITXT_THREAD_START = ITXT_THREAD_BASE + 1; // (0,0)
- ITXT_THREAD_MAXPROGRESS = ITXT_THREAD_BASE + 2;
- // (0, MaxProgress)
- ITXT_THREAD_PROGRESS = ITXT_THREAD_BASE + 3; // (Current, 0)
- ITXT_THREAD_ERROR = ITXT_THREAD_BASE + 4;
- // (PWideChar(ErrorString),0)
- ITXT_THREAD_FINISH = ITXT_THREAD_BASE + 5;
- // , (Added, Duplicates)
- ITXT_THREAD_START_FILE = ITXT_THREAD_BASE + 6;
- // (PWideChar(FileName),0);
- ITXT_THREAD_DEST_CONTACT = ITXT_THREAD_BASE + 7;
- // (hContact,0)
- ITXT_THREAD_ALLSTARTED = ITXT_THREAD_BASE + 8; //
- ITXT_THREAD_ALLFINISHED = ITXT_THREAD_BASE + 9; // :)
-
-type
- TSendMethod = (smSend, smPost);
-
-type
- TImportThrd = class(TThread)
- private
- { Private declarations }
- RegExpr: TPerlRegEx;
- hMapedFile: THandle;
- hFile: THandle;
- pFileText: Pointer;
- FolderName: WideString;
- FileName: WideString;
- FileLen: Cardinal;
- fContact: TDestContact; // Contact recognised by filename
- AddedMessages: integer;
- Duplicates: integer;
- function DoMessage(Message: Longword; wParam: WPARAM; lParam: LPARAM;
- Method: TSendMethod = smSend): Boolean;
- function DoMapFile: Boolean;
- procedure DoUnMapFile;
- Procedure PreMessageSP(var src: AnsiString; CSP: integer);
- procedure AddMsgToDB(hContact: THandle; Direction: integer;
- MsgTimeStamp: Longword; const Text: AnsiString; var AddMsg, Dupy: integer);
- procedure TextImportProcedure;
- procedure BinImportProcedure;
- protected
- procedure Execute; override;
- public
- FileNames: WideString; // File Names
- OffsetFileName: integer; // offset name of file in FileNames
- WorkPattern: RTxtPattern; // Pattern for work
- DContact: TDestContact; // Recognised or defined contact
- Destination: TDestProto; // destination protocol
- ParentHWND: Longword; // HWND of parent window
- end;
-
-function IsDuplicateEvent(hContact: THandle; dbei: TDBEVENTINFO): Boolean;
-
-function PassMessage(Handle: THandle; Message: Longword; wParam: wParam;
- lParam: lParam; Method: TSendMethod = smSend): Boolean;
-
-implementation
-
-// Returns TRUE if event already is in base
-function IsDuplicateEvent(hContact: THandle; dbei: TDBEVENTINFO): Boolean;
-var
- hExistingDbEvent: THandle;
- dbeiExisting: TDBEVENTINFO;
- dwFirstEventTimeStamp: Longword;
- dwLastEventTimeStamp: Longword;
- dwPreviousTimeStamp: Longword;
-begin
- result := FALSE;
- if not CheckForDuplicates then
- exit;
- hExistingDbEvent := db_event_first(hContact);
- if hExistingDbEvent = 0 then
- begin
- result := FALSE;
- exit;
- end;
-
- FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbBlob := 0;
- db_event_get(hExistingDbEvent, @dbeiExisting);
- dwFirstEventTimeStamp := dbeiExisting.timestamp;
-
- hExistingDbEvent := db_event_last(hContact);
- if hExistingDbEvent = 0 then
- begin
- result := FALSE;
- exit;
- end;
-
- FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbBlob := 0;
- db_event_get(hExistingDbEvent, @dbeiExisting);
- dwLastEventTimeStamp := dbeiExisting.timestamp;
-
- // If before the first
- if (dbei.timestamp < dwFirstEventTimeStamp) then
- begin
- result := FALSE;
- exit;
- end;
-
- // If after the last
- if (dbei.timestamp > dwLastEventTimeStamp) then
- begin
- result := FALSE;
- exit;
- end;
-
- dwPreviousTimeStamp := dwLastEventTimeStamp;
-
- if (dbei.timestamp <= dwPreviousTimeStamp) then // search from the end
- begin
- while (hExistingDbEvent <> 0) do
- begin
- FillChar(dbeiExisting, SizeOf(dbeiExisting), Byte(0));
- dbeiExisting.cbBlob := 0;
- db_event_get(hExistingDbEvent, @dbeiExisting);
- // compare event
- if (dbei.timestamp = dbeiExisting.timestamp) and
- ((dbei.flags) = (dbeiExisting.flags)) and
- // fix for first event
- (dbei.eventType = dbeiExisting.eventType) and
- (dbei.cbBlob = dbeiExisting.cbBlob) then
- begin
- result := true;
- exit;
- end;
-
- if (dbei.timestamp > dbeiExisting.timestamp) then
- begin
- result := FALSE;
- exit;
- end;
- // get the previous
- hExistingDbEvent := db_event_prev(hContact,hExistingDbEvent);
- end;
- end;
-end;
-
-Procedure TImportThrd.PreMessageSP(var src: AnsiString; CSP: integer);
-var
- i: integer;
- ls: integer;
- PSP, ASP: integer;
-begin
- ls := -1;
- repeat
- i := ls + 2;
- PSP := 0;
- while (src[i + PSP] = ' ') do
- inc(PSP);
- if PSP > 0 then
- case WorkPattern.PreMsg.PreSP of
- 0: PSP := 0;
- -1: ;
- -2: if PSP > CSP then
- PSP := CSP;
- else
- if PSP > WorkPattern.PreMsg.PreSP then
- PSP := WorkPattern.PreMsg.PreSP;
- end; // case
- Delete(src, i, PSP);
- ls := PosEx(#$0D#$0A, src, i);
- ASP := 0;
- while (ls > 1) and (src[ls - ASP - 1] = ' ') do
- inc(ASP);
- if ASP > 0 then
- case WorkPattern.PreMsg.AfterSP of
- 0: ASP := 0;
- -1: ;
- -2: if ASP > CSP then
- ASP := CSP;
- else
- if ASP > WorkPattern.PreMsg.AfterSP then
- ASP := WorkPattern.PreMsg.AfterSP;
- end; // case
- Delete(src, ls - ASP - 1, ASP);
- Until ls <= 0
-end;
-
-Procedure TImportThrd.AddMsgToDB(hContact: THandle; Direction: integer;
- MsgTimeStamp: Longword; const Text: AnsiString; var AddMsg, Dupy: integer);
-var
- dbei: TDBEVENTINFO;
- proto: AnsiString;
- s: WideString;
-begin
- FillChar(dbei, SizeOf(dbei), Byte(0));
- dbei.eventType := EVENTTYPE_MESSAGE;
- dbei.flags := Direction;
- proto := GetContactProto(hContact);
- dbei.szModule := PAnsiChar(proto);
- dbei.timestamp := MsgTimeStamp;
- dbei.cbBlob := Length(Text) + 1;
- dbei.pBlob := PByte(AllocMem(dbei.cbBlob));
- try
- Move(Text[1], dbei.pBlob^, dbei.cbBlob);
- if not IsDuplicateEvent(hContact, dbei) then
- if db_event_add(hContact, @dbei) <> 0 then
- inc(AddMsg)
- else
- begin
- s := 'Error adding message to database';
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else
- begin
- if ShowDuplicates then
- begin
- if (dbei.flags and DBEF_SENT) > 0 then
- s := '>'
- else
- s := '<';
- s := TranslateWideString('Duplicate:') + ' ' + s + ' ' +
- TimeStampToWStr(dbei.timestamp);
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0, smSend);
- end;
- inc(Dupy);
- end;
- finally
- FreeMem(dbei.pBlob);
- end;
-end;
-
-function PassMessage(Handle: THandle; Message: Longword; wParam: wParam;
- lParam: lParam; Method: TSendMethod = smSend): Boolean;
-var
- Tries: integer;
-begin
- result := true;
- case Method of
- smSend:
- SendMessage(Handle, Message, wParam, lParam);
- smPost: begin
- Tries := 5;
- while (Tries > 0) and not PostMessage(Handle, Message, wParam,
- lParam) do
- begin
- Dec(Tries);
- Sleep(5);
- end;
- result := (Tries > 0);
- end;
- end;
-end;
-
-function TImportThrd.DoMessage(Message: Longword; wParam: wParam;
- lParam: lParam; Method: TSendMethod = smSend): Boolean;
-begin
- result := PassMessage(ParentHWND, Message, wParam, lParam, Method);
-end;
-
-function TImportThrd.DoMapFile: Boolean;
-var
- s: pWideChar;
-begin
- result := true;
- hFile := CreateFileW(PWideChar(FileName), GENERIC_READ, 0, nil,
- OPEN_EXISTING, 0, 0);
- if hFile = INVALID_HANDLE_VALUE then
- begin
- result := FALSE;
- s := 'Error opening file';
- DoMessage(ITXT_THREAD_ERROR, wparam(s), 0);
- exit;
- end;
- FileLen := GetFileSize(hFile, nil);
- hMapedFile := CreateFileMapping(hFile, nil, PAGE_READONLY, 0, 0, 'ImportTXTmapfile');
- if hMapedFile = 0 then
- begin
- result := FALSE;
- s := 'Error mapping file';
- DoMessage(ITXT_THREAD_ERROR, wparam(s), 0);
- exit;
- end;
- pFileText := MapViewOfFile(hMapedFile, FILE_MAP_READ, 0, 0, 0);
- if pFileText = nil then
- begin
- result := FALSE;
- s := 'Error mapping';
- DoMessage(ITXT_THREAD_ERROR, wparam(s), 0);
- exit;
- end;
-end;
-
-procedure TImportThrd.DoUnMapFile;
-begin
- UnmapViewOfFile(pFileText);
- pFileText := nil;
- CloseHandle(hMapedFile);
- CloseHandle(hFile);
-end;
-
-procedure TryDetermContact(var DContact: TDestContact);
-begin
- if DContact.ProtoName <> '' then
- begin
- if DContact.ContactUID <> '' then
- begin
- DContact.hContact := GetContactByUID(DContact.ProtoName, DContact.ContactUID)
- end
- else if DContact.ContactNick <> '' then
- begin
- DContact.hContact := GetContactByNick(DContact.ProtoName, DContact.ContactNick);
- end
- else
- DContact.hContact := INVALID_HANDLE_VALUE;
- end
- else
- DContact.hContact := INVALID_HANDLE_VALUE;
-end;
-
-procedure TImportThrd.TextImportProcedure;
-var
- PosCur, LenCur, PosNext: integer;
- TextLength, h1, h2: integer;
- PRN, ARN, j: DWORD;
- msg_flag: integer;
- DT: Longword;
- TxtMsg: AnsiString;
- s: WideString;
- tempstr: PAnsiChar;
- tempwstr: PWideChar;
-begin
- AddedMessages := 0;
- Duplicates := 0;
- Case WorkPattern.Charset of
- inANSI:
- begin
- if WorkPattern.Codepage <> 0 then
- tempstr := ANSIToUTF8(PAnsiChar(pFileText), tempstr, WorkPattern.Codepage)
- else
- tempstr := ANSIToUTF8(PAnsiChar(pFileText), tempstr, cp);
- RegExpr.Subject := tempstr;
- FreeMem(tempstr);
- end;
- inUTF8:
- RegExpr.Subject := PAnsiChar(pFileText) + 3;
- inUCS2:
- begin
- GetMem(tempwstr, FileLen + 2);
- lstrcpynW(tempwstr, PWideChar(pFileText), FileLen);
- tempwstr[FileLen div SizeOf(WideChar)] := #$0000;
- // file is not ended dy #0000
- tempstr := WidetoUTF8(ChangeUnicode(tempwstr), tempstr);
- RegExpr.Subject := tempstr;
- FreeMem(tempstr);
- FreeMem(tempwstr);
- end;
- end; // case
- if (WorkPattern.UseHeader and 1) = 0 then
- // If the information on a direction is not present that we will transform a line
- begin
- tempstr := ANSIToUTF8(PAnsiChar(WorkPattern.Msg.Incoming), tempstr, cp);
- WorkPattern.Msg.Incoming := tempstr;
- FreeMem(tempstr);
- tempstr := ANSIToUTF8(PAnsiChar(WorkPattern.Msg.Outgoing), tempstr, cp);
- WorkPattern.Msg.Outgoing := tempstr;
- FreeMem(tempstr);
- end;
- if (WorkPattern.UseHeader > 0) then
- begin
- tempstr := ANSIToUTF8(PAnsiChar(WorkPattern.Header.Pattern), tempstr, cp);
- RegExpr.RegEx := tempstr;
- RegExpr.Options := [preMultiLine, preUTF8];
- FreeMem(tempstr);
- if not RegExpr.Match then
- begin
- s := TranslateWideString('Header not found');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- exit;
- end
- else
- begin
- if (WorkPattern.UseHeader and 1) = 1 then
- begin
- WorkPattern.Msg.Incoming := RegExpr.SubExpressions[WorkPattern.Header.Incoming];
- WorkPattern.Msg.Outgoing := RegExpr.SubExpressions[WorkPattern.Header.Outgoing];
- end;
- if (WorkPattern.UseHeader and 2) = 2 then
- if (DContact.hContact = 0) or
- (DContact.hContact = INVALID_HANDLE_VALUE) then
- begin
- if WorkPattern.Header.InUID <> 0 then
- DContact.ContactUID := RegExpr.SubExpressions[WorkPattern.Header.InUID]
- else
- DContact.ContactUID := '';
- if WorkPattern.Header.InNick <> 0 then
- DContact.ContactNick := RegExpr.SubExpressions[WorkPattern.Header.InNick]
- else
- DContact.ContactNick := '';
- TryDetermContact(DContact);
- end;
- end;
- end;
- // Whether if it has not turned out to define in header then we look it was defined in a file
- 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
- DoMessage(ITXT_THREAD_DEST_CONTACT, DContact.hContact, 0);
- DoMessage(ITXT_THREAD_START, 0, 0);
- tempstr := ANSIToUTF8(PAnsiChar(WorkPattern.Msg.Pattern), tempstr, cp);
- RegExpr.RegEx := tempstr;
- RegExpr.Options := [preMultiLine, preUTF8];
- FreeMem(tempstr);
-
- TextLength := Length(RegExpr.Subject) - 1; // Position of last symbol
- DoMessage(ITXT_THREAD_MAXPROGRESS, 0, TextLength);
- RegExpr.State := [preNotEmpty];
- // search for regular expression
- if not RegExpr.Match then
- begin
- s := TranslateWideString('No messages in this file');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end
- else
- begin
- PosCur := RegExpr.MatchedExpressionOffset;
- // get the position of RegExpression
- repeat
- LenCur := RegExpr.MatchedExpressionLength;
- // get the length of RegExpression
- // Further we define a message direction (incoming or outgoing)
- if RegExpr.SubExpressions[WorkPattern.Msg.Direction] = WorkPattern.Msg.Incoming then
- msg_flag := DBEF_READ
- else
- msg_flag := DBEF_READ or DBEF_SENT;
- msg_flag := msg_flag or DBEF_UTF;
- // make timestamp
- if WorkPattern.Msg.Seconds <> 0 then
- DT := timestamp
- (StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Year]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Month]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Day]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Hours]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Minutes]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Seconds]))
- else
- DT := timestamp
- (StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Year]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Month]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Day]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Hours]),
- StrToInt(RegExpr.SubExpressions[WorkPattern.Msg.Minutes]), 0);
-
- if RegExpr.MatchAgain then
- PosNext := RegExpr.MatchedExpressionOffset
- // search for next regexpr
- else
- PosNext := TextLength; // if not then end of file
- h1 := PosCur + LenCur; // The message text beginning presumably
- h2 := PosNext - PosCur - LenCur - 2; // its presumably message length
- // working with message text
- if WorkPattern.UsePreMsg then
- PRN := DWORD(WorkPattern.PreMsg.PreRN)
- else
- PRN := DWORD(-1);
- if PRN <> 0 then
- begin
- j := 1;
- while ((RegExpr.Subject[h1] = Char($0D)) and
- (RegExpr.Subject[h1 + 1] = Char($0A))) and (j <= PRN) do
- begin
- inc(h1, 2);
- Dec(h2, 2);
- inc(j);
- end; // remove carriage return in the beginning
- end;
- if WorkPattern.UsePreMsg then
- ARN := DWORD(WorkPattern.PreMsg.AfterRN)
- else
- ARN := DWORD(-1);
- if ARN <> 0 then
- begin
- j := 1;
- while ((RegExpr.Subject[h1 + h2] = Char($0D)) and
- (RegExpr.Subject[h1 + h2 + 1] = Char($0A))) and (j <= ARN) do
- begin
- Dec(h2, 2);
- inc(j)
- end; // remove carriage return in the end
- end;
- // get the message text
- TxtMsg := Copy(RegExpr.Subject, h1, h2 + 2);
- // remove spaces if needs
- if WorkPattern.UsePreMsg and
- ((WorkPattern.PreMsg.PreSP <> 0) or
- (WorkPattern.PreMsg.AfterSP <> 0)) then
- PreMessageSP(TxtMsg, UTF8Len(PAnsiChar(RegExpr.MatchedExpression)));
- AddMsgToDB(DContact.hContact, msg_flag, DT, TxtMsg, AddedMessages,
- Duplicates); // adding in base
- PosCur := PosNext;
- DoMessage(ITXT_THREAD_PROGRESS, PosCur, 0);
- until (PosNext = TextLength) or Terminated;
- end; // RegExpr.Exec
- end
- else
- begin
- s := TranslateWideString('Can''t determine destination contact');
- DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
- end;
-end;
-
-procedure TImportThrd.BinImportProcedure;
-var
- i: integer;
- s: WideString;
- tempstr: PAnsiChar;
-var
- dbei: TDBEVENTINFO;
- evSize: integer;
- proto: AnsiString;
- pt: int_ptr;
- fsz: cardinal;
-{$DEFINE BIN_IMPORT_}
-{$I BmContactIP.inc}
-{$I BqhfIP.inc}
-{$I BICQ6IP.inc}
-{$I BICQ5IP.inc}
-{$I BRMSIP.inc}
-{$I BbayanIP.inc}
-{$UNDEF BIN_IMPORT_}
-begin
- AddedMessages := 0;
- Duplicates := 0;
- case WorkPattern.BinProc of
- 1: // mContactImport
- {$I BmContactIP.inc}
- 2: // QHF
- {$I BqhfIP.inc}
- 3: // ICQ6
- {$I BICQ6IP.inc}
- 4: // ICQ5
- {$I BICQ5IP.inc}
- 5: // Nokia midp-rms
- {$I BRMSIP.inc}
- 6: // BayanICQ
- {$I BbayanIP.inc}
- end;
-end;
-
-procedure TImportThrd.Execute;
-var
- i: integer;
- s1: WideString;
- tempstr: PAnsiChar;
-begin
- DoMessage(ITXT_THREAD_ALLSTARTED, 0, 0);
- FolderName := Copy(FileNames, 1, OffsetFileName - 1);
- i := OffsetFileName;
- while (FileNames[i + 1] <> #0) and not Terminated do
- begin //
- s1 := '';
- inc(i);
- while FileNames[i] <> #0 do
- begin
- s1 := s1 + FileNames[i];
- inc(i);
- end;
- if (s1 <> '') and (s1 <> #0) then
- begin //
- FileName := FolderName + '\' + s1;
- DoMessage(ITXT_THREAD_START_FILE, wparam(PWideChar(FileName)),0, smSend);
- pFileText := nil;
- hFile := INVALID_HANDLE_VALUE;
- DContact.ProtoName := Destination.ProtoName;
- fContact.hContact := INVALID_HANDLE_VALUE;
- RegExpr := TPerlRegEx.Create;
- // .
- try
- //
- if WorkPattern.UseFileName then
- if (DContact.hContact = 0) or
- (DContact.hContact = INVALID_HANDLE_VALUE) then
- begin
- tempstr := WidetoUTF8(PWideChar(FileName), tempstr);
- RegExpr.Subject := tempstr;
- FreeMem(tempstr);
- tempstr := ANSIToUTF8(PAnsiChar(WorkPattern.FName.Pattern),tempstr, cp);
- RegExpr.RegEx := tempstr;
- FreeMem(tempstr);
- RegExpr.Options := [preUTF8];
-
- if RegExpr.Match then
- begin
- fContact.ProtoName := Destination.ProtoName;
- if WorkPattern.FName.InUID <> 0 then
- fContact.ContactUID := RegExpr.SubExpressions[WorkPattern.FName.InUID]
- else
- fContact.ContactUID := '';
- if WorkPattern.FName.InNick <> 0 then
- fContact.ContactNick := RegExpr.SubExpressions[WorkPattern.FName.InNick]
- else
- fContact.ContactNick := '';
- TryDetermContact(fContact);
- end;
- end;
-
- //
- // [preMultiLine]
- if DoMapFile then //
- begin
- db_set_safety_mode(0);
- case WorkPattern.IType of
- 1: TextImportProcedure;
- 2: BinImportProcedure;
- end; // case
- end; // DoMapFile
- finally
- db_set_safety_mode(1);
- DoMessage(ITXT_THREAD_FINISH, AddedMessages, Duplicates);
- DoUnMapFile;
- RegExpr.Free;
- end;
- DContact.hContact := INVALID_HANDLE_VALUE;
- Sleep(10); //
- end; //
- end; //
- DoMessage(ITXT_THREAD_ALLFINISHED, 0, 0);
-end;
-
-end.
diff --git a/plugins/ImportTXT/ImportTxtWiz.pas b/plugins/ImportTXT/ImportTxtWiz.pas deleted file mode 100644 index 25b5896892..0000000000 --- a/plugins/ImportTXT/ImportTxtWiz.pas +++ /dev/null @@ -1,390 +0,0 @@ -unit ImportTxtWiz;
-
-interface
-
-uses Windows, Messages, SysUtils,
- m_api,
- general, ImportTU, FileDlgs,
- ImportThrd;
-
-{$R ImpTxtWiz.res}
-{$I ImpWizRes.inc}
-
-function WizardIntroPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-function ImportTypePageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-function WizardDlgProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-function ImportFilesPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-function ImportDestinationPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-function ImportProgressPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-
-implementation
-
-const
- WIZM_GOTOPAGE = (WM_USER + 10); // wParam=resource id, lParam=dlgproc
- WIZM_DISABLEBUTTON = (WM_USER + 11); // wParam=0:back, 1:next, 2:cancel
- WIZM_SETCANCELTEXT = (WM_USER + 12); // lParam=(char*)newText
- WIZM_SETNEXTTEXT = (WM_USER + 13); // lParam=(char*)newText
- WIZM_ENABLEBUTTON = (WM_USER + 14); // wParam=0:back, 1:next, 2:cancel
- WIZM_ACCLISTCHANGED = (WM_USER + 15); // OnAccountListChanged
-
-var
- hwndPage: HWND;
- IndexOfPattern: integer;
- ImportThrd: TImportThrd;
- ProtoSelect: integer;
- nFO: integer;
- FilePath: WideString;
- FileName: WideString;
- FileNames: array of WideString;
- StartTime, FinishTime: TDateTime;
-
-function MakeFileList(hdlg: HWND; param: WORD): boolean;
-var
- i: integer;
- s1: WideString;
-begin
- result := false;
- case param of
- IDC_FILE:
- FileName := OpenDialogExecute(hdlg, $0200, nFO, TxtPatterns[IndexOfPattern].DefExtension);
- // OFN_ALLOWMULTISELECT = $00000200;
- IDC_DIR:
- FileName := FolderDialogExecute(hdlg, nFO, TxtPatterns[IndexOfPattern].DefExtension);
- end;
- if FileName <> '' then
- begin
- SendDlgItemMessageW(hdlg, IDC_LIST, LB_RESETCONTENT, 0, 0);
- SendDlgItemMessageW(hdlg, IDC_PATH, WM_SETTEXT, 0, 0);
- SetLength(FileNames, 0);
- FilePath := Copy(FileName, 1, nFO - 1);
- SendDlgItemMessageW(hdlg, IDC_PATH, WM_SETTEXT, 0, lparam(PWideChar(FilePath)));
- i := nFO;
- while FileName[i + 1] <> #0 do
- begin
- s1 := '';
- Inc(i);
- while FileName[i] <> #0 do
- begin
- s1 := s1 + FileName[i];
- Inc(i);
- end;
- if (s1 <> '') and (s1 <> #0) then
- begin
- SetLength(FileNames, Length(FileNames) + 1);
- FileNames[High(FileNames)] := s1;
- SendDlgItemMessageW(hdlg, IDC_LIST, LB_ADDSTRING, 0, lparam(PWideChar(s1)));
- end;
- end;
- end;
- if High(FileNames) > -1 then
- result := true;
-end;
-
-procedure AddStatusMessage(hdlg: HWND; msg: WideString);
-begin
- SendDlgItemMessageW(hdlg, IDC_STATUS, LB_SETCURSEL,
- SendDlgItemMessageW(hdlg, IDC_STATUS, LB_ADDSTRING, 0, lparam(PWideChar(msg))), 0);
-end;
-
-procedure AccLstChngd;
-begin
- SendMessageW(hwndPage, WIZM_ACCLISTCHANGED, 0, 0);
-end;
-
-function WizardIntroPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-begin
- result := false;
- case hMessage of
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 0, 0);
- IndexOfPattern := 0;
- ProtoSelect := 0;
- SetLength(FileNames, 0);
- result := true;
- end;
- WM_COMMAND:
- case LOWORD(wParam) of
- IDOK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPTYPE, tlparam(@ImportTypePageProc));
- IDCANCEL:
- PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
- end; // Case wParam
- end; // Case hMassege
-end;
-
-function ImportTypePageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-var
- i: integer;
-begin
- result := false;
- case hMessage of
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- ReadPatterns;
- if Length(TxtPatterns) > 0 then
- begin
- For i := 0 to High(TxtPatterns) do
- SendDlgItemMessage(hdlg, IDC_COMBO1, CB_ADDSTRING, 0, tlparam(PChar(TxtPatterns[i].Name)));
- SendDlgItemMessage(hdlg, IDC_COMBO1, CB_SETCURSEL, GetLastPattern, 0);
- IndexOfPattern := GetLastPattern;
- end
- else
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 1, 0);
- result := true;
- end;
- WM_COMMAND:
- begin
- if (HiWord(wParam) = CBN_SELCHANGE) and (LOWORD(wParam) = IDC_COMBO1)
- then
- IndexOfPattern := SendDlgItemMessage(hdlg, IDC_COMBO1,
- CB_GETCURSEL, 0, 0);
- Case LOWORD(wParam) of
- IDC_BACK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPWIZARDINTRO, tlparam(@WizardIntroPageProc));
- IDOK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPFILES, tlparam(@ImportFilesPageProc));
- IDCANCEL:
- PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
- end; // Case wParam
- end; // WM_COMMAND
- end; // Case hMassage
-end;
-
-function ImportFilesPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-var
- i: integer;
-begin
- result := false;
- case hMessage of
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- if High(FileNames) < 0 then
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 1, 0)
- else
- begin
- SendDlgItemMessageW(hdlg, IDC_PATH, WM_SETTEXT, 0, tlparam(PWideChar(FilePath)));
- for i := 0 to High(FileNames) do
- SendDlgItemMessageW(hdlg, IDC_LIST, LB_ADDSTRING, 0, tlparam(PWideChar(FileNames[i])));
- end;
- result := true;
- end;
- WM_COMMAND:
- Case LOWORD(wParam) of
- IDC_FILE, IDC_DIR:
- if MakeFileList(hdlg, LOWORD(wParam)) then
- SendMessage(GetParent(hdlg), WIZM_ENABLEBUTTON, 1, 0)
- else
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 1, 0);
- IDC_BACK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPTYPE, tlparam(@ImportTypePageProc));
- IDOK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPDEST, tlparam(@ImportDestinationPageProc));
- IDCANCEL:
- PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
- end; // Case wParam
- end; // Case hMassage
-end;
-
-function ImportDestinationPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-var
- i: integer;
- tempws: WideString;
-begin
- result := false;
- case hMessage of
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- EnumProtocols;
- for i := 0 to ProtoCount - 1 do
- begin
- tempws := Protocols[i].ProtoName + ' | ';
- tempws := tempws + Protocols[i].ProtoUID + ' | ' + Protocols[i].ProtoNick;
- SendDlgItemMessageW(hdlg, IDC_COMBO1, CB_ADDSTRING, 0, tlparam(PWideChar(tempws)));
- end;
- SendDlgItemMessage(hdlg, IDC_COMBO1, CB_SETCURSEL, 0, 0);
- OnAccountListChange := AccLstChngd;
- CheckDlgButton(hdlg, IDC_CHKDUPW, BST_CHECKED);
- CheckForDuplicates := true;
- CheckDlgButton(hdlg, IDC_SHOWDUPW, BST_UNCHECKED);
- CheckForDuplicates := false;
- result := true;
- end;
- WM_COMMAND:
- begin
- if (HiWord(wParam) = CBN_SELCHANGE) and (LOWORD(wParam) = IDC_COMBO1)
- then
- ProtoSelect := SendDlgItemMessage(hdlg, IDC_COMBO1, CB_GETCURSEL, 0, 0);
-
- if (HiWord(wParam) = BN_CLICKED) and (LOWORD(wParam) = IDC_CHKDUPW) then
- EnableWindow(GetDlgItem(hdlg, IDC_SHOWDUPW),
- IsDlgButtonChecked(hdlg, IDC_CHKDUPW)<>BST_UNCHECKED);
-
- Case LOWORD(wParam) of
- IDC_BACK:
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_IMPFILES, tlparam(@ImportFilesPageProc));
- IDOK:
- begin
- CheckForDuplicates := LongBool(IsDlgButtonChecked(hdlg, IDC_CHKDUPW));
- ShowDuplicates := LongBool(IsDlgButtonChecked(hdlg, IDC_SHOWDUPW));
- PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_PROGRESS, tlparam(@ImportProgressPageProc));
- end;
- IDCANCEL:
- PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
- end; // Case wParam
- end; // WM_COMMAND
- WIZM_ACCLISTCHANGED:
- begin
- ProtoSelect := SendDlgItemMessage(hdlg, IDC_COMBO1, CB_GETCURSEL, 0, 0);
- SendDlgItemMessageW(hdlg, IDC_COMBO1, CB_RESETCONTENT, 0, 0);
- for i := 0 to ProtoCount - 1 do
- begin
- tempws := Protocols[i].ProtoName + ' | ';
- tempws := tempws + Protocols[i].ProtoUID + ' | ' + Protocols[i].ProtoNick;
- SendDlgItemMessageW(hdlg, IDC_COMBO1, CB_ADDSTRING, 0, tlparam(PWideChar(tempws)));
- end;
- if ProtoSelect < ProtoCount - 1 then
- SendDlgItemMessage(hdlg, IDC_COMBO1, CB_SETCURSEL, ProtoSelect, 0)
- else
- SendDlgItemMessage(hdlg, IDC_COMBO1, CB_SETCURSEL, ProtoCount - 1, 0);
- end; // WIZM_...
- end; // Case hMassage
-end;
-
-function ImportProgressPageProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-var
- H, Mi, sec, ms: WORD;
- s: WideString;
-begin
- result := false;
- case hMessage of
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 0, 0);
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 1, 0);
- SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 2, 0);
- SendMessage(GetParent(hdlg), WIZM_SETCANCELTEXT, 0, tlparam(TranslateW('Finish')));
- // START THREAD
- ImportThrd := TImportThrd.Create(true);
- ImportThrd.FreeOnTerminate := true;
- ImportThrd.DContact.hContact := 0;
- ImportThrd.Destination := Protocols[ProtoSelect];
- ImportThrd.FileNames := FileName + #0 + #0;
- ImportThrd.OffsetFileName := nFO;
- ImportThrd.WorkPattern := TxtPatterns[IndexOfPattern];
- ImportThrd.ParentHWND := hdlg;
- ImportThrd.Resume;
- result := true;
- end;
- WM_COMMAND:
- Case LOWORD(wParam) of
- IDCANCEL:
- PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
- end; // Case wParam
- //
- //
- ITXT_THREAD_ALLSTARTED:
- StartTime := Time;
- ITXT_THREAD_START:
- begin
- AddStatusMessage(hdlg, TranslateWideString('Import started...'));
- end;
- //
- ITXT_THREAD_MAXPROGRESS:
- SendDlgItemMessage(hdlg, IDC_PROGRESS, PBM_SETRANGE, 0, MakeLParam(0, lParam));
- // ...
- ITXT_THREAD_PROGRESS:
- SendDlgItemMessage(hdlg, IDC_PROGRESS, PBM_SETPOS, wParam, 0);
- //
- ITXT_THREAD_ERROR:
- AddStatusMessage(hdlg, TranslateWideString(PWideChar(wParam)));
- //
- ITXT_THREAD_FINISH:
- begin
- AddStatusMessage(hdlg, WideFormat(TranslateWideString('Added: %d messages'), [wParam]));
- AddStatusMessage(hdlg, WideFormat(TranslateWideString('Duplicates: %d messages'), [lParam]));
- end;
- //
- ITXT_THREAD_START_FILE:
- AddStatusMessage(hdlg, WideFormat(TranslateWideString('File: %s'), [PWideChar(wParam)]));
- //
- ITXT_THREAD_DEST_CONTACT:
- begin
- s := GetContactID(wParam, '', true) + ' | ' + GetContactNick(wParam, '', true);
- AddStatusMessage(hdlg, WideFormat(TranslateWideString('To: %s'), [s]));
- end;
- ITXT_THREAD_ALLFINISHED:
- begin
- FinishTime := Time;
- DecodeTime(FinishTime - StartTime, H, Mi, sec, ms);
- AddStatusMessage(hdlg, WideFormat(TranslateWideString('In: %d:%d:%d'), [H, Mi, sec]));
- SendMessage(GetParent(hdlg), WIZM_ENABLEBUTTON, 2, 0);
- end;
- end; // Case hMessage
-end;
-
-function WizardDlgProc(hdlg: HWND; hMessage:uint; wParam:WPARAM; lParam:LPARAM): LongBool; stdcall;
-begin
- result := false;
- case hMessage of
- WM_DESTROY:
- SetLastPattern(IndexOfPattern);
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(hdlg);
- hwndPage := CreateDialog(hInstance, MAKEINTRESOURCE(IDD_IMPWIZARDINTRO),
- hdlg, @WizardIntroPageProc);
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER or SWP_NOSIZE);
- ShowWindow(hwndPage, SW_SHOW);
- ShowWindow(hdlg, SW_SHOW);
- SendMessage(hdlg, WM_SETICON, ICON_BIG, LoadIcon(hInstance, MAKEINTRESOURCE(110)));
- result := true;
- end;
- WIZM_GOTOPAGE:
- begin
- DestroyWindow(hwndPage);
- EnableWindow(GetDlgItem(hdlg, IDC_BACK), true);
- EnableWindow(GetDlgItem(hdlg, IDOK), true);
- EnableWindow(GetDlgItem(hdlg, IDCANCEL), true);
- SetDlgItemTextW(hdlg, IDCANCEL, TranslateW('Cancel'));
- hwndPage := CreateDialog(hInstance, MAKEINTRESOURCE(wParam), hdlg, Pointer(lParam));
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER or SWP_NOSIZE);
- ShowWindow(hwndPage, SW_SHOW);
- end;
- WIZM_DISABLEBUTTON:
- begin
- case wParam of
- 0: EnableWindow(GetDlgItem(hdlg, IDC_BACK), false);
- 1: EnableWindow(GetDlgItem(hdlg, IDOK), false);
- 2: EnableWindow(GetDlgItem(hdlg, IDCANCEL), false);
- end; // Case wParam
- end;
- WIZM_ENABLEBUTTON:
- begin
- case wParam of
- 0: EnableWindow(GetDlgItem(hdlg, IDC_BACK), true);
- 1: EnableWindow(GetDlgItem(hdlg, IDOK), true);
- 2: EnableWindow(GetDlgItem(hdlg, IDCANCEL), true);
- end; // Case wParam
- end;
- WIZM_SETCANCELTEXT:
- SetDlgItemTextW(hdlg, IDCANCEL, PWideChar(lParam));
- WIZM_SETNEXTTEXT:
- SetDlgItemTextW(hdlg, IDOK, PWideChar(lParam));
- WM_COMMAND:
- SendMessage(hwndPage, WM_COMMAND, wParam, lParam);
- WM_CLOSE:
- begin
- OnAccountListChange := nil;
- DestroyWindow(hwndPage);
- DestroyWindow(hdlg);
- end;
- end; // Case hMessage
-end;
-
-end.
diff --git a/plugins/ImportTXT/PerlRegEx.pas b/plugins/ImportTXT/PerlRegEx.pas deleted file mode 100644 index 617479fa91..0000000000 --- a/plugins/ImportTXT/PerlRegEx.pas +++ /dev/null @@ -1,447 +0,0 @@ -(**********************************************************
-* *
-* Perl Regular Expressions *
-* *
-* Delphi wrapper around PCRE - http://www.pcre.org *
-* *
-* Copyright (C) 1999-2006 Jan Goyvaerts *
-* *
-* Design & implementation Jan Goyvaerts 1999-2006 *
-* *
-* *
-* Shorted and added partial ability for PCRE 7.0 *
-* by Abyss *
-**********************************************************)
-
-unit PerlRegEx;
-
-interface
-
-
-
-uses SysUtils;
-
-type
- TPerlRegExOptions = set of (
- preCaseLess, // /i -> Case insensitive
- preMultiLine, // /m -> ^ and $ also match before/after a newline, not just at the beginning and the end of the string
- preSingleLine, // /s -> Dot matches any character, including \n (newline). Otherwise, it matches anything except \n
- preExtended, // /x -> Allow regex to contain extra whitespace, newlines and Perl-style comments, all of which will be filtered out
- preAnchored, // /A -> Successful match can only occur at the start of the subject or right after the previous match
- preDollarEndOnly, // /E
- preExtra, // /X
- preUnGreedy, // Repeat operators (+, *, ?) are not greedy by default
- // (i.e. they try to match the minimum number of characters instead of the maximum)
- preUTF8 // UTF8
- );
-type
- TPerlRegExState = set of (
- preNotBOL, // Not Beginning Of Line: ^ does not match at the start of Subject
- preNotEOL, // Not End Of Line: $ does not match at the end of Subject
- preNotEmpty // Empty matches not allowed
- );
-
-const
- // Maximum number of subexpressions (backreferences)
- // Subexpressions are created by placing round brackets in the regex, and are referenced by \1, \2, ...
- // In Perl, they are available as $1, $2, ... after the regex matched; with TPerlRegEx, use the Subexpressions property
- // You can also insert \1, \2, ... in the Replacement string; \0 is the complete matched expression
- MAX_SUBEXPRESSIONS = 99;
-
-
-type
- TPerlRegEx = class
- private // *** Property storage, getters and setters
- FCompiled, FStudied: Boolean;
- FOptions: TPerlRegExOptions;
- FState: TPerlRegExState;
- FRegEx, FSubject: string;
- FStart, FStop: Integer;
- function GetMatchedExpression: string;
- function GetMatchedExpressionLength: Integer;
- function GetMatchedExpressionOffset: Integer;
- procedure SetOptions(Value: TPerlRegExOptions);
- procedure SetRegEx(const Value: string);
- function GetSubExpressionCount: Integer;
- function GetSubExpressions(Index: Integer): string;
- function GetSubExpressionLengths(Index: Integer): Integer;
- function GetSubExpressionOffsets(Index: Integer): Integer;
- procedure SetSubject(const Value: string);
- procedure SetStart(const Value: Integer);
- procedure SetStop(const Value: Integer);
- function GetFoundMatch: Boolean;
- private // *** Variables used by pcrelib.dll
- Offsets: array[0..(MAX_SUBEXPRESSIONS+1)*3] of Integer;
- OffsetCount: Integer;
- pcreOptions: Integer;
- pattern, hints, chartable: Pointer;
- FSubjectPChar: PChar;
- protected
- procedure CleanUp;
- // Dispose off whatever we created, so we can start over. Called automatically when needed, so it is not made public
- public
- constructor Create;
- // Come to life
- destructor Destroy; override;
- // Clean up after ourselves
- class function EscapeRegExChars(const S: string): string;
- // Escapes regex characters in S so that the regex engine can be used to match S as plain text
- procedure Compile;
- // Compile the regex. Called automatically by Match
- procedure Study;
- // Study the regex. Studying takes time, but will make the execution of the regex a lot faster.
- // Call study if you will be using the same regex many times
- function Match: Boolean;
- // Attempt to match the regex
- function MatchAgain: Boolean;
- // Attempt to match the regex to the remainder of the string after the previous match
- // To avoid problems (when using ^ in the regex), call MatchAgain only after a succesful Match()
- function NamedSubExpression(const SEName: string): Integer;
- // Returns the index of the named group SEName
- function Config (What: integer): Integer;
- //This function makes it possible for a client program
- // to find out which optional features are available in the
- //version of the PCRE library it is using.
- property Compiled: Boolean read FCompiled;
- // True if the RegEx has already been compiled.
- property FoundMatch: Boolean read GetFoundMatch;
- // Returns True when MatchedExpression* and SubExpression* indicate a match
- property Studied: Boolean read FStudied;
- // True if the RegEx has already been studied
- property MatchedExpression: string read GetMatchedExpression;
- // The matched string
- property MatchedExpressionLength: Integer read GetMatchedExpressionLength;
- // Length of the matched string
- property MatchedExpressionOffset: Integer read GetMatchedExpressionOffset;
- // Character offset in the Subject string at which the matched substring starts
- property Start: Integer read FStart write SetStart;
- // Starting position in Subject from which MatchAgain begins
- property Stop: Integer read FStop write SetStop;
- // Last character in Subject that Match and MatchAgain search through
- property State: TPerlRegExState read FState write FState;
- // State of Subject
- property SubExpressionCount: Integer read GetSubExpressionCount;
- // Number of matched subexpressions
- property SubExpressions[Index: Integer]: string read GetSubExpressions;
- // Matched subexpressions after a regex has been matched
- property SubExpressionLengths[Index: Integer]: Integer read GetSubExpressionLengths;
- // Lengths of the subexpressions
- property SubExpressionOffsets[Index: Integer]: Integer read GetSubExpressionOffsets;
- // Character offsets in the Subject string of the subexpressions
- property Subject: string read FSubject write SetSubject;
- // The string on which Match() will try to match RegEx
- published
- property Options: TPerlRegExOptions read FOptions write SetOptions;
- // Options
- property RegEx: string read FRegEx write SetRegEx;
- // The regular expression to be matched
- end;
-
-
-
-implementation
-
- { ********* pcrelib.dll imports ********* }
-
-const
- PCRE_CASELESS = $00000001;
- PCRE_MULTILINE = $00000002;
- PCRE_SINGLELINE = $00000004;
- PCRE_EXTENDED = $00000008;
- PCRE_ANCHORED = $00000010;
- PCRE_DOLLAR_ENDONLY = $00000020;
- PCRE_EXTRA = $00000040;
- PCRE_NOTBOL = $00000080;
- PCRE_NOTEOL = $00000100;
- PCRE_UNGREEDY = $00000200;
- PCRE_NOTEMPTY = $00000400;
- PCRE_UTF8 = $00000800;
- PCRE_NO_AUTO_CAPTURE = $00001000;
- PCRE_NO_UTF8_CHECK = $00002000;
- PCRE_AUTO_CALLOUT = $00004000;
- PCRE_PARTIAL = $00008000;
- PCRE_DFA_SHORTEST = $00010000;
- PCRE_DFA_RESTART = $00020000;
- PCRE_FIRSTLINE = $00040000;
- PCRE_DUPNAMES = $00080000;
- PCRE_NEWLINE_CR = $00100000;
- PCRE_NEWLINE_LF = $00200000;
- PCRE_NEWLINE_CRLF = $00300000;
- PCRE_NEWLINE_ANY = $00400000;
-
- // Exec error codes
- PCRE_ERROR_NOMATCH = -1;
- PCRE_ERROR_NULL = -2;
- PCRE_ERROR_BADOPTION = -3;
- PCRE_ERROR_BADMAGIC = -4;
- PCRE_ERROR_UNKNOWN_OPCODE = -5;
- PCRE_ERROR_UNKNOWN_NODE = -5; // For backward compatibility
- PCRE_ERROR_NOMEMORY = -6;
- PCRE_ERROR_NOSUBSTRING = -7;
- PCRE_ERROR_MATCHLIMIT = -8;
- PCRE_ERROR_CALLOUT = -9; // Never used by PCRE itself
- PCRE_ERROR_BADUTF8 =-10;
- PCRE_ERROR_BADUTF8_OFFSET =-11;
- PCRE_ERROR_PARTIAL =-12;
- PCRE_ERROR_BADPARTIAL =-13;
- PCRE_ERROR_INTERNAL =-14;
- PCRE_ERROR_BADCOUNT =-15;
- PCRE_ERROR_DFA_UITEM =-16;
- PCRE_ERROR_DFA_UCOND =-17;
- PCRE_ERROR_DFA_UMLIMIT =-18;
- PCRE_ERROR_DFA_WSSIZE =-19;
- PCRE_ERROR_DFA_RECURSE =-20;
- PCRE_ERROR_RECURSIONLIMIT =-21;
- PCRE_ERROR_NULLWSLIMIT =-22;
- PCRE_ERROR_BADNEWLINE =-23;
-
-(* Request types for pcre_config(). Do not re-arrange, in order to remain compatible. *)
-
- PCRE_CONFIG_UTF8 = 0;
- PCRE_CONFIG_NEWLINE = 1;
- PCRE_CONFIG_LINK_SIZE = 2;
- PCRE_CONFIG_POSIX_MALLOC_THRESHOLD = 3;
- PCRE_CONFIG_MATCH_LIMIT = 4;
- PCRE_CONFIG_STACKRECURSE = 5;
- PCRE_CONFIG_UNICODE_PROPERTIES = 6;
- PCRE_CONFIG_MATCH_LIMIT_RECURSION = 7;
-type
- PPChar = ^PChar;
- PInt = ^Integer;
-
-
-
-// Functions we import from the PCRE library DLL
-// Leading underscores gratuitously added by Borland C++Builder 6.0
-function pcre_maketables: PAnsiChar; cdecl; external 'pcre3.dll';
-function pcre_compile(const pattern: PChar; options: Integer; errorptr: PPChar; erroroffset: PInt;
- const tables: PChar): Pointer; cdecl; external 'pcre3.dll';
-function pcre_exec(const pattern: Pointer; const hints: Pointer; const subject: PChar; length, startoffset: Integer;
- options: Integer; offsets: PInt; offsetcount: Integer): Integer; cdecl; external 'pcre3.dll';
-function pcre_get_stringnumber(const pattern: Pointer; const Name: PChar): Integer; cdecl; external 'pcre3.dll';
-function pcre_study(const pattern: Pointer; options: Integer; errorptr: PPChar): Pointer; cdecl; external 'pcre3.dll';
-function pcre_fullinfo(const pattern: Pointer; const hints: Pointer; what: Integer; where: Pointer): Integer; cdecl; external 'pcre3.dll';
-function pcre_version: pchar; cdecl; external 'pcre3.dll';
-function pcre_config (what:integer; where:pointer):integer; cdecl; external 'pcre3.dll';
-//procedure pcre_free(ptr: Pointer); cdecl; external 'pcre3.dll';
-
-
-
-
- { ********* TPerlRegEx component ********* }
-
-procedure TPerlRegEx.CleanUp;
-begin
- FCompiled := False; FStudied := False;
- pattern := nil; hints := nil;
- OffsetCount := 0;
-end;
-
-procedure TPerlRegEx.Compile;
-var
- Error: PChar;
- ErrorOffset: Integer;
-begin
- if FRegEx = '' then raise Exception.Create('TPerlRegEx.Compile() - Please specify a regular expression in RegEx first');
- CleanUp;
- Pattern := pcre_compile(PChar(FRegEx), pcreOptions, @Error, @ErrorOffset, chartable);
- if Pattern = nil then
- raise Exception.Create(Format('TPerlRegEx.Compile() - Error in regex at offset %d: %s', [ErrorOffset, AnsiString(Error)]));
- FCompiled := True
-end;
-
-
-constructor TPerlRegEx.Create;
-begin
- inherited Create;
- FState := [preNotEmpty];
- chartable := pcre_maketables;
-end;
-
-destructor TPerlRegEx.Destroy;
-begin
- CleanUp;
- inherited Destroy;
-end;
-
-class function TPerlRegEx.EscapeRegExChars(const S: string): string;
-var
- I: Integer;
-begin
- Result := S;
- I := Length(Result);
- while I > 0 do begin
- if Result[I] in ['.', '[', ']', '(', ')', '?', '*', '+', '{', '}', '^', '$', '|', '\'] then
- Insert('\', Result, I)
- else if Result[I] = #0 then begin
- Result[I] := '0';
- Insert('\', Result, I);
- end;
- Dec(I);
- end;
-end;
-
-function TPerlRegEx.GetFoundMatch: Boolean;
-begin
- Result := OffsetCount > 0;
-end;
-
-function TPerlRegEx.GetMatchedExpression: string;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Result := GetSubExpressions(0);
-end;
-
-function TPerlRegEx.GetMatchedExpressionLength: Integer;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Result := GetSubExpressionLengths(0)
-end;
-
-function TPerlRegEx.GetMatchedExpressionOffset: Integer;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Result := GetSubExpressionOffsets(0)
-end;
-
-function TPerlRegEx.GetSubExpressionCount: Integer;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Result := OffsetCount-1
-end;
-
-function TPerlRegEx.GetSubExpressionLengths(Index: Integer): Integer;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Assert((Index >= 0) and (Index <= SubExpressionCount), 'REQUIRE: Index <= SubExpressionCount');
- Result := Offsets[Index*2+1]-Offsets[Index*2]
-end;
-
-function TPerlRegEx.GetSubExpressionOffsets(Index: Integer): Integer;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- Assert((Index >= 0) and (Index <= SubExpressionCount), 'REQUIRE: Index <= SubExpressionCount');
- Result := Offsets[Index*2]
-end;
-
-function TPerlRegEx.GetSubExpressions(Index: Integer): string;
-begin
- Assert(FoundMatch, 'REQUIRE: There must be a successful match first');
- if Index > SubExpressionCount then Result := ''
- else Result := Copy(FSubject, Offsets[Index*2], Offsets[Index*2+1]-Offsets[Index*2]);
-end;
-
-function TPerlRegEx.Match: Boolean;
-var
- I, Opts: Integer;
-begin
- if not Compiled then Compile;
- if preNotBOL in State then Opts := PCRE_NOTBOL else Opts := 0;
- if preNotEOL in State then Opts := Opts or PCRE_NOTEOL;
- if preNotEmpty in State then Opts := Opts or PCRE_NOTEMPTY;
- if FStart > FStop then OffsetCount := -1
- else OffsetCount := pcre_exec(Pattern, Hints, FSubjectPChar, FStop, 0, Opts, @Offsets[0], High(Offsets));
- Result := OffsetCount > 0;
- // Convert offsets into string indices
- if Result then begin
- for I := 0 to OffsetCount*2-1 do
- Inc(Offsets[I]);
- FStart := Offsets[1];
- if Offsets[0] = Offsets[1] then Inc(FStart); // Make sure we don't get stuck at the same position
- end;
-end;
-
-function TPerlRegEx.MatchAgain: Boolean;
-var
- I, Opts: Integer;
-begin
- if not Compiled then Compile;
- if preNotBOL in State then Opts := PCRE_NOTBOL else Opts := 0;
- if preNotEOL in State then Opts := Opts or PCRE_NOTEOL;
- if preNotEmpty in State then Opts := Opts or PCRE_NOTEMPTY;
- if FStart > FStop then OffsetCount := -1
- else OffsetCount := pcre_exec(Pattern, Hints, FSubjectPChar, FStop, FStart-1, Opts, @Offsets[0], High(Offsets));
- Result := OffsetCount > 0;
- // Convert offsets into string indices
- if Result then begin
- for I := 0 to OffsetCount*2-1 do
- Inc(Offsets[I]);
- FStart := Offsets[1];
- if Offsets[0] = Offsets[1] then Inc(FStart); // Make sure we don't get stuck at the same position
- end;
-end;
-
-function TPerlRegEx.NamedSubExpression(const SEName: string): Integer;
-begin
- Result := pcre_get_stringnumber(Pattern, PChar(SEName));
-end;
-
-function TPerlRegEx.Config(What: integer):integer;
-begin
- result:=-1;
- pcre_config(what, @result);
-end;
-
-
-procedure TPerlRegEx.SetOptions(Value: TPerlRegExOptions);
-begin
- if (FOptions <> Value) then begin
- FOptions := Value;
- pcreOptions := 0;
- if (preCaseLess in Value) then pcreOptions := pcreOptions or PCRE_CASELESS;
- if (preMultiLine in Value) then pcreOptions := pcreOptions or PCRE_MULTILINE;
- if (preSingleLine in Value) then pcreOptions := pcreOptions or PCRE_SINGLELINE;
- if (preExtended in Value) then pcreOptions := pcreOptions or PCRE_EXTENDED;
- if (preAnchored in Value) then pcreOptions := pcreOptions or PCRE_ANCHORED;
- if (preDollarEndOnly in Value) then pcreOptions := pcreOptions or PCRE_DOLLAR_ENDONLY;
- if (preExtra in Value) then pcreOptions := pcreOptions or PCRE_EXTRA;
- if (preUnGreedy in Value) then pcreOptions := pcreOptions or PCRE_UNGREEDY;
- if (preUTF8 in Value) then pcreOptions := pcreOptions or PCRE_UTF8;
- CleanUp
- end
-end;
-
-procedure TPerlRegEx.SetRegEx(const Value: string);
-begin
- if FRegEx <> Value then begin
- FRegEx := Value;
- CleanUp
- end
-end;
-
-procedure TPerlRegEx.SetStart(const Value: Integer);
-begin
- if Value < 1 then FStart := 1
- else FStart := Value;
- // If FStart > Length(Subject), MatchAgain() will simply return False
-end;
-
-procedure TPerlRegEx.SetStop(const Value: Integer);
-begin
- if Value > Length(Subject) then FStop := Length(Subject)
- else FStop := Value;
-end;
-
-procedure TPerlRegEx.SetSubject(const Value: string);
-begin
- FSubject := Value;
- FSubjectPChar := PChar(Value);
- FStart := 1;
- FStop := Length(Subject);
- OffsetCount := 0;
-end;
-
-
-
-procedure TPerlRegEx.Study;
-var
- Error: PChar;
-begin
- if not FCompiled then Compile;
- Hints := pcre_study(Pattern, 0, @Error);
- if Error <> nil then raise Exception.Create('TPerlRegEx.Study() - Error studying the regex: ' + AnsiString(Error));
- FStudied := True
-end;
-
-
-end.
\ No newline at end of file diff --git a/plugins/ImportTXT/doc/changelog_ru.txt b/plugins/ImportTXT/doc/changelog_ru.txt deleted file mode 100644 index 434eb38ca7..0000000000 --- a/plugins/ImportTXT/doc/changelog_ru.txt +++ /dev/null @@ -1,77 +0,0 @@ -v. 0.0.1.9
-* исправлено дублирование сообщения, если оно совпадает с первым в базе
-* поддержка исправленного xml_api и поддержка плагина XML Driver (для седьмой ветки)
-
-v. 0.0.1.8
-* !важный фикс проверки дубликатов
-+ добавлена возможность показывать дубликаты
-+ автоскролл в окне сообщений
-+ добавлена возможность отключить проверку на дубликаты
-* баг с кривым выводом статусных сообщений
-+ добавлен параметр Codepage в шаблон
-- убрана возможность одновременного импорта
-+ иконка в окне импорта
-+ перечитывание шаблонов, при открытии окна и в Мастере
-+ запоминание последнего шаблона
-+ полностью переделан импорт из ICQ6
-
-v. 0.0.1.7
-+ добавлен шаблон D[i]chat
-+ добавлен импорт из ICQ6
-+ добавлен импорт из XML файлов ICQ5
-
-v. 0.0.1.6
-* исправлена блокировка папки с импортируемыми файлами
-+ добавлен шаблон Pigeon
-
-v. 0.0.1.5
-* исправлено расширение по умолчанию при выборе папки
-
-v. 0.0.1.4
-+ добавлена поддержка Updater
-* когда не найден заголовок, не загоралась кнопка "завершить"
-* исправлен шаблон mContacts
-
-v. 0.0.1.3
-+ добавлена поддержка бинарных файлов qhf
-
-v. 0.0.1.2
-+ добавлен параметр DefaultExtension в шаблон
-+ добавлена поддержка бинарных файлов, пока только mContact
-
-v. 0.0.1.1
-+ добавлена возможность автостарта
-* обновление списка аккаунтов при его изменении :)
-
-v. 0.0.1.0
-* пункт меню добавляется всем контактам
-* добавлен мастер массового импорта
-
-v. 0.0.0.6
-* переработан формат файлов шаблона, теперь это ini файлы
-* выделен обработчик сообщений перед импортом (удаление переводов строк и пробелов)
-+ добавлена поддержка Message Export
-* мелкие исправления
-
-v. 0.0.0.5
-* добавлена поддержка файлов с заголовком, с ником в заголовке сообщениия, но без направления
- (History++)
-
-v. 0.0.0.4
-* добавлена поддержка мультиаккаунтности для 0.8+
-* пункт меню теперь добавляется для всех ICQ протоколов (если несколько копий DLL)
-
-v. 0.0.0.3
-* изменены процедуры преобразования кодировок
-* убраны утечки памяти
-+ добавлена собственная иконка
-
-v. 0.0.0.2
-* изменен способ работы с рег. выражениями (pcre3.dll)
-+ сообщения импортируются в базу в UTF8 или ANSI в зависимости от версии Миранды
-+ разные кодировки входных файлов
-+ фикс перевода
-
-
-v. 0.0.0.1
-+ первый релиз
\ No newline at end of file diff --git a/plugins/ImportTXT/doc/examples_ru.txt b/plugins/ImportTXT/doc/examples_ru.txt deleted file mode 100644 index 9c71639cf4..0000000000 --- a/plugins/ImportTXT/doc/examples_ru.txt +++ /dev/null @@ -1,169 +0,0 @@ -
-Пример файла:
-************
-
- История сообщений с Неизвестный (000000000)
- Сохранено из Jimm 07.06.2008 11:49:17
-
-
------------------------------------->>>-
- Abyss (06.09.2007 17:52:51):
-Привет!
-
-------------------------------------<<<-
- Неизвестный (06.09.2007 18:03:09):
-Хай
-
-************
-
-Шаблон такой:
-
-[General]
-Name=Jimm import pattern
-Charset=ANSI
-UseHeader=2
-UsePreMsg=1
-[Message]
-Pattern=^------------------------------------(<<<|>>>)-\r\n\s([^\r\n]+?)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\):$
-In=<<<
-Out=>>>
-Direction=1
-Day=3
-Month=4
-Year=5
-Hours=6
-Minutes=7
-Seconds=8
-[PreMessage]
-PreRN=1
-AfterRN=2
-[Header]
-Pattern=^\r\n\tИстория сообщений с ([^\r\n]+?)\s\((\d{5,})\)\r\n\tСохранено из Jimm\s[^\r\n]+?\r\n
-InNick=1
-InUID=2
-
-Коментарии: основные моменты содержаться в pattern_cfg,
-Такие значения RN потому что:
-считаем...
-
-Привет!{\r\n} Раз
-{\r\n} два после
-------------------------------------<<<-
- Неизвестный (06.09.2007 18:03:09):{\r\n} Один до
-Хай
-
-UseHeader=2 используем заголовок только для определения контакта назначения
-
-
-====================================================================================================================================
-Для History++
-=============
-
-Пример файла
-************
-
-###
-### Полная история
-### Abyss (ICQ: 0000000) - Неизвестный (ICQ: 00000000)
-### (создана модулем history++)
-###
-
-[06.09.2007 17:52:51] Abyss:
-Привет!
-
-[06.09.2007 18:03:09] Неизвестный:
-Хай
-
-************
-Файл шаблона выглядит так:
-**************************
-[General]
-Name=History++ pattern
-Charset=UCS2
-UseHeader=3
-UsePreMsg=1
-[Message]
-Pattern=^\[(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\]\s([^\r\n]+?):$
-Direction=7
-Day=1
-Month=2
-Year=3
-Hours=4
-Minutes=5
-Seconds=6
-[Header]
-Pattern=^###\r\n###\s[^\r\n]+?\r\n###\s([^\r\n]+?)\s\([^\r\n]+?:\s([^\r\n]+?)\)\s-\s([^\r\n]+?)\s\([^\r\n]+?:\s([^\r\n]+?)\)\r\n###\s[^\r\n]+?\r\n###\r\n
-In=3
-Out=1
-InNick=3
-OutNick=1
-InUID=4
-OutUID=2
-[PreMessage]
-PreRN=1
-AfterRN=2
-**************************
-
-Все аналогично только добавляется обработка заголовка, получаем ник для того чтобы потом его использовать в качестве маркера направления
-
-========================================================================================================================================
-
-Для Message Export
-==================
-Файл:
-*****
-------------------------------------------------
- History for
-User : Неизвестный
-Protocol : ICQ
-UIN : 00000000
-FirstName : Mister
-LastName : X
-Age : 0
-Gender : M
-e-mail :
-Nick : Неизвестный
-City :
-State : 66
-Phone :
-Homepage :
-- About -
-
-------------------------------------------------
-Abyss 06.09.2007 17:52:51 Привет
- Как дела?
-Неизвестный 06.09.2007 18:03:09 Хай, нормально
-
-*******************
-
-[General]
-Name=Message export import pattern
-Charset=UTF8
-UseHeader=3
-UsePreMsg=1
-[Message]
-Pattern=^([^\r\n]+?)[\s]+?(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\s
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[Header]
-Pattern=^------------------------------------------------\r\n[\s]+?History for\r\nUser[\s]+?:\s([^\r\n]+?)\r\n(.*\r\n)+?Nick[\s]+?:\s([^\r\n]+?)\s\r\n(.*\r\n)+?^------------------------------------------------$
-In=1
-InNick=3
-[PreMessage]
-PreRN=0
-AfterRN=1
-PreSP=-2
-*********************
-
-
-Добавлено удаление пробелов в многострочных сообщениях PreSP=-2
-
-С этим форматом сообщений бардак: 1) если протокол НЕ ICQ то UID мы не увидим, тоесть ни JID ни что-то там еще не сохраняются
- приходится использовать Ник, что не есть гуд
- 2) Ник! Зачем писать в файлы пробел после ника????
- Все строчки (Potocol, User, email) нормальные, а после ника пробел.
\ No newline at end of file diff --git a/plugins/ImportTXT/doc/pattern_cfg_ru.txt b/plugins/ImportTXT/doc/pattern_cfg_ru.txt deleted file mode 100644 index 28518d8b77..0000000000 --- a/plugins/ImportTXT/doc/pattern_cfg_ru.txt +++ /dev/null @@ -1,77 +0,0 @@ -Структура файла шаблона плагина importtxt начиная с версии 0.0.1.2
-Расширение файла .ini
-
-[General]* Общие параметры
-Name=* Имя шаблона, выводится в списке
-Type=* Тип импорта возможные значения
- 1 - импорт из текстовых файлов
- 2 - импорт из бинарных файлов
-*******параметры для импорта текста*********
-Charset=* кодировка ANSI, UTF8, UCS2
-Codepage= кодовая страница для ANSI
-UseHeader= 0..3 - использовать заголовок
- первый бит использовать заголовок для распознавания направления
- второй бит использовать заголовок для распознования контакта назначения
-UsePreMsg= 0 - не использовать предварительную обработку сообщений,
- даже если не используется, то всё равно будут удаляться все переводы строки в конце и в начале
- 1 - использовать предварительную обработку
-*******параметры для бинарного импорта*********
-BinProcedure= Используется для установки процедуры бинарного импорта (обязательна при Type=2)
- Возможные значения:
- 1 - mContacts
- 2 - QHF
- 3 - ICQ6
- 4 - ICQ5
-*******общие параметры*********
-UseFileName= использовать имя файла для определения UID
-DefaultExtension= Расширение файлов по умолчанию (если нет то txt)
-*******параметры для импорта текста*********
-[Message]* Сообщение
-Pattern=* рег. выражение для разбора заголовка сообщения
-In= варианты направления, если нет или пустые то используется из заголовка
-Out= если UseHeader=0 и In пустой, то ошибка
-Direction=* номер подвыражения определяющее направление сообщения (либо жестко заданное либо ник или уин)
-Day=* номер подваражения дня
-Month=* номер подваражения месяца
-Year=* номер подваражения года
-Hours=* номер подваражения часов
-Minutes=* номер подваражения минут
-Seconds= номер подваражения секунд (может быть 0, тогда при импорте принимается за 00)
-
-[Header] Заголовок файла
-Pattern=* рег. выражение заголовка
-In=* подвыражение определяющее то что сообщение входящее (Ник, Уин)
-Out= подвыражение определяющее то что сообщение исходящее (Ник, Уин)
- может быть 0 или отсутствовать, если при импорте Direction<>In тогда оно исходящее, такая случайная фишка, но очень помогающая
-InNick=* Ник собеседника
-OutNick= Ваш Ник //не используется
-InUID=* UID собеседника
-OutUID= ваш UID //не используется
-
-[PreMessage] Обработка сообщения перед импортом в базу
-PreRN= удалить переводы строк в начале сообщения (целое число или -1 тогда все)
-AfterRN= удалить переводы строк в конце сообщения (целое число или -1 тогда все)
-PreSP= удалить пробелы в начале каждой строки сообщения
-AfterSP= удалить пробелы в конце каждой строки сообщения
- возможные значения:
- целое число
- -1 все
- -2 кол-во равно длине распознаного шаблона заголовка сообщения (актуально для Message Export)
- любой параметр может отсутствовать или быть равен нулю, тогда не используется
- SP использовать только в случае крайней необходимости, потому что замедляется работа
-*******общие параметры*********
-[FileName] Имя файла
-Pattern=* шаблон для распознования
-InNick=* Ник собеседника
-OutNick= Ваш Ник //не используется
-InUID=* UID собеседника
-OutUID= Ваш UID //не используется
-
-
- * обязательная секция, если указаны UseHeader=1, а секции [Header] нет, то ошибка, аналогично с [PreMessage] и [FileName]
- * обязательный параметр в секции, если параметр не обязателен то по умолчанию используется либо 0 для PS, либо -1 для RN , либо пустая строка
- * если в UseHeader включен второй бит, то обязателен либо InUID, либо InNick, приоритетом распознавания является UID
- * в Имени файла аналогично
-
- UID означает Уникальный ИДентификатор :) это может быть UIN, JID и т.д.
-
\ No newline at end of file diff --git a/plugins/ImportTXT/doc/readme_ru.txt b/plugins/ImportTXT/doc/readme_ru.txt deleted file mode 100644 index 36ced8f7d8..0000000000 --- a/plugins/ImportTXT/doc/readme_ru.txt +++ /dev/null @@ -1,78 +0,0 @@ -Import TXT plugin for Miranda IM
-================================
-Плагин предоставляет возможность импортировать историю контактов
-из других клиентов, хранящуюся в текстовых файлах.
-
-Copyright and License
-===============================
-
-Copyright (C) 2008 Andrey Kunitsyn (Abyss) All Rights Reserved
-Some procedures are used written by Alexey Kulakov
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-
-Установка:
-==========
-1. Сделайте бэкап Базы Миранды
-2. Скопируйте importtxt.dll, папку importtxt и всё её содержимое в папку Plugins каталога Миранды.
-3. Скопируйте файл pcre3.dll в корень миранды или system32
-4. Содержимое файла importtxt_translate.txt добавьте в конец Лангпака
-5. Запустите миранду
-В меню контактов появится пункт "Import history..." ("Импортировать историю")
-В главном меню появиться такой же пункт - это мастер импорта.
-
-Для автостарта мастера нужно прописать в базе ImportTXT/AutoStart значение 1 типа byte
-
-ВАЖНО:
-======
-Обязательно сделайте бэкап базы!
-Файлы шаблонов должны быть в кодировке ANSI.
-
-
-Описание:
-=========
-Плагин написан с нацеленностью на универсальность, вы можете написать
-свои правила разбора файлов и положить в папку importtxt.
-НО есть некоторые ограничения:
-1. Входные файлы могут быть в любой кодировке (ANSI, UTF8, UCS2)
- (перекодирование происходит с кодовой страницей лангпака, если его нет то с системной)
-2. Каждое сообщение в файле должно содержать заголовок с полной информацией о нем:
- - направление (входящее или исходящее)
- - таймштамп (полная дата, полное время (можно без секунд, но это должно быть обозначено в шаблоне)
- - текст сообщения :)
-3. Начиная с версии 0.0.0.5 поддерживаются входные файлы следующего вида:
- в файле есть заголовок с никами переписывающихся , в заголовке каждого сообщения есть Ник, но нет направления сообщения
- (под этот тип подходят файлы экспортируемые History++)
-4. Для массового импорта необходима информация о контакте назначения (UID или Ник), в заголовке файла или имени файла.
-
-Начиная с версии 0.0.1.2 реализована поддержка некоторых бинарных файлов.
-(каких именно смотрите pattern_cfg)
-Начиная с версии 0.0.1.7 добавлен импорт из XML файлов ICQ5 (для импорта нужно ядро не ниже 0.8.0.21)
-
-Примерный алгоритм работы:
-==========================
-В файле ищется регулярное выражение описанное в шаблоне, при помощи подвыражений выделяется дата, время и тд.
-Всё что находится после него и до следующего считается текстом сообщения.
-
-Дубликаты
-=========
-При импорте происходит простая проверка на дубликаты (направление, таймштамп, размер сообщения) как в import.dll
-
-Написание шаблона:
-==================
-Формат файлов шаблона описан в pattern_cfg
-Примеры написания с комментариями в examples
-
-Подробнее о регулярных выражениях вы можете почитать в интернете ;).
diff --git a/plugins/ImportTXT/ico/def_ico.ico b/plugins/ImportTXT/ico/def_ico.ico Binary files differdeleted file mode 100644 index 5d86592fee..0000000000 --- a/plugins/ImportTXT/ico/def_ico.ico +++ /dev/null diff --git a/plugins/ImportTXT/importtxt.dpr b/plugins/ImportTXT/importtxt.dpr deleted file mode 100644 index 353e5e82dd..0000000000 --- a/plugins/ImportTXT/importtxt.dpr +++ /dev/null @@ -1,155 +0,0 @@ -(*
- ImportTXT plugin for Miranda IM: the free IM client for Microsoft* Windows*
-
- Copyright () 2008 Abyss
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*)
-
-{$IMAGEBASE $2080000}
-library importtxt;
-
-uses
- Windows,
- Messages,
- SysUtils,
- IniFiles,
- m_api,// in '.\inc\m_api.pas',
-{ ImportThrd
- KOL in '.\kol\kol.pas',
- err in '.\kol\err.pas',
- KOLedb in '.\kol\KOLEdb.pas',
-}
- General in 'general.pas',
- ImportT in 'ImportT.pas',
- ImportTU in 'ImportTU.pas',
- ImportThrd in 'ImportThrd.pas',
- PerlRegEx in 'PerlRegEx.pas',
- ImportTxtDlg in 'ImportTxtDlg.pas',
- ImportTxtWiz in 'ImportTxtWiz.pas';
-
-{$R version.res}
-
-const MIID_IMPORTTEXT:TGUID = '{6F376B33-D3F4-4c4f-A96B-77DA08043B06}';
-
-
-var
- hwndWizard:HWND;
- hwndDialog:HWND;
-
-function ContactMenuCommand(wParam: wParam; lParam: lParam): int_ptr; cdecl;
-begin
- result := 0;
- if IsWindow(hwndDialog) then
- begin
- SetForegroundWindow(hwndDialog);
- BringWindowToTop(hwndDialog);
- end
- else
- hwndDialog := CreateDialogParamW(hInstance, MAKEINTRESOURCEW(IDD_IMPDIALOG),
- 0, @IDMainWndProc, wParam);
-end;
-
-function MainMenuCommand(wParam: wParam; lParam: lParam): int_ptr; cdecl;
-begin
- result := 0;
- if (IsWindow(hwndWizard)) then
- begin
- SetForegroundWindow(hwndWizard);
- BringWindowToTop(hwndWizard);
- end
- else
- hwndWizard := CreateDialogW(hInstance, MAKEINTRESOURCEW(IDD_IMPWIZARD), 0, @WizardDlgProc);
-end;
-
-function OnAccountChanged(wParam: wParam; lParam: lParam): int; cdecl;
-begin
- result := 0;
- EnumProtocols;
- if Assigned(OnAccountListChange) then
- OnAccountListChange;
-end;
-
-function OnModulesLoaded(wParam: wParam; lParam: lParam): int; cdecl;
-begin
- EnumProtocols;
- // check for AutoStart
- if (DBReadByte(0, IMPORT_TXT_MODULE, IMPORT_TXT_AS) = 1) and (ProtoCount > 0) then
- begin
- CallService(IMPORT_WIZ_SERVICE, 0, 0);
- DBWriteByte(0, IMPORT_TXT_MODULE, IMPORT_TXT_AS, 0);
- end;
- result := 0;
-end;
-
-function OnPreShutdown(wParam: wParam; lParam: lParam): int; cdecl;
-begin
- if IsWindow(hwndWizard) then
- SendMessage(hwndWizard, WM_CLOSE, 0, 0);
- if IsWindow(hwndDialog) then
- SendMessage(hwndDialog, WM_CLOSE, 0, 0);
- result := 0;
-end;
-
-function Load(): int; cdecl;
-var
- mi:TMO_MenuItem;
-begin
- Langpack_register;
- cp := Langpack_GetDefaultCodePage;
-
- CreateServiceFunction(IMPORT_TXT_SERVICE, @ContactMenuCommand);
- CreateServiceFunction(IMPORT_WIZ_SERVICE, @MainMenuCommand);
-
- FillChar(mi, sizeof(mi), 0);
- SET_UID(@mi, '5FC2C67E-A16B-47B7-A6A1-40BE922CCD93');
- mi.position := 1000090050;
- mi.hIcon := LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DEFAULT));
- mi.szName.a := 'Import history';
- mi.pszService := IMPORT_TXT_SERVICE;
- Menu_AddContacTMenuItem(@mi);
-
- SET_UID(@mi, '0610209E-5BE0-4D57-AAE8-E1CCF1FB78B8');
- mi.position := 500050010;
- mi.pszService := IMPORT_WIZ_SERVICE;
- Menu_AddMainMenuItem(@mi);
-
- HookEvent(ME_SYSTEM_MODULESLOADED, @OnModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, @OnPreShutdown);
- HookEvent(ME_PROTO_ACCLISTCHANGED, @OnAccountChanged);
- result := 0;
-end;
-
-function Unload: int; cdecl;
-begin
- Result := 0;
-end;
-
-exports
- Load, Unload;
-
-begin
- PluginInfo.cbSize :=sizeof(TPLUGININFOEX);
- PluginInfo.shortName :='Import TXT';
- PluginInfo.version :=$0000010A;
- PluginInfo.description:='Imports history saved in TXT files from other clients.';
- PluginInfo.author :='Abyss';
- PluginInfo.copyright :=' 2008 Abyss';
- PluginInfo.homepage :='https://miranda-ng.org/p/ImportTXT/';
- PluginInfo.flags :=UNICODE_AWARE;
- PluginInfo.uuid :=MIID_IMPORTTEXT;
-
- DisableThreadLibraryCalls(hInstance);
-end.
diff --git a/plugins/ImportTXT/importtxt/ICQ5_p.ini b/plugins/ImportTXT/importtxt/ICQ5_p.ini deleted file mode 100644 index d2f468af7d..0000000000 --- a/plugins/ImportTXT/importtxt/ICQ5_p.ini +++ /dev/null @@ -1,9 +0,0 @@ -[General]
-Name=ICQ5 xml files import
-Type=2
-BinProcedure=4
-DefaultExtension=xml
-UseFileName=1
-[FileName]
-Pattern=^[^\r\n]+?\\(\d{5,})-(\d{4,})\.xml$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/ICQ6_p.ini b/plugins/ImportTXT/importtxt/ICQ6_p.ini deleted file mode 100644 index 1d9984962a..0000000000 --- a/plugins/ImportTXT/importtxt/ICQ6_p.ini +++ /dev/null @@ -1,5 +0,0 @@ -[General]
-Name=ICQ6 database
-Type=2
-BinProcedure=3
-DefaultExtension=mdb
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/MAgent_p.ini b/plugins/ImportTXT/importtxt/MAgent_p.ini deleted file mode 100644 index 6b54883d78..0000000000 --- a/plugins/ImportTXT/importtxt/MAgent_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=MobileAgent import pattern
-Type=1
-Charset=UCS2
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^---------------------------([<>])--\r\n([^\r\n]+?)\s\((\d\d?).(\d\d?).(\d\d\d?\d?)\s(\d\d?).(\d\d?).(\d\d?)\)$
-In=>
-Out=<
-Direction=1
-Day=3
-Month=4
-Year=5
-Hours=6
-Minutes=7
-Seconds=8
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\(\d{5,})\.txt$
-InUID=1
diff --git a/plugins/ImportTXT/importtxt/QHF_p.ini b/plugins/ImportTXT/importtxt/QHF_p.ini deleted file mode 100644 index b6eb687502..0000000000 --- a/plugins/ImportTXT/importtxt/QHF_p.ini +++ /dev/null @@ -1,5 +0,0 @@ -[General]
-Name=QHF files import pattern (QIP PDA and Infinum)
-Type=2
-BinProcedure=2
-DefaultExtension=qhf
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/SEmidprms_p.ini b/plugins/ImportTXT/importtxt/SEmidprms_p.ini deleted file mode 100644 index ca0637d8f6..0000000000 --- a/plugins/ImportTXT/importtxt/SEmidprms_p.ini +++ /dev/null @@ -1,5 +0,0 @@ -[General]
-Name=Jimm midp-rms SonyEricsson
-Type=2
-BinProcedure=5
-DefaultExtension=d
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/bayanICQ_p.ini b/plugins/ImportTXT/importtxt/bayanICQ_p.ini deleted file mode 100644 index f85bb397e5..0000000000 --- a/plugins/ImportTXT/importtxt/bayanICQ_p.ini +++ /dev/null @@ -1,9 +0,0 @@ -[General]
-Name=bayanICQ import pattern
-Type=2
-BinProcedure=6
-DefaultExtension=hf
-UseFileName=1
-[FileName]
-Pattern=^[^\r\n]+?\\hist(\d{5,})\.hf$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/dichat_p.ini b/plugins/ImportTXT/importtxt/dichat_p.ini deleted file mode 100644 index 3fd5c6a25e..0000000000 --- a/plugins/ImportTXT/importtxt/dichat_p.ini +++ /dev/null @@ -1,24 +0,0 @@ -[General]
-Name=D[i]Chat import pattern
-Type=1
-Charset=ANSI
-UseHeader=2
-UsePreMsg=1
-[Message]
-Pattern=^---(<<<|>>>)---\r\n\s([^\r\n]+?)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\):$
-In=<<<
-Out=>>>
-Direction=1
-Day=3
-Month=4
-Year=5
-Hours=6
-Minutes=7
-Seconds=8
-[PreMessage]
-PreRN=1
-AfterRN=2
-[Header]
-Pattern=^\t ([^\r\n]+?)\s\((\d{5,})\)\r\n\t D\[i\]Chat\s[^\r\n]+?\r\n
-InNick=1
-InUID=2
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/historypp_p.ini b/plugins/ImportTXT/importtxt/historypp_p.ini deleted file mode 100644 index 7d5e353e48..0000000000 --- a/plugins/ImportTXT/importtxt/historypp_p.ini +++ /dev/null @@ -1 +0,0 @@ -[General]
Name=History++ pattern
Type=1
Charset=UCS2
UseHeader=3
UsePreMsg=1
[Message]
Pattern=^\[(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\]\s([^\r\n]+?):$
Direction=7
Day=1
Month=2
Year=3
Hours=4
Minutes=5
Seconds=6
[Header]
Pattern=^###\r\n###\s[^\r\n]+?\r\n###\s([^\r\n]+?)\s\([^\r\n]+?:\s([^\r\n]+?)\)\s-\s([^\r\n]+?)\s\([^\r\n]+?:\s([^\r\n]+?)\)\r\n###\s[^\r\n]+?\r\n###\r\n
In=3
Out=1
InNick=3
OutNick=1
InUID=4
OutUID=2
[PreMessage]
PreRN=1
AfterRN=2
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/jasmine.ini b/plugins/ImportTXT/importtxt/jasmine.ini deleted file mode 100644 index 0f79cafb31..0000000000 --- a/plugins/ImportTXT/importtxt/jasmine.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Jasmine IM import pattern
-Type=1
-Charset=UCS2
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^(?:-*\n)?(<<|>>):\s(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)-(\d\d?):(\d\d?):(\d\d?):\n
-In=>>
-Out=<<
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\\[(.*)\]\.txt$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/jimm_p.ini b/plugins/ImportTXT/importtxt/jimm_p.ini deleted file mode 100644 index 10d9ab2100..0000000000 --- a/plugins/ImportTXT/importtxt/jimm_p.ini +++ /dev/null @@ -1,24 +0,0 @@ -[General]
-Name=Jimm import pattern
-Type=1
-Charset=ANSI
-UseHeader=2
-UsePreMsg=1
-[Message]
-Pattern=^------------------------------------(<<<|>>>)-\r\n\s([^\r\n]+?)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\):$
-In=<<<
-Out=>>>
-Direction=1
-Day=3
-Month=4
-Year=5
-Hours=6
-Minutes=7
-Seconds=8
-[PreMessage]
-PreRN=1
-AfterRN=2
-[Header]
-Pattern=^\r\n\t ([^\r\n]+?)\s\((\d{5,})\)\r\n\t Jimm\s[^\r\n]+?\r\n
-InNick=1
-InUID=2
diff --git a/plugins/ImportTXT/importtxt/jimmws2_p.ini b/plugins/ImportTXT/importtxt/jimmws2_p.ini deleted file mode 100644 index 8f0baa9b1f..0000000000 --- a/plugins/ImportTXT/importtxt/jimmws2_p.ini +++ /dev/null @@ -1,22 +0,0 @@ -[General]
-Name=Jimm import pattern(without seconds) modified
-Type=1
-Charset=ANSI
-UseHeader=3
-UsePreMsg=1
-[Message]
-Pattern=([^\r\n]+?)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?)\):\r\n
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-[PreMessage]
-PreRN=1
-AfterRN=2
-[Header]
-Pattern=^\r\n\t ([^\r\n]+?)\s\((\d{5,})\)\r\n\t Jimm\s[^\r\n]+?\r\n
-In=1
-InNick=1
-InUID=2
diff --git a/plugins/ImportTXT/importtxt/jimmws_p.ini b/plugins/ImportTXT/importtxt/jimmws_p.ini deleted file mode 100644 index 59c609fd50..0000000000 --- a/plugins/ImportTXT/importtxt/jimmws_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Jimm import pattern(without seconds)
-Type=1
-Charset=ANSI
-UseHeader=2
-UsePreMsg=1
-[Message]
-Pattern=^------------------------------------(<<<|>>>)-\r\n\s([^\r\n]+?)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?)\):$
-In=<<<
-Out=>>>
-Direction=1
-Day=3
-Month=4
-Year=5
-Hours=6
-Minutes=7
-[PreMessage]
-PreRN=1
-AfterRN=2
-[Header]
-Pattern=^\r\n\t ([^\r\n]+?)\s\((\d{5,})\)\r\n\t Jimm\s[^\r\n]+?\r\n
-InNick=1
-InUID=2
diff --git a/plugins/ImportTXT/importtxt/mContact_p.ini b/plugins/ImportTXT/importtxt/mContact_p.ini deleted file mode 100644 index 925c712330..0000000000 --- a/plugins/ImportTXT/importtxt/mContact_p.ini +++ /dev/null @@ -1,9 +0,0 @@ -[General]
-Name=mContact import pattern
-Type=2
-BinProcedure=1
-UseFileName=1
-DefaultExtension=dat
-[FileName]
-Pattern=^[^\r\n]+?\\([^\r\n\\]+?)\.dat$
-InNick=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/msgexport_p.ini b/plugins/ImportTXT/importtxt/msgexport_p.ini deleted file mode 100644 index 828c23f80b..0000000000 --- a/plugins/ImportTXT/importtxt/msgexport_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Message export import pattern
-Type=1
-Charset=UTF8
-UseHeader=3
-UsePreMsg=1
-[Message]
-Pattern=^([^\r\n]+?)[\s]+?(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\s
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[Header]
-Pattern=^------------------------------------------------\r\n[\s]+?History for\r\nUser[\s]+?:\s([^\r\n]+?)\r\n(.*\r\n)+?Nick[\s]+?:\s([^\r\n]+?)\r\n(.*\r\n)+?^------------------------------------------------$
-In=1
-InNick=3
-[PreMessage]
-PreRN=0
-AfterRN=1
-PreSP=-2
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/nokmidprms_p.ini b/plugins/ImportTXT/importtxt/nokmidprms_p.ini deleted file mode 100644 index d743b1a9df..0000000000 --- a/plugins/ImportTXT/importtxt/nokmidprms_p.ini +++ /dev/null @@ -1,9 +0,0 @@ -[General]
-Name=Jimm midp-rms Nokia
-Type=2
-BinProcedure=5
-DefaultExtension=rms
-UseFileName=1
-[FileName]
-Pattern=^[^\r\n]+?\\Jimm_m_hist(\d{5,})\.rms$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/pigeon_p.ini b/plugins/ImportTXT/importtxt/pigeon_p.ini deleted file mode 100644 index 7487075089..0000000000 --- a/plugins/ImportTXT/importtxt/pigeon_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Pigeon import pattern
-Type=1
-Charset=ANSI
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^\[(I|O)\s(\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?)\]$
-In=I
-Out=O
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\msg_(\d{5,})\.txt$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/qip_p.ini b/plugins/ImportTXT/importtxt/qip_p.ini deleted file mode 100644 index ddb112f8f5..0000000000 --- a/plugins/ImportTXT/importtxt/qip_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=QIP import pattern
-Type=1
-Charset=ANSI
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^--------------------------------------([<>])-\r\n([^\r\n]+?)\s\((\d\d?):(\d\d?):(\d\d?)\s(\d\d?)/(\d\d?)/(\d\d\d?\d?)\)$
-In=<
-Out=>
-Direction=1
-Day=6
-Month=7
-Year=8
-Hours=3
-Minutes=4
-Seconds=5
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\(\d{5,})\.txt$
-InUID=1
diff --git a/plugins/ImportTXT/importtxt/rnq_p.ini b/plugins/ImportTXT/importtxt/rnq_p.ini deleted file mode 100644 index 1fe75ad7d6..0000000000 --- a/plugins/ImportTXT/importtxt/rnq_p.ini +++ /dev/null @@ -1,22 +0,0 @@ -[General]
-Name=RnQ pattern
-Type=1
-Charset=ANSI
-UseHeader=3
-UsePreMsg=1
-[Header]
-Pattern=^###\s([^\r\n]+)=([^\r\n]+)\s###
-InUID=2
-In=1
-[Message]
-Pattern=^ (\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?):(\d\d?):(\d\d?),\s([^\r\n]+?)$
-Direction=7
-Day=1
-Month=2
-Year=3
-Hours=4
-Minutes=5
-Seconds=6
-[PreMessage]
-PreRN=1
-AfterRN=2
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/smaper_p.ini b/plugins/ImportTXT/importtxt/smaper_p.ini deleted file mode 100644 index d02eedae78..0000000000 --- a/plugins/ImportTXT/importtxt/smaper_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Smaper(vmICQ) import pattern
-Type=1
-Charset=UCS2
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^(<-|->)\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?)\.(\d\d?)\.(\d\d?)\)$
-In=<-
-Out=->
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\(\d{5,})\.txt$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxt/smapern_p.ini b/plugins/ImportTXT/importtxt/smapern_p.ini deleted file mode 100644 index cce53f048c..0000000000 --- a/plugins/ImportTXT/importtxt/smapern_p.ini +++ /dev/null @@ -1,23 +0,0 @@ -[General]
-Name=Smaper (with Nick) import pattern
-Type=1
-Charset=UCS2
-UsePreMsg=1
-UseFileName=1
-[Message]
-Pattern=^(<-|->)\s[^\r\n]+?\s\((\d\d?)\.(\d\d?)\.(\d\d\d?\d?)\s(\d\d?)\.(\d\d?)\.(\d\d?)\)$
-In=<-
-Out=->
-Direction=1
-Day=2
-Month=3
-Year=4
-Hours=5
-Minutes=6
-Seconds=7
-[PreMessage]
-PreRN=1
-AfterRN=2
-[FileName]
-Pattern=^[^\r\n]+?\\(\d{5,})\.txt$
-InUID=1
\ No newline at end of file diff --git a/plugins/ImportTXT/importtxtdlg.pas b/plugins/ImportTXT/importtxtdlg.pas deleted file mode 100644 index 3acb77f0a7..0000000000 --- a/plugins/ImportTXT/importtxtdlg.pas +++ /dev/null @@ -1,227 +0,0 @@ -unit ImportTxtDlg;
-
-interface
-
-uses
- m_api,
- Windows, Messages, SysUtils, CommDlg, IniFiles,
- ImportThrd, general, ImportTU, FileDlgs;
-
-
-{$I ImpDlgRes.inc}
-
-function IDMainWndProc(Dialog:HWnd; hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
-
-implementation
-
-{$R ImpTxtDlg.res}
-
-type
- TImpTxtDlgData = record
- cbSize: integer;
- CanStart: boolean;
- ChoFile: boolean;
- ChoPatt: boolean;
- PattFError: boolean;
- ITStarted: boolean;
- ITFinished: boolean;
- StartTime: TDateTime;
- FinishTime: TDateTime;
- IndexOfPattern: integer;
- oFN: integer;
- hContact: THandle;
- ImportThrd: TImportThrd;
- end;
-
-type PImpTxtDlgData = ^TImpTxtDlgData;
-
-var ITDD:TImpTxtDlgData;
-
-procedure AddStatusMessage(hDLG:HWND; msg:WideString);
-begin
- SendDlgItemMessageW(hDLG,IDC_STATUSLIST,LB_SETCURSEL,
- SendDlgItemMessageW(hDLG,IDC_STATUSLIST,LB_ADDSTRING,0,lparam(PWideChar(msg))),0);
-end;
-
-procedure FillComboBox(hDlg:hWnd); //
-var
- i:integer;
-begin
- ITDD.PattFError:=true;
- ReadPatterns;
- SendDlgItemMessage(hDLG, IDC_TYPECOMBO, CB_RESETCONTENT, 0, 0);
- if Length(TxtPatterns) > 0 then
- begin
- For i := 0 to High(TxtPatterns) do
- SendDlgItemMessage(hDLG, IDC_TYPECOMBO, CB_ADDSTRING, 0, lparam(PChar(TxtPatterns[i].Name)));
- ITDD.PattFError := false;
- end
- else
- begin
- AddStatusMessage(hDLG, TranslateWideString('No Files Patterns Found'));
- EnableWindow(GetDlgItem(hDLG, IDC_TYPECOMBO), false);
- ITDD.ChoPatt := false;
- end;
-end;
-
-procedure MStart(hDLG: HWnd); //
-begin
- with ITDD do
- begin
- CanStart := ChoFile and ChoPatt and (not PattFError);
- EnableWindow(GetDlgItem(hDLG, IDSTART), CanStart);
- end;
-end;
-
-function IDMainWndProc(Dialog:HWnd; hMessage:uint;wParam:WPARAM;lParam:LPARAM):lresult; stdcall;
-//
-var
- s:WideString;
- tempwstr:PWideChar;
- H,Mi,sec,ms:word;
-
-begin
- result:= 0;
- case hMessage of
- WM_DESTROY:
- begin
- if ITDD.ImportThrd <> Nil then
- ITDD.ImportThrd.Terminate;
- SetLastPattern(SendDlgItemMessage(Dialog, IDC_TYPECOMBO, CB_GETCURSEL, 0, 0));
- end;
-
- WM_INITDIALOG:
- begin
- TranslateDialogDefault(Dialog);
- tempwstr := Clist_GetContactDisplayName(lParam,0);
- s := WideFormat(TranslateWideString('Import history to %s (%s)'), [tempwstr, GetContactID(lParam)]);
- SetWindowTextW(Dialog, PWideChar(s));
- SendMessage(Dialog, WM_SETICON, ICON_SMALL, LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DEFAULT)));
- FillChar(ITDD, SizeOf(TImpTxtDlgData), 0);
- with ITDD do
- begin
- cbSize := SizeOf(TImpTxtDlgData);
- hContact := lParam;
- CanStart := false;
- ChoFile := false;
- ChoPatt := true;
- PattFError := false;
- ITStarted := false;
- ITFinished := false;
- end;
-
- FillComboBox(Dialog);
- SendDlgItemMessage(Dialog, IDC_TYPECOMBO, CB_SETCURSEL, GetLastPattern, 0);
- ITDD.IndexOfPattern := GetLastPattern;
- MStart(Dialog);
- CheckDlgButton(Dialog, IDC_CHKDUP, BST_CHECKED);
- CheckForDuplicates := true;
- CheckDlgButton(Dialog, IDC_SHOWDUP, BST_UNCHECKED);
- CheckForDuplicates := false;
- ShowWindow(Dialog, SW_NORMAL);
- end;
-
- WM_COMMAND:
- begin
- if (HiWord(wParam) = CBN_SELCHANGE) and (LoWord(wParam) = IDC_TYPECOMBO) then //
- begin
- ITDD.ChoPatt := true;
- ITDD.IndexOfPattern := SendDlgItemMessage(Dialog, IDC_TYPECOMBO, CB_GETCURSEL, 0, 0);
- MStart(Dialog);
- end;
-
- if (HiWord(wParam) = BN_CLICKED) and (LoWord(wParam) = IDC_CHKDUP) then
- EnableWindow(GetDlgItem(Dialog, IDC_SHOWDUP),
- IsDlgButtonChecked(Dialog, IDC_CHKDUP)<>BST_UNCHECKED);
-
- case LoWord(wParam) of
- IDCLOSE:
- DestroyWindow(Dialog);
- IDC_BRWSBTN:
- begin // "..."
- s := OpenDialogExecute(Dialog, 0, ITDD.oFN,
- TxtPatterns[ITDD.IndexOfPattern].DefExtension);
- ITDD.ChoFile := s <> '';
- SendDlgItemMessageW(Dialog, IDC_FILENAME, WM_SETTEXT, 0, tlparam(PWideChar(s)));
- MStart(Dialog);
- end;
- IDSTART:
- begin //
- with ITDD do
- if CanStart then
- begin
- EnableWindow(GetDlgItem(Dialog, IDSTART), false);
- EnableWindow(GetDlgItem(Dialog, IDCLOSE), false);
- EnableWindow(GetDlgItem(Dialog, IDC_TYPECOMBO), false);
- EnableWindow(GetDlgItem(Dialog, IDC_BRWSBTN), false);
- ImportThrd := TImportThrd.Create(true);
- ImportThrd.FreeOnTerminate := true;
- ImportThrd.DContact.hContact := hContact;
- CheckForDuplicates := LongBool(IsDlgButtonChecked(Dialog, IDC_CHKDUP));
- ShowDuplicates := LongBool(IsDlgButtonChecked(Dialog, IDC_SHOWDUP));
- H := SendDlgItemMessageW(Dialog, IDC_FILENAME, WM_GETTEXTLENGTH, 0, 0) + 1;
- SetLength(s, H);
- SendDlgItemMessageW(Dialog, IDC_FILENAME, WM_GETTEXT, H, tlparam(PWideChar(s)));
- ImportThrd.FileNames := s + #0 + #0;
- ImportThrd.OffsetFileName := oFN;
- ImportThrd.WorkPattern := TxtPatterns[IndexOfPattern];
- ImportThrd.ParentHWND := Dialog;
- ImportThrd.Resume;
- end;
- end;
- end;
- end;
- WM_CLOSE:
- begin
- DestroyWindow(Dialog);
- end;
- //
- //
- ITXT_THREAD_ALLSTARTED:
- begin
- ITDD.ITStarted := true;
- ITDD.StartTime := Time;
- end;
- ITXT_THREAD_START:
- begin
- AddStatusMessage(Dialog, TranslateWideString('Import started...'));
- end;
- //
- ITXT_THREAD_MAXPROGRESS:
- SendDlgItemMessage(Dialog, IDC_PROGRESS, PBM_SETRANGE, 0, MakeLParam(0, lParam));
- // ...
- ITXT_THREAD_PROGRESS:
- SendDlgItemMessage(Dialog, IDC_PROGRESS, PBM_SETPOS, wParam, 0);
- //
- ITXT_THREAD_ERROR:
- AddStatusMessage(Dialog, TranslateWideString(PWideChar(wParam)));
- //
- ITXT_THREAD_FINISH:
- begin
- ITDD.ITFinished := true;
- ITDD.FinishTime := Time;
- DecodeTime(ITDD.FinishTime - ITDD.StartTime, H, Mi, sec, ms);
- AddStatusMessage(Dialog, WideFormat(TranslateWideString('Added: %d messages'), [wParam]));
- AddStatusMessage(Dialog, WideFormat(TranslateWideString('Duplicates: %d messages'), [lParam]));
- AddStatusMessage(Dialog, WideFormat(TranslateWideString('In: %d:%d:%d'), [H, Mi, sec]));
- AddStatusMessage(Dialog, '');
- SendDlgItemMessageW(Dialog, IDC_FILENAME, WM_SETTEXT, 0, 0);
- ITDD.ChoFile := false;
- EnableWindow(GetDlgItem(Dialog, IDC_TYPECOMBO), true);
- EnableWindow(GetDlgItem(Dialog, IDC_BRWSBTN), true);
- EnableWindow(GetDlgItem(Dialog, IDCLOSE), true);
- end;
- //
- ITXT_THREAD_START_FILE:
- AddStatusMessage(Dialog, WideFormat(TranslateWideString('File: %s'), [PWideChar(wParam)]));
- //
- ITXT_THREAD_DEST_CONTACT:
- begin
- s := GetContactID(wParam, '', true) + ' | ' + GetContactNick(wParam, '', true);
-
- AddStatusMessage(Dialog, WideFormat(TranslateWideString('To: %s'), [s]));
- end;
- end;
-end;
-
-end.
diff --git a/plugins/ImportTXT/make.bat b/plugins/ImportTXT/make.bat deleted file mode 100644 index 397b13ed7d..0000000000 --- a/plugins/ImportTXT/make.bat +++ /dev/null @@ -1,30 +0,0 @@ -@echo off
-set p1=%1
-set p2=%2
-if "%p1%" == "" (echo "please specify target platform by adding 'fpc' or 'fpc64 parameter to command line!'"&&pause&&goto :EOF)
-if "%p2%" == "" (echo "please specify target output directory by adding 15 for bin15 to command line!'"&&pause&&goto :EOF)
-if /i '%1' == 'fpc' (
- set OUTDIR="..\..\bin%2\Release\Plugins"
- set FPCBIN=fpc.exe
-) else if /i '%1' == 'fpc64' (
- set OUTDIR="..\..\bin%2\Release64\Plugins"
- set FPCBIN=ppcrossx64.exe
-)
-set PROJECT=ImportTXT
-
-if not exist %OUTDIR% mkdir %OUTDIR%
-md tmp
-
-rem brcc32 -foImpTxt_Ver.res ImpTxt_Ver.rc
-rem brcc32 -foImpTxtDlg.res ImpTxtDlg.rc
-rem brcc32 -foImpTxtWiz.res ImpTxtWiz.rc
-rc version.rc
-
-%FPCBIN% @..\Utils.pas\fpc.cfg %PROJECT%.dpr %3 %4 %5 %6 %7 %8 %9
-if errorlevel 1 exit /b 1
-
-move .\tmp\%PROJECT%.dll %OUTDIR%
-move .\tmp\%PROJECT%.map .
-del /Q tmp\*
-rd tmp
-exit /b 0
diff --git a/plugins/ImportTXT/version.rc b/plugins/ImportTXT/version.rc deleted file mode 100644 index e1cede5c9b..0000000000 --- a/plugins/ImportTXT/version.rc +++ /dev/null @@ -1,51 +0,0 @@ -// Microsoft Visual C++ generated resource script.
-//
-#ifdef APSTUDIO_INVOKED
-#error this file is not editable by Microsoft Visual C++
-#endif //APSTUDIO_INVOKED
-
-#include "..\..\include\m_version.h"
-
/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-#pragma code_page(1252)
-#endif //_WIN32
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,0,1,12
- PRODUCTVERSION MIRANDA_VERSION_COREVERSION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "000004b0"
- BEGIN
- VALUE "CompanyName", "Miranda Open Source Project"
- VALUE "FileDescription", "ImportTXT plugin for Miranda NG"
- VALUE "FileVersion", "0.0.1.12"
- VALUE "InternalName", "importtxt"
- VALUE "LegalCopyright", " 2008 Abyss"
- VALUE "LegalTrademarks", "Gnu General Public License V2"
- VALUE "OriginalFilename", "importtxt.dll"
- VALUE "ProductName", "Import TXT Module"
- VALUE "ProductVersion", "0.0.1.12"
- VALUE "Comments", "Imports history saved in TXT files from other clients" END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x0, 1200
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/QuickSearch/version.RES b/plugins/QuickSearch/version.RES Binary files differnew file mode 100644 index 0000000000..ac94f5ecf9 --- /dev/null +++ b/plugins/QuickSearch/version.RES diff --git a/plugins/Watrack/version.RES b/plugins/Watrack/version.RES Binary files differnew file mode 100644 index 0000000000..3c8432b9e9 --- /dev/null +++ b/plugins/Watrack/version.RES diff --git a/plugins/mRadio/version.RES b/plugins/mRadio/version.RES Binary files differnew file mode 100644 index 0000000000..b130578b35 --- /dev/null +++ b/plugins/mRadio/version.RES diff --git a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt index dc04af300a..ac5d4b7043 100644 --- a/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt +++ b/tools/build_scripts/bin15/z2_PackPluginUpdater_x32.txt @@ -66,7 +66,6 @@ Plugins\iehistory.dll Plugins\ieview.dll Plugins\ignorestate.dll Plugins\import.dll -Plugins\importtxt.dll Plugins\irc.dll Plugins\jabber.dll Plugins\keyboardnotify.dll diff --git a/tools/build_scripts/z1_ReBuild_Full.bat b/tools/build_scripts/z1_ReBuild_Full.bat index 7f098d232d..3c71d673c6 100644 --- a/tools/build_scripts/z1_ReBuild_Full.bat +++ b/tools/build_scripts/z1_ReBuild_Full.bat @@ -35,7 +35,7 @@ if "%comp%"=="bin15" ( MsBuild.exe "mir_full.sln" /m /t:Rebuild /p:Configuration=Release;Platform="%ptr%" /fileLogger /fileLoggerParameters:LogFile=Logs\full%tp%.log;errorsonly;warningsonly;summary MsBuild.exe "mir_icons.sln" /m /t:Rebuild /p:Configuration=Release;Platform="%ptr%" /fileLogger /fileLoggerParameters:LogFile=Logs\icons%tp%.log;errorsonly;warningsonly;summary -call pascal%tp%.bat +call pascal.bat %tp% pushd ..\plugins\HistoryPlusPlus call make.bat %tp% @@ -92,12 +92,6 @@ copy /V /Y ..\plugins\Boltun\src\Engine\boltun.mindw "Release%tp%\Plugins\" copy /V /Y ..\plugins\Watrack\player.ini "Release%tp%\Plugins\" copy /V /Y ..\plugins\RemovePersonalSettings\docs\RemovePersonalSettings.ini "Release%tp%\" -if /i '%tp%' == '32' ( - md "Release32\Plugins\Importtxt" - copy /V /Y ..\plugins\ImportTXT\importtxt\*.ini "Release32\Plugins\Importtxt\" - copy /V /Y %SourceDir%\tools\build_scripts\redist\pcre3.dll "Release32\Libs" -) - rem xcopy /S /V /Y "..\delphi\%tp%" "Release%tp%" xcopy /S /V /Y "..\pre-symbols\%comp%\%tp%" "Symbols%tp%" xcopy /S /V /Y "..\pre-build\%comp%\%tp%" "Release%tp%" diff --git a/tools/build_scripts/z2_PackPluginUpdater.bat b/tools/build_scripts/z2_PackPluginUpdater.bat index 7bba9862c0..37d6d05534 100644 --- a/tools/build_scripts/z2_PackPluginUpdater.bat +++ b/tools/build_scripts/z2_PackPluginUpdater.bat @@ -57,7 +57,6 @@ for /f %%a in ('dir plugins\*.dll /B /L') do ( if /I "%%a"=="HistoryPP.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\HistoryPP_icons.dll") if /I "%%a"=="ICQ.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_ICQ.dll" "Icons\xStatus_ICQ.dll") if /I "%%a"=="Import.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Libs\sqlite3.mir") - if /I "%%a"=="ImportTXT.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Libs\pcre3.dll" Plugins\Importtxt\*.ini) if /I "%%a"=="IRC.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_IRC.dll") if /I "%%a"=="Jabber.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Icons\Proto_Jabber.dll" "Icons\xStatus_Jabber.dll" "Libs\libaxolotl.mir") if /I "%%a"=="Listeningto.dll" (%ZipIt% "%Arch%\Plugins\%%~na.zip" "Plugins\Listeningto\*.dll") |