OSDN Git Service

LogFolderPプロパティ追加による変更。
[gikonavigoeson/gikonavi.git] / BoardGroup.pas
index a4a1326..80a3a4b 100644 (file)
@@ -183,7 +183,7 @@ type
                FHEADTXTTime: TDateTime;                //HEAD.TXT\82ð\8eæ\93¾\82µ\82½\93ú\8e\9e
                FIsHEADTXT:             boolean;        //HEAD.TXT\82ð\8eæ\93¾\82µ\82Ä\82¢\82é\82©
         FTitlePictureURL:      string; //top\8aG\82ÌURL
-
+               FMultiplicity : Integer; //\8fd\95¡\82µ\82Ä\82¢\82é\82©\82Ç\82¤\82©\81H
                function GetThreadItem(index: integer): TThreadItem;
                procedure SetThreadItem(index: integer; value: TThreadItem);
                procedure SetRound(b: Boolean);
@@ -262,7 +262,7 @@ type
                property HEADTXTTime: TDateTime read FHEADTXTTime write FHEADTXTTime;
                property IsHEADTXT:     boolean read FIsHEADTXT write FIsHEADTXT;
         property TitlePictureURL: string read FTitlePictureURL write FTitlePictureURL;
-
+               property Multiplicity: Integer read FMultiplicity write FMultiplicity;
        end;
 
        //\83X\83\8c
@@ -308,7 +308,9 @@ type
                procedure Init;
                function GetCreateDate: TDateTime;
        public
-               constructor Create( inPlugIn : TBoardPlugIn; inURL : string );
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string ); overload;
+        constructor Create( is2ch : Boolean; const inURL, inHost, inBBSID, inBBSKey : string ); overload;
+
                destructor Destroy; override;
 
                function GetDatURL: string;
@@ -675,8 +677,15 @@ end;
 
 procedure TCategory.Delete(index: integer);
 begin
-       if Items[index] <> nil then
-               TBoard(Items[index]).Free;
+       if (Items[index] <> nil) then begin
+               try
+                       if TBoard(Items[index]).Multiplicity = 0 then
+                               TBoard(Items[index]).Free
+                       else
+                               TBoard(Items[index]).Multiplicity := TBoard(Items[index]).Multiplicity - 1;
+               except
+               end;
+       end;
        inherited Delete(index);
 end;
 
@@ -834,11 +843,11 @@ begin
                GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
                if GikoSys.Is2chHost( host ) then
                        FilePath :=
-                               IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                               GikoSys.Setting.LogFolderP  +
                                BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
                else
                        FilePath :=
-                               IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                               GikoSys.Setting.LogFolderP +
                                EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME
        end else begin
                // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
@@ -999,12 +1008,12 @@ procedure TBoard.LoadSettings;
 var
        ini: TMemIniFile;
        FileName: string;
-    tmp: string;
+       tmp: string;
 begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath ) + FOLDER_INI_FILENAME
        else
-               FileName := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               FileName := GikoSys.Setting.LogFolderP
                                                        + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + FOLDER_INI_FILENAME;
 
        if not FileExists(FileName) then
@@ -1049,7 +1058,7 @@ begin
        if Length( FilePath ) > 0 then
                FileName := ExtractFilePath( FilePath )
        else
-               FileName := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               FileName := GikoSys.Setting.LogFolderP
                                                        + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM;
        if not GikoSys.DirectoryExistsEx(FileName) then
                GikoSys.ForceDirectoriesEx(FileName);
@@ -1111,7 +1120,7 @@ begin
     except
        if( inDateTimeString[5] = '/' ) and ( inDateTimeString[8] = '/' ) then begin
             y := StrToIntDef( Copy(inDateTimeString, 1, 4), 1970 );
-            m := StrToIntDef( Copy(inDateTimeString, 6, 2), 1 );
+                       m := StrToIntDef( Copy(inDateTimeString, 6, 2), 1 );
             d := StrToIntDef( Copy(inDateTimeString, 9, 2), 1 );
             hour := 0; min  := 0; sec  := 0;
 
@@ -1154,7 +1163,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               Result := GikoSys.Setting.LogFolderP
                                                + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SUBJECT_FILENAME;
 end;
 
@@ -1164,7 +1173,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := ExtractFilePath( FilePath ) + FOLDER_INDEX_FILENAME
        else
-               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               Result := GikoSys.Setting.LogFolderP
                                                + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + FOLDER_INDEX_FILENAME;
 end;
 //SETTING.TXT\82Ì\83t\83@\83C\83\8b\96¼\8eæ\93¾
@@ -1173,7 +1182,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := ExtractFilePath( FilePath ) + SETTINGTXT_FILENAME
        else
-               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               Result := GikoSys.Setting.LogFolderP
                                                + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + SETTINGTXT_FILENAME;
 end;
 
@@ -1182,7 +1191,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := ExtractFilePath( FilePath ) + HEADTXT_FILENAME
        else
-               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               Result := GikoSys.Setting.LogFolderP
                                                + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + HEADTXT_FILENAME;
 end;
 function TBoard.GetTitlePictureFileName: string;
@@ -1196,15 +1205,23 @@ begin
                if Length( FilePath ) > 0 then
                        Result := ExtractFilePath( FilePath ) + tmpName
                else
-                       Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+                       Result := GikoSys.Setting.LogFolderP
                                                        + BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + tmpName;
        end;
 end;
 
 // \83X\83\8c\97§\82Ä\91\97\90MURL
 function TBoard.GetSendURL: string;
+var
+       Protocol, Host, Path, Document, Port, Bookmark : string;
 begin
-       Result := GikoSys.UrlToServer(URL) + 'test/subbbs.cgi';
+    Result := GikoSys.UrlToServer(URL);
+    GikoSys.ParseURI( URL, Protocol,Host, Path, Document, Port, Bookmark );
+    if GikoSys.Is2chHost(Host) then
+        Result := Result + 'test/bbs.cgi'
+    else
+        Result := Result + 'test/subbbs.cgi';
+
 end;
 
 procedure TBoard.SetRound(b: Boolean);
@@ -1284,7 +1301,7 @@ begin
                        if Items[i].NewArrival then
                        begin
                                if Items[i].ShortTitle = '' then
-                                       Items[i].ShortTitle := ZenToHan(Items[i].Title);
+                                       Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
                                if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                                        inc(Result);
                        end;
@@ -1308,7 +1325,7 @@ begin
                        if Items[i].IsLogFile then
                        begin
                                if Items[i].ShortTitle = '' then
-                                       Items[i].ShortTitle := ZenToHan(Items[i].Title);
+                                       Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
                                if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                                        inc(Result);
                        end;
@@ -1326,7 +1343,7 @@ begin
        else
                for i := 0 to Count - 1 do begin
                        if Items[i].ShortTitle = '' then
-                               Items[i].ShortTitle := ZenToHan(Items[i].Title);
+                               Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
                        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then
                                inc(Result);
                end;
@@ -1356,7 +1373,7 @@ begin
                        if Items[i].NewArrival then
                        begin
                                if Items[i].ShortTitle = '' then
-                                       Items[i].ShortTitle := ZenToHan(Items[i].Title);
+                                       Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
                                if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
                                        if Index = Cnt then begin
                                                Result := Items[i];
@@ -1426,7 +1443,7 @@ begin
        end else begin
                for i := 0 to Count - 1 do begin
                        if Items[i].ShortTitle = '' then
-                               Items[i].ShortTitle := ZenToHan(Items[i].Title);
+                               Items[i].ShortTitle := CustomStringReplace(ZenToHan(Items[i].Title), ' ', '');
                        if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin
                                if Index = Cnt then begin
                                        Result := Items[i];
@@ -1511,11 +1528,11 @@ begin
                        GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
                        if GikoSys.Is2chHost( host ) then
                                FilePath :=
-                                       IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                                       GikoSys.Setting.LogFolderP +
                                        BBS2CH_LOG_FOLDER + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat'
                        else
                                FilePath :=
-                                       IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder ) +
+                                       GikoSys.Setting.LogFolderP +
                                        EXTERNAL_LOG_FOLDER + PATH_DELIM + host + PATH_DELIM + BBSID + PATH_DELIM + BBSKey + '.dat';
                        FileName        := BBSKey + '.dat';
                        IsLogFile       := FileExists( FilePath );
@@ -1529,6 +1546,43 @@ begin
 end;
 
 // *************************************************************************
+// \83v\83\89\83O\83C\83\93\82ð\97\98\97p\82µ\82È\82¢\83R\83\93\83X\83g\83\89\83N\83^
+// *************************************************************************
+constructor TThreadItem.Create(
+       is2ch : Boolean;
+    const inURL, inHost, inBBSID, inBBSKey : string
+);
+var
+       foundPos                        : Integer;
+const
+       READ_PATH                                                       = '/test/read.cgi';
+begin
+
+       inherited Create;
+       Init;
+
+       FBoardPlugIn    := nil;
+
+    foundPos := Pos( READ_PATH, inURL );
+    if foundPos > 0 then begin
+        // dat \82Ì\95Û\91\83p\83X\82ð\90Ý\92è
+        if is2ch then
+            FilePath :=
+
+                GikoSys.Setting.LogFolderP +
+                BBS2CH_LOG_FOLDER + PATH_DELIM + inBBSID + PATH_DELIM + inBBSKey + '.dat'
+        else
+            FilePath :=
+                GikoSys.Setting.LogFolderP +
+                EXTERNAL_LOG_FOLDER + PATH_DELIM + inHost + PATH_DELIM + inBBSID + PATH_DELIM + inBBSKey + '.dat';
+        FileName       := inBBSKey + '.dat';
+        IsLogFile      := FileExists( FilePath );
+        URL                            := GikoSys.Get2chBrowsableThreadURL( inURL );
+    end else
+       URL                             := inURL;
+
+end;
+// *************************************************************************
 // \83f\83X\83g\83\89\83N\83^
 // *************************************************************************
 destructor TThreadItem.Destroy;
@@ -1709,7 +1763,7 @@ begin
        if Length( FilePath ) > 0 then
                Result := FilePath
        else
-               Result := IncludeTrailingPathDelimiter( GikoSys.Setting.LogFolder )
+               Result := GikoSys.Setting.LogFolderP
                                                + BBS2CH_LOG_FOLDER + PATH_DELIM + ParentBoard.BBSID + PATH_DELIM + FileName;
 end;