From d33589090926b9ce4564cddecf985dba4fc14976 Mon Sep 17 00:00:00 2001 From: yoffy Date: Sun, 16 Nov 2003 10:52:04 +0000 Subject: [PATCH] =?utf8?q?=E3=83=BB=E3=82=A4=E3=83=B3=E3=83=87=E3=83=B3?= =?utf8?q?=E3=83=88=E3=81=AE=E8=AA=BF=E6=95=B4=E3=80=82=20=E3=83=BBTBBS2ch?= =?utf8?q?=20=E3=81=8A=E3=82=88=E3=81=B3=20TCategory=20=E3=81=AB=20FindBoa?= =?utf8?q?rdFromURL=20=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- BoardGroup.pas | 160 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 64 deletions(-) diff --git a/BoardGroup.pas b/BoardGroup.pas index 2cef86e..a8c9338 100644 --- a/BoardGroup.pas +++ b/BoardGroup.pas @@ -97,6 +97,7 @@ type function Find(key: string): TCategory; function FindBBSID(BBSID: string): TBoard; function FindBoardFromTitle(Title: string): TBoard; + function FindBoardFromURL(inURL: string): TBoard; function FindThreadItem(BBSID: string; FileName: string): TThreadItem; function GetLogFolder: string; @@ -134,6 +135,7 @@ type function FindName(key: string): TBoard; function FindBBSID(BBSID: string): TBoard; function FindBoardFromTitle(Title: string): TBoard; + function FindBoardFromURL(inURL: string): TBoard; function IsMidoku: Boolean; property NodeExpand: Boolean read FExpand write FExpand; @@ -167,10 +169,10 @@ type FExpand: Boolean; FBoardPlugIn : TBoardPlugIn; // ‚±‚̔‚ðƒTƒ|[ƒg‚·‚éƒvƒ‰ƒOƒCƒ“ - FFilePath : string; // ‚±‚̃XƒŒˆê——‚ª•Û‘¶‚³‚ê‚Ä‚¢‚éƒpƒX + FFilePath : string; // ‚±‚̃XƒŒˆê——‚ª•Û‘¶‚³‚ê‚Ä‚¢‚éƒpƒX FIsLogFile : Boolean; // ƒƒO‘¶Ýƒtƒ‰ƒO - FIntData : Integer; // D‚«‚É‚¢‚¶‚Á‚Ă悵B‚¢‚ë‚ñ‚È—p“r‚ÉŽg‚¤yo - FListData : TList; // D‚«‚É‚¢‚¶‚Á‚Ă悵B‚¢‚ë‚ñ‚È—p“r‚ÉŽg‚¤yo + FIntData : Integer; // D‚«‚É‚¢‚¶‚Á‚Ă悵B‚¢‚ë‚ñ‚È—p“r‚ÉŽg‚¤yo + FListData : TList; // D‚«‚É‚¢‚¶‚Á‚Ă悵B‚¢‚ë‚ñ‚È—p“r‚ÉŽg‚¤yo function GetThreadItem(index: integer): TThreadItem; procedure SetThreadItem(index: integer; value: TThreadItem); @@ -204,11 +206,11 @@ type property ParentCategory: TCategory read FParentCategory write FParentCategory; property BoardPlugIn : TBoardPlugIn read FBoardPlugIn; - property FilePath : string read FFilePath write FFilePath; - property IsLogFile : Boolean read FIsLogFile write FIsLogFile; - property IntData : Integer read FIntData write FIntData; - property ListData : TList read FListData write FListData; - function IsBoardPlugInAvailable : Boolean; + property FilePath : string read FFilePath write FFilePath; + property IsLogFile : Boolean read FIsLogFile write FIsLogFile; + property IntData : Integer read FIntData write FIntData; + property ListData : TList read FListData write FListData; + function IsBoardPlugInAvailable : Boolean; function Add(item: TThreadItem): integer; procedure Insert(Index: Integer; Item: TThreadItem); @@ -330,7 +332,7 @@ type property BoardPlugIn : TBoardPlugIn read FBoardPlugIn; property FilePath : string read FFilePath write FFilePath; property SizeByte : Integer read FSizeByte write FSizeByte; - function IsBoardPlugInAvailable : Boolean; + function IsBoardPlugInAvailable : Boolean; end; @@ -468,6 +470,23 @@ begin end; end; +function TBBS2ch.FindBoardFromURL(inURL: string): TBoard; +var + i: Integer; + Category: TCategory; + Board: TBoard; +begin + Result := nil; + for i := 0 to Count - 1 do begin + Category := Items[i]; + Board := Category.FindBoardFromURL(inURL); + if Board <> nil then begin + Result := Board; + Exit; + end; + end; +end; + function TBBS2ch.FindThreadItem(BBSID: string; FileName: string): TThreadItem; var Board: TBoard; @@ -487,7 +506,7 @@ end; procedure TBBS2ch.ReadBoardFile; var i, j, k: integer; - kbound: Integer; + kbound: Integer; idx: Integer; ini: TMemIniFile; CategoryList: TStringList; @@ -522,29 +541,29 @@ begin Category.Title := CategoryList[i]; for j := 0 to BoardList.Count - 1 do begin - Board := nil; + Board := nil; inistr := ini.ReadString(CategoryList[i], BoardList[j], ''); - //===== ƒvƒ‰ƒOƒCƒ“ - try - kbound := High( BoardPlugIns ); - for k := Low( BoardPlugIns ) to kbound do begin - if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin - if BoardPlugIns[ k ].AcceptURL( inistr ) then begin - Board := TBoard.Create( BoardPlugIns[ k ], inistr ); + //===== ƒvƒ‰ƒOƒCƒ“ + try + kbound := High( BoardPlugIns ); + for k := Low( BoardPlugIns ) to kbound do begin + if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin + if BoardPlugIns[ k ].AcceptURL( inistr ) then begin + Board := TBoard.Create( BoardPlugIns[ k ], inistr ); Break; - end; - end; - end; - except - // exception ‚ª”­¶‚µ‚½ê‡‚Í“à•”ˆ—‚É”C‚¹‚½‚¢‚Ì‚Å‚±‚±‚ł͉½‚à‚µ‚È‚¢ - end; + end; + end; + end; + except + // exception ‚ª”­¶‚µ‚½ê‡‚Í“à•”ˆ—‚É”C‚¹‚½‚¢‚Ì‚Å‚±‚±‚ł͉½‚à‚µ‚È‚¢ + end; if Board = nil then begin Board := TBoard.Create; Board.URL := inistr; - end; + end; Board.BeginUpdate; Board.No := j + 1; Board.Title := BoardList[j]; @@ -687,6 +706,19 @@ begin end; end; +function TCategory.FindBoardFromURL(inURL: string): TBoard; +var + i: integer; +begin + Result := nil; + for i := 0 to Count - 1 do begin + if Items[i].URL = inURL then begin + Result := Items[i]; + Exit; + end; + end; +end; + function TCategory.IsMidoku: Boolean; var i: Integer; @@ -738,7 +770,7 @@ begin FUpdate := True; - FBoardPlugIn := nil; + FBoardPlugIn := nil; end; // ************************************************************************* @@ -755,7 +787,7 @@ begin FBoardPlugIn := inPlugIn; URL := inURL; - // ƒvƒ‰ƒOƒCƒ“‚É TBoardItem ‚ªì¬‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é + // ƒvƒ‰ƒOƒCƒ“‚É TBoardItem ‚ªì¬‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é inPlugIn.CreateBoardItem( DWORD( Self ) ); end; @@ -770,9 +802,9 @@ begin SaveSettings; end; - // ƒvƒ‰ƒOƒCƒ“‚É TBoardItem ‚ª”jŠü‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é - if IsBoardPlugInAvailable then - BoardPlugIn.DisposeBoardItem( DWORD( Self ) ); + // ƒvƒ‰ƒOƒCƒ“‚É TBoardItem ‚ª”jŠü‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é + if IsBoardPlugInAvailable then + BoardPlugIn.DisposeBoardItem( DWORD( Self ) ); Clear; inherited; @@ -785,17 +817,17 @@ function TBoard.IsBoardPlugInAvailable : Boolean; begin repeat - if BoardPlugIn = nil then - Break; - - if not Assigned( Pointer( BoardPlugIn.Module ) ) then - Break; + if BoardPlugIn = nil then + Break; + + if not Assigned( Pointer( BoardPlugIn.Module ) ) then + Break; - Result := True; - Exit; - until True; + Result := True; + Exit; + until True; - Result := False; + Result := False; end; @@ -904,10 +936,10 @@ var FileName: string; begin if Length( FilePath ) > 0 then - FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME - else - FileName := ParentCategory.ParentBBS2ch.GetLogFolder - + BBSID + PATH_DELIM + FOLDER_INI_FILENAME; + FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME + else + FileName := ParentCategory.ParentBBS2ch.GetLogFolder + + BBSID + PATH_DELIM + FOLDER_INI_FILENAME; if not FileExists(FileName) then Exit; @@ -938,10 +970,10 @@ var FileName: string; begin if Length( FilePath ) > 0 then - FileName := ExtractFilePath( FilePath ) - else - FileName := ParentCategory.ParentBBS2ch.GetLogFolder - + BBSID + PATH_DELIM; + FileName := ExtractFilePath( FilePath ) + else + FileName := ParentCategory.ParentBBS2ch.GetLogFolder + + BBSID + PATH_DELIM; if not GikoSys.DirectoryExistsEx(FileName) then GikoSys.ForceDirectoriesEx(FileName); FileName := FileName + FOLDER_INI_FILENAME; @@ -981,20 +1013,20 @@ end; function TBoard.GetSubjectFileName: string; begin if Length( FilePath ) > 0 then - Result := FilePath - else - Result := ParentCategory.ParentBBS2ch.GetLogFolder - + BBSID + PATH_DELIM + SUBJECT_FILENAME; + Result := FilePath + else + Result := ParentCategory.ParentBBS2ch.GetLogFolder + + BBSID + PATH_DELIM + SUBJECT_FILENAME; end; // ƒCƒ“ƒfƒbƒNƒXƒtƒ@ƒCƒ‹–¼(folder.idx)Žæ“¾iƒpƒX{ƒtƒ@ƒCƒ‹–¼j function TBoard.GetFolderIndexFileName: string; begin if Length( FilePath ) > 0 then - Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME - else - Result := ParentCategory.ParentBBS2ch.GetLogFolder - + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME; + Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME + else + Result := ParentCategory.ParentBBS2ch.GetLogFolder + + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME; end; // ƒXƒŒ—§‚Ä‘—MURL @@ -1292,7 +1324,7 @@ begin FBoardPlugIn := inPlugIn; URL := inURL; - // ƒvƒ‰ƒOƒCƒ“‚É TThreadItem ‚ªì¬‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é + // ƒvƒ‰ƒOƒCƒ“‚É TThreadItem ‚ªì¬‚³‚ꂽ‚±‚Æ‚ð“`‚¦‚é inPlugIn.CreateThreadItem( DWORD( Self ) ); end; @@ -1318,17 +1350,17 @@ function TThreadItem.IsBoardPlugInAvailable : Boolean; begin repeat - if BoardPlugIn = nil then - Break; + if BoardPlugIn = nil then + Break; - if not Assigned( Pointer( BoardPlugIn.Module ) ) then - Break; + if not Assigned( Pointer( BoardPlugIn.Module ) ) then + Break; - Result := True; - Exit; - until True; + Result := True; + Exit; + until True; - Result := False; + Result := False; end; -- 2.11.0