OSDN Git Service

したらばJBBS用の過去ログのコード追加
authorh677 <h677>
Mon, 6 Sep 2004 16:41:41 +0000 (16:41 +0000)
committerh677 <h677>
Mon, 6 Sep 2004 16:41:41 +0000 (16:41 +0000)
res/ExternalBoardPlugIn/ShitarabaJBBSPlugIn.dpr

index 5d5afb6..361e949 100644 (file)
@@ -3,7 +3,7 @@ library ShitarabaJBBSPlugIn;
 {
        ShitarabaJBBSPlugIn
        \82µ\82½\82ç\82Î\8f\88\97\9d\83\86\83j\83b\83g
-       $Id: ShitarabaJBBSPlugIn.dpr,v 1.29 2004/08/27 21:01:46 h677 Exp $
+       $Id: ShitarabaJBBSPlugIn.dpr,v 1.30 2004/09/06 16:41:41 h677 Exp $
 }
 
 uses
@@ -636,6 +636,24 @@ begin
                                finally
                                        downResult.Free;
                                end;
+                       end else if responseCode = 302 then begin
+                               //http://jbbs.shitaraba.com/bbs/read.cgi/game/3477/1077473358/
+                               //http://jbbs.shitaraba.com/game/bbs/read.cgi?BBS=3477&KEY=1077473358
+                               //http://jbbs.shitaraba.com/game/3477/storage/1077473358.html
+                               //\89ß\8b\8e\83\8d\83O
+                               uri := TIdURI.Create( ReadURL );
+                               uriList := TStringList.Create;
+                               try
+                                       ExtractHttpFields( ['/', '?'], [], uri.Path, uriList );
+                                       URL := uri.Protocol + '://' + uri.Host +
+                                                       '/' + uriList[3] + '/' + uriList[4] + '/storage/' + uriList[ 5 ] + '.html';
+                               finally
+                                       uriList.Free;
+                                       uri.Free;
+                               end;
+                               uri := TIdURI.Create( ReadURL );
+                               Result := StorageDownload(uri.Path, uri.Document);
+                               uri.Free;
                        end else if responseCode = 304 then begin
                                Result := dsNotModify;
                        end;
@@ -794,7 +812,7 @@ begin
                                                end;
                                                tmpHTML.Delete(i);
                                        end;
-                    j := 0;
+                                       j := 0;
                                        for i := 0 to tmpHTML.Count - 1 do begin
                                                tmpLine := AnsiLowerCase(tmpHTML[i]);
                                                tS := AnsiPos('<dl>', tmpLine);
@@ -915,31 +933,27 @@ begin
 
                                if downResult.Count > 0 then begin
                                        if FileExists( FilePath ) then
-                                               logStream := TFileStream.Create( FilePath, fmOpenReadWrite or fmShareDenyWrite )
-                                       else
-                                               logStream := TFileStream.Create( FilePath, fmCreate or fmShareDenyWrite );
+                                               DeleteFile(FilePath);
+
+                                       logStream := TFileStream.Create( FilePath, fmCreate or fmShareDenyWrite );
                                        try
-                                               logStream.Position      := logStream.Size;
+                                               logStream.Position      := 0;
                                                logStream.Write( PChar( downResult.Text )^, Length( downResult.Text ) );
                                        finally
                                                logStream.Free;
                                        end;
 
-                                       if Count = 0 then
-                                                                                       // \90V\8bK
-                                               Result := dsComplete
-                                       else
-                                               // \92Ç\8bL
-                                               Result := dsDiffComplete;
+                                       // \90V\8bK
+                                       Result := dsComplete;
 
-                                       Size    := Size + Length( downResult.Text );
+                                       Size    := Length( downResult.Text );
                                        // CGI \82©\82ç\82Í\90³\82µ\82¢\93ú\95t\82ª\93¾\82ç\82ê\82È\82¢\82Ì\82Å\8c»\8dÝ\82É\90Ý\92è
                                        LastModified    := Now;
 
 
 
-                                       NewReceive              := Count + 1;
-                                       Count                                   := Count + downResult.Count;
+                                       NewReceive              := 1;
+                                       Count                                   := downResult.Count;
                                        NewResCount             := downResult.Count;
                                        //http://jbbs.livedoor.com/bbs/read.cgi/game/1578/1086710948/l100
                                        //http://jbbs.livedoor.com/game/1578/storage/1086710948.html