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.11 - (hide annotations) (download) (as text)
Sun May 22 09:14:31 2005 UTC (18 years, 11 months ago) by h677
Branch: remodeling
CVS Tags: v1_50_0_576
Changes since 1.59.2.10: +0 -3 lines
File MIME type: text/x-pascal
コメント行を削除しただけ

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

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