summaryrefslogtreecommitdiff
path: root/plugins/ImportTXT/BICQ6IP.inc
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ImportTXT/BICQ6IP.inc')
-rw-r--r--plugins/ImportTXT/BICQ6IP.inc166
1 files changed, 84 insertions, 82 deletions
diff --git a/plugins/ImportTXT/BICQ6IP.inc b/plugins/ImportTXT/BICQ6IP.inc
index af8c197e74..f3169374a3 100644
--- a/plugins/ImportTXT/BICQ6IP.inc
+++ b/plugins/ImportTXT/BICQ6IP.inc
@@ -1,91 +1,93 @@
-{$ifdef BIN_IMPORT_}
-var DS: PDataSource;
- SS: PSession;
- QR1: PQuery;
+{$IFDEF BIN_IMPORT_}
var
- OneContact:boolean;
- flags:integer;
- timestamp:LongWord;
- Msg:string;
+ DS: PDataSource;
+ SS: PSession;
+ QR1: PQuery;
-function FindUIDinDB(too:string):string;
-var QR2: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;
+ 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}
+{$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_SENT or DBEF_READ
- else flags:=DBEF_READ;
- if IsMirandaUnicode then flags:=flags or DBEF_UTF;
- timestamp:=DateTimeToTimeStamp(QR1.DFieldByName['date']-693594);
- Msg:=QR1.SFieldByName['subject'];
- if IsMirandaUnicode then
- begin
- tempstr:=ANSIToUTF8(PAnsiChar(Msg),tempstr,cp);
- Msg:=tempstr;
- FreeMem(tempstr);
- end;
- AddMsgToDB(DContact.hContact,flags,timestamp,Msg,AddedMessages,Duplicates);
- end;
- end;
- except
- ShowException(ExceptObject,ExceptAddr)
+ 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('Its not %s file'), ['ICQ6 mdb']);
+ DoMessage(ITXT_THREAD_ERROR, wparam(PWideChar(s)), 0);
end;
- QR1.Next;
- DoMessage(ITXT_THREAD_PROGRESS,QR1.CurIndex,0);
- end; //for
- end
- else
- begin
- s:=WideFormat(TranslateWideString('Its not %s file'),['ICQ6 mdb']);
- DoMessage(ITXT_THREAD_ERROR,integer(PWideChar(s)),0);
- end;
- finally
- DS.Free;
- DS := nil;
- SS := nil;
- QR1 := nil;
- end;
+ finally
+ DS.Free;
+ DS := nil;
+ SS := nil;
+ QR1 := nil;
+ end;
end;
-{$endif}
-
+{$ENDIF}