OSDN Git Service

・URL から TThreadItem を検索するスピードを大幅に高速化。
authoryoffy <yoffy>
Sun, 23 Nov 2003 15:45:11 +0000 (15:45 +0000)
committeryoffy <yoffy>
Sun, 23 Nov 2003 15:45:11 +0000 (15:45 +0000)
BoardGroup.pas
Favorite.pas
GikoSystem.pas
gikoNavi.res

index 1db76d2..e8f4227 100644 (file)
@@ -431,19 +431,19 @@ begin
 end;
 
 function       BBSsFindThreadFromURL(
-       inURL   : string
+       inURL                   : string
 ) : TThreadItem;
 var
-       i                       : Integer;
+       board                   : TBoard;
+       boardURL        : string;
 begin
 
-       for i := Length( BBSs ) - 1 downto 0 do begin
-               Result := BBSs[ i ].FindThreadFromURL( inURL );
-               if Result <> nil then
-                       Exit;
-       end;
-
-       Result := nil;
+       boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
+       board                   := BBSsFindBoardFromURL( boardURL );
+       if board = nil then
+               Result := nil
+       else
+               Result := board.FindThreadFromURL( inURL );
 
 end;
 
@@ -555,14 +555,17 @@ end;
 //*************************************************************************)
 function TBBS.FindThreadFromURL(inURL: string): TThreadItem;
 var
-       i       : Integer;
+       board                   : TBoard;
+       boardURL        : string;
 begin
-       for i := Count - 1 downto 0 do begin
-               Result := Items[ i ].FindThreadFromURL( inURL );
-               if Result <> nil then
-                       Exit;
-       end;
-       Result := nil;
+
+       boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
+       board                   := FindBoardFromURL( boardURL );
+       if board = nil then
+               Result := nil
+       else
+               Result := board.FindThreadFromURL( inURL );
+
 end;
 
 function TBBS.FindThreadItem(BBSID: string; FileName: string): TThreadItem;
@@ -702,15 +705,16 @@ end;
 //*************************************************************************)
 function TCategory.FindThreadFromURL(inURL: string): TThreadItem;
 var
-       i                                               : Integer;
+       board                   : TBoard;
+       boardURL        : string;
 begin
 
-       for i := Count - 1 downto 0 do begin
-               Result := Items[ i ].FindThreadFromURL( inURL );
-               if Result <> nil then
-                       Exit;
-       end;
-       Result := nil;
+       boardURL        := GikoSys.GetThreadURL2BoardURL( inURL );
+       board                   := FindBoardFromURL( boardURL );
+       if board = nil then
+               Result := nil
+       else
+               Result := board.FindThreadFromURL( inURL );
 
 end;
 
@@ -1375,7 +1379,7 @@ begin
                                        IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
                                        EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat';
                        FileName        := BBSKey + '.dat';
-      IsLogFile        := FileExists( FilePath );
+                       IsLogFile       := FileExists( FilePath );
                end;
        end else begin
                // \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
index 7bbe895..1cad441 100644 (file)
@@ -126,36 +126,14 @@ end;
 function       TFavoriteThreadItem.GetItem : TThreadItem;
 var
        threadItem      : TThreadItem;
-       boardPlugIn     : TBoardPlugIn;
        board                           : TBoard;
        boardURL                : string;
        i                                               : Integer;
 begin
 
        if FItem = nil then begin
-               //===== \83v\83\89\83O\83C\83\93
-               boardPlugIn     := nil;
-               try
-                       for i := Length( BoardPlugIns ) - 1 downto 0 do begin
-                               if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
-                                       if BoardPlugIns[ i ].AcceptURL( url ) = atThread then begin
-                                               boardPlugIn := BoardPlugIns[ i ];
-                                               threadItem      := TThreadItem.Create(boardPlugIn, URL );
-                                               boardURL                := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
-                                               threadItem.Free;
-
-                                               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;
-
-               if Length( boardURL ) = 0 then
-                       boardURL := GikoSys.Get2chThreadURL2BoardURL( URL );
-
-               board   := BBSsFindBoardFromURL( boardURL );
+       boardURL        := GikoSys.GetThreadURL2BoardURL( URL );
+               board                   := BBSsFindBoardFromURL( boardURL );
 
                if board = nil then
                        // \81¦\8dì\82Á\82Ä\82à\81A\92Ç\89Á\82·\82é\83J\83e\83S\83\8a\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
@@ -164,7 +142,7 @@ begin
                        FItem := board.FindThreadFromURL( URL );
 
                if FItem = nil then begin
-                       FItem := TThreadItem.Create( boardPlugIn, URL );
+                       FItem := TThreadItem.Create( board.BoardPlugIn, URL );
 
                        FItem.Title := Title;
                        board.Add( FItem );
index 7af7a4d..a15fdf6 100644 (file)
@@ -183,6 +183,7 @@ type
                function Parse2chURL2(URL: string): TPathRec;
                procedure ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
                function GetVersionBuild: Integer;
+               function        GetThreadURL2BoardURL( inURL : string ) : string;
                function        Get2chThreadURL2BoardURL( inURL : string ) : string;
                function        Get2chBrowsableThreadURL( inURL : string ) : string;
                function        Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
@@ -2656,6 +2657,39 @@ begin
        end;
 end;
 
+function       TGikoSys.GetThreadURL2BoardURL(
+       inURL : string
+) : string;
+var
+       threadItem      : TThreadItem;
+       boardPlugIn     : TBoardPlugIn;
+       i                                               : Integer;
+begin
+
+       //===== \83v\83\89\83O\83C\83\93
+       boardPlugIn     := nil;
+       try
+               for i := Length( BoardPlugIns ) - 1 downto 0 do begin
+                       if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
+                               if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
+                                       boardPlugIn := BoardPlugIns[ i ];
+                                       threadItem      := TThreadItem.Create( boardPlugIn, inURL );
+                                       Result                  := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
+                                       threadItem.Free;
+
+                                       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;
+
+       if Length( Result ) = 0 then
+               Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
+
+end;
+
 function       TGikoSys.Get2chThreadURL2BoardURL(
        inURL : string
 ) : string;
index 592fb82..1398b79 100644 (file)
Binary files a/gikoNavi.res and b/gikoNavi.res differ