OSDN Git Service

・ファイルパス関連に AbonDir, AbonFile を追加。
[gikonavigoeson/gikonavi.git] / ExternalBoardManager.pas
1 unit ExternalBoardManager;
2
3 interface
4
5 uses
6         Windows, Classes, SysUtils,
7         IdHTTP, IdComponent, IdGlobal, IdException,
8         GikoSystem, BoardGroup, AbonUnit;
9
10 type
11         // TThreadItem \82Ì\83v\83\8d\83p\83e\83B\90Ý\92è\81^\8eæ\93¾ ID
12         TThreadItemProperty = (
13                 tipContext,                                                     // : DWORD                      // \8e©\97R\82É\90Ý\92è\82µ\82Ä\82¢\82¢\92l
14                 tipNo,                                                                  // : Integer            // \94Ô\8d\86
15                 tipFileName,                                            // : string                     // \83X\83\8c\83b\83h\83t\83@\83C\83\8b\96¼
16                 tipTitle,                                                               // : string                     // \83X\83\8c\83b\83h\83^\83C\83g\83\8b
17                 tipRoundDate,                                           // : TDateTime  // \83X\83\8c\83b\83h\82ð\8eæ\93¾\82µ\82½\93ú\8e\9e\81i\8f\84\89ñ\93ú\8e\9e\81j
18                 tipLastModified,                                // : TDateTime  // \83X\83\8c\83b\83h\82ª\8dX\90V\82³\82ê\82Ä\82¢\82é\93ú\8e\9e\81i\83T\81[\83o\91¤\93ú\8e\9e\81j
19                 tipCount,                                                               // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83\8d\81[\83J\83\8b\81j
20                 tipAllResCount,                                 // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83T\81[\83o\81j
21                 tipNewResCount,                                 // : Integer            // \83X\83\8c\83b\83h\90V\92\85\90\94
22                 tipSize,                                                                // : Integer            // \83X\83\8c\83b\83h\83T\83C\83Y
23                 tipRound,                                                               // : Boolean            // \8f\84\89ñ\83t\83\89\83O
24                 tipRoundName,                                           // : string                     // \8f\84\89ñ\96¼
25                 tipIsLogFile,                                           // : Boolean            // \83\8d\83O\91\8dÝ\83t\83\89\83O
26                 tipKokomade,                                            // : Integer            // \83R\83R\82Ü\82Å\93Ç\82ñ\82¾\94Ô\8d\86
27                 tipNewReceive,                                  // : Integer            // \83R\83R\82©\82ç\90V\8bK\8eó\90M
28                 tipNewArrival,                                  // : Boolean            // \90V\92\85
29                 tipUnRead,                                                      // : Boolean            // \96¢\93Ç\83t\83\89\83O
30                 tipScrollTop,                                           // : Integer            // \83X\83N\83\8d\81[\83\8b\88Ê\92u
31                 tipDownloadHost,                                // : string                     // \8d¡\82Ì\83z\83X\83g\82Æ\88á\82¤\8fê\8d\87\82Ì\83z\83X\83g
32                 tipAgeSage,                                                     // : TThreadAgeSage     // \83A\83C\83e\83\80\82Ì\8fã\82°\89º\82°
33                 tipURL                                                                  // : string                     // \83X\83\8c\83b\83h\82ð\83u\83\89\83E\83U\82Å\95\\8e¦\82·\82é\8dÛ\82Ì URL
34         );
35
36 var
37         OnWork                  : TWorkEvent;
38         OnWorkBegin     : TWorkBeginEvent;
39         OnWorkEnd               : TWorkEndEvent;
40
41 function ThreadItemDat2HTML(
42         inInstance      : DWORD;                // \83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X
43         inDatRes                : PChar;                // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<> \82Å\8d\\90¬\82³\82ê\82½\83e\83L\83X\83g
44         inResNo                 : DWORD;                // \83\8c\83X\94Ô\8d\86
45         inIsNew                 : Boolean               // \90V\92\85\83\8c\83X\82È\82ç True
46 ) : PChar; stdcall;                             // \90®\8c`\82³\82ê\82½ HTML
47
48 implementation
49
50 // =========================================================================
51 // PlugInMain
52 // =========================================================================
53
54 // *************************************************************************
55 // \96ß\82è\92l\82ª PChar \82Å\82 \82é API \82Ì\83\81\83\82\83\8a\82ð\8am\95Û\82·\82é
56 // *************************************************************************
57 function CreateResultString(
58         resultStr : string
59 ) : PChar; stdcall;
60 var
61         tmp : PChar;
62 begin
63
64         tmp := PChar( resultStr );
65         GetMem( Result, Length( resultStr ) + 1 );
66         Move( tmp, Result, Length( resultStr ) + 1 );
67
68 end;
69
70 // *************************************************************************
71 // \96ß\82è\92l\82ª PChar \82Å\82 \82é API \82Ì\83\81\83\82\83\8a\82ð\8aJ\95ú\82·\82é
72 // *************************************************************************
73 procedure DisposeResultString(
74         resultStr : PChar
75 ); stdcall;
76 begin
77
78         FreeMem( resultStr );
79
80 end;
81
82 // *************************************************************************
83 // \8ew\92è\82µ\82½ URL \82ð\83_\83E\83\93\83\8d\81[\83h\82µ\82Ä\95Ô\82·
84 // *************************************************************************
85 function InternalDownload(
86         inURL                                                   : PChar;        // \83_\83E\83\93\83\8d\81[\83h\82·\82é URL
87         var ioModified          : Double;       // \8dÅ\8cã\82É\8eæ\93¾\82µ\82½\93ú\8e\9e
88         var outResultData       : PChar;        // \83_\83E\83\93\83\8d\81[\83h\82³\82ê\82½\95\8e\9a\97ñ
89         inRangeStart                    : DWORD;        // \8aJ\8en\88Ê\92u
90         inRangeEnd                              : DWORD         // \8fI\97¹\88Ê\92u
91 ) : Longint; stdcall;                                   // \83\8c\83X\83|\83\93\83X\83R\81[\83h
92 var
93         httpSocket                              : TIdHTTP;
94         resStream                                       : TMemoryStream;
95         content                                         : string;
96 begin
97
98         Result := -1;
99
100         httpSocket := TIdHTTP.Create( nil );
101         try
102
103                 // \83C\83x\83\93\83g\82Ì\90Ý\92è
104                 if Assigned( OnWork ) then
105                         httpSocket.OnWork                               := OnWork;
106                 if Assigned( OnWorkBegin ) then
107                         httpSocket.OnWorkBegin  := OnWorkBegin;
108                 if Assigned( OnWorkEnd ) then
109                         httpSocket.OnWorkEnd            := OnWorkEnd;
110
111                 httpSocket.Request.CustomHeaders.Clear;
112                 httpSocket.Request.ContentRangeStart    := inRangeStart;
113                 httpSocket.Request.ContentRangeEnd              := inRangeEnd;
114                 if (ioModified <> 0) and (ioModified <> ZERO_DATE) then
115                         httpSocket.Request.LastModified := ioModified - OffsetFromUTC;
116                 if inRangeStart = 0 then
117                         httpSocket.Request.AcceptEncoding := 'gzip'
118                 else
119                         httpSocket.Request.AcceptEncoding := '';
120                 httpSocket.Request.Accept := 'text/html';
121
122                 resStream := TMemoryStream.Create;
123                 try
124                         try
125                                 resStream.Clear;
126
127                                 {$IFDEF DEBUG}
128                                 Writeln('URL: ' + inURL);
129                                 {$ENDIF}
130                                 httpSocket.Get( inURL, resStream );
131                                 {$IFDEF DEBUG}
132                                 Writeln('\8eæ\93¾\82Å\97á\8aO\82È\82µ');
133                                 {$ENDIF}
134
135                                 content                 := GikoSys.GzipDecompress( resStream, httpSocket.Response.ContentEncoding );
136                                 ioModified      := httpSocket.Response.LastModified;
137
138                                 Result := httpSocket.ResponseCode;
139                                 if (Length( content ) = 0) and (Result = 206) then
140                                         Result := 304;
141
142                                 outResultData := CreateResultString( content );
143                         except
144                                 on E: EIdSocketError do begin
145                                         ioModified              := ZERO_DATE;
146                                         outResultData   := nil;
147                                 end;
148                                 on E: EIdConnectException do begin
149                                         ioModified              := ZERO_DATE;
150                                         outResultData   := nil;
151                                         //Item.ErrText  := E.Message;
152                                 end;
153                                 on E: Exception do begin
154                                         {$IFDEF DEBUG}
155                                         Writeln('\8eæ\93¾\82Å\97á\8aO\82 \82è');
156                                         Writeln('E.Message: ' + E.Message);
157                                         {$ENDIF}
158                                         ioModified              := ZERO_DATE;
159                                         outResultData   := nil;
160                                         Result                          := httpSocket.ResponseCode;
161                                         //Item.ErrText  := E.Message;
162                                 end;
163                         end;
164                 finally
165                         resStream.Free;
166                 end;
167
168         finally
169                 httpSocket.Free;
170         end;
171
172 end;
173
174 // *************************************************************************
175 // \82Q\82¿\82á\82ñ\82Ë\82é\82Ì dat \8c`\8e®\82ð\83\8d\81[\83J\83\8b\82 \82Ú\81`\82ñ\82É\92Ê\82·
176 // *************************************************************************
177 function InternalAbon(
178         inDatText : PChar                               // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<>[\89ü\8ds] \82Å\8d\\90¬\82³\82ê\82½\83e\83L\83X\83g
179 ) : PChar; stdcall;                             // \82 \82Ú\81`\82ñ\8dÏ\82Ý\82Ì dat \8c`\8e®\83e\83L\83X\83g
180 var
181         datList : TStringList;
182         dat : PChar;
183 begin
184
185         datList := TStringList.Create;
186         datList.Text := string( inDatText );
187         //GikoSys.FAbon.IndividualAbon( datList, ChangeFileExt(FileName,'.NG'));
188         GikoSys.FAbon.Execute( datList );
189         GikoSys.FSelectResFilter.Execute( datList );
190
191         Result := CreateResultString( datList.Text );
192
193 end;
194
195 // *************************************************************************
196 // \82Q\82¿\82á\82ñ\82Ë\82é\82Ì dat \8c`\8e® 1 \8ds\82ð HTML \82É\95Ï\8a·\82·\82é
197 // *************************************************************************
198 function InternalDat2HTML(
199         inDatRes        : PChar;                        // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<> \82Å\8d\\90¬\82³\82ê\82½\83e\83L\83X\83g
200         inResNo         : DWORD;                        // \83\8c\83X\94Ô\8d\86
201         inIsNew         : Boolean                       // \90V\92\85\83\8c\83X\82È\82ç True
202 ) : PChar; stdcall;                             // \90®\8c`\82³\82ê\82½ HTML
203 var
204         board : TBoard;
205         threadItem : TThreadItem;
206 begin
207
208         // \83_\83~\81[\82Ì\83N\83\89\83X
209         board                           := TBoard.Create;
210         threadItem      := TThreadItem.Create;
211
212         try
213                 threadItem.ParentBoard := Board;
214
215                 Result := ThreadItemDat2HTML( DWORD( threadItem ), inDatRes, inResNo, inIsNew );
216         except
217         end;
218
219 end;
220
221
222
223 // =========================================================================
224 // FilePath
225 // =========================================================================
226
227 // *************************************************************************
228 // \83u\83\89\83E\83U\96{\91Ì\82ª\92u\82¢\82Ä\82 \82é\83t\83H\83\8b\83_
229 // *************************************************************************
230 function ApplicationFolder : PChar; stdcall;
231 begin
232
233         Result := CreateResultString( GikoSys.GetAppDir );
234
235 end;
236
237 // *************************************************************************
238 // \8f\89\8aú\90Ý\92è\83t\83H\83\8b\83_
239 // *************************************************************************
240 function PreferencesFolder : PChar; stdcall;
241 begin
242
243         Result := CreateResultString( GikoSys.GetConfigDir );
244
245 end;
246
247 // *************************************************************************
248 // \8f\89\8aú\90Ý\92è\83t\83@\83C\83\8b
249 // *************************************************************************
250 function PreferencesFile : PChar; stdcall;
251 begin
252
253         Result := CreateResultString( GikoSys.GetAppDir + 'gikoNavi.ini' );
254
255 end;
256
257 // *************************************************************************
258 // \83\8d\83O\83t\83H\83\8b\83_
259 // *************************************************************************
260 function LogFolder : PChar; stdcall;
261 begin
262
263         Result := CreateResultString( GikoSys.GetAppDir + 'Log\' );
264
265 end;
266
267 // *************************************************************************
268 // CSS \83t\83H\83\8b\83_
269 // *************************************************************************
270 function CSSFolder : PChar; stdcall;
271 begin
272
273         Result := CreateResultString( GikoSys.GetStyleSheetDir );
274
275 end;
276
277 // *************************************************************************
278 // \83X\83L\83\93\82ð\93ü\82ê\82Ä\82¨\82­\83t\83H\83\8b\83_
279 // *************************************************************************
280 function SkinFolder : PChar; stdcall;
281 begin
282
283         Result := CreateResultString( GikoSys.GetSkinDir );
284
285 end;
286
287 // *************************************************************************
288 // \8eg\97p\82µ\82Ä\82¢\82é CSS / \83X\83L\83\93
289 // *************************************************************************
290 function SkinFile : PChar; stdcall;
291 begin
292
293         Result := CreateResultString( GikoSys.Setting.CSSFileName );
294
295 end;
296
297 // *************************************************************************
298 // \82 \82Ú\81[\82ñ\8bK\91¥\82ª\92u\82¢\82Ä\82 \82é\83f\83B\83\8c\83N\83g\83\8a
299 // *************************************************************************
300 function AbonFolder : PChar; stdcall;
301 begin
302
303         Result := CreateResultString( GikoSys.Setting.GetNGWordsDir );
304
305 end;
306
307 // *************************************************************************
308 // \8eg\97p\82µ\82Ä\82¢\82é\82 \82Ú\81[\82ñ\8bK\91¥
309 // *************************************************************************
310 function AbonFile : PChar; stdcall;
311 begin
312
313         Result := CreateResultString( GikoSys.FAbon.GetNGwordpath );
314
315 end;
316
317
318
319 // =========================================================================
320 // ThreadItem
321 // =========================================================================
322
323 // *************************************************************************
324 // TThreadItem \83N\83\89\83X\82Ì\83v\83\8d\83p\83e\83B\82ð\8eæ\93¾\82·\82é
325 // *************************************************************************
326 function ThreadItemGetLong(
327         instance                : DWORD;
328         propertyID      : TThreadItemProperty
329 ) : DWORD; stdcall;
330 var
331         threadItem : TThreadItem;
332 begin
333
334         threadItem := TThreadItem( instance );
335         case propertyID of
336                 tipContext:                                                     // : DWORD                      // \8e©\97R\82É\90Ý\92è\82µ\82Ä\82¢\82¢\92l
337                         Result := threadItem.Context;
338                 tipNo:                                                                  // : Integer            // \94Ô\8d\86
339                         Result := threadItem.No;
340                 tipFileName:                                            // : string                     // \83X\83\8c\83b\83h\83t\83@\83C\83\8b\96¼
341                         Result := DWORD( CreateResultString( threadItem.FileName ) );
342                 tipTitle:                                                               // : string                     // \83X\83\8c\83b\83h\83^\83C\83g\83\8b
343                         Result := DWORD( CreateResultString( threadItem.Title ) );
344                 tipCount:                                                               // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83\8d\81[\83J\83\8b\81j
345                         Result := threadItem.Count;
346                 tipAllResCount:                                 // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83T\81[\83o\81j
347                         Result := threadItem.AllResCount;
348                 tipNewResCount:                                 // : Integer            // \83X\83\8c\83b\83h\90V\92\85\90\94
349                         Result := threadItem.NewResCount;
350                 tipSize:                                                                // : Integer            // \83X\83\8c\83b\83h\83T\83C\83Y
351                         Result := threadItem.Size;
352                 tipRound:                                                               // : Boolean            // \8f\84\89ñ\83t\83\89\83O
353                         Result := DWORD( threadItem.Round );
354                 tipRoundName:                                           // : string                     // \8f\84\89ñ\96¼
355                         Result := DWORD( CreateResultString( threadItem.RoundName ) );
356                 tipIsLogFile:                                           // : Boolean            // \83\8d\83O\91\8dÝ\83t\83\89\83O
357                         Result := DWORD( threadItem.IsLogFile );
358                 tipKokomade:                                            // : Integer            // \83R\83R\82Ü\82Å\93Ç\82ñ\82¾\94Ô\8d\86
359                         Result := threadItem.Kokomade;
360                 tipNewReceive:                                  // : Integer            // \83R\83R\82©\82ç\90V\8bK\8eó\90M
361                         Result := threadItem.NewReceive;
362                 tipNewArrival:                                  // : Boolean            // \90V\92\85
363                         Result := DWORD( threadItem.NewArrival );
364                 tipUnRead:                                                      // : Boolean            // \96¢\93Ç\83t\83\89\83O
365                         Result := DWORD( threadItem.UnRead );
366                 tipScrollTop:                                           // : Integer            // \83X\83N\83\8d\81[\83\8b\88Ê\92u
367                         Result := threadItem.ScrollTop;
368                 tipDownloadHost:                                // : string                     // \8d¡\82Ì\83z\83X\83g\82Æ\88á\82¤\8fê\8d\87\82Ì\83z\83X\83g
369                         Result := DWORD( CreateResultString( threadItem.DownloadHost ) );
370                 tipAgeSage:                                                     // : TThreadAgeSage     // \83A\83C\83e\83\80\82Ì\8fã\82°\89º\82°
371                         Result := DWORD( threadItem.AgeSage );
372                 tipURL:                                                                 // : string                     // \83X\83\8c\83b\83h\82ð\83u\83\89\83E\83U\82Å\95\\8e¦\82·\82é\8dÛ\82Ì URL
373                         Result := DWORD( CreateResultString( threadItem.URL ) );
374         end;
375 end;
376
377 // *************************************************************************
378 // TThreadItem \83N\83\89\83X\82Ì\83v\83\8d\83p\83e\83B\82ð\90Ý\92è\82·\82é
379 // *************************************************************************
380 procedure ThreadItemSetLong(
381         instance                : DWORD;
382         propertyID      : TThreadItemProperty;
383         param : DWORD
384 ); stdcall;
385 var
386         threadItem      : TThreadItem;
387 begin
388
389         threadItem := TThreadItem( instance );
390         case propertyID of
391                 tipContext:                                                     // : DWORD                      // \8e©\97R\82É\90Ý\92è\82µ\82Ä\82¢\82¢\92l
392                         threadItem.Context                      := param;
393                 tipNo:                                                                  // : Integer            // \94Ô\8d\86
394                         threadItem.No                                           := param;
395                 tipFileName:                                            // : string                     // \83X\83\8c\83b\83h\83t\83@\83C\83\8b\96¼
396                 begin
397                         threadItem.FileName                     := string( PChar( param ) );
398                         DisposeResultString( PChar( param ) );
399                 end;
400                 tipTitle:                                                               // : string                     // \83X\83\8c\83b\83h\83^\83C\83g\83\8b
401                 begin
402                         threadItem.Title                                := string( PChar( param ) );
403                         DisposeResultString( PChar( param ) );
404                 end;
405                 tipCount:                                                               // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83\8d\81[\83J\83\8b\81j
406                         threadItem.Count                                := param;
407                 tipAllResCount:                                 // : Integer            // \83X\83\8c\83b\83h\83J\83E\83\93\83g\81i\83T\81[\83o\81j
408                         threadItem.AllResCount  := param;
409                 tipNewResCount:                                 // : Integer            // \83X\83\8c\83b\83h\90V\92\85\90\94
410                         threadItem.NewResCount  := param;
411                 tipSize:                                                                // : Integer            // \83X\83\8c\83b\83h\83T\83C\83Y
412                         threadItem.Size                                 := param;
413                 tipRound:                                                               // : Boolean            // \8f\84\89ñ\83t\83\89\83O
414                         threadItem.Round                                := Boolean( param );
415                 tipRoundName:                                           // : string                     // \8f\84\89ñ\96¼
416                 begin
417                         threadItem.RoundName            := string( PChar( param ) );
418                         DisposeResultString( PChar( param ) );
419                 end;
420                 tipIsLogFile:                                           // : Boolean            // \83\8d\83O\91\8dÝ\83t\83\89\83O
421                         threadItem.IsLogFile            := Boolean( param );
422                 tipKokomade:                                            // : Integer            // \83R\83R\82Ü\82Å\93Ç\82ñ\82¾\94Ô\8d\86
423                         threadItem.Kokomade                     := param;
424                 tipNewReceive:                                  // : Integer            // \83R\83R\82©\82ç\90V\8bK\8eó\90M
425                         threadItem.NewReceive           := param;
426                 tipNewArrival:                                  // : Boolean            // \90V\92\85
427                         threadItem.NewArrival           := Boolean( param );
428                 tipUnRead:                                                      // : Boolean            // \96¢\93Ç\83t\83\89\83O
429                         threadItem.UnRead                               := Boolean( param );
430                 tipScrollTop:                                           // : Integer            // \83X\83N\83\8d\81[\83\8b\88Ê\92u
431                         threadItem.ScrollTop             := param;
432                 tipDownloadHost:                                // : string                     // \8d¡\82Ì\83z\83X\83g\82Æ\88á\82¤\8fê\8d\87\82Ì\83z\83X\83g
433                 begin
434                         threadItem.DownloadHost := string( PChar( param ) );
435                         DisposeResultString( PChar( param ) );
436                 end;
437                 tipAgeSage:                                                     // : TThreadAgeSage     // \83A\83C\83e\83\80\82Ì\8fã\82°\89º\82°
438                         threadItem.AgeSage                      := TGikoAgeSage( param );
439                 tipURL:                                                                 // : string                     // \83X\83\8c\83b\83h\82ð\83u\83\89\83E\83U\82Å\95\\8e¦\82·\82é\8dÛ\82Ì URL
440                 begin
441                         threadItem.URL                                  := string( PChar( param ) );
442                         DisposeResultString( PChar( param ) );
443                 end;
444         end;
445
446 end;
447
448 // *************************************************************************
449 // TThreadItem \83N\83\89\83X\82Ì\83v\83\8d\83p\83e\83B\82ð\8eæ\93¾\82·\82é
450 // *************************************************************************
451 function ThreadItemGetDouble(
452         instance                : DWORD;
453         propertyID      : TThreadItemProperty
454 ) : Double; stdcall;
455 var
456         threadItem : TThreadItem;
457 begin
458
459         threadItem := TThreadItem( instance );
460         case propertyID of
461                 tipRoundDate:                                           // : TDateTime  // \83X\83\8c\83b\83h\82ð\8eæ\93¾\82µ\82½\93ú\8e\9e\81i\8f\84\89ñ\93ú\8e\9e\81j
462                         Result := threadItem.RoundDate;
463                 tipLastModified:                                // : TDateTime  // \83X\83\8c\83b\83h\82ª\8dX\90V\82³\82ê\82Ä\82¢\82é\93ú\8e\9e\81i\83T\81[\83o\91¤\93ú\8e\9e\81j
464                         Result := threadItem.LastModified;
465         end;
466
467 end;
468
469 // *************************************************************************
470 // TThreadItem \83N\83\89\83X\82Ì\83v\83\8d\83p\83e\83B\82ð\90Ý\92è\82·\82é
471 // *************************************************************************
472 procedure ThreadItemSetDouble(
473         instance                : DWORD;
474         propertyID      : TThreadItemProperty;
475         param                           : Double
476 ); stdcall;
477 var
478         threadItem : TThreadItem;
479 begin
480
481         threadItem := TThreadItem( instance );
482         case propertyID of
483                 tipRoundDate:                                           // : TDateTime  // \83X\83\8c\83b\83h\82ð\8eæ\93¾\82µ\82½\93ú\8e\9e\81i\8f\84\89ñ\93ú\8e\9e\81j
484                         threadItem.RoundDate            := param;
485                 tipLastModified:                                // : TDateTime  // \83X\83\8c\83b\83h\82ª\8dX\90V\82³\82ê\82Ä\82¢\82é\93ú\8e\9e\81i\83T\81[\83o\91¤\93ú\8e\9e\81j
486                         threadItem.LastModified := param;
487         end;
488
489 end;
490
491 // *************************************************************************
492 // TThreadItem \83N\83\89\83X\82ð\8c³\82É\82Q\82¿\82á\82ñ\82Ë\82é\82Ì dat \8c`\8e® 1 \8ds\82ð HTML \82É\95Ï\8a·\82·\82é
493 // *************************************************************************
494 function ThreadItemDat2HTML(
495         inInstance      : DWORD;                // \83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X
496         inDatRes                : PChar;                // \96¼\91O<>\83\81\81[\83\8b<>\93ú\95tID<>\96{\95¶<> \82Å\8d\\90¬\82³\82ê\82½\83e\83L\83X\83g
497         inResNo                 : DWORD;                // \83\8c\83X\94Ô\8d\86
498         inIsNew                 : Boolean               // \90V\92\85\83\8c\83X\82È\82ç True
499 ) : PChar; stdcall;                             // \90®\8c`\82³\82ê\82½ HTML
500 var
501         threadItem : TThreadItem;
502         res : TResRec;
503         no : string;
504 begin
505
506         threadItem      := TThreadItem( inInstance );
507         // \88ø\90\94\82ð\95ª\89ð
508         res                                     := GikoSys.DivideStrLine( string( inDatRes ) );
509         no                                      := IntToStr( inResNo );
510
511         try
512                 if GikoSys.Setting.UseSkin then begin
513                         // \83X\83L\83\93
514                         if inIsNew then
515                                 Result := CreateResultString( GikoSys.SkinedRes(
516                                         GikoSys.LoadFromSkin(
517                                                 GikoSys.GetSkinNewResFileName, threadItem, 0
518                                         ), res, no
519                                 ) )
520                         else
521                                 Result := CreateResultString( GikoSys.SkinedRes(
522                                         GikoSys.LoadFromSkin(
523                                                 GikoSys.GetSkinResFileName, threadItem, 0
524                                         ), res, no
525                                 ) );
526                 end else begin
527                         // CSS or \83f\83t\83H\83\8b\83g
528                         if res.FName = '' then
529                                 res.FName := '&nbsp;';
530                         if res.FMailTo = '' then
531                                 Result := CreateResultString( '<a name="' + no + '"></a>'
532                                                                 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + no + '</a></span> '
533                                                                 + '<span class="name_label">\96¼\91O\81F</span> '
534                                                                 + '<span class="name"><b>' + res.FName + '</b></span> '
535                                                                 + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
536                                                                 + '<span class="date">' + res.FDateTime+ '</span></div>'
537                                                                 + '<div class="mes">' + res.FBody + ' </div>' )
538                         else if GikoSys.Setting.ShowMail then
539                                 Result := CreateResultString( '<a name="' + no + '"></a>'
540                                                                 + '<div class="header"><span class="no"><a href="menu:' + no + '">' + no + '</a></span>'
541                                                                 + '<span class="name_label"> \96¼\91O\81F </span>'
542                                                                 + '<a class="name_mail" href="mailto:' + res.FMailTo + '">'
543                                                                 + '<b>' + res.FName + '</b></a><span class="mail"> [' + res.FMailTo + ']</span>'
544                                                                 + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
545                                                                 + '<span class="date"> ' + res.FDateTime+ '</span></div>'
546                                                                 + '<div class="mes">' + res.FBody + ' </div>' )
547                         else
548                                 Result := CreateResultString( '<a name="' + no + '"></a>'
549                                                                 + '<div class="header"><span class="no"><a href="menu:' + no + '">' + no + '</a></span>'
550                                                                 + '<span class="name_label"> \96¼\91O\81F </span>'
551                                                                 + '<a class="name_mail" href="mailto:' + res.FMailTo + '">'
552                                                                 + '<b>' + res.FName + '</b></a>'
553                                                                 + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
554                                                                 + '<span class="date"> ' + res.FDateTime+ '</span></div>'
555                                                                 + '<div class="mes">' + res.FBody + ' </div>' );
556                 end;
557         except
558         end;
559
560 end;
561
562 // *************************************************************************
563 // \83_\83E\83\93\83\8d\81[\83h\82ª\90i\8ds\82µ\82½
564 // *************************************************************************
565 procedure ThreadItemWork(
566         inInstance      : DWORD;                        // \83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X
567         inWorkCount     : Integer                       // \8c»\8dÝ\82Ì\90i\95à\8fó\8bµ(\83J\83E\83\93\83g)
568 ); stdcall;
569 begin
570
571         if Assigned( OnWork ) then
572                 OnWork( TObject( inInstance ), wmRead, inWorkCount );
573
574 end;
575
576 // *************************************************************************
577 // \83_\83E\83\93\83\8d\81[\83h\82ª\8en\82Ü\82Á\82½
578 // *************************************************************************
579 procedure ThreadItemWorkBegin(
580         inInstance                      : DWORD;        // \83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X
581         inWorkCountMax  : Integer       // \92Ê\90M\82Ì\8fI\82í\82è\82ð\8e¦\82·\83J\83E\83\93\83g
582 ); stdcall;
583 begin
584
585         if Assigned( OnWorkBegin ) then
586                 OnWorkBegin( TObject( inInstance ), wmRead, inWorkCountMax );
587
588 end;
589
590 // *************************************************************************
591 // \83_\83E\83\93\83\8d\81[\83h\82ª\8fI\82í\82Á\82½
592 // *************************************************************************
593 procedure ThreadItemWorkEnd(
594         inInstance      : DWORD                         // \83N\83\89\83X\82Ì\83C\83\93\83X\83^\83\93\83X
595 ); stdcall;
596 begin
597
598         if Assigned( OnWorkEnd ) then
599                 OnWorkEnd( TObject( inInstance ), wmRead );
600
601 end;
602
603 exports
604         CreateResultString,
605         DisposeResultString,
606         ApplicationFolder,
607         PreferencesFolder,
608         PreferencesFile,
609         LogFolder,
610         CSSFolder,
611         SkinFolder,
612         SkinFile,
613         AbonFolder,
614         AbonFile,
615         InternalDownload,
616         InternalAbon,
617         InternalDat2HTML,
618         ThreadItemGetLong,
619         ThreadItemSetLong,
620         ThreadItemGetDouble,
621         ThreadItemSetDouble,
622         ThreadItemDat2HTML,
623         ThreadItemWork,
624         ThreadItemWorkBegin,
625         ThreadItemWorkEnd;
626
627 end.