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.31 - (hide annotations) (download) (as text)
Fri Jan 23 15:22:37 2004 UTC (20 years, 3 months ago) by h677
Branch: MAIN
Changes since 1.30: +4 -4 lines
File MIME type: text/x-pascal
文字列の一致を”=”ではなくAnsiCompareStr関数を使うようにした

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

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