| 146 |
Abone: Boolean; |
Abone: Boolean; |
| 147 |
foundPos: Integer; |
foundPos: Integer; |
| 148 |
boardPlugIn : TBoardPlugIn; |
boardPlugIn : TBoardPlugIn; |
| 149 |
|
listContent : string; |
| 150 |
begin |
begin |
| 151 |
while not Terminated do begin |
while not Terminated do begin |
| 152 |
if FItem.FThreadItem <> nil then |
//===== プラグイン |
| 153 |
boardPlugIn := FItem.FThreadItem.BoardPlugIn |
boardPlugIn := nil; |
| 154 |
else |
ExternalBoardManager.OnWork := Work; |
| 155 |
boardPlugIn := nil; |
ExternalBoardManager.OnWorkBegin := WorkBegin; |
| 156 |
if boardPlugIn <> nil then begin |
ExternalBoardManager.OnWorkEnd := WorkEnd; |
| 157 |
if Assigned( Pointer( boardPlugIn.Module ) ) then begin |
|
| 158 |
ExternalBoardManager.OnWork := Work; |
case FItem.FDownType of |
| 159 |
ExternalBoardManager.OnWorkBegin := WorkBegin; |
gdtBoard: |
| 160 |
ExternalBoardManager.OnWorkEnd := WorkEnd; |
begin |
| 161 |
boardPlugIn.Download( DWORD( FItem.FThreadItem ) ); |
if FItem.FBoard <> nil then begin |
| 162 |
|
if FItem.FBoard.IsBoardPlugInAvailable then begin |
| 163 |
if FAbort then |
boardPlugIn := FItem.FBoard.BoardPlugIn; |
| 164 |
Item.State := gdsAbort |
Item.State := TGikoDownloadState( boardPlugIn.DownloadBoard( DWORD( FItem.FBoard ) ) ); |
| 165 |
else |
end; |
| 166 |
Item.State := gdsComplete; |
end; |
|
if Assigned( OnDownloadEnd ) then |
|
|
Synchronize( FireDownloadEnd ); |
|
|
if Terminated then |
|
|
Break; |
|
|
|
|
|
Suspend; |
|
|
Continue; |
|
| 167 |
end; |
end; |
| 168 |
|
gdtThread: |
| 169 |
|
begin |
| 170 |
|
if FItem.FThreadItem <> nil then begin |
| 171 |
|
if FItem.FThreadItem.IsBoardPlugInAvailable then begin |
| 172 |
|
boardPlugIn := FItem.FThreadItem.BoardPlugIn; |
| 173 |
|
Item.State := TGikoDownloadState( boardPlugIn.DownloadThread( DWORD( FItem.FThreadItem ) ) ); |
| 174 |
|
end; |
| 175 |
|
end; |
| 176 |
|
end; |
| 177 |
|
end; |
| 178 |
|
|
| 179 |
|
if boardPlugIn <> nil then begin |
| 180 |
|
if FAbort then |
| 181 |
|
Item.State := gdsAbort; |
| 182 |
|
if Assigned( OnDownloadEnd ) then |
| 183 |
|
Synchronize( FireDownloadEnd ); |
| 184 |
|
if Terminated then |
| 185 |
|
Break; |
| 186 |
|
|
| 187 |
|
Suspend; |
| 188 |
|
Continue; |
| 189 |
end; |
end; |
| 190 |
|
|
| 191 |
|
//===== プラグインを使用しない場合 |
| 192 |
FAbort := False; |
FAbort := False; |
| 193 |
FIndy.Request.CustomHeaders.Clear; |
FIndy.Request.CustomHeaders.Clear; |
| 194 |
FIndy.Response.Clear; |
FIndy.Response.Clear; |
| 889 |
NumCount: Integer; |
NumCount: Integer; |
| 890 |
Body: TStringList; |
Body: TStringList; |
| 891 |
Rec: TSubjectRec; |
Rec: TSubjectRec; |
| 892 |
|
function MakeThreadCallBack( |
| 893 |
|
inURL : PChar; // スレッドの URL |
| 894 |
|
inTitle : PChar; // スレタイ |
| 895 |
|
inCount : DWORD // レスの数 |
| 896 |
|
) : Boolean; stdcall; // 列挙を続けるなら True |
| 897 |
|
begin |
| 898 |
|
Result := True; |
| 899 |
|
|
| 900 |
|
Inc( NumCount ); |
| 901 |
|
// ※作り途中。本当は URL ではなく FileName を引数に取る※ |
| 902 |
|
index := Board.GetIndex( inURL ); |
| 903 |
|
if index = -1 then begin |
| 904 |
|
//新しいスレッド |
| 905 |
|
NewItem := TThreadItem.Create( Board.BoardPlugIn, inURL ); |
| 906 |
|
|
| 907 |
|
NewItem.Title := inTitle; |
| 908 |
|
// NewItem.Count := inCount; |
| 909 |
|
NewItem.ParentBoard := Board; |
| 910 |
|
NewItem.No := NumCount; |
| 911 |
|
NewItem.RoundDate := ZERO_DATE; |
| 912 |
|
NewItem.LastModified := ZERO_DATE; |
| 913 |
|
NewItem.AgeSage := gasNew; |
| 914 |
|
NewList.Add( NewItem ); |
| 915 |
|
end else begin |
| 916 |
|
//Board.Items[index].Count := Count; |
| 917 |
|
//Board.Items[index].Count := Rec.FCount; |
| 918 |
|
if Board.Items[index].No > NumCount then |
| 919 |
|
Board.Items[index].AgeSage := gasAge |
| 920 |
|
else if Board.Items[index].AllResCount < inCount then |
| 921 |
|
Board.Items[index].AgeSage := gasSage |
| 922 |
|
else |
| 923 |
|
Board.Items[index].AgeSage := gasNone; |
| 924 |
|
|
| 925 |
|
Board.Items[index].No := NumCount; |
| 926 |
|
Board.Items[index].AllResCount := inCount; |
| 927 |
|
// if not Board.Items[index].IsLogFile then |
| 928 |
|
// Board.Items[index].Count := inCountt; |
| 929 |
|
NewList.Add( Board.Items[index] ); |
| 930 |
|
Board.DeleteList( index ); |
| 931 |
|
end; |
| 932 |
|
end; |
| 933 |
begin |
begin |
| 934 |
NewList := TList.Create; |
NewList := TList.Create; |
| 935 |
Body := TStringList.Create; |
Body := TStringList.Create; |
| 939 |
//サーバ上ファイルの更新時刻設定 |
//サーバ上ファイルの更新時刻設定 |
| 940 |
Board.LastModified := LastModified; |
Board.LastModified := LastModified; |
| 941 |
|
|
| 942 |
//新しいリストを作成する |
if Board.IsBoardPlugInAvailable then begin |
| 943 |
//新しいリストに古いリストのログがあるならそれを新しいリストに追加 |
// 新しいリストを作成する |
| 944 |
//古いログがなければ、新たにスレオブジェクトを作成 |
// 新しいリストに古いリストのログがあるならそれを新しいリストに追加 |
| 945 |
Body.Text := Content; |
// 古いログがなければ、新たにスレオブジェクトを作成 |
| 946 |
NumCount := 0; |
NumCount := 0; |
| 947 |
for i := 0 to Body.Count - 1 do begin |
Board.BoardPlugIn.EnumThread( DWORD( Board ), @MakeThreadCallBack ); |
| 948 |
//if i = 0 then Continue; //1行目はステータス行のため処理なし |
|
| 949 |
|
// 新しいリストに無かったアイテムを新しいリストに追加 |
| 950 |
Rec := GikoSys.DivideSubject(Body[i]); |
for i := 0 to Board.Count - 1 do begin |
| 951 |
Rec.FFileName := Trim(Rec.FFileName); |
if Board.Items[i].IsLogFile then begin |
| 952 |
if (Rec.FTitle = '') and (Rec.FCount = 0) then Continue; |
Inc( NumCount ); |
| 953 |
Inc(NumCount); |
Board.Items[i].No := NumCount; |
| 954 |
index := Board.GetIndex(Rec.FFileName); |
Board.Items[i].AllResCount := Board.Items[i].Count; |
| 955 |
if index = -1 then begin |
Board.Items[i].NewResCount := 0; |
| 956 |
//新しいスレッド |
Board.Items[i].AgeSage := gasNone; |
| 957 |
NewItem := TThreadItem.Create; |
newList.Add( Board.Items[i] ); |
| 958 |
NewItem.FileName := Rec.FFileName; |
end; |
| 959 |
NewItem.Title := Rec.FTitle; |
end; |
|
// NewItem.Count := Rec.FCount; |
|
|
NewItem.AllResCount := Rec.FCount; |
|
|
NewItem.ParentBoard := Board; |
|
|
NewItem.No := NumCount; |
|
|
NewItem.RoundDate := ZERO_DATE; |
|
|
NewItem.LastModified := ZERO_DATE; |
|
|
NewItem.AgeSage := gasNew; |
|
|
NewList.Add(NewItem); |
|
|
end else begin |
|
|
//Board.Items[index].Count := Count; |
|
|
//Board.Items[index].Count := Rec.FCount; |
|
|
if Board.Items[index].No > NumCount then |
|
|
Board.Items[index].AgeSage := gasAge |
|
|
else if Board.Items[index].AllResCount < Rec.FCount then |
|
|
Board.Items[index].AgeSage := gasSage |
|
|
else |
|
|
Board.Items[index].AgeSage := gasNone; |
|
|
|
|
| 960 |
|
|
| 961 |
Board.Items[index].No := NumCount; |
// 古いリストを消す(リストのみ。スレオブジェクト自体は消さない) |
| 962 |
Board.Items[index].AllResCount := Rec.FCount; |
for i := Board.Count - 1 downto 0 do |
| 963 |
// if not Board.Items[index].IsLogFile then |
Board.DeleteList( i ); |
| 964 |
// Board.Items[index].Count := Rec.FCount; |
|
| 965 |
NewList.Add(Board.Items[index]); |
// 新しいリストをボードオブジェクトに追加 |
| 966 |
Board.DeleteList(index); |
for i := 0 to newList.Count - 1 do |
| 967 |
end; |
Board.Add( TThreadItem(newList[i]) ); |
| 968 |
end; |
end else begin |
| 969 |
|
//新しいリストを作成する |
| 970 |
|
//新しいリストに古いリストのログがあるならそれを新しいリストに追加 |
| 971 |
|
//古いログがなければ、新たにスレオブジェクトを作成 |
| 972 |
|
Body.Text := Content; |
| 973 |
|
NumCount := 0; |
| 974 |
|
for i := 0 to Body.Count - 1 do begin |
| 975 |
|
//if i = 0 then Continue; //1行目はステータス行のため処理なし |
| 976 |
|
|
| 977 |
|
Rec := GikoSys.DivideSubject(Body[i]); |
| 978 |
|
Rec.FFileName := Trim(Rec.FFileName); |
| 979 |
|
if (Rec.FTitle = '') and (Rec.FCount = 0) then Continue; |
| 980 |
|
Inc(NumCount); |
| 981 |
|
index := Board.GetIndex(Rec.FFileName); |
| 982 |
|
if index = -1 then begin |
| 983 |
|
//新しいスレッド |
| 984 |
|
NewItem := TThreadItem.Create; |
| 985 |
|
NewItem.FileName := Rec.FFileName; |
| 986 |
|
NewItem.Title := Rec.FTitle; |
| 987 |
|
// NewItem.Count := Rec.FCount; |
| 988 |
|
NewItem.AllResCount := Rec.FCount; |
| 989 |
|
NewItem.ParentBoard := Board; |
| 990 |
|
NewItem.No := NumCount; |
| 991 |
|
NewItem.RoundDate := ZERO_DATE; |
| 992 |
|
NewItem.LastModified := ZERO_DATE; |
| 993 |
|
NewItem.AgeSage := gasNew; |
| 994 |
|
NewList.Add(NewItem); |
| 995 |
|
end else begin |
| 996 |
|
//Board.Items[index].Count := Count; |
| 997 |
|
//Board.Items[index].Count := Rec.FCount; |
| 998 |
|
if Board.Items[index].No > NumCount then |
| 999 |
|
Board.Items[index].AgeSage := gasAge |
| 1000 |
|
else if Board.Items[index].AllResCount < Rec.FCount then |
| 1001 |
|
Board.Items[index].AgeSage := gasSage |
| 1002 |
|
else |
| 1003 |
|
Board.Items[index].AgeSage := gasNone; |
| 1004 |
|
|
| 1005 |
|
|
| 1006 |
|
Board.Items[index].No := NumCount; |
| 1007 |
|
Board.Items[index].AllResCount := Rec.FCount; |
| 1008 |
|
// if not Board.Items[index].IsLogFile then |
| 1009 |
|
// Board.Items[index].Count := Rec.FCount; |
| 1010 |
|
NewList.Add(Board.Items[index]); |
| 1011 |
|
Board.DeleteList(index); |
| 1012 |
|
end; |
| 1013 |
|
end; |
| 1014 |
|
|
| 1015 |
//新しいリストに無かったアイテムを新しいリストに追加 |
//新しいリストに無かったアイテムを新しいリストに追加 |
| 1016 |
for i := 0 to Board.Count - 1 do begin |
for i := 0 to Board.Count - 1 do begin |
| 1017 |
if Board.Items[i].IsLogFile then begin |
if Board.Items[i].IsLogFile then begin |
| 1018 |
inc(NumCount); |
inc(NumCount); |
| 1019 |
Board.Items[i].No := NumCount; |
Board.Items[i].No := NumCount; |
| 1020 |
Board.Items[i].AllResCount := Board.Items[i].Count; |
Board.Items[i].AllResCount := Board.Items[i].Count; |
| 1021 |
Board.Items[i].NewResCount := 0; |
Board.Items[i].NewResCount := 0; |
| 1022 |
Board.Items[i].AgeSage := gasNone; |
Board.Items[i].AgeSage := gasNone; |
| 1023 |
NewList.Add(Board.Items[i]); |
NewList.Add(Board.Items[i]); |
| 1024 |
end; |
end; |
| 1025 |
end; |
end; |
| 1026 |
|
|
| 1027 |
//古いリストを消す(リストのみ。スレオブジェクト自体は消さない) |
//古いリストを消す(リストのみ。スレオブジェクト自体は消さない) |
| 1028 |
for i := Board.Count - 1 downto 0 do |
for i := Board.Count - 1 downto 0 do |
| 1029 |
Board.DeleteList(i); |
Board.DeleteList(i); |
| 1030 |
|
|
| 1031 |
//新しいリストをボードオブジェクトに追加 |
//新しいリストをボードオブジェクトに追加 |
| 1032 |
for i := 0 to NewList.Count - 1 do |
for i := 0 to NewList.Count - 1 do |
| 1033 |
Board.Add(TThreadItem(NewList[i])); |
Board.Add(TThreadItem(NewList[i])); |
| 1034 |
|
|
| 1035 |
//リスト(subject.txt)を保存 |
//リスト(subject.txt)を保存 |
| 1036 |
// GikoSys.ForceDirectoriesEx(GikoSys.GetLogDir + Board.BBSID); |
// GikoSys.ForceDirectoriesEx(GikoSys.GetLogDir + Board.BBSID); |
| 1037 |
// Body.SaveToFile(GikoSys.GetSubjectFileName(Board.BBSID)); |
// Body.SaveToFile(GikoSys.GetSubjectFileName(Board.BBSID)); |
| 1038 |
GikoSys.ForceDirectoriesEx(ExtractFilePath(Board.GetSubjectFileName)); |
GikoSys.ForceDirectoriesEx(ExtractFilePath(Board.GetSubjectFileName)); |
| 1039 |
Body.SaveToFile(Board.GetSubjectFileName); |
Body.SaveToFile(Board.GetSubjectFileName); |
| 1040 |
|
end; |
| 1041 |
finally |
finally |
| 1042 |
Body.Free; |
Body.Free; |
| 1043 |
NewList.Free; |
NewList.Free; |