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.1 - (show annotations) (download) (as text)
Sun Nov 16 10:50:11 2003 UTC (20 years, 5 months ago) by yoffy
Branch: MAIN
File MIME type: text/x-pascal
・ExternalBoardManager が大きくなったので分割。
・ThreadItemOnGetBoardURL を追加。

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

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