OSDN Git Service

・板がない場合は IE で開くように変更。
authoryoffy <yoffy>
Fri, 28 Nov 2003 02:28:38 +0000 (02:28 +0000)
committeryoffy <yoffy>
Fri, 28 Nov 2003 02:28:38 +0000 (02:28 +0000)
BoardGroup.pas
Favorite.pas
Giko.pas
GikoSystem.pas

index aca137f..8bce471 100644 (file)
@@ -96,6 +96,7 @@ type
                function FindBoardFromURL(inURL: string): TBoard;
                function FindThreadFromURL( inURL : string ) : TThreadItem;
                function FindThreadItem(BBSID: string; FileName: string): TThreadItem;
+               function FindCategoryFromTitle( inTitle : string ) : TCategory;
                function GetLogFolder: string;
 
                property Items[index: integer]: TCategory read GetCategory write SetCategory;
@@ -580,6 +581,22 @@ begin
        Result := Board.Find(FileName);
 end;
 
+function TBBS.FindCategoryFromTitle( inTitle : string ) : TCategory;
+var
+       i : Integer;
+begin
+
+       for i := Count - 1 downto 0 do begin
+               if Items[ i ].Title = inTitle then begin
+                       Result := Items[ i ];
+                       Exit;
+               end;
+       end;
+
+       Result := nil;
+
+end;
+
 (*************************************************************************
  *\83\8d\83O\83t\83H\83\8b\83_\8eæ\93¾
  *
@@ -1136,23 +1153,23 @@ var
        i: Integer;
 begin
        Result := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-  begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].NewArrival then
-             inc(Result);
-    end;
-  end else begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].NewArrival then
-      begin
-        if Items[i].ShortTitle = '' then
-               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-             inc(Result);
-      end;
-    end;
-  end;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+       begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].NewArrival then
+                               inc(Result);
+               end;
+       end else begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].NewArrival then
+                       begin
+                               if Items[i].ShortTitle = '' then
+                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+                                       inc(Result);
+                       end;
+               end;
+       end;
 end;
 
 function TBoard.GetLogThreadCount: Integer;
@@ -1160,23 +1177,23 @@ var
        i: Integer;
 begin
        Result := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-  begin
-    for i := 0 to Count - 1 do begin
-           if Items[i].IsLogFile then
-                   inc(Result);
-    end;
-  end else begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].IsLogFile then
-      begin
-        if Items[i].ShortTitle = '' then
-               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-               inc(Result);
-      end;
-    end;
-  end;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+       begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].IsLogFile then
+                               inc(Result);
+               end;
+       end else begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].IsLogFile then
+                       begin
+                               if Items[i].ShortTitle = '' then
+                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+                                       inc(Result);
+                       end;
+               end;
+       end;
 end;
 
 function TBoard.GetUserThreadCount: Integer;
@@ -1184,15 +1201,15 @@ var
        i: Integer;
 begin
        Result := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-         Result := Count
-  else
-    for i := 0 to Count - 1 do begin
-      if Items[i].ShortTitle = '' then
-        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-      if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
-        inc(Result);
-    end;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+               Result := Count
+       else
+               for i := 0 to Count - 1 do begin
+                       if Items[i].ShortTitle = '' then
+                               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                       if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
+                               inc(Result);
+               end;
 end;
 
 function TBoard.GetNewThread(Index: Integer): TThreadItem;
@@ -1202,34 +1219,34 @@ var
 begin
        Result := nil;
        Cnt := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-  begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].NewArrival then
-                  begin
-        if Index = Cnt then begin
-          Result := Items[i];
-          Exit;
-        end;
-        inc(Cnt);
-      end;
-    end;
-  end else begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].NewArrival then
-      begin
-        if Items[i].ShortTitle = '' then
-          Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-          if Index = Cnt then begin
-            Result := Items[i];
-            Exit;
-          end;
-          inc(Cnt);
-        end;
-      end;
-    end;
-  end;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+       begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].NewArrival then
+                                                                       begin
+                               if Index = Cnt then begin
+                                       Result := Items[i];
+                                       Exit;
+                               end;
+                               inc(Cnt);
+                       end;
+               end;
+       end else begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].NewArrival then
+                       begin
+                               if Items[i].ShortTitle = '' then
+                                       Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                                       if Index = Cnt then begin
+                                               Result := Items[i];
+                                               Exit;
+                                       end;
+                                       inc(Cnt);
+                               end;
+                       end;
+               end;
+       end;
 end;
 
 function TBoard.GetLogThread(Index: Integer): TThreadItem;
@@ -1237,36 +1254,36 @@ var
        i: Integer;
        Cnt: Integer;
 begin
-  Cnt := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-  begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].IsLogFile then
-                  begin
-        if Index = Cnt then begin
-          Result := Items[i];
-          Exit;
-        end;
-        inc(Cnt);
-      end;
-    end;
-  end else begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].IsLogFile then
-        begin
-          if Items[i].ShortTitle = '' then
-            Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-          if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-            if Index = Cnt then begin
-              Result := Items[i];
-              Exit;
-          end;
-          inc(Cnt);
-        end;
-      end;
-         end;
-  end;
-  Result := nil;
+       Cnt := 0;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+       begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].IsLogFile then
+                                                                       begin
+                               if Index = Cnt then begin
+                                       Result := Items[i];
+                                       Exit;
+                               end;
+                               inc(Cnt);
+                       end;
+               end;
+       end else begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].IsLogFile then
+                               begin
+                                       if Items[i].ShortTitle = '' then
+                                               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                                       if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                                               if Index = Cnt then begin
+                                                       Result := Items[i];
+                                                       Exit;
+                                       end;
+                                       inc(Cnt);
+                               end;
+                       end;
+               end;
+       end;
+       Result := nil;
 end;
 
 function TBoard.GetUserThread(Index: Integer): TThreadItem;
@@ -1276,28 +1293,28 @@ var
 begin
        Result := nil;
        Cnt := 0;
-  if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
-  begin
-    for i := 0 to Count - 1 do begin
-      if Index = Cnt then
-      begin
-        Result := Items[ i ];
-        Exit;
-      end;
-      inc( Cnt );
-    end;
-  end else begin
-    for i := 0 to Count - 1 do begin
-      if Items[i].ShortTitle = '' then
-        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-      if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
-        if Index = Cnt then begin
-          Result := Items[i];
-          Exit;
-        end;
-        inc(Cnt);
-      end;
-    end;
+       if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
+       begin
+               for i := 0 to Count - 1 do begin
+                       if Index = Cnt then
+                       begin
+                               Result := Items[ i ];
+                               Exit;
+                       end;
+                       inc( Cnt );
+               end;
+       end else begin
+               for i := 0 to Count - 1 do begin
+                       if Items[i].ShortTitle = '' then
+                               Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
+                       if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                               if Index = Cnt then begin
+                                       Result := Items[i];
+                                       Exit;
+                               end;
+                               inc(Cnt);
+                       end;
+               end;
        end;
 end;
 
index 1603877..fec8939 100644 (file)
@@ -105,14 +105,19 @@ begin
 end;
 
 function       TFavoriteBoardItem.GetItem : TBoard;
+var
+       category : TCategory;
 begin
 
        if FItem = nil then begin
                FItem := BBSsFindBoardFromURL( URL );
-               // \8b\8c\8e®\82Ì\82¨\8bC\82É\93ü\82è\82Æ\82Ì\8cÝ\8a·\90«\82Ì\82½\82ß
-               if FItem = nil then
+               {
+               if FItem = nil then begin
                        // \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¯
-                       FItem := TBoard.Create( nil, URL );
+                       FItem                           := GikoSys.GetUnknownBoard( nil, URL );
+                       FItem.Title     := Title;
+               end;
+               }
        end;
 
        Result := FItem;
@@ -154,8 +159,9 @@ begin
                board                   := BBSsFindBoardFromURL( boardURL );
 
                if board = nil then
+                       Exit
                        // \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¯
-                       board := TBoard.Create( nil, boardURL )
+                       //board := GikoSys.GetUnknownBoard( nil, boardURL )
                else
                        FItem := board.FindThreadFromURL( URL );
 
index cddd459..90274a8 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -6225,30 +6225,14 @@ begin
                                                boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
                                                Board                           := BBSsFindBoardFromURL( boardURL );
                                                if Board = nil then begin
-                                                       Board                                           := TBoard.Create( tmpThread.BoardPlugIn, boardURL );
-                                                       category                                := TCategory.Create;
-                                                       category.Title  := '(\96¼\8fÌ\95s\96¾)';
-                                                       category.Add( Board );
-                                                       // \81¦\8c\83\82µ\82­\95Û\97¯\92\86
-                                                       BBSs[ 0 ].Add( category );
-
-                                                       if FTreeType = gtt2ch then begin
-                                                               // \94Â\83\8a\83X\83g\82É\93o\98^\82³\82ê\82Ä\82¢\82È\82¢\82Ì\82Å\83c\83\8a\81[\82É\92Ç\89Á
-                                                               // SetBoardTreeNode; 1 \8ds\82Å\8dÏ\82Ü\82¹\82Ä\82à\82æ\82µ
-                                                               categoryNode                                                            := TreeView.Items.AddChild(
-                                                                       TreeView.Items.GetFirstNode, category.Title );
-                                                               categoryNode.Data                                               := category;
-                                                               categoryNode.ImageIndex                 := ITEM_ICON_CATEGORY1;
-                                                               categoryNode.SelectedIndex      := ITEM_ICON_CATEGORY2;
-
-                                                               Board.BeginUpdate;
-                                                               boardNode                                                                               :=
-                                                                       TreeView.Items.AddChild( categoryNode, Board.Title );
-                                                               boardNode.Data                                                  := Board;
-                                                               boardNode.ImageIndex                            := ITEM_ICON_BOARD1;
-                                                               boardNode.SelectedIndex                 := ITEM_ICON_BOARD2;
-                                                               Board.EndUpdate;
-                                                       end;
+                                                       // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
+                                                       GikoSys.OpenBrowser(URL, gbtUserApp);
+                                                       Exit;
+                                                       {
+                                                       Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
+                                                       if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
+                                                               ShowBBSTree( BBSs[ 1 ] );
+                                                       }
                                                end else begin
                                                        if not Board.IsThreadDatRead then
                                                                GikoSys.ReadSubjectFile( Board );
@@ -6299,9 +6283,14 @@ begin
                Board := BBSsFindBoardFromURL( boardURL );
                if Board = nil then
                        Board := BBSsFindBoardFromBBSID( BBSID );
-               if Board = nil then
+               if Board = nil then begin
                        // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
-                       Board := TBoard.Create( nil, boardURL );
+                       GikoSys.OpenBrowser(URL, gbtUserApp);
+                       Exit;
+                       //Board := GikoSys.GetUnknownBoard( nil, boardURL );
+                       //if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
+                       //      ShowBBSTree( BBSs[ 1 ] );
+               end;
                if not Board.IsThreadDatRead then
                        GikoSys.ReadSubjectFile(Board);
                ThreadItem := Board.FindThreadFromURL( URL );
index 2a6b60e..ffc398b 100644 (file)
@@ -14,7 +14,7 @@ uses
 {$IFEND}
        {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
        Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
-               MojuUtils;
+       MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain;
 
 type
        //BBS\83^\83C\83v
@@ -189,6 +189,9 @@ type
                function        Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
                procedure ReadBoardFile;
 
+               function        GetUnknownCategory : TCategory;
+               function        GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
+
                // \83X\83L\83\93\82ð\93Ç\82Ý\8d\9e\82Ý\81A\92l\82ð\92u\8a·\82·\82é
                function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
        // \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
@@ -210,7 +213,7 @@ const
 implementation
 
 uses
-       Giko, RoundData, ExternalBoardManager, ExternalBoardPlugInMain;
+       Giko, RoundData;
 
 const
        FOLDER_INDEX_VERSION                                    = '1.01';
@@ -2921,6 +2924,46 @@ begin
        end;
 end;
 
+function       TGikoSys.GetUnknownCategory : TCategory;
+const
+       UNKNOWN_CATEGORY = '(\96¼\8fÌ\95s\96¾)';
+begin
+
+       if Length( BBSs ) < 2 then begin
+               Result := nil;
+               Exit;
+       end;
+
+       Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
+       if Result = nil then begin
+               Result                          := TCategory.Create;
+               Result.Title    := UNKNOWN_CATEGORY;
+               BBSs[ 1 ].Add( Result );
+       end;
+
+end;
+
+function       TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
+var
+       category : TCategory;
+const
+       UNKNOWN_BOARD = '(\96¼\8fÌ\95s\96¾)';
+begin
+
+       category := GetUnknownCategory;
+       if category = nil then begin
+               Result := nil;
+       end else begin
+               Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
+               if Result = nil then begin
+                       Result                          := TBoard.Create( inPlugIn, inURL );
+                       Result.Title    := UNKNOWN_BOARD;
+                       category.Add( Result );
+               end;
+       end;
+
+end;
+
 initialization
        GikoSys := TGikoSys.Create;