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.61.2.2 - (hide annotations) (download) (as text)
Mon Jun 27 20:30:43 2005 UTC (18 years, 9 months ago) by h677
Branch: Bb50
CVS Tags: v1_50_0_595, v1_50_0_598, v1_50_0_590, v1_50_0_593, v1_50_0_596, b50, v1_50_0_594, v1_50_0_599
Changes since 1.61.2.1: +1 -0 lines
File MIME type: text/x-pascal
BoardGroupのClearでFBoardPluginにnilを突っ込むように微修正

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

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