OSDN Git Service

・板一覧更新の処理メッセージを追加
[gikonavigoeson/gikonavi.git] / NewBoard.pas
1 unit NewBoard;
2
3 interface
4
5 uses
6         Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7         Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
8         IdTCPConnection, IdTCPClient, IdHTTP, IDException, StdCtrls, IniFiles,
9         GikoSystem, BoardGroup;
10
11 type
12         TNewBoardItem = record
13                 FResponseCode: Integer;
14                 FContent: string;
15         end;
16
17         TNewBoardDialog = class(TForm)
18                 Label1: TLabel;
19                 MessageMemo: TMemo;
20                 UpdateButton: TButton;
21         CloseButton: TButton;
22                 Indy: TIdHTTP;
23                 IdAntiFreeze: TIdAntiFreeze;
24                 StopButton: TButton;
25         BoardURLComboBox: TComboBox;
26         Label13: TLabel;
27         EditIgnoreListsButton: TButton;
28         Label2: TLabel;
29     SakuCheckBox: TCheckBox;
30                 procedure UpdateButtonClick(Sender: TObject);
31                 procedure StopButtonClick(Sender: TObject);
32                 procedure CloseButtonClick(Sender: TObject);
33                 procedure FormCreate(Sender: TObject);
34         procedure EditIgnoreListsButtonClick(Sender: TObject);
35         procedure FormClose(Sender: TObject; var Action: TCloseAction);
36         private
37                 { Private \90é\8c¾ }
38                 IgnoreLists : TStringList;
39                 FAbort: Boolean;
40                 function BoardDownload(const URL: String): TNewBoardItem;
41                 function BoardLoardFromFile(const FilePath: String): String;
42                 function UpdateURL(s: string): boolean;
43                 procedure SetIgnoreCategory(b: boolean);
44                 procedure EditIgnoreList(Sender: TObject);
45                 procedure UpdateIgnoreList(Sender: TObject);
46         function CheckDeleteItem(ini: TMemIniFile): Boolean;
47         public
48                 { Public \90é\8c¾ }
49         class procedure InitHTTPClient(client : TIdHTTP);
50         end;
51
52 var
53         NewBoardDialog: TNewBoardDialog;
54
55
56 implementation
57
58 uses Giko, IdHeaderList, MojuUtils, GikoDataModule;
59
60 {$R *.dfm}
61
62 procedure TNewBoardDialog.UpdateButtonClick(Sender: TObject);
63 var
64         Item: TNewBoardItem;
65         URL : String;
66         protocol, host, path, document, port, bookmark: String;
67     TabURLs: TStringList;
68 begin
69         try
70                 MessageMemo.Clear;
71                 GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
72                 FAbort := False;
73                 UpdateButton.Enabled := False;
74                 StopButton.Enabled := True;
75                 CloseButton.Enabled := False;
76                 EditIgnoreListsButton.Enabled := False;
77                 URL := BoardURLComboBox.Text;
78                 GikoSys.ParseURI(URL, protocol, host, path, document, port, bookmark);
79                 if (protocol = '') then begin
80                         Item.FContent := BoardLoardFromFile(URL);
81                 end else if (AnsiPos('http', protocol) > 0) then begin
82                         Item := BoardDownload(URL);
83                 end;
84                 StopButton.Enabled := False;
85                 if FAbort then
86                         Exit;
87                 if Item.FContent <> '' then begin
88             TabURLs := TStringList.Create;
89             try
90                 GikoDM.GetTabURLs(TabURLs);
91                         if (UpdateURL(Item.FContent)) then begin
92                                 GikoForm.ReloadBBS;
93                             end;
94                 GikoDM.OpenURLs(TabURLs);
95             finally
96                         TabURLs.Free;
97             end;
98                 end else
99                         MessageMemo.Lines.Add('\83_\83E\83\93\83\8d\81[\83h\82ª\8e¸\94s\82µ\82Ü\82µ\82½[' + IntToStr(Item.FResponseCode) + ']');
100         finally
101                 UpdateButton.Enabled := True;
102                 StopButton.Enabled := False;
103                 CloseButton.Enabled := True;
104                 EditIgnoreListsButton.Enabled := True;
105         end;
106 end;
107
108 procedure TNewBoardDialog.StopButtonClick(Sender: TObject);
109 begin
110         FAbort := True;
111         Indy.DisconnectSocket;
112 end;
113
114 procedure TNewBoardDialog.CloseButtonClick(Sender: TObject);
115 begin
116         Close;
117 end;
118
119 function TNewBoardDialog.BoardDownload(const URL: String): TNewBoardItem;
120 var
121         Stream: TMemoryStream;
122         s: string;
123         i: Integer;
124 begin
125     InitHTTPClient( Indy );
126
127         Indy.Request.UserAgent := GikoSys.GetUserAgent;
128         Indy.Request.Referer := '';
129         Indy.Request.AcceptEncoding := 'gzip';
130
131         Indy.Request.CacheControl := 'no-cache';
132         Indy.Request.CustomHeaders.Add('Pragma: no-cache');
133
134 //      s := '';
135         Stream := TMemoryStream.Create;
136         try
137                 try
138                         MessageMemo.Lines.Add('\88È\89º\82Ì\8fê\8f\8a\82©\82ç\8eæ\93¾\82µ\82Ü\82·');
139                         //MessageMemo.Lines.Add(GikoSys.Setting.BoardURL2ch);
140                         MessageMemo.Lines.Add(URL);
141                         MessageMemo.Lines.Add('\83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·');
142                         IdAntiFreeze.Active := True;
143                         try
144                                 Indy.Get(URL, Stream);
145                         finally
146                                 IdAntiFreeze.Active := False;
147                         end;
148                         MessageMemo.Lines.Add('\83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½');
149                         MessageMemo.Lines.Add('\83f\81[\83^\82ð\93W\8aJ\82µ\82Ü\82·\81F' + IntToStr(Stream.Size) + 'Byte\81^' + Indy.Response.ContentEncoding);
150                         Result.FContent := GikoSys.GzipDecompress(Stream, Indy.Response.ContentEncoding);
151                         MessageMemo.Lines.Add('\83f\81[\83^\93W\8aJ\82ª\8a®\97¹\82µ\82Ü\82µ\82½');
152                 except
153                         on E: EIdConnectException do begin
154                                 MessageMemo.Lines.Add('');
155                                 MessageMemo.Lines.Add('\90Ú\91±\82ª\8e¸\94s\82µ\82Ü\82µ\82½ \89ñ\90ü\82â\83v\83\8d\83L\83V\81AFW\82Ì\8fó\91Ô\82ð\92²\82×\82Ä\82­\82¾\82³\82¢');
156                                 MessageMemo.Lines.Add('FW\82ð\93ü\82ê\82Ä\82¢\82é\90l\82Í\90Ý\92è\82ð\8am\94F\82µ\82Ä\82­\82¾\82³\82¢');
157                                 MessageMemo.Lines.Add('NEC\82ÌPC\82Ì\8fê\8d\87\82ÍPC GATE\82ª\88«\82³\82ð\82µ\82Ä\82¢\82é\89Â\94\\90«\82ª\8d\82\82¢\82Å\82·');
158                                 MessageMemo.Lines.Add('Message: ' + E.Message);
159                         end;
160                         on E: Exception do begin
161                                 if FAbort then
162                                         MessageMemo.Lines.Add('\83_\83E\83\93\83\8d\81[\83h\82ð\92\86\92f\82µ\82Ü\82µ\82½')
163                                 else begin
164                                         MessageMemo.Lines.Add('\94Â\88ê\97\97\82Ì\8eæ\93¾\82É\8e¸\94s\82µ\82Ü\82µ\82½');
165                                         MessageMemo.Lines.Add('ResponseCode: ' + IntToStr(Indy.ResponseCode));
166                                         MessageMemo.Lines.Add('Message: ' + E.Message);
167                                         MessageMemo.Lines.Add('------------------------');
168                                         for i := 0 to Indy.Response.RawHeaders.Count - 1 do begin
169                                                 s := Indy.Response.RawHeaders.Names[i];
170                                                 s := s + ': ' + Indy.Response.RawHeaders.Values[s];
171                                                 MessageMemo.Lines.Add(s);
172                                         end;
173                                         MessageMemo.Lines.Add('------------------------');
174                                 end;
175                         end;
176                 end;
177                 Result.FResponseCode := Indy.ResponseCode;
178         finally
179                 Stream.Free;
180         end;
181 end;
182
183 function TNewBoardDialog.UpdateURL(s: string): boolean;
184 var
185         i: Integer;
186         idx: Integer;
187         idx1: Integer;
188         idx2: Integer;
189         tmp: string;
190         URL: string;
191         Title: string;
192         cate: string;
193         Board: TBoard;
194         Change: Boolean;
195         Ignore: Boolean;
196         ini: TMemIniFile;
197         oldURLs : TStringList;
198         newURLs : TStringList;
199     SakuIdx: Integer;
200 begin
201         Change := False;
202         MessageMemo.Lines.Add('\90V\94Â\81A\94ÂURL\95Ï\8dX\83`\83F\83b\83N\82ð\8aJ\8en\82µ\82Ü\82·');
203         MessageMemo.Lines.Add('');
204         s := CustomStringReplace(s, '<B>', '<b>', true);
205         s := CustomStringReplace(s, '<BR>', '<br>', true);
206         s := CustomStringReplace(s, '</B>', '</b>', true);
207         s := CustomStringReplace(s, '<A HREF', '<a href', true);
208         s := CustomStringReplace(s, '</A', '</a', true);
209         cate := '';
210
211         oldURLs := TStringList.Create;
212         newURLs := TStringList.Create;
213
214         try
215
216                 GikoSys.ForceDirectoriesEx(GikoSys.GetConfigDir);
217                 ini := TMemIniFile.Create(GikoSys.GetBoardFileName);
218                 try
219                         //
220                         //\8dí\8f\9c\83I\83v\83V\83\87\83\93\82ª\91I\91ð\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Í\83N\83\8a\83A
221
222                         ini.Clear;
223
224                         while True do begin
225                                 idx1 := AnsiPos('<b>', s);
226                                 idx2 := AnsiPos('<a', s);
227 //                              if (idx1 = 0) and (idx2 = 0) then Break;
228                                 if (idx2 = 0) then Break;   // \82à\82¤URL\82Í\82È\82¢
229
230                                 if idx1 < idx2 then begin
231                                         //<br>
232                                         idx := AnsiPos('</b>', s);
233                                         if idx = 0 then begin
234                                                 s := Copy(s, idx1 + 4, Length(s));
235                                                 continue;
236                                         end;
237                                         tmp := Copy(s, idx1, (idx - idx1) + 4);
238                                         tmp := CustomStringReplace(tmp, '<b>', '');
239                                         tmp := CustomStringReplace(tmp, '</b>', '');
240                                         Ignore := false;
241                                         for i := 0 to IgnoreLists.Count - 1 do begin
242                                                 if tmp = Trim(IgnoreLists[i]) then begin
243                                                         cate := '';
244                                                         s := Copy(s, idx + 5, Length(s));
245                                                         Ignore := True;
246                                                         break;
247                                                 end;
248                                         end;
249                                         if Ignore then
250                                                 Continue;
251                                         {
252                                         if (tmp = '\82¨\82·\82·\82ß') or
253                                                  (tmp = '\93Á\95Ê\8aé\89æ') or
254                                                  (tmp = '\82Ü\82¿\82a\82a\82r') or
255                                                  (tmp = '\83`\83\83\83b\83g') or
256                                                  (tmp = '\82¨\8aG\82©\82«') or
257                                                  (tmp = '\89^\89c\88Ä\93à') or
258                                                  (tmp = '\83c\81[\83\8b\97Þ') or
259                                                  (tmp = '\91¼\82Ì\83T\83C\83g') then begin
260                                                 cate := '';
261                                                 s := Copy(s, idx + 5, Length(s));
262                                                 Continue;
263                                         end;
264                                         }
265                                         s := Copy(s, idx + 5, Length(s));
266                                         cate := tmp;
267                                 end else begin
268                                         //<a href=
269                                         if cate = '' then begin
270                                                 s := Copy(s, idx2 + 2, Length(s));
271                                         end else begin
272                                                 idx := AnsiPos('</a>', s);
273                                                 tmp := Copy(s, idx2, (idx - idx2) + 4);
274                                                 tmp := CustomStringReplace(tmp, '<a href=', '');
275                                                 tmp := CustomStringReplace(tmp, '</a>', '');
276                         tmp := CustomStringReplace(tmp, 'TARGET=_blank', '');
277                                                 i := AnsiPos('>', tmp);
278                                                 if i <> 0 then begin
279                                                         URL := Trim(Copy(tmp, 1, i - 1));
280                                                         Title := Copy(tmp, i + 1, Length(tmp));
281                             if (SakuCheckBox.Checked = True) and (Title = '\8dí\8f\9c\97v\90¿') then begin
282                                 SakuIdx := Pos('.2ch.net/saku/', URL);
283                                 if (SakuIdx > 0) then
284                                     URL := Copy(URL, 1, SakuIdx - 1) + '.2ch.net/saku2ch/';
285                             end;
286                             // BBSs\82ª\8bó\91Î\8dô
287                             if Length(BBSs) = 0 then begin
288                                 Board := nil;
289                             end else begin
290                                 Board := BBSs[ 0 ].FindBoardFromTitleAndCategory(cate, Title);
291                                 if Board = nil then
292                                     Board := BBSs[ 0 ].FindBoardFromURLAndCategory(cate, URL);
293                             end;
294                             if Board = nil then begin
295                                 MessageMemo.Lines.Add('\90V\94Â\92Ç\89Á\81u' + Title + '(' + URL + ')\81v');
296                                 ini.WriteString(cate, Title, URL);
297                                 Change := True;
298                             end else begin
299                                 if Board.URL <> URL then begin
300                                         MessageMemo.Lines.Add('URL\95Ï\8dX\81u' + Board.Title + '(' + URL +')\81v');
301                                     ini.WriteString(cate, Title, URL);
302                                     oldURLs.Add(Board.URL);
303                                     newURLs.Add(URL);
304                                     Change := True;
305                                 end else begin
306                                         ini.WriteString(cate, Title, URL);
307                                 end;
308                             end;
309                                                 end else begin
310                                                         s := Copy(s, idx2 + 2, Length(s));
311                                                         Continue;
312                                                 end;
313                                                 s := Copy(s, idx + 5, Length(s));
314                                         end;
315                                 end;
316                         end;
317             // \83J\83e\83S\83\8a/\94Â\82ª\8c¸\82Á\82½\82¾\82¯\82¾\82ÆChange\83t\83\89\83O\82ª\82½\82½\82È\82¢\82Æ\82«\82Ì\91Î\8dô
318             if not Change then begin
319                 Change := CheckDeleteItem(ini);
320             end;
321                 finally
322                         if Change then
323                                 ini.UpdateFile;
324                         ini.Free;
325                 end;
326                 MessageMemo.Lines.Add('');
327             if Change then begin
328             GikoForm.FavoritesURLReplace(oldURLs, newURLs);
329             GikoForm.RoundListURLReplace(oldURLs, newURLs);
330             GikoForm.TabFileURLReplace(oldURLs, newURLs);
331                         MessageMemo.Lines.Add('\90V\94Â\81A\94ÂURL\95Ï\8dX\83`\83F\83b\83N\82ª\8a®\97¹\82µ\82Ü\82µ\82½');
332                         MessageMemo.Lines.Add('\81u\95Â\82\82é\81v\83{\83^\83\93\82ð\89\9f\82µ\82Ä\82­\82¾\82³\82¢');
333                 end else
334                         MessageMemo.Lines.Add('\90V\94Â\81A\94ÂURL\95Ï\8dX\82Í \82 \82è\82Ü\82¹\82ñ\82Å\82µ\82½');
335     finally
336         oldURLs.Free;
337         newURLs.Free;
338         end;
339         Result := Change;
340 end;
341 //! \8dí\8f\9c\83J\83e\83S\83\8a/\94Â\83`\83F\83b\83N
342 function TNewBoardDialog.CheckDeleteItem(ini: TMemIniFile): Boolean;
343 var
344         URL: string;
345         Title: string;
346         orgini: TMemIniFile;
347     orgStrings, newStrings: TStringList;
348     i: Integer;
349 begin
350     orgini := TMemIniFile.Create(GikoSys.GetBoardFileName);
351     orgStrings := TStringList.Create;
352     newStrings := TStringList.Create;
353     try
354         ini.ReadSections(newStrings);
355         orgini.ReadSections(orgStrings);
356         if (newStrings.Count <> orgStrings.Count) then begin
357             //\83J\83e\83S\83\8a\92Ç\89Á\82Í\81A\94Â\82ª\92Ç\89Á\82É\82È\82é\82Ì\82Å\83`\83F\83b\83N\82µ\82È\82­\82Ä\82à\82¢\82¢
358             //\83J\83e\83S\83\8a\82Ì\8dí\8f\9c\83`\83F\83b\83N
359             for i := 0 to orgStrings.Count - 1 do begin
360                 if (newStrings.IndexOf(orgStrings[i]) = -1) then begin
361                     MessageMemo.Lines.Add('\83J\83e\83S\83\8a\8dí\8f\9c\81u' + orgStrings[i] + '\81v');
362                 end;
363             end;
364             Result := True;
365         end else begin
366             // \94Â\82Ì\90\94\83`\83F\83b\83N
367             ini.GetStrings(newStrings);
368             orgini.GetStrings(orgStrings);
369             if (newStrings.Count <> orgStrings.Count) then begin
370                 // \94Â\82Ì\8dí\8f\9c\83`\83F\83b\83N
371                 for i := 0 to orgStrings.Count - 1 do begin
372                     if (newStrings.IndexOf(orgStrings[i]) = -1) then begin
373                         Title := Copy(orgStrings[i], 1 , AnsiPos('=',orgStrings[i]) - 1);
374                         URL := Copy(orgStrings[i],
375                             AnsiPos('=',orgStrings[i]) + 1, Length(orgStrings[i]));
376                         MessageMemo.Lines.Add('\94Â\8dí\8f\9c\81u' + Title + '(' + URL +')\81v');
377                     end;
378                 end;
379                 Result := True;
380             end;
381         end;
382     finally
383         orgStrings.Free;
384         newStrings.Free;
385         orgini.Free;
386     end;
387 end;
388 procedure TNewBoardDialog.FormCreate(Sender: TObject);
389 var
390     CenterForm: TCustomForm;
391 begin
392     CenterForm := TCustomForm(Owner);
393     if Assigned(CenterForm) then begin
394         Left := ((CenterForm.Width - Width) div 2) + CenterForm.Left;
395         Top := ((CenterForm.Height - Height) div 2) + CenterForm.Top;
396     end else begin
397         Left := (Screen.Width - Width) div 2;
398         Top := (Screen.Height - Height) div 2;
399     end;
400
401         StopButton.Enabled := False;
402         BoardURLComboBox.Clear;
403         BoardURLComboBox.Items.AddStrings(GikoSys.Setting.BoardURLs);
404         try
405                 BoardURLComboBox.ItemIndex := GikoSys.Setting.BoardURLSelected - 1;
406         except
407                 BoardURLComboBox.ItemIndex := 0;
408         end;
409         SetIgnoreCategory(false);
410
411     SakuCheckBox.Checked := GikoSys.Setting.SakuBoard;
412 end;
413 //\94Â\8dX\90V\82Ì\8f\9c\8aO\83J\83e\83S\83\8a\83\8a\83X\83g\82Ì\93o\98^
414 {['\82¨\82·\82·\82ß', '\93Á\95Ê\8aé\89æ', '\82Ü\82¿\82a\82a\82r', '\83`\83\83\83b\83g', '\82¨\8aG\82©\82«', '\89^\89c\88Ä\93à', '\83c\81[\83\8b\97Þ', '\91¼\82Ì\83T\83C\83g']}
415 procedure TNewBoardDialog.SetIgnoreCategory(b: boolean);
416 begin
417         IgnoreLists := TStringList.Create;
418         if not( FileExists(GikoSys.Setting.GetIgnoreFileName) ) or ( b )then begin
419                 IgnoreLists.Add('\82¨\82·\82·\82ß');
420                 IgnoreLists.Add('\93Á\95Ê\8aé\89æ');
421                 IgnoreLists.Add('\82Ü\82¿\82a\82a\82r');
422                 IgnoreLists.Add('\83`\83\83\83b\83g');
423                 IgnoreLists.Add('\82¨\8aG\82©\82«');
424                 IgnoreLists.Add('\89^\89c\88Ä\93à');
425                 IgnoreLists.Add('\83c\81[\83\8b\97Þ');
426                 IgnoreLists.Add('\91¼\82Ì\83T\83C\83g');
427         end else begin
428                 try
429                         IgnoreLists.LoadFromFile(GikoSys.Setting.GetIgnoreFileName);
430                 except
431                         IgnoreLists.Free;
432                         SetIgnoreCategory(true);
433                 end;
434         end;
435 end;
436
437 procedure TNewBoardDialog.EditIgnoreListsButtonClick(Sender: TObject);
438 begin
439         EditIgnoreList(Sender);
440         EditIgnoreListsButton.OnClick := UpdateIgnoreList;
441 end;
442 procedure TNewBoardDialog.EditIgnoreList(Sender: TObject);
443 var
444         i: Integer;
445 begin
446         EditIgnoreListsButton.Caption := '\8f\9c\8aO\83J\83e\83S\83\8a\81[\8dX\90V';
447         Label2.Caption := '\8ae\82P\8ds\82É\83J\83e\83S\83\8a\96¼\82ð\8bL\93ü\82µ\82Ä\82­\82¾\82³\82¢\81B\81i\89ü\8ds\82ÍCtrl+Enter\81j';
448         UpdateButton.Enabled := false;
449         //MessageMemo.ReadOnly := false;
450         MessageMemo.Clear;
451         for i := 0 to IgnoreLists.Count - 1 do
452                 MessageMemo.Lines.Add(IgnoreLists[i]);
453 end;
454 procedure TNewBoardDialog.UpdateIgnoreList(Sender: TObject);
455 var
456         i: Integer;
457 begin
458         Label2.Caption := '';
459     UpdateButton.Enabled := true;
460         EditIgnoreListsButton.Caption := '\8f\9c\8aO\83J\83e\83S\83\8a\81[\95Ò\8fW';
461         IgnoreLists.Clear;
462         for i := 0 to MessageMemo.Lines.Count - 1 do
463                 IgnoreLists.Add(MessageMemo.Lines[i]);
464         IgnoreLists.SaveToFile(GikoSys.Setting.GetIgnoreFileName);
465         IgnoreLists.Free;
466         SetIgnoreCategory(false);
467         //MessageMemo.ReadOnly := true;
468         MessageMemo.Clear;
469         EditIgnoreListsButton.OnClick := EditIgnoreListsButtonClick;
470 end;
471
472 procedure TNewBoardDialog.FormClose(Sender: TObject;
473   var Action: TCloseAction);
474 begin
475     GikoSys.Setting.SakuBoard := SakuCheckBox.Checked;
476         IgnoreLists.Free;
477 end;
478 //! \83\8d\81[\83J\83\8b\83t\83@\83C\83\8b\82ð\83\8d\81[\83h\82·\82é
479 function TNewBoardDialog.BoardLoardFromFile(const FilePath: String): String;
480 var
481         html : TStringList;
482 begin
483         Result := '';
484         // \83t\83@\83C\83\8b\82ª\91\8dÝ\82µ\82Ä\82¢\82é\82©\83`\83F\83b\83N
485         if (FileExists(FilePath)) then begin
486                 html := TStringList.Create();
487                 try
488                         html.LoadFromFile(FilePath);
489                         Result := html.Text;
490                 finally
491                         html.Free;
492                 end;
493         end;
494 end;
495
496 class procedure TNewBoardDialog.InitHTTPClient(client : TIdHTTP);
497 begin
498         client.Request.Clear;
499     client.Request.CustomHeaders.Clear;
500         client.Request.UserAgent := GikoSys.GetUserAgent;
501         client.RecvBufferSize := Gikosys.Setting.RecvBufferSize;
502         client.ProxyParams.BasicAuthentication := False;
503         client.ReadTimeout := GikoSys.Setting.ReadTimeOut;
504     client.ConnectTimeout := GikoSys.Setting.ReadTimeOut;
505
506         if GikoSys.Setting.ReadProxy then begin
507                 if GikoSys.Setting.ProxyProtocol then
508                         client.ProtocolVersion := pv1_1
509                 else
510                         client.ProtocolVersion := pv1_0;
511                 client.ProxyParams.ProxyServer := GikoSys.Setting.ReadProxyAddress;
512                 client.ProxyParams.ProxyPort := GikoSys.Setting.ReadProxyPort;
513                 client.ProxyParams.ProxyUsername := GikoSys.Setting.ReadProxyUserID;
514                 client.ProxyParams.ProxyPassword := GikoSys.Setting.ReadProxyPassword;
515                 if GikoSys.Setting.ReadProxyUserID <> '' then
516                         client.ProxyParams.BasicAuthentication := True;
517         end else begin
518                 if GikoSys.Setting.Protocol then
519                         client.ProtocolVersion := pv1_1
520                 else
521                         client.ProtocolVersion := pv1_0;
522                 client.ProxyParams.ProxyServer := '';
523                 client.ProxyParams.ProxyPort := 80;
524                 client.ProxyParams.ProxyUsername := '';
525                 client.ProxyParams.ProxyPassword := '';
526         end;
527 end;
528 end.