Develop and Download Open Source Software

Browse CVS Repository

Annotation of /gikonavigoeson/gikonavi/BoardGroup.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.77 - (hide annotations) (download) (as text)
Sat Jan 31 15:48:36 2009 UTC (15 years, 2 months ago) by h677
Branch: MAIN
CVS Tags: v1_63_1_819, v1_62_0_812, v1_60_0_788, v1_60_0_789, v1_60_0_781, v1_60_0_782, v1_60_0_784, v1_60_0_786, v1_60_0_787, v1_61_0_796, v1_61_0_797, v1_61_0_795, v1_61_0_798, v1_61_0_799, v1_63_0_818, v1_63_0_817, v1_63_0_816, v1_63_0_815, v1_62_0_805, v1_62_0_804, v1_62_0_807, v1_62_0_806, v1_62_0_803, v1_62_0_802, v1_62_0_809, v1_60_0_780, v1_60_0_779, v1_62_0_810, v1_62_0_811, v1_60_0_783, v1_60_1_793, v1_62_1_813, v1_61_0_800, v1_60_0_793, v1_60_0_792, v1_60_0_791, v1_60_0_790, v1_60_2_794, v1_61_1_801, HEAD
Branch point for: Bb62, Bb63, Bb60, Bb61
Changes since 1.76: +3 -3 lines
File MIME type: text/x-pascal
スレッド一覧読み込み時に利用するTThreadItemのコンストラクタで、
余分なURLの処理をなくした。

1 hi_ 1.1 unit BoardGroup;
2    
3     interface
4    
5     uses
6 h677 1.71 Windows, SysUtils, Classes, ComCtrls, {HTTPApp,} YofUtils, IdGlobal,
7     ExternalBoardManager, ExternalBoardPlugInMain, StrUtils;
8 hi_ 1.1
9     type
10     //???鴻????;腓冴?≪?ゃ?????御??
11 h677 1.70 TGikoViewType = (gvtAll, gvtLog, gvtNew, gvtLive, gvtArch, gvtUser);
12 hi_ 1.1 //???鴻???????筝???
13 h677 1.69 TGikoAgeSage = (gasNone, gasAge, gasSage, gasNew, gasArch, gasNull);
14 hi_ 1.1
15     TCategory = class;
16     TBoard = class;
17     TThreadItem = class;
18    
19 h677 1.71
20 yoffy 1.35 // BBS ?????若??
21 yoffy 1.17 TBBS = class(TList)
22 hi_ 1.1 private
23     FTitle: string;
24 yoffy 1.35 FFilePath : string; // ?帥???鴻????????/span>
25 hi_ 1.1 FExpand: Boolean;
26     FKubetsuChk: Boolean; //腟?莨若?炊??紊ф??絖?絨??絖??阪??/span>
27     FSelectText: string; //腟?莨若?炊??絖???
28     FShortSelectText: string;
29 yoffy 1.35 FIsBoardFileRead : Boolean; // ?帥???鴻??????粋昭?障??????????鐚?
30 hi_ 1.1
31     function GetCategory(index: integer): TCategory;
32     procedure SetCategory(index: integer; value: TCategory);
33     procedure SetSelectText(s: string);
34     public
35 yoffy 1.35 constructor Create( boardFilePath : string );
36 hi_ 1.1 destructor Destroy; override;
37    
38     function Add(item: TCategory): integer;
39     procedure Delete(index: integer);
40     procedure Clear; override;
41     function Find(key: string): TCategory;
42 h677 1.43 function FindBBSID(const BBSID: string): TBoard;
43     function FindBoardFromTitle(const Title: string): TBoard;
44     function FindBoardFromURL(const inURL: string): TBoard;
45     function FindThreadFromURL(const inURL : string ) : TThreadItem;
46     function FindThreadItem(const BBSID, FileName: string): TThreadItem;
47     function FindCategoryFromTitle(const inTitle : string ) : TCategory;
48 yoffy 1.35 property FilePath : string read FFilePath write FFilePath;
49 hi_ 1.1
50     property Items[index: integer]: TCategory read GetCategory write SetCategory;
51     property Title: string read FTitle write FTitle;
52     property NodeExpand: Boolean read FExpand write FExpand;
53 h677 1.43
54 hi_ 1.1 property KubetsuChk: Boolean read FKubetsuChk write FKubetsuChk;
55     property SelectText: string read FSelectText write SetSelectText;
56     property ShortSelectText: string read FShortSelectText write FShortSelectText;
57 yoffy 1.35
58     property IsBoardFileRead : Boolean read FIsBoardFileRead write FIsBoardFileRead;
59 hi_ 1.1 end;
60    
61 yoffy 1.41 // ?????眼??? URL ?????鴻??)
62 yoffy 1.52 TCategory = class(TStringList)
63 hi_ 1.1 private
64     FNo: Integer;
65     FTitle: string;
66 yoffy 1.17 FParenTBBS: TBBS;
67 hi_ 1.1 FExpand: Boolean;
68    
69     function GetBoard(index: integer): TBoard;
70     procedure SetBoard(index: integer; value: TBoard);
71     public
72     constructor Create;
73     destructor Destroy; override;
74    
75     property No: Integer read FNo write FNo;
76     property Title: string read FTitle write FTitle;
77     property Items[index: integer]: TBoard read GetBoard write SetBoard;
78 yoffy 1.17 property ParenTBBS: TBBS read FParenTBBS write FParenTBBS;
79 hi_ 1.1
80     function Add(item: TBoard): integer;
81     procedure Delete(index: integer);
82     procedure Clear; override;
83 h677 1.43 function FindName(const key: string): TBoard;
84     function FindBBSID(const BBSID: string): TBoard;
85     function FindBoardFromTitle(const Title: string): TBoard;
86     function FindBoardFromURL(const inURL: string): TBoard;
87     function FindThreadFromURL(const inURL : string ) : TThreadItem;
88 hi_ 1.1 function IsMidoku: Boolean;
89    
90     property NodeExpand: Boolean read FExpand write FExpand;
91     end;
92    
93 h677 1.71 //! ?鴻???????違?????潟???>散??
94     TThreadCount = function(Item : TThreadItem): Boolean;
95    
96 yoffy 1.41 // ???鴻?????? URL ?????鴻??)
97 yoffy 1.52 TBoard = class(TStringList)
98 hi_ 1.1 private
99 yoffy 1.41 FContext: DWORD; // ?????違?ゃ?潟?????宴??┃絎???????????筝祉???ゃ?潟?鴻?帥?潟?鴻???ャ??)
100 yoffy 1.9
101 hi_ 1.1 FNo: Integer; //???/span>
102     FTitle: string; //???若???帥?ゃ????/span>
103     FBBSID: string; //BBSID
104     FURL: string; //???若??URL
105     FRound: Boolean; //?鴻??????筝?荀у掘??篋?膣?
106     FRoundName: string; //綏≦????
107     FRoundDate: TDateTime; //?鴻??????筝?荀с????緇??????ユ??鐚?綏≦???ユ??鐚?
108     FLastModified: TDateTime; //?鴻??????筝?荀с???贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
109     FLastGetTime: TDateTime; //?鴻???????障?????鴻??????筝?荀с????緇????贋?違?????ユ??鐚??泣?若???贋?ユ???紙?吾??莨若?炊????戎??????鐚?
110     FIsThreadDatRead: Boolean; //?鴻?????????鴻??????粋昭?障??????????鐚?
111     FUnRead: Integer; //?鴻???????????/span>
112 yoffy 1.41 FParentCategory: TCategory; //荀??????眼??/span>
113 hi_ 1.1 FModified: Boolean; //篆????????/span>
114     FBoolData: Boolean; //??????????????戎??yo
115     FSPID: string; //?吾??莨若?睡??PID
116     FPON: string; //?吾??莨若?睡??ON
117 h677 1.60 FCookie: string; //?吾??莨若?睡??ookie??絖???
118     FExpires: TDateTime; //Cookie?????号????
119 hi_ 1.1 FKotehanName: string; //?潟????喝????
120     FKotehanMail: string; //?潟????潟?<?若??/span>
121    
122     FUpdate: Boolean;
123     FExpand: Boolean;
124    
125 yoffy 1.9 FBoardPlugIn : TBoardPlugIn; // ?????帥???泣???若???????????違?ゃ??/span>
126 yoffy 1.13 FFilePath : string; // ?????鴻???荀с??篆?絖???????????????/span>
127 yoffy 1.9 FIsLogFile : Boolean; // ???医?????????/span>
128 yoffy 1.13 FIntData : Integer; // 絅純?????????c??????????????????????戎??yo
129     FListData : TList; // 絅純?????????c??????????????????????戎??yo
130 yoffy 1.9
131 h677 1.60 FSETTINGTXTTime : TDateTime; //SETTING.TXT????緇??????ユ??
132     FIsSETTINGTXT : boolean; //SETTING.TXT????緇???????????
133     FHEADTXTTime : TDateTime; //HEAD.TXT????緇??????ユ??
134     FIsHEADTXT : boolean; //HEAD.TXT????緇???????????
135     FTitlePictureURL: string; //top腟泣??RL
136     FMultiplicity : Integer; //??茲?????????????????鐚?
137     FIs2ch : Boolean; //host??2ch????????
138     FNewThreadCount: Integer; //?亥???鴻??????????/span>
139     FLogThreadCount: Integer; //???井?????鴻??????????/span>
140     FUserThreadCount: Integer; //鐚?
141 h677 1.70 FLiveThreadCount: Integer; //??絖??鴻????????/span>
142     FArchiveThreadCount: Integer; //DAT?純?<?鴻????????/span>
143 hi_ 1.1 function GetThreadItem(index: integer): TThreadItem;
144     procedure SetThreadItem(index: integer; value: TThreadItem);
145     procedure SetRound(b: Boolean);
146     procedure SetRoundName(s: string);
147 h677 1.60 //procedure SetRoundName(s: PChar);
148 hi_ 1.1 procedure SetLastModified(d: TDateTime);
149     procedure SetLastGetTime(d: TDateTime);
150     procedure SetUnRead(i: Integer);
151     procedure SetKotehanName(s: string);
152     procedure SetKotehanMail(s: string);
153 yoffy 1.25 procedure Init;
154 hi_ 1.1 public
155 yoffy 1.25 constructor Create( inPlugIn : TBoardPlugIn; inURL : string );
156 hi_ 1.1 destructor Destroy; override;
157    
158 yoffy 1.9 property Context: DWORD read FContext write FContext;
159    
160 hi_ 1.1 property Items[index: integer]: TThreadItem read GetThreadItem write SetThreadItem;
161     property No: Integer read FNo write FNo;
162     property Title: string read FTitle write FTitle;
163     property BBSID: string read FBBSID write FBBSID;
164     property URL: string read FURL write FURL;
165     property Round: Boolean read FRound write SetRound;
166 h677 1.60 //property RoundName: PChar read FRoundName write SetRoundName;
167 hi_ 1.1 property RoundName: string read FRoundName write SetRoundName;
168     property RoundDate: TDateTime read FRoundDate write FRoundDate;
169     property LastModified: TDateTime read FLastModified write SetLastModified;
170     property LastGetTime: TDateTime read FLastGetTime write SetLastGetTime;
171     property UnRead: Integer read FUnRead write SetUnRead;
172     property Modified: Boolean read FModified write FModified;
173     property IsThreadDatRead: Boolean read FIsThreadDatRead write FIsThreadDatRead;
174     property ParentCategory: TCategory read FParentCategory write FParentCategory;
175    
176 yoffy 1.9 property BoardPlugIn : TBoardPlugIn read FBoardPlugIn;
177 yoffy 1.13 property FilePath : string read FFilePath write FFilePath;
178     property IsLogFile : Boolean read FIsLogFile write FIsLogFile;
179     property IntData : Integer read FIntData write FIntData;
180     property ListData : TList read FListData write FListData;
181     function IsBoardPlugInAvailable : Boolean;
182 yoffy 1.9
183 hi_ 1.1 function Add(item: TThreadItem): integer;
184     procedure Insert(Index: Integer; Item: TThreadItem);
185     procedure Delete(index: integer);
186     procedure DeleteList(index: integer);
187     procedure Clear; override;
188 h677 1.43 function FindThreadFromFileName(const ItemFileName: string): TThreadItem;
189     function FindThreadFromURL(const inURL : string ) : TThreadItem;
190     function GetIndexFromFileName(const ItemFileName: string): Integer;
191 h677 1.60 function GetIndexFromURL(const URL: string; reverse : Boolean = False): Integer;
192 hi_ 1.1 procedure LoadSettings;
193     procedure SaveSettings;
194     function GetReadCgiURL: string;
195     function GetSubjectFileName: string;
196     function GetFolderIndexFileName: string;
197 h677 1.48 function GetSETTINGTXTFileName: string;
198     function GETHEADTXTFileName: string;
199     function GetTitlePictureFileName: string;
200 yoffy 1.2 function GetSendURL: string;
201 hi_ 1.1
202     function GetNewThreadCount: Integer;
203     function GetLogThreadCount: Integer;
204 h677 1.70 function GetArchiveThreadCount: Integer;
205     function GetLiveThreadCount: Integer;
206 hi_ 1.1 function GetUserThreadCount: Integer;
207     function GetNewThread(Index: Integer): TThreadItem;
208 h677 1.60 function GetLogThread(Index: Integer): TThreadItem; overload;
209 h677 1.70 function GetArchiveThread(Index: Integer): TThreadItem;
210     function GetLiveThread(Index: Integer): TThreadItem;
211 hi_ 1.1 function GetUserThread(Index: Integer): TThreadItem;
212 h677 1.71 function GetThreadCount(func :TThreadCount ): Integer;
213     function GetThread(func :TThreadCount;const Index :Integer ): TThreadItem;
214 hi_ 1.1 procedure BeginUpdate;
215     procedure EndUpdate;
216     property NodeExpand: Boolean read FExpand write FExpand;
217     property BoolData: Boolean read FBoolData write FBoolData;
218     property SPID: string read FSPID write FSPID;
219     property PON: string read FPON write FPON;
220     property KotehanName: string read FKotehanName write SetKotehanName;
221     property KotehanMail: string read FKotehanMail write SetKotehanMail;
222 h677 1.48
223     property SETTINGTXTTime: TDateTime read FSETTINGTXTTime write FSETTINGTXTTime;
224     property IsSETTINGTXT: boolean read FIsSETTINGTXT write FIsSETTINGTXT;
225     property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;
226     property IsHEADTXT: boolean read FIsHEADTXT write FIsHEADTXT;
227 h677 1.60 property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;
228 h677 1.55 property Multiplicity: Integer read FMultiplicity write FMultiplicity;
229 h677 1.60 property Is2ch : boolean read FIs2ch write FIs2ch;
230     property NewThreadCount: Integer read FNewThreadCount write FNewThreadCount; //?亥???鴻??????????/span>
231     property LogThreadCount: Integer read FLogThreadCount write FLogThreadCount; //???井?????鴻??????????/span>
232     property UserThreadCount: Integer read FUserThreadCount write FUserThreadCount; //鐚?
233 h677 1.70 property LiveThreadCount: Integer read FLiveThreadCount write FLiveThreadCount;
234     property ArchiveThreadCount: Integer read FArchiveThreadCount write FArchiveThreadCount;
235    
236 h677 1.60 property Cookie: string read FCookie write FCookie;
237     property Expires: TDateTime read FExpires write FExpires;
238 hi_ 1.1 end;
239    
240     //?鴻??/span>
241     TThreadItem = class(TObject)
242     private
243 yoffy 1.6 FContext: DWORD; // ?????違?ゃ?潟?????宴??┃絎???????????筝祉???ゃ?潟?鴻?帥?潟?鴻???ャ??)
244 hi_ 1.1 FNo: Integer; //???/span>
245     FFileName: string; //?鴻?????????<?ゃ????
246     FTitle: string; //?鴻???????帥?ゃ????/span>
247     FShortTitle: string; //?????鴻???????帥?ゃ?????罎?膣∝???
248     FRoundDate: TDateTime; //?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
249     FLastModified: TDateTime; //?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
250     FCount: Integer; //?鴻???????????潟??鐚????若?????
251     FAllResCount: Integer; //?鴻???????????潟??鐚??泣?若??鐚?
252     FNewResCount: Integer; //?鴻???????亥????/span>
253     FSize: Integer; //?鴻???????泣?ゃ??/span>
254     FRound: Boolean; //綏≦????????/span>
255     FRoundName: string; //綏≦????
256     FIsLogFile: Boolean; //???医?????????/span>
257     FParentBoard: TBoard; //荀????若??
258     FKokomade: Integer; //?潟?潟?障?ц????????/span>
259     FNewReceive: Integer; //?潟?潟?????域???篆?/span>
260     FNewArrival: Boolean; //?亥??
261     FUnRead: Boolean; //?????????/span>
262     FScrollTop: Integer; //?鴻?????若???臀?/span>
263     FDownloadHost: string; //篁??????鴻?????????翫???????鴻??
264     FAgeSage: TGikoAgeSage; //?≪?ゃ?????????筝???
265     FUpdate: Boolean;
266     FExpand: Boolean;
267 yoffy 1.7 FURL : string; // ?????鴻???????????吟?ц;腓冴??????? URL
268 h677 1.68 FJumpAddress : Integer; //???合??垽??絎?URL??荼????????????絎??????????鴻????垩???ャ??
269 hi_ 1.1 procedure SetLastModified(d: TDateTime);
270     procedure SetRound(b: Boolean);
271 h677 1.43 procedure SetRoundName(const s: string);
272 h677 1.60 //procedure SetRoundName(const s: PChar);
273 hi_ 1.1 procedure SetKokomade(i: Integer);
274     procedure SetUnRead(b: Boolean);
275     procedure SetScrollTop(i: Integer);
276 yoffy 1.25 procedure Init;
277 h677 1.43 function GetCreateDate: TDateTime;
278 h677 1.60 function GetFilePath: String;
279 hi_ 1.1 public
280 h677 1.60 constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard; inURL : string ); overload;
281     constructor Create(const inPlugIn : TBoardPlugIn; const inBoard : TBoard;
282 h677 1.77 const inURL : string; inExist: Boolean; const inFilename: string ); overload;
283 h677 1.59
284 hi_ 1.1 destructor Destroy; override;
285    
286     function GetDatURL: string;
287     function GetDatgzURL: string;
288     // function GetOldDatgzURL: string;
289 h677 1.43 function GetOfflawCgiURL(const SessionID: string): string;
290 hi_ 1.1 function GetSendURL: string;
291     procedure DeleteLogFile;
292     function GetThreadFileName: string;
293     procedure BeginUpdate;
294     procedure EndUpdate;
295    
296 yoffy 1.6 property Context: DWORD read FContext write FContext;
297    
298 hi_ 1.1 property No: Integer read FNo write FNo;
299     property FileName: string read FFileName write FFileName;
300     property Title: string read FTitle write FTitle;
301     property ShortTitle: string read FShortTitle write FShortTitle;
302     property RoundDate: TDateTime read FRoundDate write FRoundDate;
303     property LastModified: TDateTime read FLastModified write SetLastModified;
304     property Count: Integer read FCount write FCount;
305     property AllResCount: Integer read FAllResCount write FAllResCount;
306     property NewResCount: Integer read FNewResCount write FNewResCount;
307     property Size: Integer read FSize write FSize;
308     property Round: Boolean read FRound write SetRound;
309     property RoundName: string read FRoundName write SetRoundName;
310 h677 1.60 //property RoundName: PChar read FRoundName write SetRoundName;
311 hi_ 1.1
312     property IsLogFile: Boolean read FIsLogFile write FIsLogFile;
313     property ParentBoard: TBoard read FParentBoard write FParentBoard;
314     property Kokomade: Integer read FKokomade write SetKokomade;
315     property NewReceive: Integer read FNewReceive write FNewReceive;
316     property NewArrival: Boolean read FNewArrival write FNewArrival;
317     property UnRead: Boolean read FUnRead write SetUnRead;
318     property ScrollTop: Integer read FScrollTop write SetScrollTop;
319     property Expand: Boolean read FExpand write FExpand;
320     property DownloadHost: string read FDownloadHost write FDownloadHost;
321     property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;
322 h677 1.43 property CreateDate: TDateTime read GetCreateDate;
323 yoffy 1.17 property URL : string read FURL write FURL;
324 h677 1.60 property FilePath : string read GetFilePath;
325 h677 1.68 property JumpAddress : Integer read FJumpAddress write FJumpAddress;
326 hi_ 1.1 end;
327    
328 h677 1.60 TBoardGroup = class(TStringList)
329     private
330     FBoardPlugIn : TBoardPlugIn; // ?????帥???泣???若???????????違?ゃ??/span>
331     public
332 h677 1.62 destructor Destroy; override;
333     procedure Clear ; override;
334 h677 1.60 property BoardPlugIn : TBoardPlugIn read FBoardPlugIn write FBoardPlugIn;
335     end;
336 hi_ 1.1
337 h677 1.75 // ?号???????Board
338     TSpecialBoard = class(TBoard)
339     public
340     function Add(item: TThreadItem): integer; overload;
341     procedure Clear; overload;
342     end;
343 hi_ 1.1
344 yoffy 1.17 function BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
345     function BBSsFindBoardFromURL( inURL : string ) : TBoard;
346     function BBSsFindBoardFromTitle( inTitle : string ) : TBoard;
347 h677 1.43 function BBSsFindThreadFromURL(const inURL : string ) : TThreadItem;
348 h677 1.45 function ConvertDateTimeString( inDateTimeString : string) : TDateTime;
349    
350 h677 1.75 procedure DestorySpecialBBS( inBBS : TBBS );
351    
352 hi_ 1.1 var
353 yoffy 1.17 BBSs : array of TBBS;
354 h677 1.60 BoardGroups : array of TBoardGroup;
355 h677 1.75 SpecialBBS : TBBS;
356 h677 1.76 SpecialBoard: TSpecialBoard;
357    
358 hi_ 1.1 implementation
359    
360     uses
361 h677 1.71 GikoSystem, RoundData, MojuUtils, DateUtils, IniFiles;
362 hi_ 1.1
363     const
364 yoffy 1.6 BBS2CH_NAME: string = '鐚??<????????';
365     BBS2CH_LOG_FOLDER: string = '2ch';
366 yoffy 1.19 EXTERNAL_LOG_FOLDER: string = 'exboard';
367 hi_ 1.1
368 yoffy 1.6 FOLDER_INI_FILENAME: string = 'Folder.ini';
369     FOLDER_INDEX_FILENAME: string = 'Folder.idx';
370     SUBJECT_FILENAME: string = 'subject.txt';
371     PATH_DELIM: string = '\';
372 h677 1.48 SETTINGTXT_FILENAME: string = 'SETTING.TXT';
373 h677 1.49 HEADTXT_FILENAME: string = 'head.html';
374 yoffy 1.6 //DEFAULT_LIST_COUNT: Integer = 100;
375 hi_ 1.1
376 h677 1.71 //! ???違?????c??????????????菴???
377     function CountLog(Item: TThreadItem): Boolean;
378     begin
379     Result := Item.IsLogFile;
380     end;
381     //! ?亥??????????菴???
382     function CountNew(Item: TThreadItem): Boolean;
383     begin
384     Result := Item.NewArrival;
385     end;
386     //! DAT?純?<????????菴???
387     function CountDat(Item: TThreadItem): Boolean;
388     begin
389     Result := (Item.AgeSage = gasArch);
390     end;
391     //! ??絖??鴻??????????菴???
392     function CountLive(Item: TThreadItem): Boolean;
393     begin
394     Result := (Item.AgeSage <> gasArch);
395     end;
396    
397     //! 絽吾????
398     function CountAll(Item: TThreadItem): Boolean;
399     begin
400     Result := True;
401     end;
402    
403    
404 hi_ 1.1
405 yoffy 1.35 // BBSID ???????? 2 ?<???????????炊「???冴???障??
406     // BBSID ??戎????サ???帥?????????????
407     // ???純???翫??? URL ??篏睡???????????????
408 yoffy 1.17 function BBSsFindBoardFromBBSID(
409 yoffy 1.21 inBBSID : string
410 yoffy 1.17 ) : TBoard;
411 h677 1.60 var
412     i : Integer;
413     tmpBoard : TBoard;
414 yoffy 1.17 begin
415    
416 h677 1.60 // Result := BBSs[ 0 ].FindBBSID( inBBSID );
417     Result := nil;
418     if Length(BoardGroups) > 0 then begin
419     for i := BoardGroups[0].Count - 1 downto 0 do begin
420     tmpBoard := TBoard(BoardGroups[0].Objects[i]);
421     if tmpBoard.Is2ch then begin
422     if AnsiCompareStr(tmpBoard.BBSID, inBBSID) = 0 then begin
423     Result := tmpBoard;
424     EXIT;
425     end;
426     end;
427     end;
428     end;
429 yoffy 1.17
430     end;
431 h677 1.60 {**********************************************
432     ?????∽?違??????帥??RL??就綣?ф検?????????????
433     plugin??篏睡???????????違??ExtractBoardURL( inURL )
434     2ch?????違??GikoSys.Get2chThreadURL2BoardURL( inURL );
435     ?у????????????若?喝?冴?????????????
436     **********************************************}
437 yoffy 1.17 function BBSsFindBoardFromURL(
438 yoffy 1.21 inURL : string
439 yoffy 1.17 ) : TBoard;
440     var
441 h677 1.60 i,p : Integer;
442     accept : TAcceptType;
443     protocol, host, path, document, port, bookmark : string;
444 yoffy 1.17 begin
445 h677 1.60 Result := nil;
446     for i := Length(BoardGroups) - 1 downto 1 do begin
447     accept := BoardGroups[i].BoardPlugIn.AcceptURL(inURL);
448     if (accept = atBoard) or (accept = atThread) then begin
449     if BoardGroups[i].Find(inURL, p) then begin
450     Result := TBoard(BoardGroups[i].Objects[p]);
451     Exit;
452     end else begin
453     inURL := BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL);
454     if BoardGroups[i].Find(inURL, p) then begin
455     Result := TBoard(BoardGroups[i].Objects[p]);
456     Exit;
457     end;
458     end;
459     end;
460     end;
461     //??????????????plugin??篏帥????????ゃ????茯帥?鴻??
462     if BoardGroups[0].Find(inURL, p) then
463     Result := TBoard(BoardGroups[0].Objects[p]);
464    
465     if (Result = nil) then begin
466     GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
467     //???鴻????2ch????BBSID?ц??鴻??
468     if GikoSys.Is2chHost(host) then begin
469     Result := BBSsFindBoardFromBBSID(GikoSys.URLToID( inURL ));
470     end;
471 yoffy 1.17 end;
472    
473     end;
474    
475     function BBSsFindBoardFromTitle(
476 yoffy 1.21 inTitle : string
477 yoffy 1.17 ) : TBoard;
478     var
479 h677 1.60 i,j : Integer;
480     tmpBoard : TBoard;
481 yoffy 1.17 begin
482 h677 1.60 Result := nil;
483 yoffy 1.21 for i := Length( BBSs ) - 1 downto 0 do begin
484 h677 1.60 for j := BoardGroups[i].Count - 1 downto 0 do begin
485     tmpBoard := TBoard(BoardGroups[i].Objects[j]);
486     if ( AnsiCompareStr(tmpBoard.Title, inTitle) = 0) then begin
487     Result := tmpBoard;
488     Exit;
489     end;
490     end;
491 yoffy 1.17 end;
492    
493     end;
494    
495     function BBSsFindThreadFromURL(
496 h677 1.43 const inURL : string
497 yoffy 1.17 ) : TThreadItem;
498     var
499 yoffy 1.24 board : TBoard;
500 h677 1.65 tmpThread : TThreadItem;
501 yoffy 1.24 boardURL : string;
502 h677 1.60 protocol, host, path, document, port, bookmark : string;
503     BBSID, BBSKey : string;
504 h677 1.65 i, bi : Integer;
505 yoffy 1.17 begin
506    
507 yoffy 1.24 boardURL := GikoSys.GetThreadURL2BoardURL( inURL );
508     board := BBSsFindBoardFromURL( boardURL );
509     if board = nil then
510     Result := nil
511 h677 1.60 else begin
512 yoffy 1.24 Result := board.FindThreadFromURL( inURL );
513 h677 1.60 //??????2ch???帥????
514     if (Result = nil) and (board.Is2ch) then begin
515     GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
516     GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
517     Result := board.FindThreadFromFileName(BBSKey + '.dat');
518 h677 1.65 end else if (Result = nil) and not (board.Is2ch) then begin
519     //?????違?ゃ?括鎧??「膣??筝祉??RL????筝??у??眼?????c??蕁?)
520     try
521     bi := Length(BoardGroups) - 1;
522     for i := 1 to bi do begin
523     if (BoardGroups[i].BoardPlugIn <> nil) and (Assigned(Pointer(BoardGroups[i].BoardPlugIn.Module))) then begin
524     if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
525     tmpThread := TThreadItem.Create( BoardGroups[i].BoardPlugIn, Board, inURL );
526     if not board.IsThreadDatRead then begin
527     GikoSys.ReadSubjectFile( board );
528     end;
529     Result := Board.FindThreadFromFileName( tmpThread.FileName );
530     tmpThread.Free;
531     Break;
532     end;
533     end;
534     end;
535     except
536     Result := nil;
537     end;
538 h677 1.60 end;
539     end;
540 yoffy 1.17
541     end;
542 h677 1.75 {!
543     \brief ?号?????BBS????/span>
544     \param bbs ???ゃ?????号?????BBS
545     }
546     procedure DestorySpecialBBS( inBBS : TBBS );
547     var
548     sCategory : TCategory;
549     sBoard : TSpecialBoard;
550     begin
551     if inBBS <> nil then begin
552     sCategory := inBBS.Items[0];
553     if sCategory <> nil then begin
554     sBoard := TSpecialBoard(sCategory.Items[0]);
555     if sBoard <> nil then begin
556     sBoard.Modified := False;
557     sBoard.Clear;
558     FreeAndNil(sBoard);
559     end;
560     end;
561     FreeAndNil(inBBS);
562     end;
563     end;
564 yoffy 1.17
565 hi_ 1.1 (*************************************************************************
566     *罘??遵??鐚?TBBS?潟?潟?鴻????????/span>
567     *Public
568     *************************************************************************)
569 yoffy 1.35 constructor TBBS.Create( boardFilePath : string );
570 hi_ 1.1 begin
571 yoffy 1.25 inherited Create;
572 hi_ 1.1 Title := BBS2CH_NAME;
573 yoffy 1.35 FFilePath := boardFilePath;
574 hi_ 1.1 end;
575    
576     (*************************************************************************
577     *罘??遵??鐚?TBBS???鴻????????/span>
578     *Public
579     *************************************************************************)
580 yoffy 1.17 destructor TBBS.Destroy;
581 hi_ 1.1 begin
582     Clear;
583     inherited;
584     end;
585    
586     (*************************************************************************
587     *罘??遵??鐚?
588     *Public
589     *************************************************************************)
590 yoffy 1.17 function TBBS.GetCategory(index: integer): TCategory;
591 hi_ 1.1 begin
592     Result := TCategory(inherited Items[index]);
593     end;
594    
595 yoffy 1.17 procedure TBBS.SetCategory(index: integer; value: TCategory);
596 hi_ 1.1 begin
597     inherited Items[index] := value;
598     end;
599    
600 yoffy 1.17 function TBBS.Add(item: TCategory): integer;
601 hi_ 1.1 begin
602 yoffy 1.17 Item.ParenTBBS := self;
603 hi_ 1.1 Result := inherited Add(item);
604     end;
605    
606 yoffy 1.17 procedure TBBS.Delete(index: integer);
607 hi_ 1.1 begin
608     if Items[index] <> nil then
609     TCategory(Items[index]).Free;
610     Items[index] := nil;
611     inherited Delete(index);
612     end;
613    
614 yoffy 1.17 procedure TBBS.Clear;
615 hi_ 1.1 var
616     i: integer;
617     begin
618     for i := Count - 1 downto 0 do
619     Delete(i);
620 h677 1.39 Capacity := Count;
621 hi_ 1.1 end;
622    
623 yoffy 1.17 function TBBS.Find(key: string): TCategory;
624 hi_ 1.1 begin
625     Result := nil;
626     end;
627    
628 h677 1.43 function TBBS.FindBBSID(const BBSID: string): TBoard;
629 hi_ 1.1 var
630 yoffy 1.21 i : Integer;
631 hi_ 1.1 begin
632 yoffy 1.36 if not IsBoardFileRead then
633     GikoSys.ReadBoardFile( Self );
634 yoffy 1.21 for i := Count - 1 downto 0 do begin
635     Result := Items[ i ].FindBBSID(BBSID);
636     if Result <> nil then
637 hi_ 1.1 Exit;
638     end;
639 yoffy 1.21 Result := nil;
640 hi_ 1.1 end;
641    
642 yoffy 1.17 //*************************************************************************
643     // ?帥?ゃ????????眼?????帥???≪??
644     //*************************************************************************)
645 h677 1.43 function TBBS.FindBoardFromTitle(const Title: string): TBoard;
646 hi_ 1.1 var
647     i: Integer;
648     begin
649 yoffy 1.36 if not IsBoardFileRead then
650 h677 1.60 GikoSys.ReadBoardFile( Self );
651 yoffy 1.21 for i := Count - 1 downto 0 do begin
652     Result := Items[ i ].FindBoardFromTitle(Title);
653     if Result <> nil then
654 hi_ 1.1 Exit;
655     end;
656 yoffy 1.21 Result := nil;
657 hi_ 1.1 end;
658    
659 yoffy 1.17 //*************************************************************************
660     // URL ??????篁??????帥???≪??
661     //*************************************************************************)
662 h677 1.43 function TBBS.FindBoardFromURL(const inURL: string): TBoard;
663 yoffy 1.13 var
664 yoffy 1.21 i : Integer;
665 yoffy 1.13 begin
666 yoffy 1.36 if not IsBoardFileRead then
667 h677 1.60 GikoSys.ReadBoardFile( Self );
668 yoffy 1.21 for i := Count - 1 downto 0 do begin
669     Result := Items[ i ].FindBoardFromURL( inURL );
670     if Result <> nil then
671 yoffy 1.13 Exit;
672     end;
673 yoffy 1.21 Result := nil;
674 yoffy 1.13 end;
675    
676 yoffy 1.17 //*************************************************************************
677     // URL ??????篁??????鴻?????????≪??
678     //*************************************************************************)
679 h677 1.43 function TBBS.FindThreadFromURL(const inURL: string): TThreadItem;
680 yoffy 1.17 var
681 yoffy 1.24 board : TBoard;
682     boardURL : string;
683 yoffy 1.17 begin
684 yoffy 1.24
685     boardURL := GikoSys.GetThreadURL2BoardURL( inURL );
686     board := FindBoardFromURL( boardURL );
687     if board = nil then
688     Result := nil
689     else
690     Result := board.FindThreadFromURL( inURL );
691    
692 yoffy 1.17 end;
693    
694 h677 1.43 function TBBS.FindThreadItem(const BBSID, FileName: string): TThreadItem;
695 hi_ 1.1 var
696     Board: TBoard;
697     begin
698     Result := nil;
699     Board := FindBBSID(BBSID);
700     if Board = nil then
701     Exit;
702 yoffy 1.41 Result := Board.FindThreadFromFileName(FileName);
703 hi_ 1.1 end;
704    
705 h677 1.43 function TBBS.FindCategoryFromTitle(const inTitle : string ) : TCategory;
706 yoffy 1.27 var
707     i : Integer;
708     begin
709    
710     for i := Count - 1 downto 0 do begin
711 h677 1.31 if AnsiCompareStr(Items[ i ].Title, inTitle) = 0 then begin
712 yoffy 1.27 Result := Items[ i ];
713     Exit;
714     end;
715     end;
716    
717     Result := nil;
718    
719     end;
720    
721 yoffy 1.17 procedure TBBS.SetSelectText(s: string);
722 hi_ 1.1 begin
723     FSelectText := s;
724 h677 1.51 ShortSelectText := CustomStringReplace(ZenToHan(s), ' ', '');
725 hi_ 1.1 end;
726    
727 yoffy 1.17 {class function TBBS.GetColumnName(Index: Integer): string;
728 hi_ 1.1 begin
729     Result := COLUMN_CATEGORY[Index];
730     end;
731    
732 yoffy 1.17 class function TBBS.GetColumnCount: Integer;
733 hi_ 1.1 begin
734     Result := Length(COLUMN_CATEGORY);
735     end;}
736    
737     //===================
738     //TCategory
739     //===================
740     constructor TCategory.Create;
741     begin
742 yoffy 1.25 inherited;
743 yoffy 1.52
744     Duplicates := dupIgnore;
745     CaseSensitive := False;
746 h677 1.53 //Sorted := True;
747 hi_ 1.1 end;
748    
749     destructor TCategory.Destroy;
750     begin
751     Clear;
752     inherited;
753     end;
754    
755     function TCategory.GetBoard(index: integer): TBoard;
756     begin
757 yoffy 1.41 Result := TBoard( Objects[index] );
758 hi_ 1.1 end;
759    
760     procedure TCategory.SetBoard(index: integer; value: TBoard);
761     begin
762 yoffy 1.41 Objects[index] := value;
763     Strings[index] := value.URL
764 hi_ 1.1 end;
765    
766     function TCategory.Add(item: TBoard): integer;
767     begin
768     Item.ParentCategory := self;
769 yoffy 1.41 Result := AddObject( item.URL, item );
770 hi_ 1.1 end;
771    
772     procedure TCategory.Delete(index: integer);
773     begin
774 h677 1.60 inherited Delete(index);
775 hi_ 1.1 end;
776    
777     procedure TCategory.Clear;
778     var
779     i: integer;
780     begin
781     for i := Count - 1 downto 0 do
782     Delete(i);
783 h677 1.43 Capacity := Count;
784 hi_ 1.1 end;
785    
786 h677 1.43 function TCategory.FindName(const key: string): TBoard;
787 hi_ 1.1 begin
788     Result := nil;
789     end;
790    
791 h677 1.43 function TCategory.FindBBSID(const BBSID: string): TBoard;
792 hi_ 1.1 var
793 yoffy 1.21 i : integer;
794 hi_ 1.1 begin
795 yoffy 1.21 for i := Count - 1 downto 0 do begin
796 h677 1.31 if AnsiCompareStr(Items[i].FBBSID, BBSID) = 0 then begin
797 hi_ 1.1 Result := Items[i];
798     Exit;
799     end;
800     end;
801 yoffy 1.21 Result := nil;
802 hi_ 1.1 end;
803    
804 yoffy 1.17 //*************************************************************************
805     // ?帥?ゃ????????眼?????帥???≪??
806     //*************************************************************************)
807 h677 1.43 function TCategory.FindBoardFromTitle(const Title: string): TBoard;
808 hi_ 1.1 var
809 yoffy 1.21 i : integer;
810 hi_ 1.1 begin
811 yoffy 1.21 for i := Count - 1 downto 0 do begin
812 h677 1.31 if AnsiCompareStr(Items[i].FTitle, Title) = 0 then begin
813 hi_ 1.1 Result := Items[i];
814     Exit;
815     end;
816     end;
817 yoffy 1.21 Result := nil;
818 hi_ 1.1 end;
819    
820 yoffy 1.17 //*************************************************************************
821     // URL ??????篁??????帥???≪??
822     //*************************************************************************)
823 h677 1.43 function TCategory.FindBoardFromURL(const inURL: string): TBoard;
824 yoffy 1.13 var
825 yoffy 1.21 i : Integer;
826 yoffy 1.13 begin
827 yoffy 1.41 i := IndexOf( inURL );
828     if i >= 0 then
829     Result := TBoard( Objects[ i ] )
830     else
831     Result := nil;
832 yoffy 1.13 end;
833    
834 yoffy 1.17 //*************************************************************************
835     // URL ??????篁??????鴻?????????≪??
836     //*************************************************************************)
837 h677 1.43 function TCategory.FindThreadFromURL(const inURL: string): TThreadItem;
838 yoffy 1.17 var
839 yoffy 1.24 board : TBoard;
840     boardURL : string;
841 yoffy 1.17 begin
842    
843 yoffy 1.24 boardURL := GikoSys.GetThreadURL2BoardURL( inURL );
844     board := FindBoardFromURL( boardURL );
845     if board = nil then
846     Result := nil
847     else
848     Result := board.FindThreadFromURL( inURL );
849 yoffy 1.17
850     end;
851    
852 hi_ 1.1 function TCategory.IsMidoku: Boolean;
853     var
854     i: Integer;
855     j: Integer;
856     begin
857     Result := False;
858     for i := 0 to Count - 1 do begin
859     if Items[i] <> nil then begin
860     for j := 0 to Items[i].Count - 1 do begin
861     if Items[i].Items[j] <> nil then begin
862     // if (Items[i].Items[j].IsLogFile) and (Items[i].Items[j].Count > Items[i].Items[j].Kokomade) then begin
863     if (Items[i].Items[j].IsLogFile) and (Items[i].Items[j].UnRead) then begin
864     Result := True;
865     Exit;
866     end;
867     end;
868     end;
869     end;
870     end;
871     end;
872    
873     {class function TCategory.GetColumnName(Index: Integer): string;
874     begin
875     Result := COLUMN_BOARD[Index];
876     end;
877    
878     class function TCategory.GetColumnCount: Integer;
879     begin
880     Result := Length(COLUMN_BOARD);
881     end;}
882    
883     //===================
884     //TBoard
885     //===================
886 yoffy 1.25 procedure TBoard.Init;
887 hi_ 1.1 begin
888 yoffy 1.52 Duplicates := dupIgnore;
889     CaseSensitive := False;
890 h677 1.53 //Sorted := True;
891 yoffy 1.52
892 hi_ 1.1 FNo := 0;
893     FTitle := '';
894     FBBSID := '';
895     FURL := '';
896     FRound := False;
897     FRoundDate := ZERO_DATE;
898     FLastModified := ZERO_DATE;
899     FLastGetTime := ZERO_DATE;
900     FIsThreadDatRead := False;
901     FUnRead := 0;
902 h677 1.63 FMultiplicity := 0;
903 hi_ 1.1 // FListStyle := vsReport;
904     // FItemNoVisible := True;
905    
906     FUpdate := True;
907 yoffy 1.9 end;
908    
909     // *************************************************************************
910     // 紊????帥?????違?ゃ?潟????絎??????潟?潟?鴻????????/span>
911     // *************************************************************************
912     constructor TBoard.Create(
913     inPlugIn : TBoardPlugIn;
914 yoffy 1.18 inURL : string
915 yoffy 1.9 );
916 yoffy 1.19 var
917     protocol, host, path, document, port, bookmark : string;
918 yoffy 1.9 begin
919    
920 yoffy 1.25 inherited Create;
921     Init;
922 yoffy 1.9
923     FBoardPlugIn := inPlugIn;
924     URL := inURL;
925 yoffy 1.17 BBSID := GikoSys.UrlToID( inURL );
926 yoffy 1.9
927 yoffy 1.19 if inPlugIn = nil then begin
928 yoffy 1.20 // subject.txt ???絖????鴻??荐??
929     GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
930 h677 1.60 if GikoSys.Is2chHost( host ) then begin
931     Self.Is2ch := True;
932 yoffy 1.20 FilePath :=
933 h677 1.59 GikoSys.Setting.LogFolderP +
934 yoffy 1.20 BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
935 h677 1.60 end else begin
936     Self.Is2ch := False;
937 yoffy 1.20 FilePath :=
938 h677 1.59 GikoSys.Setting.LogFolderP +
939 yoffy 1.20 EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
940 h677 1.60 end;
941 yoffy 1.19 end else begin
942 yoffy 1.26 // ?????違?ゃ?潟? TBoardItem ??篏???????????????篌?????
943 yoffy 1.17 inPlugIn.CreateBoardItem( DWORD( Self ) );
944 h677 1.60 //Self.Is2ch := False; //plugin?眼?ц┃絎?????
945 yoffy 1.19 end;
946 yoffy 1.9
947 hi_ 1.1 end;
948    
949 yoffy 1.9 // *************************************************************************
950     // ???鴻????????/span>
951     // *************************************************************************
952 hi_ 1.1 destructor TBoard.Destroy;
953     begin
954     if FModified then begin
955     GikoSys.WriteThreadDat(Self);
956     SaveSettings;
957     end;
958    
959 yoffy 1.13 // ?????違?ゃ?潟? TBoardItem ???贋?????????????篌?????
960     if IsBoardPlugInAvailable then
961     BoardPlugIn.DisposeBoardItem( DWORD( Self ) );
962 yoffy 1.9
963 hi_ 1.1 Clear;
964     inherited;
965     end;
966    
967 yoffy 1.9 // *************************************************************************
968     // 紊????帥?????違?ゃ?潟??篏睡????純??
969     // *************************************************************************
970     function TBoard.IsBoardPlugInAvailable : Boolean;
971     begin
972    
973     repeat
974 yoffy 1.13 if BoardPlugIn = nil then
975     Break;
976    
977     if not Assigned( Pointer( BoardPlugIn.Module ) ) then
978     Break;
979 yoffy 1.9
980 yoffy 1.13 Result := True;
981     Exit;
982     until True;
983    
984     Result := False;
985 yoffy 1.9
986     end;
987    
988 hi_ 1.1 function TBoard.GetThreadItem(index: integer): TThreadItem;
989     begin
990 yoffy 1.41 Result := TThreadItem( Objects[index] );
991 hi_ 1.1 end;
992    
993     procedure TBoard.SetThreadItem(index: integer; value: TThreadItem);
994     begin
995 yoffy 1.41 Objects[index] := value;
996     Strings[index] := value.URL;
997 hi_ 1.1 end;
998    
999     function TBoard.Add(Item: TThreadItem): Integer;
1000     begin
1001     Item.ParentBoard := Self;
1002 yoffy 1.41 Result := inherited AddObject(Item.URL, Item);
1003 hi_ 1.1 end;
1004    
1005     procedure TBoard.Insert(Index: Integer; Item: TThreadItem);
1006     begin
1007     Item.ParentBoard := Self;
1008 yoffy 1.41 inherited InsertObject(Index, Item.URL, Item);
1009    
1010 hi_ 1.1 end;
1011    
1012     //Index?ф??絎????????鴻???????????吾?с???????贋?
1013     procedure TBoard.Delete(index: Integer);
1014     begin
1015     if Items[index] <> nil then
1016     TThreadItem(Items[index]).Free;
1017     inherited Delete(index);
1018     end;
1019    
1020     //Index?ф??絎????????鴻???????????鴻?????????わ??鴻???????吾?с????????????鐚?
1021     procedure TBoard.DeleteList(index: integer);
1022     begin
1023     inherited Delete(index);
1024     end;
1025    
1026     procedure TBoard.Clear;
1027     var
1028     i: integer;
1029     begin
1030     // FUnRead := 0;
1031     for i := Count - 1 downto 0 do
1032     Delete(i);
1033 yoffy 1.41 Capacity := Count;
1034 hi_ 1.1 end;
1035    
1036 h677 1.43 function TBoard.FindThreadFromFileName(const ItemFileName: string): TThreadItem;
1037 hi_ 1.1 var
1038     i: integer;
1039     begin
1040     Result := nil;
1041     for i := 0 to Count - 1 do begin
1042 h677 1.31 if AnsiCompareStr(Items[i].FileName, ItemFileName) = 0 then begin
1043 hi_ 1.1 Result := Items[i];
1044     Exit;
1045     end;
1046     end;
1047     end;
1048    
1049 h677 1.43 function TBoard.GetIndexFromFileName(const ItemFileName: string): Integer;
1050 hi_ 1.1 var
1051     i: integer;
1052     begin
1053     Result := -1;
1054     for i := 0 to Count - 1 do begin
1055     if Items[i].FileName = ItemFileName then begin
1056     Result := i;
1057     Exit;
1058     end;
1059     end;
1060     end;
1061    
1062 h677 1.60 function TBoard.GetIndexFromURL(const URL: string; reverse : Boolean = False): Integer;
1063     var
1064     i : Integer;
1065 yoffy 1.11 begin
1066 h677 1.60 if not reverse then
1067     Result := IndexOf( URL )
1068     else begin
1069     Result := -1;
1070     for i := Self.Count - 1 downto 0 do begin
1071     if Strings[i] = URL then begin
1072     Result := i;
1073     break;
1074     end;
1075     end;
1076     end;
1077 yoffy 1.11 end;
1078    
1079 h677 1.43 function TBoard.FindThreadFromURL(const inURL : string ) : TThreadItem;
1080 yoffy 1.17 var
1081     i : Integer;
1082     begin
1083    
1084     if not IsThreadDatRead then
1085     GikoSys.ReadSubjectFile( Self );
1086 yoffy 1.41
1087     i := IndexOf( inURL );
1088     if i >= 0 then
1089     Result := TThreadItem( Objects[ i ] )
1090     else
1091     Result := nil;
1092 yoffy 1.17
1093     end;
1094    
1095 hi_ 1.1 {function TBoard.GetMidokuCount: Integer;
1096     var
1097     i: integer;
1098     begin
1099     Result := 0;
1100     for i := 0 to Count- 1 do begin
1101     if Items[i] <> nil then begin
1102     if (Items[i].IsLogFile) and (Items[i].Count > Items[i].Kokomade) then
1103     inc(Result);
1104     end;
1105     end;
1106     end;
1107     }
1108    
1109     procedure TBoard.LoadSettings;
1110     var
1111     ini: TMemIniFile;
1112     FileName: string;
1113 h677 1.55 tmp: string;
1114 hi_ 1.1 begin
1115 yoffy 1.12 if Length( FilePath ) > 0 then
1116 yoffy 1.13 FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME
1117     else
1118 h677 1.59 FileName := GikoSys.Setting.LogFolderP
1119 yoffy 1.40 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + FOLDER_INI_FILENAME;
1120 hi_ 1.1
1121     if not FileExists(FileName) then
1122     Exit;
1123     ini := TMemIniFile.Create(FileName);
1124     try
1125     // Round := ini.ReadBool('Status', 'Round', False);
1126 h677 1.32 tmp := ini.ReadString('Status', 'RoundDate', DateTimeToStr(ZERO_DATE));
1127 h677 1.48 FRoundDate := ConvertDateTimeString(tmp);
1128     tmp := ini.ReadString('Status', 'LastModified', DateTimeToStr(ZERO_DATE));
1129     FLastModified := ConvertDateTimeString(tmp);
1130     tmp := ini.ReadString('Status', 'LastGetTime', DateTimeToStr(ZERO_DATE));
1131     FLastGetTime := ConvertDateTimeString(tmp);
1132    
1133     tmp := ini.ReadString('BoardInformation', 'SETTINGTXTTime', DateTimeToStr(ZERO_DATE));
1134     FSETTINGTXTTime := ConvertDateTimeString(tmp);
1135     tmp := ini.ReadString('BoardInformation', 'HEADTXTTime', DateTimeToStr(ZERO_DATE));
1136     FHEADTXTTime := ConvertDateTimeString(tmp);
1137    
1138     FIsSETTINGTXT := ini.ReadBool('BoardInformation', 'IsSETTINGTXT', false);
1139     FIsHEADTXT := ini.ReadBool('BoardInformation', 'IsHEADTXT', false);
1140     FTitlePictureURL := ini.ReadString('BoardInformation', 'TitlePictureURL', '');
1141    
1142 hi_ 1.1 FUnRead := ini.ReadInteger('Status', 'UnRead', 0);
1143     FSPID := ini.ReadString('Cookie', 'SPID', '');
1144     FPON := ini.ReadString('Cookie', 'PON', '');
1145 h677 1.60 FCookie := ini.ReadString('Cookie', 'Cookie', '');
1146     tmp := ini.ReadString('Cookie', 'Expires', DateTimeToStr(ZERO_DATE));
1147     FExpires := ConvertDateTimeString(tmp);
1148 hi_ 1.1 FKotehanName := ini.ReadString('Kotehan', 'Name', '');
1149     FKotehanMail := ini.ReadString('Kotehan', 'Mail', '');
1150 h677 1.48
1151 hi_ 1.1 if UnRead < 0 then
1152     UnRead := 0;
1153     finally
1154     ini.Free;
1155     end;
1156     end;
1157    
1158     procedure TBoard.SaveSettings;
1159     var
1160     ini: TMemIniFile;
1161     FileName: string;
1162     begin
1163 yoffy 1.12 if Length( FilePath ) > 0 then
1164 yoffy 1.13 FileName := ExtractFilePath( FilePath )
1165     else
1166 h677 1.59 FileName := GikoSys.Setting.LogFolderP
1167 yoffy 1.40 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM;
1168 hi_ 1.1 if not GikoSys.DirectoryExistsEx(FileName) then
1169     GikoSys.ForceDirectoriesEx(FileName);
1170     FileName := FileName + FOLDER_INI_FILENAME;
1171     ini := TMemIniFile.Create(FileName);
1172     try
1173     if UnRead < 0 then
1174     UnRead := 0;
1175     // ini.WriteBool('Status', 'Round', Round);
1176     ini.WriteDateTime('Status', 'RoundDate', FRoundDate);
1177     ini.WriteDateTime('Status', 'LastModified', FLastModified);
1178     ini.WriteDateTime('Status', 'LastGetTime', FLastGetTime);
1179     ini.WriteInteger('Status', 'UnRead', FUnRead);
1180     ini.WriteString('Cookie', 'SPID', FSPID);
1181     ini.WriteString('Cookie', 'PON', FPON);
1182 h677 1.60 ini.WriteString('Cookie', 'Cookie', FCookie);
1183     ini.WriteDateTime('Cookie', 'Expires', FExpires);
1184 hi_ 1.1 ini.WriteString('Kotehan', 'Name', FKotehanName);
1185     ini.WriteString('Kotehan', 'Mail', FKotehanMail);
1186 h677 1.48
1187     ini.WriteDateTime('BoardInformation', 'SETTINGTXTTime', FSETTINGTXTTime);
1188     ini.WriteDateTime('BoardInformation', 'HEADTXTTime', FHEADTXTTime);
1189    
1190     ini.WriteBool('BoardInformation', 'IsSETTINGTXT', FIsSETTINGTXT);
1191     ini.WriteBool('BoardInformation', 'IsHEADTXT', FIsHEADTXT);
1192     ini.WriteString('BoardInformation', 'TitlePictureURL', FTitlePictureURL);
1193 hi_ 1.1 // ini.WriteInteger('Status', 'ListStyle', Ord(ListStyle));
1194     // ini.WriteBool('Status', 'ItemNoVisible', ItemNoVisible);
1195     // ini.WriteInteger('Status', 'ViewType', Ord(ViewType));
1196     ini.UpdateFile;
1197     finally
1198     ini.Free;
1199     end;
1200     end;
1201 h677 1.32 //????????003 02 08 0:32:13??????就綣???ヤ??????????с??????
1202     // 2003/02/08 0:32:13?????????
1203 h677 1.37 function ConvertDateTimeString( inDateTimeString : string) : TDateTime;
1204     const
1205     ZERO_DATE_STRING : string = '1970/01/01 0:00:00';
1206 h677 1.32 var
1207     i : Integer;
1208 h677 1.37 y: Integer;
1209     m: Integer;
1210     d: Integer;
1211     hour: Integer;
1212     min: Integer;
1213     sec: Integer;
1214 h677 1.32 begin
1215 h677 1.37 if inDateTimeString = '' then
1216     inDateTimeString := ZERO_DATE_STRING;
1217    
1218 h677 1.32 if ( AnsiPos('/', inDateTimeString ) = 0 ) and
1219     ( AnsiCompareStr( DateTimeToStr(ZERO_DATE), inDateTimeString) <> 0 ) then begin
1220     for i := 0 to 1 do begin
1221     Insert('/',inDateTimeString, AnsiPos(' ', inDateTimeString) + 1 );
1222     Delete(inDateTimeString, AnsiPos(' ', inDateTimeString), 1);
1223     end;
1224     end;
1225 h677 1.37 try
1226     Result := StrToDateTime( inDateTimeString );
1227     except
1228     if( inDateTimeString[5] = '/' ) and ( inDateTimeString[8] = '/' ) then begin
1229     y := StrToIntDef( Copy(inDateTimeString, 1, 4), 1970 );
1230 h677 1.55 m := StrToIntDef( Copy(inDateTimeString, 6, 2), 1 );
1231 h677 1.37 d := StrToIntDef( Copy(inDateTimeString, 9, 2), 1 );
1232     hour := 0; min := 0; sec := 0;
1233    
1234     if Length(inDateTimeString) > 11 then begin
1235     if( inDateTimeString[13] = ':' ) and ( inDateTimeString[16] = ':' ) then begin
1236     hour := StrToIntDef( Copy(inDateTimeString, 12, 1), 0 );
1237     min := StrToIntDef( Copy(inDateTimeString, 14, 2), 0 );
1238     sec := StrToIntDef( Copy(inDateTimeString, 17, 2), 0 );
1239     end else if( inDateTimeString[14] = ':' ) and ( inDateTimeString[17] = ':' ) then begin
1240     hour := StrToIntDef( Copy(inDateTimeString, 12, 2), 0 );
1241     min := StrToIntDef( Copy(inDateTimeString, 15, 2), 0 );
1242     sec := StrToIntDef( Copy(inDateTimeString, 18, 2), 0 );
1243     end;
1244     end;
1245     try
1246     Result := EncodeDateTime(y ,m, d, hour, min, sec, 0);
1247     except
1248     Result := ZERO_DATE;
1249     end;
1250     end else
1251     Result := ZERO_DATE;
1252     end;
1253    
1254    
1255     // Result := inDateTimeString;
1256 h677 1.32 end;
1257 h677 1.71 //! ?泣???吾?с????URL??緇?
1258 hi_ 1.1 function TBoard.GetReadCgiURL: string;
1259     begin
1260     Result := URL + SUBJECT_FILENAME;
1261    
1262     end;
1263    
1264 h677 1.71 //! ?泣???吾?с???????<?ゃ??????緇?鐚????刻????<?ゃ????鐚?
1265 hi_ 1.1 function TBoard.GetSubjectFileName: string;
1266     begin
1267 yoffy 1.11 if Length( FilePath ) > 0 then
1268 yoffy 1.13 Result := FilePath
1269     else
1270 h677 1.59 Result := GikoSys.Setting.LogFolderP
1271 yoffy 1.40 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME;
1272 hi_ 1.1 end;
1273    
1274 h677 1.71 //! ?ゃ?潟???????鴻???<?ゃ????(folder.idx)??緇?鐚????刻????<?ゃ????鐚?
1275 hi_ 1.1 function TBoard.GetFolderIndexFileName: string;
1276     begin
1277 yoffy 1.12 if Length( FilePath ) > 0 then
1278 yoffy 1.13 Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME
1279     else
1280 h677 1.59 Result := GikoSys.Setting.LogFolderP
1281 yoffy 1.40 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME;
1282 hi_ 1.1 end;
1283 h677 1.71 //! SETTING.TXT?????<?ゃ??????緇?
1284 h677 1.48 function TBoard.GetSETTINGTXTFileName: string;
1285     begin
1286     if Length( FilePath ) > 0 then
1287     Result := ExtractFilePath( FilePath ) + SETTINGTXT_FILENAME
1288     else
1289 h677 1.59 Result := GikoSys.Setting.LogFolderP
1290 h677 1.48 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SETTINGTXT_FILENAME;
1291     end;
1292    
1293     function TBoard.GETHEADTXTFileName: string;
1294     begin
1295     if Length( FilePath ) > 0 then
1296     Result := ExtractFilePath( FilePath ) + HEADTXT_FILENAME
1297     else
1298 h677 1.59 Result := GikoSys.Setting.LogFolderP
1299 h677 1.48 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + HEADTXT_FILENAME;
1300     end;
1301     function TBoard.GetTitlePictureFileName: string;
1302     var
1303     tmpName: string;
1304     begin
1305     if FTitlePictureURL = '' then
1306     Result := ''
1307     else begin
1308     tmpName := Copy(FTitlePictureURL, LastDelimiter('/', FTitlePictureURL) + 1, Length(FTitlePictureURL));
1309     if Length( FilePath ) > 0 then
1310     Result := ExtractFilePath( FilePath ) + tmpName
1311     else
1312 h677 1.59 Result := GikoSys.Setting.LogFolderP
1313 h677 1.48 + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + tmpName;
1314     end;
1315     end;
1316 hi_ 1.1
1317 yoffy 1.2 // ?鴻???????篆?RL
1318     function TBoard.GetSendURL: string;
1319     begin
1320 h677 1.58 Result := GikoSys.UrlToServer(URL);
1321 h677 1.60 if Self.Is2ch then
1322 h677 1.58 Result := Result + 'test/bbs.cgi'
1323     else
1324     Result := Result + 'test/subbbs.cgi';
1325    
1326 yoffy 1.2 end;
1327    
1328 hi_ 1.1 procedure TBoard.SetRound(b: Boolean);
1329     begin
1330     if b then
1331     RoundList.Add(Self)
1332     else
1333     RoundList.Delete(Self);
1334     if FRound = b then Exit;
1335     FRound := b;
1336     if FUpdate then
1337     FModified := True;
1338     end;
1339    
1340     procedure TBoard.SetRoundName(s: string);
1341     begin
1342     if FRoundName = s then Exit;
1343     FRoundName := s;
1344     if FUpdate then
1345     FModified := True;
1346     end;
1347 h677 1.71
1348 hi_ 1.1 procedure TBoard.SetLastModified(d: TDateTime);
1349     begin
1350     if FLastModified = d then Exit;
1351     FLastModified := d;
1352     if FUpdate then
1353     FModified := True;
1354     end;
1355    
1356     procedure TBoard.SetLastGetTime(d: TDateTime);
1357     begin
1358     if FLastGetTime = d then Exit;
1359     FLastGetTime := d;
1360     if FUpdate then
1361     FModified := True;
1362     end;
1363    
1364     procedure TBoard.SetUnRead(i: Integer);
1365     begin
1366     if FUnRead = i then Exit;
1367     if i < 0 then i := 0;
1368     FUnRead := i;
1369     if FUpdate then
1370     FModified := True;
1371     end;
1372    
1373     procedure TBoard.SetKotehanName(s: string);
1374     begin
1375     if FKotehanName = s then Exit;
1376     FKotehanName := s;
1377     if FUpdate then
1378     FModified := True;
1379     end;
1380    
1381     procedure TBoard.SetKotehanMail(s: string);
1382     begin
1383     if FKotehanMail = s then Exit;
1384     FKotehanMail := s;
1385     if FUpdate then
1386     FModified := True;
1387     end;
1388 h677 1.71 //! func???>散????眼?????鴻?????????違??菴???
1389     function TBoard.GetThreadCount(func :TThreadCount ): Integer;
1390 hi_ 1.1 var
1391     i: Integer;
1392     begin
1393     Result := 0;
1394 yoffy 1.27 if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
1395     begin
1396     for i := 0 to Count - 1 do begin
1397 h677 1.71 if func(Items[i]) then
1398 yoffy 1.27 inc(Result);
1399     end;
1400     end else begin
1401     for i := 0 to Count - 1 do begin
1402 h677 1.71 if func(Items[i]) then
1403 yoffy 1.27 begin
1404     if Items[i].ShortTitle = '' then
1405 h677 1.54 Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
1406 yoffy 1.27 if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
1407     inc(Result);
1408     end;
1409     end;
1410     end;
1411 hi_ 1.1 end;
1412 h677 1.71 //! ?亥???鴻?????????違????緇?????
1413     function TBoard.GetNewThreadCount: Integer;
1414     begin
1415     Result := GetThreadCount(CountNew);
1416     end;
1417     //! ???井?????鴻?????????違????緇?????
1418 hi_ 1.1 function TBoard.GetLogThreadCount: Integer;
1419     begin
1420 h677 1.71 Result := GetThreadCount(CountLog);
1421 hi_ 1.1 end;
1422 h677 1.71 //! 腟?莨若?炊?>散????眼?????鴻?????????違????緇?????
1423 hi_ 1.1 function TBoard.GetUserThreadCount: Integer;
1424     begin
1425 h677 1.71 Result := GetThreadCount(CountAll);
1426 hi_ 1.1 end;
1427 h677 1.71 //! DAT?純?<?鴻?????????違????緇?????
1428 h677 1.70 function TBoard.GetArchiveThreadCount: Integer;
1429     begin
1430 h677 1.71 Result := GetThreadCount(CountDat);
1431 h677 1.70 end;
1432 h677 1.71 //! ??絖??鴻?????????違????緇?????
1433 h677 1.70 function TBoard.GetLiveThreadCount: Integer;
1434     begin
1435 h677 1.71 Result := GetThreadCount(CountLive);
1436 h677 1.70 end;
1437 h677 1.71 //! func???>散??????????Index???????鴻??????????緇?????
1438     function TBoard.GetThread(func :TThreadCount;const Index :Integer ): TThreadItem;
1439 h677 1.70 var
1440     i: Integer;
1441     Cnt: Integer;
1442     begin
1443     Result := nil;
1444     Cnt := 0;
1445     if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
1446     begin
1447     for i := 0 to Count - 1 do begin
1448 h677 1.71 if func(Items[i]) then begin
1449 h677 1.70 if Index = Cnt then begin
1450     Result := Items[i];
1451     Exit;
1452     end;
1453     inc(Cnt);
1454     end;
1455     end;
1456     end else begin
1457     for i := 0 to Count - 1 do begin
1458 h677 1.71 if func(Items[i]) then begin
1459     if Length(Items[i].ShortTitle) = 0 then
1460 h677 1.70 Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
1461     if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
1462     if Index = Cnt then begin
1463     Result := Items[i];
1464     Exit;
1465     end;
1466     inc(Cnt);
1467     end;
1468     end;
1469     end;
1470     end;
1471     end;
1472 h677 1.71 //! DAT?純?<?鴻????????ndex???????鴻??????????緇?????
1473     function TBoard.GetArchiveThread(Index: Integer): TThreadItem;
1474     begin
1475     Result := GetThread(CountDat, Index);
1476     end;
1477     //! ??絖??鴻????????ndex???????鴻??????????緇?????
1478 h677 1.70 function TBoard.GetLiveThread(Index: Integer): TThreadItem;
1479     begin
1480 h677 1.71 Result := GetThread(CountLive, Index);
1481 h677 1.70 end;
1482 h677 1.71 //! ?亥???鴻????????ndex???????鴻??????????緇?????
1483 hi_ 1.1 function TBoard.GetNewThread(Index: Integer): TThreadItem;
1484     begin
1485 h677 1.71 Result := GetThread(CountNew, Index);
1486 hi_ 1.1 end;
1487 h677 1.71 //! Log?????鴻????????ndex???????鴻??????????緇?????
1488 hi_ 1.1 function TBoard.GetLogThread(Index: Integer): TThreadItem;
1489     begin
1490 h677 1.71 Result := GetThread(CountLog, Index);
1491 h677 1.60 end;
1492 h677 1.71 //! 腟?莨若?帥??ndex???????鴻??????????緇?????
1493 hi_ 1.1 function TBoard.GetUserThread(Index: Integer): TThreadItem;
1494     begin
1495 h677 1.71 Result := GetThread(CountAll, Index);
1496 hi_ 1.1 end;
1497    
1498     procedure TBoard.BeginUpdate;
1499     begin
1500     FUpdate := False;
1501     end;
1502    
1503     procedure TBoard.EndUpdate;
1504     begin
1505     FUpdate := True;
1506     end;
1507    
1508     //constructor TThreadItem.Create(AOwner: TComponent);
1509 yoffy 1.25 procedure TThreadItem.Init;
1510 hi_ 1.1 begin
1511     FNo := 0;
1512     FFileName := '';
1513     FTitle := '';
1514     FRoundDate := ZERO_DATE;
1515     FLastModified := ZERO_DATE;
1516     FCount := 0;
1517     FAllResCount := 0;
1518     FNewResCount := 0;
1519     FSize := 0;
1520     FRound := False;
1521     FIsLogFile := False;
1522     FParentBoard := nil;
1523     FKokomade := -1;
1524     FNewReceive := 0;
1525     FNewArrival := False;
1526    
1527     FUpdate := True;
1528 yoffy 1.8 FURL := '';
1529 h677 1.69 FJumpAddress := 0;
1530 yoffy 1.7 end;
1531    
1532     // *************************************************************************
1533     // 紊????帥?????違?ゃ?潟????絎??????潟?潟?鴻????????/span>
1534     // *************************************************************************
1535     constructor TThreadItem.Create(
1536 h677 1.60 const inPlugIn : TBoardPlugIn;
1537     const inBoard : TBoard;
1538     inURL : string
1539 yoffy 1.7 );
1540 yoffy 1.19 var
1541     foundPos : Integer;
1542     protocol, host, path, document, port, bookmark : string;
1543     BBSID, BBSKey : string;
1544     const
1545     READ_PATH = '/test/read.cgi';
1546 yoffy 1.7 begin
1547    
1548 yoffy 1.25 inherited Create;
1549     Init;
1550 h677 1.60 FParentBoard := inBoard;
1551     //FBoardPlugIn := inPlugIn;
1552     URL := inURL;
1553 yoffy 1.7
1554 yoffy 1.19 if inPlugIn = nil then begin
1555     foundPos := Pos( READ_PATH, inURL );
1556     if foundPos > 0 then begin
1557     // dat ???絖????鴻??荐??
1558     GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
1559     GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
1560 yoffy 1.23 FileName := BBSKey + '.dat';
1561 yoffy 1.24 IsLogFile := FileExists( FilePath );
1562 yoffy 1.29 URL := GikoSys.Get2chBrowsableThreadURL( inURL );
1563 yoffy 1.19 end;
1564     end else begin
1565     // ?????違?ゃ?潟? TThreadItem ??篏???????????????篌?????
1566 yoffy 1.17 inPlugIn.CreateThreadItem( DWORD( Self ) );
1567 yoffy 1.19 end;
1568 yoffy 1.7
1569 hi_ 1.1 end;
1570 yoffy 1.9 // *************************************************************************
1571 h677 1.60 // 紊????帥?????違?ゃ?潟????絎??????潟?潟?鴻??????? Log?????????????ゆ?????/span>
1572     // FileName????緇?羝??帥??????ReadSubject??/span>
1573 h677 1.59 // *************************************************************************
1574     constructor TThreadItem.Create(
1575 h677 1.60 const inPlugIn : TBoardPlugIn;
1576     const inBoard : TBoard;
1577 h677 1.77 const inURL : string;
1578 h677 1.60 inExist: Boolean;
1579     const inFilename: string
1580 h677 1.59 );
1581     begin
1582    
1583     inherited Create;
1584     Init;
1585 h677 1.60 FParentBoard := inBoard;
1586     URL := inURL;
1587 h677 1.59
1588 h677 1.60 if inPlugIn = nil then begin
1589     // dat ???絖????鴻??荐??
1590     FileName := inFilename;
1591     IsLogFile := inExist;
1592 h677 1.77 URL := inURL;
1593 h677 1.60 end else begin
1594     // ?????違?ゃ?潟? TThreadItem ??篏???????????????篌?????
1595     inPlugIn.CreateThreadItem( DWORD( Self ) );
1596     end;
1597 h677 1.59
1598     end;
1599     // *************************************************************************
1600 yoffy 1.9 // ???鴻????????/span>
1601     // *************************************************************************
1602 hi_ 1.1 destructor TThreadItem.Destroy;
1603     begin
1604 yoffy 1.9
1605     // ?????違?ゃ?潟? TThreadItem ???贋?????????????篌?????
1606 h677 1.60 if Self.ParentBoard.IsBoardPlugInAvailable then
1607     Self.ParentBoard.BoardPlugIn.DisposeThreadItem( DWORD( Self ) );
1608 yoffy 1.7
1609 hi_ 1.1 inherited;
1610 yoffy 1.9
1611     end;
1612    
1613 hi_ 1.1 function TThreadItem.GetDatURL: string;
1614     var
1615     Protocol, Host, Path, Document, Port, Bookmark: string;
1616     begin
1617     Result := ParentBoard.URL
1618     + 'dat/'
1619     + FileName;
1620     if FDownloadHost <> '' then begin
1621     GikoSys.ParseURI(Result, Protocol, Host, Path, Document, Port, Bookmark);
1622     Result := Format('%s://%s%s%s', [Protocol,
1623     FDownloadHost,
1624     Path,
1625     Document]);
1626     end;
1627     // Result := GikoSys.UrlToServer(ParentBoard.URL)
1628     // + 'test/read.cgi/' + ParentBoard.BBSID + '/'
1629     // + ChangeFileExt(FileName, '') + '/?raw='
1630     // + IntToStr(ResNum) + '.' + IntToStr(ResSize);
1631     end;
1632    
1633     function TThreadItem.GetDatgzURL: string;
1634     function isOldKako(s: string): Boolean;
1635     begin
1636     Result := False;
1637     if AnsiPos('piza.', s) <> 0 then
1638     Result := True
1639     else if AnsiPos('www.bbspink.', s) <> 0 then
1640     Result := True
1641     else if AnsiPos('tako.', s) <> 0 then
1642     Result := True;
1643     end;
1644     var
1645     Protocol, Host, Path, Document, Port, Bookmark: string;
1646     DatNo: string;
1647     begin
1648     if FDownloadHost = '' then begin
1649     DatNo := ChangeFileExt(FileName, '');
1650     if isOldKako(ParentBoard.URL) then begin
1651     Result := Format('%s%s/%.3s/%s.dat', [ParentBoard.URL, 'kako', DatNo, DatNo]);
1652     end else begin
1653     if Length(DatNo) > 9 then begin
1654     //http://xxx.2ch.net/xxx/kako/9999/99999/999999999.dat.gz
1655     Result := Format('%s%s/%.4s/%.5s/%s.dat.gz', [ParentBoard.URL, 'kako', DatNo, DatNo, DatNo]);
1656     end else begin
1657     //http://xxx.2ch.net/xxx/kako/999/999999999.dat.gz
1658     Result := Format('%s%s/%.3s/%s.dat.gz', [ParentBoard.URL, 'kako', DatNo, DatNo]);
1659     end;
1660     end;
1661     end else begin
1662     Gikosys.ParseURI(Result, Protocol, Host, Path, Document, Port, Bookmark);
1663     DatNo := ChangeFileExt(Document, '');
1664     if isOldKako(DownloadHost) then begin
1665     Result := Format('%s://%s/%s/kako/%.3s/%s.dat', [Protocol, DownloadHost, ParentBoard.FBBSID, DatNo, DatNo]);
1666     end else begin
1667     if Length(DatNo) > 9 then begin
1668     Result := Format('%s://%s/%s/kako/%.4s/%.5s/%s.dat.gz', [Protocol, DownloadHost, ParentBoard.FBBSID, DatNo, DatNo, DatNo]);
1669     end else begin
1670     Result := Format('%s://%s/%s/kako/%.3s/%s.dat.gz', [Protocol, DownloadHost, ParentBoard.FBBSID, DatNo, DatNo]);
1671     end;
1672     end;
1673     end;
1674     end;
1675    
1676 h677 1.43 function TThreadItem.GetOfflawCgiURL(const SessionID: string): string;
1677 hi_ 1.1 begin
1678     if FDownloadHost = '' then begin
1679     Result := GikoSys.UrlToServer(ParentBoard.URL)
1680     + 'test/offlaw.cgi/' + ParentBoard.BBSID + '/'
1681     + ChangeFileExt(FileName, '') + '/?raw=.0&sid=' + HttpEncode(SessionID);
1682     end else begin
1683     //http://news.2ch.net/test/offlaw.cgi/newsplus/1014038577/?raw=.196928&sid=
1684     //GikoSys.ParseURI(Result, Protocol, Host, Path, Document, Port, Bookmark);
1685     Result := 'http://' + FDownloadHost
1686     + '/test/offlaw.cgi/' + ParentBoard.BBSID + '/'
1687     + ChangeFileExt(FileName, '') + '/?raw=.0&sid=' + HttpEncode(SessionID);
1688     end;
1689     end;
1690    
1691     function TThreadItem.GetSendURL: string;
1692     begin
1693     Result := GikoSys.UrlToServer(ParentBoard.URL)
1694     + 'test/bbs.cgi';
1695     end;
1696    
1697     procedure TThreadItem.DeleteLogFile;
1698 genyakun 1.64 var
1699     tmpFileName: String;
1700 hi_ 1.1 begin
1701 yoffy 1.30 ParentBoard.BeginUpdate;
1702    
1703 yoffy 1.50 if FUnRead then
1704     ParentBoard.UnRead := ParentBoard.UnRead - 1;
1705 hi_ 1.1 DeleteFile(GetThreadFileName);
1706 genyakun 1.64 //荅??????mp?????ゃ?????帥??
1707     tmpFileName := StringReplace(GetThreadFileName, 'dat', 'tmp', [rfReplaceAll]);
1708     DeleteFile(tmpFileName);
1709    
1710 yoffy 1.50 if FileExists(ChangeFileExt(GetThreadFileName,'.NG')) = true then
1711     DeleteFile(ChangeFileExt(GetThreadFileName,'.NG'));
1712 hi_ 1.1 FRoundDate := ZERO_DATE;
1713     FLastModified := ZERO_DATE;
1714     FSize := 0;
1715     FIsLogFile := False;
1716     FKokomade := -1;
1717     FNewReceive := 0;
1718     FNewArrival := False;
1719     FUnRead := False;
1720     FScrollTop := 0;
1721     FRound := False;
1722     FDownloadHost := '';
1723     FAgeSage := gasNone;
1724    
1725     FCount := 0;
1726     FNewResCount := 0;
1727     FRoundName := '';
1728 yoffy 1.30
1729     ParentBoard.EndUpdate;
1730     ParentBoard.Modified := True;
1731 hi_ 1.1 end;
1732    
1733     function TThreadItem.GetThreadFileName: string;
1734     begin
1735 yoffy 1.7 if Length( FilePath ) > 0 then
1736 yoffy 1.8 Result := FilePath
1737     else
1738 h677 1.59 Result := GikoSys.Setting.LogFolderP
1739 yoffy 1.40 + BBS2CH_LOG_FOLDER + PATH_DELIM + ParentBoard.BBSID + PATH_DELIM + FileName;
1740 hi_ 1.1 end;
1741    
1742     procedure TThreadItem.SetLastModified(d: TDateTime);
1743     begin
1744     if FLastModified = d then Exit;
1745     FLastModified := d;
1746     if FUpdate and (ParentBoard <> nil) then
1747     ParentBoard.FModified := True;
1748     end;
1749    
1750     procedure TThreadItem.SetRound(b: Boolean);
1751     begin
1752     if b then
1753     RoundList.Add(Self)
1754     else
1755     RoundList.Delete(Self);
1756     if FRound = b then Exit;
1757     FRound := b;
1758     if FUpdate and (ParentBoard <> nil) then
1759     ParentBoard.FModified := True;
1760     end;
1761    
1762 h677 1.43 procedure TThreadItem.SetRoundName(const s: string);
1763 hi_ 1.1 begin
1764     if FRoundName = s then Exit;
1765     FRoundName := s;
1766     if FUpdate and (ParentBoard <> nil) then
1767     ParentBoard.FModified := True;
1768     end;
1769 h677 1.71
1770    
1771 hi_ 1.1 procedure TThreadItem.SetKokomade(i: Integer);
1772     begin
1773     if FKokomade = i then Exit;
1774     FKokomade := i;
1775     if FUpdate and (ParentBoard <> nil) then
1776     ParentBoard.FModified := True;
1777     end;
1778    
1779     procedure TThreadItem.SetUnRead(b: Boolean);
1780     begin
1781     if FUnRead = b then Exit;
1782     FUnRead := b;
1783 h677 1.66 if FUpdate and (ParentBoard <> nil) then begin
1784 hi_ 1.1 ParentBoard.FModified := True;
1785 h677 1.66 if FUnRead then begin
1786     ParentBoard.UnRead := ParentBoard.UnRead + 1;
1787     end else begin
1788     ParentBoard.UnRead := ParentBoard.UnRead - 1;
1789     end;
1790     end;
1791 hi_ 1.1 end;
1792    
1793     procedure TThreadItem.SetScrollTop(i: Integer);
1794     begin
1795     if FScrollTop = i then Exit;
1796     FScrollTop := i;
1797     if FUpdate and (ParentBoard <> nil) then
1798     ParentBoard.FModified := True;
1799     end;
1800    
1801     procedure TThreadItem.BeginUpdate;
1802     begin
1803     FUpdate := False;
1804     end;
1805    
1806     procedure TThreadItem.EndUpdate;
1807     begin
1808     FUpdate := True;
1809 yoffy 1.5 end;
1810    
1811 h677 1.34 function TThreadItem.GetCreateDate: TDateTime;
1812 h677 1.33 begin
1813     // ???<?ゃ?????????鴻??????ユ????羆?????
1814 h677 1.42 try
1815     if ( GikoSys.Setting.CreationTimeLogs ) and not IsLogFile then
1816 h677 1.38 Result := ZERO_DATE
1817     else begin
1818     // ???違???<?ゃ?????≦宍絖??????????????????鴻??????ユ??
1819 h677 1.73 Result := GikoSys.GetCreateDateFromName(FFileName);
1820 h677 1.38 if GikoSys.Setting.FutureThread then begin
1821     if CompareDateTime(Result, Now) = 1 then
1822     Result := ZERO_DATE;
1823     end;
1824     end;
1825    
1826 h677 1.33 except
1827     on E: Exception do
1828     Result := ZERO_DATE;
1829     end;
1830     end;
1831 h677 1.60 function TThreadItem.GetFilePath: String;
1832     var
1833     path : String;
1834     begin
1835     path := ExtractFilePath(Self.ParentBoard.FilePath) + Self.FileName;
1836     Result := path;
1837     end;
1838    
1839 h677 1.62 destructor TBoardGroup.Destroy;
1840     begin
1841     Clear;
1842     inherited;
1843     end;
1844 h677 1.60 procedure TBoardGroup.Clear;
1845     var
1846     i : Integer;
1847     begin
1848     for i := Self.Count - 1 downto 0 do begin
1849 h677 1.61 try
1850     TBoard(Self.Objects[i]).Free;
1851     except
1852     end;
1853 h677 1.60 end;
1854     inherited Clear;
1855 h677 1.61 Self.Capacity := 0;
1856     try
1857     if FBoardPlugIn <> nil then
1858     FBoardPlugIn.Free;
1859 h677 1.62 FBoardPlugIn := nil;
1860 h677 1.61 except
1861     end;
1862    
1863 h677 1.60 end;
1864    
1865 h677 1.75 function TSpecialBoard.Add(item: TThreadItem): integer;
1866     begin
1867     Result := inherited AddObject(Item.URL, Item);
1868     end;
1869    
1870     procedure TSpecialBoard.Clear;
1871     var
1872     i: integer;
1873     begin
1874     for i := Count - 1 downto 0 do
1875     DeleteList(i);
1876     Capacity := 0;
1877     end;
1878 h677 1.34
1879 hi_ 1.1 end.
1880    

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26