• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

ギコナビ


Commit MetaInfo

Revision8d4c8e082da63d8bff9e12032d346e6418e898dd (tree)
Time2005-06-21 00:07:47
Authorh677 <h677>
Commiterh677

Log Message

したらばJBBS板更新機能の修復

Change Summary

Incremental Difference

--- a/res/ExternalBoardPlugIn/ShitarabaJBBSAcquireBoard.pas
+++ b/res/ExternalBoardPlugIn/ShitarabaJBBSAcquireBoard.pas
@@ -8,17 +8,17 @@ uses
88
99 type
1010 TShitarabaJBBSAcquireBoardDialog = class(TForm)
11- CategoryLabel: TLabel;
12- CategoryComboBox: TComboBox;
13- BoardNameLabel: TLabel;
14- BoardNameEdit: TEdit;
15- AcquireButton: TButton;
16- SaveButton: TButton;
17- LogEdit: TMemo;
18- SaveCategoryLabel: TLabel;
19- SaveCategoryComboBox: TComboBox;
20- procedure SaveButtonClick(Sender: TObject);
21- procedure AcquireButtonClick(Sender: TObject);
11+ CategoryLabel: TLabel;
12+ CategoryComboBox: TComboBox;
13+ BoardNameLabel: TLabel;
14+ BoardNameEdit: TEdit;
15+ AcquireButton: TButton;
16+ SaveButton: TButton;
17+ LogEdit: TMemo;
18+ SaveCategoryLabel: TLabel;
19+ SaveCategoryComboBox: TComboBox;
20+ procedure SaveButtonClick(Sender: TObject);
21+ procedure AcquireButtonClick(Sender: TObject);
2222 private
2323 { Private éŒ¾ }
2424 FBoardList : TStringList; //!< Žæ“¾Ï‚݂̔ƒŠƒXƒg
@@ -34,7 +34,7 @@ var
3434 implementation
3535
3636 uses Math, IniFiles,
37- PlugInMain, FilePath, Y_TextConverter;
37+ PlugInMain, FilePath, Y_TextConverter, MojuUtils;
3838
3939 const
4040 SYNCRONIZE_MENU_CAPTION = '‚µ‚½‚ç‚ÎJBBS”XV';
@@ -196,12 +196,11 @@ var
196196 downResult : string;
197197 responseCode : Longint;
198198
199- found : Integer;
200- found2 : Integer;
201- pos : Integer;
202199 board : string;
203200
204201 key : string;
202+ htmlList : TStringList;
203+ i : Integer;
205204 const
206205 BBS_HOST = 'http://jbbs.livedoor.jp/';
207206 CATEGORIES : array[0..14] of string = (
@@ -227,59 +226,40 @@ begin
227226 try
228227 if (responseCode = 200) or (responseCode = 206) then begin
229228 downResult := EUCtoSJIS( tmp );
230- found := AnsiPos( '<a ', downResult );
231- while found > 0 do begin
232- downResult := Copy( downResult, found + 3, MaxInt ); // 3 = Length( '<a ' )
233- found := AnsiPos( 'href=', downResult );
234- if found = 0 then
235- Break;
236-
237- if downResult[ found + 5 ] = '"' then begin // 5 = Length( 'href=' )
238- downResult := Copy( downResult, found + 6, MaxInt ); // 6 = Length( 'href="' )
239- found := AnsiPos( '"', downResult );
240- end else begin
241- downResult := Copy( downResult, found + 5, MaxInt ); // 5 = Length( 'href=' )
242- found := AnsiPos( ' ', downResult );
243- found2 := AnsiPos( '>', downResult );
244- if (found = 0) or (found2 = 0) then
245- found := Max( found, found2 )
246- else
247- found := Min( found, found2 );
229+ htmlList := TStringList.Create();
230+ try
231+ downResult := CustomStringReplace(downResult, '<small>', '');
232+ downResult := CustomStringReplace(downResult, '</small>', '');
233+ htmlList.Text := CustomStringReplace(downResult, '<br>', #13#10);
234+ for i := htmlList.Count - 1 downto 0 do begin
235+ downResult := htmlList[i];
236+ try
237+ //<a href="/auto/2348/">ƒgƒˆƒ^Ž©“®ŽÔŒfŽ¦”Â</a>
238+ if (AnsiPos(category, downResult) > 0) and (AnsiPos('<a href="', downResult) > 0) then begin
239+ board := Copy(downResult, AnsiPos('<a href="', downResult) + 9,
240+ Length(downResult));
241+ key := Copy(downResult, AnsiPos('">', downResult) + 2,
242+ Length(downResult));
243+ key := Copy(key, 1, AnsiPos('</a>', key) -1);
244+
245+ board := Copy(board, 1, AnsiPos('">', board) - 1);
246+ if (board = '../') then begin
247+ board := CustomStringReplace(board, '../', BBS_HOST);
248+ end else if (AnsiPos('/', board) = 1) then begin
249+ board := BBS_HOST + Copy(board, 2, Length(board));
250+ end;
251+
252+ board := key + '=' + board;
253+
254+ LogEdit.SelText := board + #13#10;
255+ FBoardList.Add( board );
256+ end;
257+ except
258+ end;
248259 end;
249- board := Copy( downResult, 1, found - 1 );
250- downResult := Copy( downResult, found, MaxInt );
251-
252- if board = BBS_HOST then
253- goto NextBoard;
254- if AnsiPos( '../', board ) = 1 then
255- board := BBS_HOST + Copy( board, 1 + 3, MaxInt ); // 3 = Length( '../' )
256-
257- found := AnsiPos( '>', downResult );
258- if found = 0 then
259- Break;
260- downResult := Copy( downResult, found + 1, MaxInt ); // 1 = Length( '>' )
261-
262- found := AnsiPos( '</a>', downResult );
263- if found = 0 then
264- Break;
265- key := Copy( downResult, 1, found - 1 );
266- key := StringReplace( key, '=', '', [rfReplaceAll] );
267-{
268- key := StringReplace( key, ' ', '', [rfReplaceAll] );
269- key := StringReplace( key, '[', '', [rfReplaceAll] );
270- key := StringReplace( key, ']', '', [rfReplaceAll] );
271-}
272- board := key + '=' + board;
273- downResult := Copy( downResult, found + 4, MaxInt ); // 4 = Length( '</a>' )
274-
275- LogEdit.SelText := board + #13#10;
276- FBoardList.Add( board );
277-NextBoard:
278- found := AnsiPos( '<a ', downResult );
260+ finally
261+ htmlList.free;
279262 end;
280- pos := FBoardList.IndexOf('JBBS=/');
281- if pos >= 0 then
282- FBoardList.Delete(pos);
283263 end else begin
284264 LogEdit.SelText :=
285265 '”î•ñ‚̎擾‚ÉŽ¸”s‚µ‚Ü‚µ‚½(' +
--- a/res/ExternalBoardPlugIn/ShitarabaJBBSPlugIn.dpr
+++ b/res/ExternalBoardPlugIn/ShitarabaJBBSPlugIn.dpr
@@ -3,7 +3,7 @@ library ShitarabaJBBSPlugIn;
33 {
44 ShitarabaJBBSPlugIn
55 ‚µ‚½‚ç‚Ώˆ—ƒ†ƒjƒbƒg
6- $Id: ShitarabaJBBSPlugIn.dpr,v 1.38.2.9 2005/06/20 14:12:19 h677 Exp $
6+ $Id: ShitarabaJBBSPlugIn.dpr,v 1.38.2.10 2005/06/20 15:07:47 h677 Exp $
77 }
88
99 uses
@@ -84,7 +84,7 @@ const
8484 MAJOR_VERSION = 1;
8585 MINOR_VERSION = 1;
8686 RELEASE_VERSION = 'alpha';
87- REVISION_VERSION = 9;
87+ REVISION_VERSION = 10;
8888
8989 SYNCRONIZE_MENU_CAPTION = '‚µ‚½‚ç‚ÎJBBS”XV';
9090