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.59.2.1 - (hide annotations) (download) (as text)
Wed May 4 06:26:07 2005 UTC (18 years, 11 months ago) by h677
Branch: remodeling
Changes since 1.59: +90 -68 lines
File MIME type: text/x-pascal
ThreadItemの持っていたプロパティを削って、省メモリ化

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

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