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.8 - (hide annotations) (download) (as text)
Thu May 19 14:33:26 2005 UTC (18 years, 11 months ago) by h677
Branch: remodeling
Changes since 1.59.2.7: +31 -9 lines
File MIME type: text/x-pascal
BBSsFindBoardFromURLで、見つからないときにホストが2chのURLなら
そのままFindBBSIDを呼ぶようにした。
BBSsFindThreadFromURLで、見つからないときにホストが2chのURLなら
FindFromFileNameを呼ぶようにした。

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

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