Develop and Download Open Source Software

Browse CVS Repository

Contents of /gikonavigoeson/gikonavi/BoardGroup.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.59.2.3 - (show annotations) (download) (as text)
Sun May 15 02:15:31 2005 UTC (18 years, 11 months ago) by h677
Branch: remodeling
Changes since 1.59.2.2: +38 -16 lines
File MIME type: text/x-pascal
BoardGroups、ホサネヘム、ヒネシ、ヲハムケケ

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

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