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.39 - (hide annotations) (download) (as text)
Tue Mar 16 15:37:55 2004 UTC (20 years, 1 month ago) by h677
Branch: MAIN
Changes since 1.38: +3 -0 lines
File MIME type: text/x-pascal
メモリリーク対策

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

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