Develop and Download Open Source Software

Browse CVS Repository

Contents of /gikonavigoeson/gikonavi/ExternalBoardItem.pas

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


Revision 1.2.8.4 - (show annotations) (download) (as text)
Sat Jun 25 10:13:46 2005 UTC (18 years, 9 months ago) by h677
Branch: remodeling
CVS Tags: v1_50_0_588
Changes since 1.2.8.3: +11 -3 lines
File MIME type: text/x-pascal
外部板のスレ一覧更新でスレの保持数が多くなると極端に遅くなる現象の改善

1 unit ExternalBoardItem;
2
3 interface
4
5 uses
6 Windows, Classes, SysUtils,
7 IdComponent,
8 ExternalBoardPlugInMain;
9
10 type
11 // TBoardItem ???????????h┃絎?鐚??緇? ID
12 TBoardItemProperty = (
13 bipContext, // : DWORD // ???宴??┃絎???????????/span>
14 bipItems, // : TThreadItem // ?帥??????????????鴻??????
15 bipNo, // : Integer // ???/span>
16 bipTitle, // : string // ?帥?帥?ゃ????/span>
17 bipRoundDate, // : TDateTime // ?帥????緇??????ユ??鐚?綏≦???ユ??鐚?
18 bipLastModified, // : TDateTime // ?帥???贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
19 bipLastGetTime, // : TDateTime // ?鴻???????障?????鴻??????筝?荀с????緇????贋?違?????ユ??鐚??泣?若???贋?ユ???紙?吾??莨若?炊????戎??????鐚?
20 bipRound, // : Boolean // 綏≦??篋?膣?
21 bipRoundName, // : string // 綏≦????
22 bipIsLogFile, // : Boolean // ???医?????????/span>
23 bipUnRead, // : Integer // ?鴻???????????/span>
24 bipURL, // : string // ?帥?????????吟?ц;腓冴??????? URL
25 bipFilePath, // : string // ?????帥??篆?絖???????????????/span>
26 bipIs2ch // : Boolean //???鴻????2ch????????
27 );
28
29 // *************************************************************************
30 // TBoardItem ????????????
31 // *************************************************************************
32 TBoardItemCreate = procedure(
33 inInstance : DWORD
34 ); stdcall;
35
36 // *************************************************************************
37 // TBoardItem ???贋???????
38 // *************************************************************************
39 TBoardItemDispose = procedure(
40 inInstance : DWORD
41 ); stdcall;
42
43 // *************************************************************************
44 // ?????潟???若??????腓冴??????
45 // *************************************************************************
46 TBoardItemOnDownload = function(
47 inInstance : DWORD // ?ゃ?潟?鴻?帥?潟??/span>
48 ) : TDownloadState; stdcall; // ?????潟???若????????????????????
49
50 // *************************************************************************
51 // ?鴻?????????腓?/span>
52 // *************************************************************************
53 TBoardItemOnCreateThread = function(
54 inInstance : DWORD; // ThreadItem ???ゃ?潟?鴻?帥?潟??/span>
55 inSubject : PChar; // ?鴻???帥??/span>
56 inName : PChar; // ????(??潟????
57 inMail : PChar; // ?<?若???≪??????/span>
58 inMessage : PChar // ????
59 ) : TDownloadState; stdcall; // ?吾??莨若?帥??????????????????
60
61 // *************************************************************************
62 // ???鴻???????宴??菴???/span>
63 // *************************************************************************
64 TBoardItemEnumThreadCallBack = function(
65 inInstance : DWORD; // TBoardItem ???ゃ?潟?鴻?帥?潟??/span>
66 inURL : PChar; // ?鴻??????? URL
67 inTitle : PChar; // ?鴻???帥??/span>
68 inCount : DWORD // ???鴻????/span>
69 ) : Boolean; stdcall; // ??????膓????????? True
70
71 // *************************************************************************
72 // ?????帥??????????????鴻????????
73 // *************************************************************************
74 TBoardItemOnEnumThread = procedure(
75 inInstance : DWORD; // ?ゃ?潟?鴻?帥?潟??/span>
76 inCallBack : TBoardItemEnumThreadCallBack // 菴??眼???鴻???潟?若????????/span>
77 ); stdcall;
78
79 // *************************************************************************
80 // ???<?ゃ?????????鴻??????? URL ??荀?羆???????
81 // *************************************************************************
82 TBoardItemOnFileName2ThreadURL = function(
83 inInstance : DWORD; // ?ゃ?潟?鴻?帥?潟??/span>
84 inFileName : PChar // ???????????<?ゃ????
85 ) : PChar; stdcall;
86
87 implementation
88
89 uses ExternalBoardManager, GikoSystem, BoardGroup, MojuUtils;
90
91 // *************************************************************************
92 // TBoardItem ?????鴻???????????c????緇?????
93 // *************************************************************************
94 function BoardItemGetLong(
95 instance : DWORD;
96 propertyID : TBoardItemProperty
97 ) : DWORD; stdcall;
98 var
99 boardItem : TBoard;
100 begin
101
102 boardItem := TBoard( instance );
103 case propertyID of
104 bipContext: // : DWORD // ???宴??┃絎???????????/span>
105 Result := boardItem.Context;
106 bipNo: // : Integer // ???/span>
107 Result := boardItem.No;
108 bipTitle: // : string // ?鴻???????帥?ゃ????/span>
109 Result := DWORD( CreateResultString( boardItem.Title ) );
110 bipRound: // : Boolean // 綏≦????????/span>
111 Result := DWORD( boardItem.Round );
112 bipRoundName: // : string // 綏≦????
113 Result := DWORD( CreateResultString( boardItem.RoundName ) );
114 bipIsLogFile: // : Boolean // ???医?????????/span>
115 Result := DWORD( boardItem.IsLogFile );
116 bipUnRead: // : Integer // ?鴻???????????/span>
117 Result := DWORD( boardItem.UnRead );
118 bipURL: // : string // ?鴻???????????????吟?ц;腓冴??????? URL
119 Result := DWORD( CreateResultString( boardItem.URL ) );
120 bipFilePath: // ?????鴻????篆?絖???????????????/span>
121 Result := DWORD( CreateResultString( boardItem.FilePath ) );
122 bipIs2ch:
123 Result := DWORD( boardItem.Is2ch );
124 else
125 Result := 0;
126 end;
127 end;
128
129 // *************************************************************************
130 // TBoardItem ?????鴻???????????c??荐??????
131 // *************************************************************************
132 procedure BoardItemSetLong(
133 instance : DWORD;
134 propertyID : TBoardItemProperty;
135 param : DWORD
136 ); stdcall;
137 var
138 boardItem : TBoard;
139 begin
140
141 boardItem := TBoard( instance );
142 case propertyID of
143 bipContext: // : DWORD // ???宴??┃絎???????????/span>
144 boardItem.Context := param;
145 bipNo: // : Integer // ???/span>
146 boardItem.No := param;
147 bipTitle: // : string // ?鴻???????帥?ゃ????/span>
148 boardItem.Title := string( PChar( param ) );
149 bipRound: // : Boolean // 綏≦????????/span>
150 boardItem.Round := Boolean( param );
151 bipRoundName: // : string // 綏≦????
152 //boardItem.RoundName := string( PChar( param ) );
153 boardItem.RoundName := PChar( param );
154 bipIsLogFile: // : Boolean // ???医?????????/span>
155 boardItem.IsLogFile := Boolean( param );
156 bipUnRead: // : Integer // ?鴻???????????/span>
157 boardItem.UnRead := Integer( param );
158 bipURL: // : string // ?鴻???????????????吟?ц;腓冴??????? URL
159 boardItem.URL := string( PChar( param ) );
160 bipFilePath: // : string // ?????鴻????篆?絖???????????????/span>
161 boardItem.FilePath := string( PChar( param ) );
162 bipIs2ch:
163 boardItem.Is2ch := Boolean( param );
164 end;
165
166 end;
167
168 // *************************************************************************
169 // TBoardItem ?????鴻???????????c????緇?????
170 // *************************************************************************
171 function BoardItemGetDouble(
172 instance : DWORD;
173 propertyID : TBoardItemProperty
174 ) : Double; stdcall;
175 var
176 boardItem : TBoard;
177 begin
178
179 boardItem := TBoard( instance );
180 case propertyID of
181 bipRoundDate: // : TDateTime // ?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
182 Result := boardItem.RoundDate;
183 bipLastModified: // : TDateTime // ?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
184 Result := boardItem.LastModified;
185 bipLastGetTime: // : TDateTime // ?鴻???????障?????鴻??????筝?荀с????緇????贋?違?????ユ??鐚??泣?若???贋?ユ???紙?吾??莨若?炊????戎??????鐚?
186 Result := boardItem.LastGetTime;
187 else
188 Result := 0;
189 end;
190
191 end;
192
193 // *************************************************************************
194 // TBoardItem ?????鴻???????????c??荐??????
195 // *************************************************************************
196 procedure BoardItemSetDouble(
197 instance : DWORD;
198 propertyID : TBoardItemProperty;
199 param : Double
200 ); stdcall;
201 var
202 boardItem : TBoard;
203 begin
204
205 boardItem := TBoard( instance );
206 case propertyID of
207 bipRoundDate: // : TDateTime // ?鴻??????????緇??????ユ??鐚?綏≦???ユ??鐚?
208 boardItem.RoundDate := param;
209 bipLastModified: // : TDateTime // ?鴻?????????贋?違???????????ユ??鐚??泣?若???贋?ユ??鐚?
210 boardItem.LastModified := param;
211 bipLastGetTime: // : TDateTime // ?鴻???????障?????鴻??????筝?荀с????緇????贋?違?????ユ??鐚??泣?若???贋?ユ???紙?吾??莨若?炊????戎??????鐚?
212 boardItem.LastGetTime := param;
213 end;
214
215 end;
216
217 // *************************************************************************
218 // TBoardItem ?????鴻????????????? TThreadItem ?????鴻????緇?????
219 // *************************************************************************
220 function BoardItemGetItems(
221 instance : DWORD;
222 index : Integer
223 ) : DWORD; stdcall;
224 var
225 boardItem : TBoard;
226 begin
227
228 boardItem := TBoard( instance );
229 Result := DWORD( boardItem.Items[ index ] );
230
231 end;
232
233 // *************************************************************************
234 // ?帥???????潟???若?????画?????
235 // *************************************************************************
236 procedure BoardItemWork(
237 inInstance : DWORD; // ?????鴻???ゃ?潟?鴻?帥?潟??/span>
238 inWorkCount : Integer // ?上?????我??倶?(?????潟??)
239 ); stdcall;
240 begin
241
242 if Assigned( OnWork ) then
243 OnWork( TObject( inInstance ), wmRead, inWorkCount );
244
245 end;
246
247 // *************************************************************************
248 // ?帥???????潟???若????紮??障?c??
249 // *************************************************************************
250 procedure BoardItemWorkBegin(
251 inInstance : DWORD; // ?????鴻???ゃ?潟?鴻?帥?潟??/span>
252 inWorkCountMax : Integer // ??篆<????????腓冴???????潟??
253 ); stdcall;
254 begin
255
256 if Assigned( OnWorkBegin ) then
257 OnWorkBegin( TObject( inInstance ), wmRead, inWorkCountMax );
258
259 end;
260
261 // *************************************************************************
262 // ?帥???????潟???若????腟???c??
263 // *************************************************************************
264 procedure BoardItemWorkEnd(
265 inInstance : DWORD // ?????鴻???ゃ?潟?鴻?帥?潟??/span>
266 ); stdcall;
267 begin
268
269 if Assigned( OnWorkEnd ) then
270 OnWorkEnd( TObject( inInstance ), wmRead );
271
272 end;
273
274 // *************************************************************************
275 // ?帥??篆????????鴻???荀с?????????????????違?????????算??????
276 // *************************************************************************
277 procedure BoardItemEnumThread(
278 inInstance : DWORD;
279 inCallBack : TBoardItemEnumThreadCallBack;
280 inSubjectText : PChar
281 ); stdcall;
282 var
283 board : TBoard;
284 subject : TStringList;
285 i : Integer;
286 rec : TSubjectRec;
287 isContinue : Boolean;
288 threadURL : string;
289 template : string;
290 begin
291
292 {$IFDEF DEBUG}
293 Writeln('ExternalBoardManager.BoardItemEnumThread');
294 {$ENDIF}
295 try
296 board := TBoard( inInstance );
297 subject := TStringList.Create;
298 try
299 //FileName?????c???????????????'(FILENAME!)'??????????絖?????????????
300 template := board.BoardPlugIn.FileName2ThreadURL( DWORD( board ), '(FILENAME!)' );
301 subject.Text := inSubjectText;
302
303 for i := 0 to subject.Count - 1 do begin
304 rec := GikoSys.DivideSubject( subject[i] );
305 rec.FFileName := Trim(rec.FFileName);
306 if AnsiPos('.', rec.FFileName) > 0 then
307 rec.FFileName := Copy(rec.FFileName, 1, AnsiPos('.', rec.FFileName) - 1);
308 if (rec.FTitle = '') and (rec.FCount = 0) then
309 Continue;
310
311 //???潟?????若????#39;(FILENAME!)'??FileName??舟??????
312 threadURL := CustomStringReplace(template, '(FILENAME!)', Rec.FFileName);
313
314 isContinue := inCallBack(
315 inInstance,
316 PChar( threadURL ),
317 PChar( rec.FTitle ),
318 DWORD( rec.FCount ) );
319
320 if ( not isContinue ) then
321 Break;
322 end;
323 finally
324 subject.Free;
325 end;
326 except
327 end;
328
329 end;
330
331 exports
332 BoardItemGetLong,
333 BoardItemSetLong,
334 BoardItemGetDouble,
335 BoardItemSetDouble,
336 BoardItemGetItems,
337 BoardItemEnumThread,
338 BoardItemWork,
339 BoardItemWorkBegin,
340 BoardItemWorkEnd;
341
342 end.

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