{ Private \90é\8c¾ }
IgnoreLists : TStringList;
FAbort: Boolean;
- function BoardDownload: TNewBoardItem;
- procedure UpdateURL(s: string);
+ function BoardDownload(const URL: String): TNewBoardItem;
+ function BoardLoardFromFile(const FilePath: String): String;
+ function UpdateURL(s: string): boolean;
procedure SetIgnoreCategory(b: boolean);
procedure EditIgnoreList(Sender: TObject);
procedure UpdateIgnoreList(Sender: TObject);
public
{ Public \90é\8c¾ }
+ class procedure InitHTTPClient(client : TIdHTTP);
end;
var
procedure TNewBoardDialog.UpdateButtonClick(Sender: TObject);
var
Item: TNewBoardItem;
+ URL : String;
+ protocol, host, path, document, port, bookmark: String;
+ TabURLs: TStringList;
begin
try
+ MessageMemo.Clear;
GikoSys.Setting.BoardURLSelected := BoardURLComboBox.ItemIndex + 1;
FAbort := False;
UpdateButton.Enabled := False;
StopButton.Enabled := True;
CloseButton.Enabled := False;
EditIgnoreListsButton.Enabled := False;
- Item := BoardDownload;
+ URL := BoardURLComboBox.Text;
+ GikoSys.ParseURI(URL, protocol, host, path, document, port, bookmark);
+ if (protocol = '') then begin
+ Item.FContent := BoardLoardFromFile(URL);
+ end else if (AnsiPos('http', protocol) > 0) then begin
+ Item := BoardDownload(URL);
+ end;
StopButton.Enabled := False;
if FAbort then
Exit;
if Item.FContent <> '' then begin
- GikoDM.TabsSaveAction.Tag := 1;
- GikoDM.TabsOpenAction.Tag := 1;
- GikoDM.TabsSaveAction.Execute;
- UpdateURL(Item.FContent);
- GikoForm.ReloadBBS;
- GikoDM.TabsSaveAction.Tag := 0;
- GikoDM.TabsOpenAction.Tag := 0;
+ TabURLs := TStringList.Create;
+ try
+ GikoDM.GetTabURLs(TabURLs);
+ if (UpdateURL(Item.FContent)) then begin
+ GikoForm.ReloadBBS;
+ end;
+ GikoDM.OpenURLs(TabURLs);
+ finally
+ TabURLs.Free;
+ end;
end else
MessageMemo.Lines.Add('\83_\83E\83\93\83\8d\81[\83h\82ª\8e¸\94s\82µ\82Ü\82µ\82½[' + IntToStr(Item.FResponseCode) + ']');
finally
Close;
end;
-function TNewBoardDialog.BoardDownload: TNewBoardItem;
+function TNewBoardDialog.BoardDownload(const URL: String): TNewBoardItem;
var
- URL: string;
Stream: TMemoryStream;
s: string;
i: Integer;
begin
- MessageMemo.Clear;
- Indy.Request.Clear;
- Indy.RecvBufferSize := Gikosys.Setting.RecvBufferSize;
- Indy.ProxyParams.BasicAuthentication := False;
- if GikoSys.Setting.ReadProxy then begin
- if GikoSys.Setting.ProxyProtocol then
- Indy.ProtocolVersion := pv1_1
- else
- Indy.ProtocolVersion := pv1_0;
- Indy.ProxyParams.ProxyServer := GikoSys.Setting.ReadProxyAddress;
- Indy.ProxyParams.ProxyPort := GikoSys.Setting.ReadProxyPort;
- Indy.ProxyParams.ProxyUsername := GikoSys.Setting.ReadProxyUserID;
- Indy.ProxyParams.ProxyPassword := GikoSys.Setting.ReadProxyPassword;
- if GikoSys.Setting.ReadProxyUserID <> '' then
- Indy.ProxyParams.BasicAuthentication := True;
- end else begin
- if GikoSys.Setting.Protocol then
- Indy.ProtocolVersion := pv1_1
- else
- Indy.ProtocolVersion := pv1_0;
- Indy.ProxyParams.ProxyServer := '';
- Indy.ProxyParams.ProxyPort := 80;
- Indy.ProxyParams.ProxyUsername := '';
- Indy.ProxyParams.ProxyPassword := '';
- end;
- //URL := GikoSys.Setting.BoardURL2ch;
- URL := BoardURLComboBox.Text;
+ InitHTTPClient( Indy );
+
Indy.Request.UserAgent := GikoSys.GetUserAgent;
Indy.Request.Referer := '';
Indy.Request.AcceptEncoding := 'gzip';
end;
end;
-procedure TNewBoardDialog.UpdateURL(s: string);
+function TNewBoardDialog.UpdateURL(s: string): boolean;
var
i: Integer;
-// j: Integer;
idx: Integer;
idx1: Integer;
idx2: Integer;
oldURLs.Free;
newURLs.Free;
end;
+ Result := Change;
end;
procedure TNewBoardDialog.FormCreate(Sender: TObject);
begin
IgnoreLists.Free;
end;
+//! \83\8d\81[\83J\83\8b\83t\83@\83C\83\8b\82ð\83\8d\81[\83h\82·\82é
+function TNewBoardDialog.BoardLoardFromFile(const FilePath: String): String;
+var
+ html : TStringList;
+begin
+ Result := '';
+ // \83t\83@\83C\83\8b\82ª\91¶\8dÝ\82µ\82Ä\82¢\82é\82©\83`\83F\83b\83N
+ if (FileExists(FilePath)) then begin
+ html := TStringList.Create();
+ try
+ html.LoadFromFile(FilePath);
+ Result := html.Text;
+ finally
+ html.Free;
+ end;
+ end;
+end;
+class procedure TNewBoardDialog.InitHTTPClient(client : TIdHTTP);
+begin
+ client.Request.Clear;
+ client.Request.CustomHeaders.Clear;
+ client.RecvBufferSize := Gikosys.Setting.RecvBufferSize;
+ client.ProxyParams.BasicAuthentication := False;
+ if GikoSys.Setting.ReadProxy then begin
+ if GikoSys.Setting.ProxyProtocol then
+ client.ProtocolVersion := pv1_1
+ else
+ client.ProtocolVersion := pv1_0;
+ client.ProxyParams.ProxyServer := GikoSys.Setting.ReadProxyAddress;
+ client.ProxyParams.ProxyPort := GikoSys.Setting.ReadProxyPort;
+ client.ProxyParams.ProxyUsername := GikoSys.Setting.ReadProxyUserID;
+ client.ProxyParams.ProxyPassword := GikoSys.Setting.ReadProxyPassword;
+ if GikoSys.Setting.ReadProxyUserID <> '' then
+ client.ProxyParams.BasicAuthentication := True;
+ end else begin
+ if GikoSys.Setting.Protocol then
+ client.ProtocolVersion := pv1_1
+ else
+ client.ProtocolVersion := pv1_0;
+ client.ProxyParams.ProxyServer := '';
+ client.ProxyParams.ProxyPort := 80;
+ client.ProxyParams.ProxyUsername := '';
+ client.ProxyParams.ProxyPassword := '';
+ end;
+end;
end.