OSDN Git Service

・TThreadItem の作成時に IsLogFile が設定されるようになった。
[gikonavigoeson/gikonavi.git] / BoardGroup.pas
index a8c9338..1db76d2 100644 (file)
@@ -4,7 +4,7 @@ interface
 
 uses
        Windows, SysUtils, Classes, ComCtrls, IniFiles, {HTTPApp,} YofUtils, IdGlobal,
-       ExternalBoardManager;
+       ExternalBoardManager, ExternalBoardPlugInMain;
 
 type
        //\83\8a\83X\83g\82Ì\95\\8e¦\83A\83C\83e\83\80\91I\91ð
@@ -47,7 +47,7 @@ type
 }
 
 {
-       TBBS2ch = class(TBBS)
+       TBBS = class(TBBS)
        end;
        TBoard2ch = class(TBoard)
        end;
@@ -71,7 +71,7 @@ type
        TThreadItem = class;
 
        //\82Æ\82è\82 \82¦\82¸\82Q\82¿\82á\82ñ\82Ë\82é\82Ì\83\8b\81[\83g
-       TBBS2ch = class(TList)
+       TBBS = class(TList)
        private
                FTitle: string;
                FLogFolder: string;
@@ -87,10 +87,6 @@ type
                constructor Create(LogFolder: string);
                destructor Destroy; override;
 
-               procedure ReadBoardFile;
-
-               function GetBoardFromBBSID(BBSID: string): TBoard;
-
                function Add(item: TCategory): integer;
                procedure Delete(index: integer);
                procedure Clear; override;
@@ -98,13 +94,14 @@ type
                function FindBBSID(BBSID: string): TBoard;
                function FindBoardFromTitle(Title: string): TBoard;
                function FindBoardFromURL(inURL: string): TBoard;
+               function FindThreadFromURL( inURL : string ) : TThreadItem;
                function FindThreadItem(BBSID: string; FileName: string): TThreadItem;
                function GetLogFolder: string;
 
                property Items[index: integer]: TCategory read GetCategory write SetCategory;
                property Title: string read FTitle write FTitle;
                property NodeExpand: Boolean read FExpand write FExpand;
-
+                                                                                
                property KubetsuChk: Boolean read FKubetsuChk write FKubetsuChk;
                property SelectText: string read FSelectText write SetSelectText;
                property ShortSelectText: string read FShortSelectText write FShortSelectText;
@@ -115,7 +112,7 @@ type
        private
                FNo: Integer;
                FTitle: string;
-               FParentBBS2ch: TBBS2ch;
+               FParenTBBS: TBBS;
                FExpand: Boolean;
 
                function GetBoard(index: integer): TBoard;
@@ -127,7 +124,7 @@ type
                property No: Integer read FNo write FNo;
                property Title: string read FTitle write FTitle;
                property Items[index: integer]: TBoard read GetBoard write SetBoard;
-               property ParentBBS2ch: TBBS2ch read FParentBBS2ch write FParentBBS2ch;
+               property ParenTBBS: TBBS read FParenTBBS write FParenTBBS;
 
                function Add(item: TBoard): integer;
                procedure Delete(index: integer);
@@ -136,6 +133,7 @@ type
                function FindBBSID(BBSID: string): TBoard;
                function FindBoardFromTitle(Title: string): TBoard;
                function FindBoardFromURL(inURL: string): TBoard;
+               function FindThreadFromURL( inURL : string ) : TThreadItem;
                function IsMidoku: Boolean;
 
                property NodeExpand: Boolean read FExpand write FExpand;
@@ -183,9 +181,9 @@ type
                procedure SetUnRead(i: Integer);
                procedure SetKotehanName(s: string);
                procedure SetKotehanMail(s: string);
+               procedure Create; overload;
        public
-               constructor Create; overload;
-               constructor Create( inPlugIn : TBoardPlugIn; inURL : string = '' ); overload;
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;
                destructor Destroy; override;
 
                property Context: DWORD read FContext write FContext;
@@ -218,6 +216,7 @@ type
                procedure DeleteList(index: integer);
                procedure Clear; override;
                function Find(ItemFileName: string): TThreadItem;
+               function FindThreadFromURL( inURL : string ) : TThreadItem;
                function GetIndex(ItemFileName: string): Integer;
                function GetIndexFromURL(URL: string): Integer;
                procedure LoadSettings;
@@ -285,10 +284,9 @@ type
                procedure SetKokomade(i: Integer);
                procedure SetUnRead(b: Boolean);
                procedure SetScrollTop(i: Integer);
-               function GetURLWrapper: string;
+               procedure Create; overload;
        public
-               constructor Create; overload;
-               constructor Create( inPlugIn : TBoardPlugIn; inURL : string = '' ); overload;
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;
                destructor Destroy; override;
 
                function GetDatURL: string;
@@ -328,7 +326,7 @@ type
                property AgeSage: TGikoAgeSage read FAgeSage write FAgeSage;
 //             property SPID: string read FSPID write FSPID;
 
-               property        URL                                     : string                                read GetURLWrapper write FURL;
+               property        URL                                     : string                                read FURL write FURL;
                property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;
                property        FilePath                : string                                read FFilePath write FFilePath;
                property        SizeByte                : Integer                               read FSizeByte write FSizeByte;
@@ -353,8 +351,13 @@ type
                procedure Clear; override;
        end;}
 
+       function        BBSsFindBoardFromBBSID( inBBSID : string ) : TBoard;
+       function        BBSsFindBoardFromURL( inURL : string ) : TBoard;
+       function        BBSsFindBoardFromTitle( inTitle : string ) : TBoard;
+       function        BBSsFindThreadFromURL( inURL : string ) : TThreadItem;
+
 var
-       BBS2ch: TBBS2ch;
+       BBSs            : array of TBBS;
 
 implementation
 
@@ -364,6 +367,7 @@ uses
 const
        BBS2CH_NAME:                                     string = '\82Q\82¿\82á\82ñ\82Ë\82é';
        BBS2CH_LOG_FOLDER:               string = '2ch';
+       EXTERNAL_LOG_FOLDER:            string  = 'exboard';
 
        FOLDER_INI_FILENAME:     string = 'Folder.ini';
        FOLDER_INDEX_FILENAME: string   = 'Folder.idx';
@@ -375,11 +379,79 @@ const
 //     COLUMN_BOARD:                   array[0..3] of string = ('\94Â\96¼', '\8eæ\93¾\90\94', '\8f\84\89ñ\97\\96ñ', '\91O\89ñ\8f\84\89ñ\93ú\8e\9e');
 //     COLUMN_THREADITEM: array[0..3] of string = ('\83X\83\8c\83b\83h\96¼', '\83J\83E\83\93\83g', '\8f\84\89ñ\97\\96ñ', '\91O\89ñ\8f\84\89ñ\93ú\8e\9e');
 
+function       BBSsFindBoardFromBBSID(
+       inBBSID : string
+) : TBoard;
+var
+       i                               : Integer;
+begin
+
+       for i := Length( BBSs ) - 1 downto 0 do begin
+               Result := BBSs[ i ].FindBBSID( inBBSID );
+               if Result <> nil then
+                       Exit;
+       end;
+
+       Result := nil;
+
+end;
+
+function       BBSsFindBoardFromURL(
+       inURL   : string
+) : TBoard;
+var
+       i                       : Integer;
+begin
+
+       for i := Length( BBSs ) - 1 downto 0 do begin
+               Result := BBSs[ i ].FindBoardFromURL( inURL );
+               if Result <> nil then
+                       Exit;
+       end;
+
+       Result := nil;
+
+end;
+
+function       BBSsFindBoardFromTitle(
+       inTitle : string
+) : TBoard;
+var
+       i                               : Integer;
+begin
+
+       for i := Length( BBSs ) - 1 downto 0 do begin
+               Result := BBSs[ i ].FindBoardFromTitle( inTitle );
+               if Result <> nil then
+                       Exit;
+       end;
+
+       Result := nil;
+
+end;
+
+function       BBSsFindThreadFromURL(
+       inURL   : string
+) : TThreadItem;
+var
+       i                       : Integer;
+begin
+
+       for i := Length( BBSs ) - 1 downto 0 do begin
+               Result := BBSs[ i ].FindThreadFromURL( inURL );
+               if Result <> nil then
+                       Exit;
+       end;
+
+       Result := nil;
+
+end;
+
 (*************************************************************************
  *\8b@\94\\96¼\81FTBBS\83R\83\93\83X\83g\83\89\83N\83^
  *Public
  *************************************************************************)
-constructor TBBS2ch.Create(LogFolder: string);
+constructor TBBS.Create(LogFolder: string);
 begin
        Title := BBS2CH_NAME;
        FLogFolder := LogFolder;
@@ -389,7 +461,7 @@ end;
  *\8b@\94\\96¼\81FTBBS\83f\83X\83g\83\89\83N\83^
  *Public
  *************************************************************************)
-destructor TBBS2ch.Destroy;
+destructor TBBS.Destroy;
 begin
        Clear;
        inherited;
@@ -399,23 +471,23 @@ end;
  *\8b@\94\\96¼\81F
  *Public
  *************************************************************************)
-function TBBS2ch.GetCategory(index: integer): TCategory;
+function TBBS.GetCategory(index: integer): TCategory;
 begin
        Result := TCategory(inherited Items[index]);
 end;
 
-procedure TBBS2ch.SetCategory(index: integer; value: TCategory);
+procedure TBBS.SetCategory(index: integer; value: TCategory);
 begin
        inherited Items[index] := value;
 end;
 
-function TBBS2ch.Add(item: TCategory): integer;
+function TBBS.Add(item: TCategory): integer;
 begin
-       Item.ParentBBS2ch := self;
+       Item.ParenTBBS := self;
        Result := inherited Add(item);
 end;
 
-procedure TBBS2ch.Delete(index: integer);
+procedure TBBS.Delete(index: integer);
 begin
        if Items[index] <> nil then
                TCategory(Items[index]).Free;
@@ -423,7 +495,7 @@ begin
        inherited Delete(index);
 end;
 
-procedure TBBS2ch.Clear;
+procedure TBBS.Clear;
 var
        i: integer;
 begin
@@ -431,201 +503,101 @@ begin
                Delete(i);
 end;
 
-function TBBS2ch.Find(key: string): TCategory;
+function TBBS.Find(key: string): TCategory;
 begin
        Result := nil;
 end;
 
-function TBBS2ch.FindBBSID(BBSID: string): TBoard;
+function TBBS.FindBBSID(BBSID: string): TBoard;
 var
-       i: Integer;
-       Category: TCategory;
-       Board: TBoard;
+       i       : Integer;
 begin
-       Result := nil;
-       for i := 0 to Count - 1 do begin
-               Category := Items[i];
-               Board := Category.FindBBSID(BBSID);
-               if Board <> nil then begin
-                       Result := Board;
+       for i := Count - 1 downto 0 do begin
+               Result := Items[ i ].FindBBSID(BBSID);
+               if Result <> nil then
                        Exit;
-               end;
        end;
+       Result := nil;
 end;
 
-function TBBS2ch.FindBoardFromTitle(Title: string): TBoard;
+//*************************************************************************
+// \83^\83C\83g\83\8b\82Ì\88ê\92v\82·\82é\94Â\82ð\92T\82·
+//*************************************************************************)
+function TBBS.FindBoardFromTitle(Title: 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.FindBoardFromTitle(Title);
-               if Board <> nil then begin
-                       Result := Board;
+       for i := Count - 1 downto 0 do begin
+               Result := Items[ i ].FindBoardFromTitle(Title);
+               if Result <> nil then
                        Exit;
-               end;
        end;
+       Result := nil;
 end;
 
-function TBBS2ch.FindBoardFromURL(inURL: string): TBoard;
+//*************************************************************************
+// URL \82ð\8eó\82¯\95t\82¯\82é\94Â\82ð\92T\82·
+//*************************************************************************)
+function TBBS.FindBoardFromURL(inURL: string): TBoard;
 var
-       i: Integer;
-       Category: TCategory;
-       Board: TBoard;
+       i                                       : Integer;
 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;
+       for i := Count - 1 downto 0 do begin
+               Result := Items[ i ].FindBoardFromURL( inURL );
+               if Result <> nil then
                        Exit;
-               end;
        end;
+       Result := nil;
 end;
 
-function TBBS2ch.FindThreadItem(BBSID: string; FileName: string): TThreadItem;
+//*************************************************************************
+// URL \82ð\8eó\82¯\95t\82¯\82é\83X\83\8c\83b\83h\82ð\92T\82·
+//*************************************************************************)
+function TBBS.FindThreadFromURL(inURL: string): TThreadItem;
 var
-       Board: TBoard;
+       i       : Integer;
 begin
+       for i := Count - 1 downto 0 do begin
+               Result := Items[ i ].FindThreadFromURL( inURL );
+               if Result <> nil then
+                       Exit;
+       end;
        Result := nil;
-       Board := FindBBSID(BBSID);
-       if Board = nil then
-               Exit;
-       Result := Board.Find(FileName);
 end;
 
-(*************************************************************************
- *\8b@\94\\96¼\81@\81@\81F\83{\81[\83h\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
- *\89Â\8e\8b\81@\81@\81@\81FPublic
- *\97\9a\97ð\82P\81@\81@\81F\90V\8bK\8dì\90¬
- *************************************************************************)
-procedure TBBS2ch.ReadBoardFile;
+function TBBS.FindThreadItem(BBSID: string; FileName: string): TThreadItem;
 var
-       i, j, k: integer;
-       kbound: Integer;
-       idx: Integer;
-       ini: TMemIniFile;
-       CategoryList: TStringList;
-       BoardList: TStringList;
-       Category: TCategory;
        Board: TBoard;
-       inistr: string;
-       RoundItem: TRoundItem;
-       BBSList: TStringList;
-       CustomList: TStringList;
-begin
-       ini := TMemIniFile.Create('');
-       BBSList := TStringList.Create;
-       CustomList := TStringList.Create;
-       try
-               if FileExists(GikoSys.GetBoardFileName) then
-                       BBSList.LoadFromFile(GikoSys.GetBoardFileName);
-               if FileExists(GikoSys.GetCustomBoardFileName) then
-                       CustomList.LoadFromFile(GikoSys.GetCustomBoardFileName);
-               BBSList.AddStrings(CustomList);
-               ini.SetStrings(BBSList);
-
-               CategoryList := TStringList.Create;
-               BoardList := TStringList.Create;
-               try
-                       ini.ReadSections(CategoryList);
-                       for i := 0 to CategoryList.Count - 1 do begin
-
-                               ini.ReadSection(CategoryList[i], BoardList);
-                               Category := TCategory.Create;
-                               Category.No := i + 1;
-                               Category.Title := CategoryList[i];
-
-                               for j := 0 to BoardList.Count - 1 do begin
-                                       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 );
-
-                                                                       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 Board = nil then begin
-                                               Board := TBoard.Create;
-                                               Board.URL := inistr;
-                                       end;
-                                       Board.BeginUpdate;
-                                       Board.No := j + 1;
-                                       Board.Title := BoardList[j];
-                                       Board.BBSID := GikoSys.UrlToID(inistr);
-                                       Board.RoundDate := ZERO_DATE;
-
-                                       idx := RoundList.Find(Board);
-                                       if idx <> -1 then begin
-                                               RoundItem := RoundList.Items[idx, grtBoard];
-                                               Board.Round := True;
-                                               Board.RoundName := RoundItem.RoundName;
-                                       end;
-                                       Category.Add(Board);
-                                       Board.EndUpdate;
-                               end;
-                               BBS2ch.Add(Category);
-                       end;
-               finally
-                       BoardList.Free;
-                       CategoryList.Free;
-               end;
-       finally
-               BBSList.Free;
-               CustomList.Free;
-               ini.Free;
-       end;
-end;
-
-function TBBS2ch.GetBoardFromBBSID(BBSID: string): TBoard;
-var
-       i: integer;
 begin
        Result := nil;
-       for i := 0 to BBS2ch.Count - 1 do begin
-               Result := BBS2ch.Items[i].FindBBSID(BBSID);
-               if Result <> nil then
-                       Exit;
-       end;
+       Board := FindBBSID(BBSID);
+       if Board = nil then
+               Exit;
+       Result := Board.Find(FileName);
 end;
 
 (*************************************************************************
  *\83\8d\83O\83t\83H\83\8b\83_\8eæ\93¾
  *
  *************************************************************************)
-function TBBS2ch.GetLogFolder: string;
+function TBBS.GetLogFolder: string;
 begin
        Result := IncludeTrailingPathDelimiter(FLogFolder)
                                        + BBS2CH_LOG_FOLDER + PATH_DELIM;
 end;
 
-procedure TBBS2ch.SetSelectText(s: string);
+procedure TBBS.SetSelectText(s: string);
 begin
        FSelectText := s;
        ShortSelectText := GikoSys.ZenToHan(s);
 end;
 
-{class function TBBS2ch.GetColumnName(Index: Integer): string;
+{class function TBBS.GetColumnName(Index: Integer): string;
 begin
        Result := COLUMN_CATEGORY[Index];
 end;
 
-class function TBBS2ch.GetColumnCount: Integer;
+class function TBBS.GetColumnCount: Integer;
 begin
        Result := Length(COLUMN_CATEGORY);
 end;}
@@ -682,41 +654,64 @@ end;
 
 function TCategory.FindBBSID(BBSID: string): TBoard;
 var
-       i: integer;
+       i       : integer;
 begin
-       Result := nil;
-       for i := 0 to Count - 1 do begin
+       for i := Count - 1 downto 0 do begin
                if Items[i].FBBSID = BBSID then begin
                        Result := Items[i];
                        Exit;
                end;
        end;
+       Result := nil;
 end;
 
+//*************************************************************************
+// \83^\83C\83g\83\8b\82Ì\88ê\92v\82·\82é\94Â\82ð\92T\82·
+//*************************************************************************)
 function TCategory.FindBoardFromTitle(Title: string): TBoard;
 var
-       i: integer;
+       i       : integer;
 begin
-       Result := nil;
-       for i := 0 to Count - 1 do begin
+       for i := Count - 1 downto 0 do begin
                if Items[i].FTitle = Title then begin
                        Result := Items[i];
                        Exit;
                end;
        end;
+       Result := nil;
 end;
 
+//*************************************************************************
+// URL \82ð\8eó\82¯\95t\82¯\82é\94Â\82ð\92T\82·
+//*************************************************************************)
 function TCategory.FindBoardFromURL(inURL: string): TBoard;
 var
-       i: integer;
+       i       : Integer;
 begin
-       Result := nil;
-       for i := 0 to Count - 1 do begin
-               if Items[i].URL = inURL then begin
+       for i := Count - 1 downto 0 do begin
+               if Pos( Items[i].URL, inURL ) = 1 then begin
                        Result := Items[i];
                        Exit;
                end;
        end;
+       Result := nil;
+end;
+
+//*************************************************************************
+// URL \82ð\8eó\82¯\95t\82¯\82é\83X\83\8c\83b\83h\82ð\92T\82·
+//*************************************************************************)
+function TCategory.FindThreadFromURL(inURL: string): TThreadItem;
+var
+       i                                               : Integer;
+begin
+
+       for i := Count - 1 downto 0 do begin
+               Result := Items[ i ].FindThreadFromURL( inURL );
+               if Result <> nil then
+                       Exit;
+       end;
+       Result := nil;
+
 end;
 
 function TCategory.IsMidoku: Boolean;
@@ -753,7 +748,7 @@ end;}
 //===================
 //TBoard
 //===================
-constructor TBoard.Create;
+procedure TBoard.Create;
 begin
        FNo := 0;
        FTitle := '';
@@ -778,17 +773,34 @@ end;
 // *************************************************************************
 constructor TBoard.Create(
        inPlugIn        : TBoardPlugIn;
-       inURL                   : string = ''
+       inURL                   : string
 );
+var
+       protocol, host, path, document, port, bookmark  : string;
+       BBSID                   : string;
 begin
 
        Create;
 
        FBoardPlugIn    := inPlugIn;
        URL                                             := inURL;
+       BBSID                                   := GikoSys.UrlToID( inURL );
 
        // \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 ) );
+       if inPlugIn = nil then begin
+               // subject.txt \82Ì\95Û\91\83p\83X\82ð\90Ý\92è
+               GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
+               if GikoSys.Is2chHost( host ) then
+                       FilePath :=
+                               IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                               BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
+               else
+                       FilePath :=
+                               IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                               EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
+       end else begin
+               inPlugIn.CreateBoardItem( DWORD( Self ) );
+       end;
 
 end;
 
@@ -916,6 +928,24 @@ begin
        end;
 end;
 
+function TBoard.FindThreadFromURL( inURL : string ) : TThreadItem;
+var
+       i : Integer;
+begin
+
+       if not IsThreadDatRead then
+               GikoSys.ReadSubjectFile( Self );
+               
+       for i := Count - 1 downto 0 do begin
+               if Pos( Items[ i ].URL, inURL ) = 1 then begin
+                       Result := Items[ i ];
+                       Exit;
+               end;
+       end;
+       Result := nil;
+
+end;
+
 {function TBoard.GetMidokuCount: Integer;
 var
        i: integer;
@@ -938,7 +968,7 @@ begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME
        else
-               FileName := ParentCategory.ParentBBS2ch.GetLogFolder
+               FileName := ParentCategory.ParenTBBS.GetLogFolder
                                                        + BBSID + PATH_DELIM + FOLDER_INI_FILENAME;
 
        if not FileExists(FileName) then
@@ -972,7 +1002,7 @@ begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath )
        else
-               FileName := ParentCategory.ParentBBS2ch.GetLogFolder
+               FileName := ParentCategory.ParenTBBS.GetLogFolder
                                                        + BBSID + PATH_DELIM;
        if not GikoSys.DirectoryExistsEx(FileName) then
                GikoSys.ForceDirectoriesEx(FileName);
@@ -1015,7 +1045,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := ParentCategory.ParentBBS2ch.GetLogFolder
+               Result := ParentCategory.ParenTBBS.GetLogFolder
                                                + BBSID + PATH_DELIM + SUBJECT_FILENAME;
 end;
 
@@ -1025,7 +1055,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME
        else
-               Result := ParentCategory.ParentBBS2ch.GetLogFolder
+               Result := ParentCategory.ParenTBBS.GetLogFolder
                                                + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME;
 end;
 
@@ -1101,7 +1131,7 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
                                begin
                                        for i := 0 to Count - 1 do begin
                                                if Items[i].NewArrival then
@@ -1113,7 +1143,7 @@ begin
                                                                                                begin
                                                                                                                                if Items[i].ShortTitle = '' then
                                                                                        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                                                                               if AnsiPos(ParentCategory.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then
+                                                                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                                                                                                                                                                inc(Result);
                                                                                                end;
                                        end;
@@ -1125,7 +1155,7 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
                                begin
                                        for i := 0 to Count - 1 do begin
                                                if Items[i].IsLogFile then
@@ -1137,7 +1167,7 @@ begin
                                                                                                begin
                                                                                                                                if Items[i].ShortTitle = '' then
                                                                                        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                                                                               if AnsiPos(ParentCategory.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then
+                                                                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                                                                                                                                                                inc(Result);
                                                                                                end;
                                        end;
@@ -1149,13 +1179,13 @@ var
        i: Integer;
 begin
        Result := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               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.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then
+               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                        inc(Result);
        end;
 end;
@@ -1167,7 +1197,7 @@ var
 begin
        Result := nil;
        Cnt := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
                                begin
                                        for i := 0 to Count - 1 do begin
                                                if Items[i].NewArrival then
@@ -1185,7 +1215,7 @@ begin
                                                                                                begin
                                                                                if Items[i].ShortTitle = '' then
                                                                                        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                               if AnsiPos(ParentCategory.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
                                                                                        if Index = Cnt then begin
                                                                                                Result := Items[i];
                                                                                                Exit;
@@ -1203,7 +1233,7 @@ var
        Cnt: Integer;
 begin
                                Cnt := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
                                begin
                                        for i := 0 to Count - 1 do begin
                                                if Items[i].IsLogFile then
@@ -1221,7 +1251,7 @@ begin
                                                                                                begin
                                                                                if Items[i].ShortTitle = '' then
                                                                                        Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title);
-                                                                               if AnsiPos(ParentCategory.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                                                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
                                                                                        if Index = Cnt then begin
                                                                                                Result := Items[i];
                                                                                                Exit;
@@ -1241,7 +1271,7 @@ var
 begin
        Result := nil;
        Cnt := 0;
-                               if Length( ParentCategory.ParentBBS2ch.ShortSelectText ) = 0 then
+                               if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then
                                begin
                                                                for i := 0 to Count - 1 do begin
                                                                                                if Index = Cnt then
@@ -1255,7 +1285,7 @@ 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.ParentBBS2ch.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
+                                               if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
                                                        if Index = Cnt then begin
                                                                Result := Items[i];
                                                                Exit;
@@ -1287,7 +1317,7 @@ begin
 end;}
 
 //constructor TThreadItem.Create(AOwner: TComponent);
-constructor TThreadItem.Create;
+procedure TThreadItem.Create;
 begin
        FNo := 0;
        FFileName := '';
@@ -1315,8 +1345,14 @@ end;
 // *************************************************************************
 constructor TThreadItem.Create(
        inPlugIn        : TBoardPlugIn;
-       inURL                   : string = ''
+       inURL                   : string
 );
+var
+       foundPos                        : Integer;
+       protocol, host, path, document, port, bookmark  : string;
+       BBSID, BBSKey   : string;
+const
+       READ_PATH                                                       = '/test/read.cgi';
 begin
 
        Create;
@@ -1324,8 +1360,27 @@ 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é
-       inPlugIn.CreateThreadItem( DWORD( Self ) );
+       if inPlugIn = nil then begin
+               foundPos := Pos( READ_PATH, inURL );
+               if foundPos > 0 then begin
+                       // dat \82Ì\95Û\91\83p\83X\82ð\90Ý\92è
+                       GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
+                       GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
+                       if GikoSys.Is2chHost( host ) then
+                               FilePath :=
+                                       IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                                       BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat'
+                       else
+                               FilePath :=
+                                       IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                                       EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat';
+                       FileName        := BBSKey + '.dat';
+      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é
+               inPlugIn.CreateThreadItem( DWORD( Self ) );
+       end;
 
 end;
 
@@ -1503,7 +1558,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := ParentBoard.ParentCategory.ParentBBS2ch.GetLogFolder
+               Result := ParentBoard.ParentCategory.ParenTBBS.GetLogFolder
                                                + ParentBoard.BBSID + PATH_DELIM + FileName;
 end;
 
@@ -1577,18 +1632,8 @@ begin
        FUpdate := True;
 end;
 
-function TThreadItem.GetURLWrapper: string;
-begin
-
-       If FURL = '' Then
-               Result := GikoSys.GetURL( ParentBoard.BBSID, FileName )
-       Else
-               Result := FURL;
-
-end;
-
 {initialization
-       BBS2ch := TBBS2ch.Create;
+       BBS2ch := TBBS.Create;
 
 finalization
        if BBS2ch <> nil then