Develop and Download Open Source Software

Browse CVS Repository

Contents of /gikonavigoeson/gikonavi/ExternalThreadItem.pas

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


Revision 1.2 - (show annotations) (download) (as text)
Mon Nov 17 08:20:37 2003 UTC (20 years, 5 months ago) by yoffy
Branch: MAIN
Changes since 1.1: +16 -6 lines
File MIME type: text/x-pascal
・TThreadItemOnWrite を追加。

1 unit ExternalThreadItem;
2
3 interface
4
5 uses
6 Windows, Classes, SysUtils,
7 IdComponent,
8 ExternalBoardPlugInMain;
9
10 type
11 // TThreadItem ???????????h┃絎?鐚??緇? ID
12 TThreadItemProperty = (
13 tipContext, // : DWORD // ???宴??┃絎???????????/span>
14 tipNo, // : Integer // ???/span>
15 tipFileName, // : string // ?鴻?????????<?ゃ????
16 tipTitle, // : string // ?鴻???????帥?ゃ????/span>
17 tipRoundDate, // : TDateTime // ?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
18 tipLastModified, // : TDateTime // ?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
19 tipCount, // : Integer // ?鴻???????????潟??鐚????若?????
20 tipAllResCount, // : Integer // ?鴻???????????潟??鐚??泣?若??鐚?
21 tipNewResCount, // : Integer // ?鴻???????亥????/span>
22 tipSize, // : Integer // ?鴻???????泣?ゃ??/span>
23 tipRound, // : Boolean // 綏≦????????/span>
24 tipRoundName, // : string // 綏≦????
25 tipIsLogFile, // : Boolean // ???医?????????/span>
26 tipKokomade, // : Integer // ?潟?潟?障?ц????????/span>
27 tipNewReceive, // : Integer // ?潟?潟?????域???篆?/span>
28 tipNewArrival, // : Boolean // ?亥??
29 tipUnRead, // : Boolean // ?????????/span>
30 tipScrollTop, // : Integer // ?鴻?????若???臀?/span>
31 tipDownloadHost, // : string // 篁??????鴻?????????翫???????鴻??
32 tipAgeSage, // : TThreadAgeSage // ?≪?ゃ?????????筝???
33 tipURL, // : string // ?鴻???????????????吟?ц;腓冴??????? URL
34 tipFilePath // : string // ?????鴻????篆?絖???????????????/span>
35 );
36
37 // *************************************************************************
38 // TThreadItem ????????????
39 // *************************************************************************
40 TThreadItemCreate = procedure(
41 inInstance : DWORD
42 ); stdcall;
43
44 // *************************************************************************
45 // TThreadItem ???贋???????
46 // *************************************************************************
47 TThreadItemDispose = procedure(
48 inInstance : DWORD
49 ); stdcall;
50
51 // *************************************************************************
52 // ?????潟???若??????腓?/span>
53 // *************************************************************************
54 TThreadItemOnDownload = function(
55 inInstance : DWORD // ?ゃ?潟?鴻?帥?潟??/span>
56 ) : TDownloadState; stdcall; // ?????潟???若????????????????????
57
58 // *************************************************************************
59 // ?吾??莨若?帥????腓?/span>
60 // *************************************************************************
61 TThreadItemOnWrite = function(
62 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
63 inName : PChar; // ????(??潟????
64 inMail : PChar; // ?<?若???≪??????/span>
65 inMessage : PChar // ????
66 ) : TDownloadState; stdcall; // ?吾??莨若?帥??????????????????
67
68 // *************************************************************************
69 // ???合?? n ??????? html ??荀?羆?
70 // *************************************************************************
71 TThreadItemOnGetRes = function(
72 inInstance : DWORD; // ?ゃ?潟?鴻?帥?潟??/span>
73 inNo : DWORD // 茵?ず???????合???/span>
74 ) : PChar; stdcall; // 茵?ず???? HTML
75
76 // *************************************************************************
77 // ?鴻?????????????? html ??荀?羆?
78 // *************************************************************************
79 TThreadItemOnGetHeader = function(
80 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
81 inOptionalHeader : PChar // 菴遵??????????
82 ) : PChar; stdcall; // ?翫就?????? HTML
83
84 // *************************************************************************
85 // ?鴻????????????? html ??荀?羆?
86 // *************************************************************************
87 TThreadItemOnGetFooter = function(
88 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
89 inOptionalFooter : PChar // 菴遵??????????/span>
90 ) : PChar; stdcall; // ?翫就?????? HTML
91
92 // *************************************************************************
93 // ??? ThreadItem ??絮??????帥? URL ??荀?羆?
94 // *************************************************************************
95 TThreadItemOnGetBoardURL = function(
96 inInstance : DWORD // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
97 ) : PChar; stdcall; // ?帥? URL
98
99 function ThreadItemDat2HTML(
100 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
101 inDatRes : PChar; // ????<>?<?若??lt;>?ヤ?ID<>????<> ?ф??????????????鴻??
102 inResNo : DWORD; // ???合???/span>
103 inIsNew : Boolean // ?亥?????鴻???? True
104 ) : PChar; stdcall; // ?翫就?????? HTML
105
106 implementation
107
108 uses ExternalBoardManager, GikoSystem, BoardGroup;
109
110 // *************************************************************************
111 // TThreadItem ?????鴻???????????c????緇?????
112 // *************************************************************************
113 function ThreadItemGetLong(
114 instance : DWORD;
115 propertyID : TThreadItemProperty
116 ) : DWORD; stdcall;
117 var
118 threadItem : TThreadItem;
119 begin
120
121 threadItem := TThreadItem( instance );
122 case propertyID of
123 tipContext: // : DWORD // ???宴??┃絎???????????/span>
124 Result := threadItem.Context;
125 tipNo: // : Integer // ???/span>
126 Result := threadItem.No;
127 tipFileName: // : string // ?鴻?????????<?ゃ????
128 Result := DWORD( CreateResultString( threadItem.FileName ) );
129 tipTitle: // : string // ?鴻???????帥?ゃ????/span>
130 Result := DWORD( CreateResultString( threadItem.Title ) );
131 tipCount: // : Integer // ?鴻???????????潟??鐚????若?????
132 Result := threadItem.Count;
133 tipAllResCount: // : Integer // ?鴻???????????潟??鐚??泣?若??鐚?
134 Result := threadItem.AllResCount;
135 tipNewResCount: // : Integer // ?鴻???????亥????/span>
136 Result := threadItem.NewResCount;
137 tipSize: // : Integer // ?鴻???????泣?ゃ??/span>
138 Result := threadItem.Size;
139 tipRound: // : Boolean // 綏≦????????/span>
140 Result := DWORD( threadItem.Round );
141 tipRoundName: // : string // 綏≦????
142 Result := DWORD( CreateResultString( threadItem.RoundName ) );
143 tipIsLogFile: // : Boolean // ???医?????????/span>
144 Result := DWORD( threadItem.IsLogFile );
145 tipKokomade: // : Integer // ?潟?潟?障?ц????????/span>
146 Result := threadItem.Kokomade;
147 tipNewReceive: // : Integer // ?潟?潟?????域???篆?/span>
148 Result := threadItem.NewReceive;
149 tipNewArrival: // : Boolean // ?亥??
150 Result := DWORD( threadItem.NewArrival );
151 tipUnRead: // : Boolean // ?????????/span>
152 Result := DWORD( threadItem.UnRead );
153 tipScrollTop: // : Integer // ?鴻?????若???臀?/span>
154 Result := threadItem.ScrollTop;
155 tipDownloadHost: // : string // 篁??????鴻?????????翫???????鴻??
156 Result := DWORD( CreateResultString( threadItem.DownloadHost ) );
157 tipAgeSage: // : TThreadAgeSage // ?≪?ゃ?????????筝???
158 Result := DWORD( threadItem.AgeSage );
159 tipURL: // : string // ?鴻???????????????吟?ц;腓冴??????? URL
160 Result := DWORD( CreateResultString( threadItem.URL ) );
161 tipFilePath: // ?????鴻????篆?絖???????????????/span>
162 Result := DWORD( CreateResultString( threadItem.FilePath ) );
163 else
164 Result := 0;
165 end;
166 end;
167
168 // *************************************************************************
169 // TThreadItem ?????鴻???????????c??荐??????
170 // *************************************************************************
171 procedure ThreadItemSetLong(
172 instance : DWORD;
173 propertyID : TThreadItemProperty;
174 param : DWORD
175 ); stdcall;
176 var
177 threadItem : TThreadItem;
178 begin
179
180 threadItem := TThreadItem( instance );
181 case propertyID of
182 tipContext: // : DWORD // ???宴??┃絎???????????/span>
183 threadItem.Context := param;
184 tipNo: // : Integer // ???/span>
185 threadItem.No := param;
186 tipFileName: // : string // ?鴻?????????<?ゃ????
187 threadItem.FileName := string( PChar( param ) );
188 tipTitle: // : string // ?鴻???????帥?ゃ????/span>
189 threadItem.Title := string( PChar( param ) );
190 tipCount: // : Integer // ?鴻???????????潟??鐚????若?????
191 threadItem.Count := param;
192 tipAllResCount: // : Integer // ?鴻???????????潟??鐚??泣?若??鐚?
193 threadItem.AllResCount := param;
194 tipNewResCount: // : Integer // ?鴻???????亥????/span>
195 threadItem.NewResCount := param;
196 tipSize: // : Integer // ?鴻???????泣?ゃ??/span>
197 threadItem.Size := param;
198 tipRound: // : Boolean // 綏≦????????/span>
199 threadItem.Round := Boolean( param );
200 tipRoundName: // : string // 綏≦????
201 threadItem.RoundName := string( PChar( param ) );
202 tipIsLogFile: // : Boolean // ???医?????????/span>
203 threadItem.IsLogFile := Boolean( param );
204 tipKokomade: // : Integer // ?潟?潟?障?ц????????/span>
205 threadItem.Kokomade := param;
206 tipNewReceive: // : Integer // ?潟?潟?????域???篆?/span>
207 threadItem.NewReceive := param;
208 tipNewArrival: // : Boolean // ?亥??
209 threadItem.NewArrival := Boolean( param );
210 tipUnRead: // : Boolean // ?????????/span>
211 threadItem.UnRead := Boolean( param );
212 tipScrollTop: // : Integer // ?鴻?????若???臀?/span>
213 threadItem.ScrollTop := param;
214 tipDownloadHost: // : string // 篁??????鴻?????????翫???????鴻??
215 threadItem.DownloadHost := string( PChar( param ) );
216 tipAgeSage: // : TThreadAgeSage // ?≪?ゃ?????????筝???
217 threadItem.AgeSage := TGikoAgeSage( param );
218 tipURL: // : string // ?鴻???????????????吟?ц;腓冴??????? URL
219 threadItem.URL := string( PChar( param ) );
220 tipFilePath: // : string // ?????鴻????篆?絖???????????????/span>
221 threadItem.FilePath := string( PChar( param ) );
222 end;
223
224 end;
225
226 // *************************************************************************
227 // TThreadItem ?????鴻???????????c????緇?????
228 // *************************************************************************
229 function ThreadItemGetDouble(
230 instance : DWORD;
231 propertyID : TThreadItemProperty
232 ) : Double; stdcall;
233 var
234 threadItem : TThreadItem;
235 begin
236
237 threadItem := TThreadItem( instance );
238 case propertyID of
239 tipRoundDate: // : TDateTime // ?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
240 Result := threadItem.RoundDate;
241 tipLastModified: // : TDateTime // ?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
242 Result := threadItem.LastModified;
243 else
244 Result := 0;
245 end;
246
247 end;
248
249 // *************************************************************************
250 // TThreadItem ?????鴻???????????c??荐??????
251 // *************************************************************************
252 procedure ThreadItemSetDouble(
253 instance : DWORD;
254 propertyID : TThreadItemProperty;
255 param : Double
256 ); stdcall;
257 var
258 threadItem : TThreadItem;
259 begin
260
261 threadItem := TThreadItem( instance );
262 case propertyID of
263 tipRoundDate: // : TDateTime // ?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
264 threadItem.RoundDate := param;
265 tipLastModified: // : TDateTime // ?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
266 threadItem.LastModified := param;
267 end;
268
269 end;
270
271 // *************************************************************************
272 // TThreadItem ?????鴻????????<????????? dat 綵√? 1 茵??? HTML ?????????
273 // *************************************************************************
274 function ThreadItemDat2HTML(
275 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
276 inDatRes : PChar; // ????<>?<?若??lt;>?ヤ?ID<>????<> ?ф??????????????鴻??
277 inResNo : DWORD; // ???合???/span>
278 inIsNew : Boolean // ?亥?????鴻???? True
279 ) : PChar; stdcall; // ?翫就?????? HTML
280 var
281 threadItem : TThreadItem;
282 res : TResRec;
283 no : string;
284 begin
285
286 {$IFDEF DEBUG}
287 Writeln('ExternalBoardManager.ThreadItemDat2HTML');
288 {$ENDIF}
289 threadItem := TThreadItem( inInstance );
290 // 綣??違????茹?/span>
291 res := GikoSys.DivideStrLine( string( inDatRes ) );
292 no := IntToStr( inResNo );
293
294 try
295 if GikoSys.Setting.UseSkin then begin
296 // ?鴻????/span>
297 if inIsNew then
298 Result := CreateResultString( GikoSys.SkinedRes(
299 GikoSys.LoadFromSkin(
300 GikoSys.Setting.GetSkinNewResFileName, threadItem, threadItem.SizeByte
301 ), res, no
302 ) )
303 else
304 Result := CreateResultString( GikoSys.SkinedRes(
305 GikoSys.LoadFromSkin(
306 GikoSys.Setting.GetSkinResFileName, threadItem, threadItem.SizeByte
307 ), res, no
308 ) );
309 end else begin
310 // CSS or ??????????
311 if res.FName = '' then
312 res.FName := '&nbsp;';
313 if res.FMailTo = '' then
314 Result := CreateResultString( '<a name="' + no + '"></a>'
315 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + no + '</a></span> '
316 + '<span class="name_label">????鐚?</span> '
317 + '<span class="name"><b>' + res.FName + '</b></span> '
318 + '<span class="date_label">??腮炊?ワ?</span> '
319 + '<span class="date">' + res.FDateTime+ '</span></div>'
320 + '<div class="mes">' + res.FBody + ' </div>' )
321 else if GikoSys.Setting.ShowMail then
322 Result := CreateResultString( '<a name="' + no + '"></a>'
323 + '<div class="header"><span class="no"><a href="menu:' + no + '">' + no + '</a></span>'
324 + '<span class="name_label"> ????鐚? </span>'
325 + '<a class="name_mail" href="mailto:' + res.FMailTo + '">'
326 + '<b>' + res.FName + '</b></a><span class="mail"> [' + res.FMailTo + ']</span>'
327 + '<span class="date_label"> ??腮炊?ワ?</span>'
328 + '<span class="date"> ' + res.FDateTime+ '</span></div>'
329 + '<div class="mes">' + res.FBody + ' </div>' )
330 else
331 Result := CreateResultString( '<a name="' + no + '"></a>'
332 + '<div class="header"><span class="no"><a href="menu:' + no + '">' + no + '</a></span>'
333 + '<span class="name_label"> ????鐚? </span>'
334 + '<a class="name_mail" href="mailto:' + res.FMailTo + '">'
335 + '<b>' + res.FName + '</b></a>'
336 + '<span class="date_label"> ??腮炊?ワ?</span>'
337 + '<span class="date"> ' + res.FDateTime+ '</span></div>'
338 + '<div class="mes">' + res.FBody + ' </div>' );
339 end;
340 except
341 Result := nil;
342 end;
343
344 end;
345
346 // *************************************************************************
347 // TThreadItem ?????鴻???????鴻??????????????????緇?????
348 // *************************************************************************
349 function ThreadItemGetHeader(
350 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
351 inOptionalHeader : PChar // 菴遵??????????
352 ) : PChar; stdcall; // ?翫就?????? HTML
353 var
354 threadItem : TThreadItem;
355 skinHeader : string;
356 optionalHeader : string;
357 begin
358
359 {$IFDEF DEBUG}
360 Writeln('ExternalBoardManager.ThreadItemGetHeader');
361 {$ENDIF}
362 threadItem := TThreadItem( inInstance );
363 optionalHeader := string( inOptionalHeader );
364
365 try
366 if GikoSys.Setting.UseSkin then begin
367 // ?鴻????/span>
368 skinHeader := GikoSys.LoadFromSkin( GikoSys.Setting.GetSkinHeaderFileName, threadItem, threadItem.SizeByte );
369 if Length( optionalHeader ) > 0 then
370 skinHeader :=
371 StringReplace( skinHeader, '</head>', optionalHeader + '</head>', [] );
372 end else if GikoSys.Setting.UseCSS then begin
373 // CSS
374 skinHeader :=
375 '<html><head>' +
376 '<title>' + threadItem.Title + '</title>' +
377 '<link rel="stylesheet" href="'+ GikoSys.Setting.GetStyleSheetDir + GikoSys.Setting.CSSFileName +'" type="text/css">' +
378 optionalHeader +
379 '</head>' +
380 '<body>' +
381 '<div class="title">' + threadItem.Title + '</div>';
382 end else begin
383 // ??????????
384 skinHeader :=
385 '<html><head>' +
386 '<title>' + threadItem.Title + '</title>' +
387 optionalHeader +
388 '</head>' +
389 '<body>' +
390 '<div class="title">' + threadItem.Title + '</div>';
391 end;
392 except
393 end;
394
395 Result := CreateResultString( skinHeader );
396
397 end;
398
399 // *************************************************************************
400 // TThreadItem ?????鴻???????鴻?????????????帥????緇?????
401 // *************************************************************************
402 function ThreadItemGetFooter(
403 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
404 inOptionalFooter : PChar // 菴遵??????????/span>
405 ) : PChar; stdcall; // ?翫就?????? HTML
406 var
407 threadItem : TThreadItem;
408 skinFooter : string;
409 optionalFooter : string;
410 begin
411
412 {$IFDEF DEBUG}
413 Writeln('ExternalBoardManager.ThreadItemGetFooter');
414 {$ENDIF}
415 threadItem := TThreadItem( inInstance );
416 optionalFooter := string( inOptionalFooter );
417
418 try
419 if GikoSys.Setting.UseSkin then begin
420 skinFooter := GikoSys.LoadFromSkin( GikoSys.Setting.GetSkinFooterFileName, threadItem, threadItem.SizeByte );
421 if Length( optionalFooter ) > 0 then
422 skinFooter :=
423 StringReplace( skinFooter, '</body>', optionalFooter + '</body>', [] );
424 end else begin
425 skinFooter :=
426 '<a name="bottom"></a>' +
427 optionalFooter +
428 '</body></html>' +
429 '<a name="last"></a>' +
430 '</body></html>';
431 end;
432 except
433 end;
434
435 Result := CreateResultString( skinFooter );
436
437 end;
438
439 // *************************************************************************
440 // ?鴻?????????????潟???若?????画?????
441 // *************************************************************************
442 procedure ThreadItemWork(
443 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
444 inWorkCount : Integer // ?上?????我??倶?(?????潟??)
445 ); stdcall;
446 begin
447
448 if Assigned( OnWork ) then
449 OnWork( TObject( inInstance ), wmRead, inWorkCount );
450
451 end;
452
453 // *************************************************************************
454 // ?鴻?????????????潟???若????紮??障?c??
455 // *************************************************************************
456 procedure ThreadItemWorkBegin(
457 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
458 inWorkCountMax : Integer // ??篆<????????腓冴???????潟??
459 ); stdcall;
460 begin
461
462 if Assigned( OnWorkBegin ) then
463 OnWorkBegin( TObject( inInstance ), wmRead, inWorkCountMax );
464
465 end;
466
467 // *************************************************************************
468 // ?鴻?????????????潟???若????腟???c??
469 // *************************************************************************
470 procedure ThreadItemWorkEnd(
471 inInstance : DWORD // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
472 ); stdcall;
473 begin
474
475 if Assigned( OnWorkEnd ) then
476 OnWorkEnd( TObject( inInstance ), wmRead );
477
478 end;
479
480 exports
481 ThreadItemGetLong,
482 ThreadItemSetLong,
483 ThreadItemGetDouble,
484 ThreadItemSetDouble,
485 ThreadItemDat2HTML,
486 ThreadItemGetHeader,
487 ThreadItemGetFooter,
488 ThreadItemWork,
489 ThreadItemWorkBegin,
490 ThreadItemWorkEnd;
491
492 end.
493

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