OSDN Git Service

・インデントの調整。
authoryoffy <yoffy>
Sun, 16 Nov 2003 10:52:04 +0000 (10:52 +0000)
committeryoffy <yoffy>
Sun, 16 Nov 2003 10:52:04 +0000 (10:52 +0000)
・TBBS2ch および TCategory に FindBoardFromURL を追加。

BoardGroup.pas

index 2cef86e..a8c9338 100644 (file)
@@ -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; // \82±\82Ì\94Â\82ð\83T\83|\81[\83g\82·\82é\83v\83\89\83O\83C\83\93
-    FFilePath                  : string;                               // \82±\82Ì\83X\83\8c\88ê\97\97\82ª\95Û\91\82³\82ê\82Ä\82¢\82é\83p\83X
+               FFilePath                       : string;                               // \82±\82Ì\83X\83\8c\88ê\97\97\82ª\95Û\91\82³\82ê\82Ä\82¢\82é\83p\83X
                FIsLogFile              : Boolean;                      // \83\8d\83O\91\8dÝ\83t\83\89\83O
-    FIntData                   : Integer;                      // \8dD\82«\82É\82¢\82\82Á\82Ä\82æ\82µ\81B\82¢\82ë\82ñ\82È\97p\93r\82É\8eg\82¤yo
-    FListData                  : TList;                                // \8dD\82«\82É\82¢\82\82Á\82Ä\82æ\82µ\81B\82¢\82ë\82ñ\82È\97p\93r\82É\8eg\82¤yo
+               FIntData                        : Integer;                      // \8dD\82«\82É\82¢\82\82Á\82Ä\82æ\82µ\81B\82¢\82ë\82ñ\82È\97p\93r\82É\8eg\82¤yo
+               FListData                       : TList;                                // \8dD\82«\82É\82¢\82\82Á\82Ä\82æ\82µ\81B\82¢\82ë\82ñ\82È\97p\93r\82É\8eg\82¤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], '');
 
-               //===== \83v\83\89\83O\83C\83\93
-          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 );
+                                       //===== \83v\83\89\83O\83C\83\93
+                                       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 \82ª\94­\90\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
-          end;
+                                                               end;
+                                                       end;
+                                               end;
+                                       except
+                                               // exception \82ª\94­\90\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
+                                       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;
 
-  // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+       // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
        inPlugIn.CreateBoardItem( DWORD( Self ) );
 
 end;
@@ -770,9 +802,9 @@ begin
                SaveSettings;
        end;
 
-  // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\94j\8aü\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
-  if IsBoardPlugInAvailable then
-       BoardPlugIn.DisposeBoardItem( DWORD( Self ) );
+       // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\94j\8aü\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+       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;
 
 // \83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b\96¼(folder.idx)\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
 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;
 
 // \83X\83\8c\97§\82Ä\91\97\90MURL
@@ -1292,7 +1324,7 @@ begin
        FBoardPlugIn    := inPlugIn;
        URL                                             := inURL;
 
-  // \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+       // \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
        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;