uses
Windows, SysUtils, Classes, ComCtrls, Controls, Forms, IdHTTP,
{HTTPApp,} YofUtils, IdGlobal, IdException, IdComponent, IniFiles, {DateUtils,}
- GikoSystem, BoardGroup, MonaUtils, ExternalBoardManager, ExternalBoardPlugInMain,
+ GikoSystem, BoardGroup, ExternalBoardManager, ExternalBoardPlugInMain,
Sort;
type
function ParseCgiStatus(Content: string): TCgiStatus;
function CgiDownload(ItemType: TGikoDownloadType; URL: string; Modified: TDateTime): Boolean;
function DatDownload(ItemType: TGikoDownloadType; URL: string; Modified: TDateTime; RangeStart: Integer; AdjustLen: Integer): Boolean;
- function DeleteStatusLine(Content: string): string;
+ procedure DeleteStatusLine(Item: TDownloadItem);
procedure InitHttpClient(client: TIdHttp);
procedure ClearHttpClient(client: TIdHttp);
protected
implementation
uses
- Y_TextConverter, MojuUtils, HTMLCreate;
+ Y_TextConverter, MojuUtils, HTMLCreate, ReplaceDataModule;
constructor TDownloadThread.Create(CreateSuspended: Boolean);
begin
if Trim(FIndy.Response.RawHeaders.Values['Date']) <> '' then begin
if Item.DownType = gdtBoard then
- Item.Board.LastGetTime := MonaUtils.DateStrToDateTime(FIndy.Response.RawHeaders.Values['Date'])
+ Item.Board.LastGetTime := GikoSys.DateStrToDateTime(FIndy.Response.RawHeaders.Values['Date'])
else
- Item.ThreadItem.ParentBoard.LastGetTime := MonaUtils.DateStrToDateTime(FIndy.Response.RawHeaders.Values['Date']);
+ Item.ThreadItem.ParentBoard.LastGetTime := GikoSys.DateStrToDateTime(FIndy.Response.RawHeaders.Values['Date']);
end;
if DownloadResult then begin
Writeln('CGIStatus: OK');
{$ENDIF}
Item.ResponseCode := 200;
- Item.Content := DeleteStatusLine(Item.Content);
- Item.ContentLength := CgiStatus.FSize;
+ DeleteStatusLine(Item);
end;
gcsINCR: begin
//\8d¡\82Í\82 \82è\82¦\82È\82¢
Writeln('CGIStatus: 206');
{$ENDIF}
Item.ResponseCode := 206;
- Item.Content := DeleteStatusLine(Item.Content);
- Item.ContentLength := CgiStatus.FSize;
+ DeleteStatusLine(Item);
end;
gcsERR: begin
{$IFDEF DEBUG}
{$ENDIF}
FIndy.Get(URL, ResStream);
Item.Content := GikoSys.GzipDecompress(ResStream, FIndy.Response.ContentEncoding);
- Item.LastModified := FIndy.Response.LastModified;
- //\8d·\95ª\8eæ\93¾\82Å\82P\83o\83C\83g\91O\82©\82ç\82Æ\82Á\82Ä\82«\82½\82Æ\82«\82Í\83}\83C\83i\83X\82·\82é
-// Item.ContentLength := FIndy.Response.ContentLength + AdjustLen;
Item.ContentLength := Length(Item.Content) + AdjustLen;
- //\96³\82¢\82Æ\8ev\82¤\82¯\82Ç\81B\81B\81B
-// if (FIndy.ResponseCode in [200, 206]) and (Item.Content = '') then
-// Result := False
+ // \92u\8a·\82·\82é
+ if GikoSys.Setting.ReplaceDat then begin
+ Item.Content := ReplaceDM.Replace(Item.Content);
+ end;
+ Item.LastModified := FIndy.Response.LastModified;
if Item.Content = '' then
Result := False
else
end;
end;
-//\8eè\94²\82«\82È\8f\88\97\9d\82Å1\8ds\96Ú\82ð\8fÁ\82·
-function TDownloadThread.DeleteStatusLine(Content: string): string;
+//\82P\8ds\96Ú\82ð\8fÁ\82µ\82Ä\81A\83R\83\93\83e\83\93\83c\83T\83C\83Y\82ð\90Ý\92è\82·\82é
+procedure TDownloadThread.DeleteStatusLine(Item: TDownloadItem);
var
SList: TStringList;
begin
SList := TStringList.Create;
try
- SList.Text := Content;
+ SList.Text := Item.Content;
+ //1\8ds\96Ú\82ð\8dí\8f\9c
if SList.Count > 1 then
SList.Delete(0);
- Result := SList.Text;
+ Item.Content := SList.Text;
+ //\89ü\8ds\83R\81[\83h\82ðCRLF -> LF\82Æ\8dl\82¦\82Ä\81A\8ds\90\94\95ª\82¾\82¯\83}\83C\83i\83X
+ Item.ContentLength := Length(SList.Text) - SList.Count;
finally
SList.Free;
end;
//dat\97\8e\82¿\83X\83\8c\82Ì\83\\81[\83g\8f\87\82ð\8c\88\92è\82·\82é\82½\82ß\82É\83\\81[\83g\82·\82é
if GikoSys.Setting.DatOchiSortIndex >= 0 then begin
- Sort.SortNoFlag := true;
- Sort.SortOrder := GikoSys.Setting.DatOchiSortOrder;
- Sort.SortIndex := GikoSys.Setting.DatOchiSortIndex;
+ Sort.SetSortNoFlag(true);
+ Sort.SetSortOrder(GikoSys.Setting.DatOchiSortOrder);
+ Sort.SetSortIndex(GikoSys.Setting.DatOchiSortIndex);
//Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
Board.CustomSort(ThreadItemSortProc);
end;
Board.Items[i].No := Board.IntData;
Board.Items[i].AllResCount := Board.Items[i].Count;
Board.Items[i].NewResCount := 0;
- Board.Items[i].AgeSage := gasNone;
+ Board.Items[i].AgeSage := gasArch;
end;
end;
Board.Items[i].No := NumCount;
Board.Items[i].AllResCount := Board.Items[i].Count;
Board.Items[i].NewResCount := 0;
- Board.Items[i].AgeSage := gasNone;
+ Board.Items[i].AgeSage := gasArch;
end;
end;
//\83\8a\83X\83g(subject.txt)\82ð\95Û\91¶
GikoSys.ForceDirectoriesEx(ExtractFilePath(Board.GetSubjectFileName));
+ Body.Text := MojuUtils.Sanitize(Body.Text);
Body.SaveToFile(Board.GetSubjectFileName);
end;
finally