OSDN Git Service

livedoorのURLでも読み込めるようにした
authorh677 <h677>
Sat, 7 Aug 2004 12:55:48 +0000 (12:55 +0000)
committerh677 <h677>
Sat, 7 Aug 2004 12:55:48 +0000 (12:55 +0000)
res/ExternalBoardPlugIn/ShitarabaJBBSPlugIn.dpr

index 25ada01..1377673 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.24 2004/08/02 16:01:14 h677 Exp $
+       $Id: ShitarabaJBBSPlugIn.dpr,v 1.25 2004/08/07 12:55:48 h677 Exp $
 }
 
 uses
@@ -77,7 +77,7 @@ const
        MAJOR_VERSION                   = 1;
        MINOR_VERSION                   = 1;
        RELEASE_VERSION         = 'alpha';
-       REVISION_VERSION        = 2;
+       REVISION_VERSION        = 3;
 
        SYNCRONIZE_MENU_CAPTION = '\82µ\82½\82ç\82ÎJBBS\94Â\8dX\90V';
 
@@ -278,7 +278,7 @@ var
        uri                             : TIdURI;
        uriList         : TStringList;
        foundPos        : Integer;
-       i                       : Integer;
+//     i                       : Integer;
 const
        BBS_HOST_1      = 'jbbs.shitaraba.com';
        BBS_HOST_2      = 'jbbs.livedoor.com';
@@ -792,7 +792,7 @@ begin
                                                end;
                                        end;
                                        //Title := tmpTitle;
-                                       tS := 0; tE := 0;
+                                       //tS := 0; tE := 0;
                                        //\96{\95\82Ì\8eæ\93¾ <DL>\82Ì\8e\9f\82Ì\8ds\82©\82ç</DL>\82Ì\91O\82Ì\8ds\82Ü\82Å
                                        for i := tmpHTML.Count - 1 downto 0 do begin
                                                tmpLine := AnsiLowerCase(tmpHTML[i]);
@@ -1145,22 +1145,30 @@ function        TShitarabaThreadItem.GetBoardURL : string;
 var
        uri                                             : TIdURI;
        uriList                         : TStringList;
+       tmphost:        String;
 begin
 
        uri                     := TIdURI.Create( ReadURL );
        uriList := TStringList.Create;
        try
                ExtractHttpFields( ['/', '?'], [], uri.Path, uriList );
+
+               tmphost := uri.Host;
+
+               if tmphost = 'jbbs.livedoor.com'  then
+                       tmphost := 'jbbs.shitaraba.com';
+
                if( AnsiPos('.html', uri.Document) = 0 ) then begin //\92Ê\8fí
                        FileName := uriList[ 5 ] + '.dat';
+                       // http://jbbs.livedoor.com/bbs/read.cgi/computer/351/1090404452/l100
                        // http://jbbs.shitaraba.com/bbs/read.cgi/game/1578/1067968274/l100
                        // http://jbbs.shitaraba.com/game/1000/subject.txt
                        Result          := CreateResultString(
-                               uri.Protocol + '://' + uri.Host + '/' + uriList[ 3 ] + '/' + uriList[ 4 ] + '/' );
+                               uri.Protocol + '://' + tmphost + '/' + uriList[ 3 ] + '/' + uriList[ 4 ] + '/' );
                end else begin
                        //http://jbbs.shitaraba.com/game/1578/storage/1086710948.html
                        Result  := CreateResultString(
-                               uri.Protocol + '://' + uri.Host + CustomStringReplace(uri.Path, '/storage', ''));
+                               uri.Protocol + '://' + tmphost + CustomStringReplace(uri.Path, '/storage', ''));
                end;
 
        finally
@@ -1209,7 +1217,7 @@ var
        uri                             : TIdURI;
        uriList         : TStringList;
        foundPos        : Integer;
-       dir                             : string;
+       dir, tmphost            : string;
 begin
 
        foundPos := AnsiPos( '?', URL );
@@ -1220,9 +1228,14 @@ begin
                try
                        ExtractHttpFields( ['/'], [], uri.Path, uriList );
                        dir := uriList[ 1 ];
+
+                       tmphost := uri.Host;
+                       if tmphost = 'jbbs.livedoor.com'  then
+                               tmphost := 'jbbs.shitaraba.com';
+
                        ExtractHttpFields( ['&'], [], Copy( URL, foundPos + 1, MaxInt ), uriList );
                        Result :=
-                               uri.Protocol + '://' + uri.Host + '/bbs/read.cgi/' +
+                               uri.Protocol + '://' + tmphost + '/bbs/read.cgi/' +
                                dir + '/' + uriList.Values[ 'BBS' ] + '/' + uriList.Values[ 'KEY' ] + '/l100';
                finally
                        uri.Free;
@@ -1237,15 +1250,20 @@ begin
                uriList := TStringList.Create;
                try
                        ExtractHttpFields( ['/'], [], uri.Path, uriList );
+
+                       tmphost := uri.Host;
+                       if tmphost = 'jbbs.livedoor.com'  then
+                               tmphost := 'jbbs.shitaraba.com';
+
                        if( AnsiPos(THREAD_MARK, URL) > 0) and (uriList.Count > 5) then begin
                                Result :=
-                                       uri.Protocol + '://' + uri.Host + THREAD_MARK + '/' +
+                                       uri.Protocol + '://' + tmphost + THREAD_MARK + '/' +
                                        uriList[ 3 ] + '/' + uriList[ 4 ] + '/' + uriList[ 5 ] + '/l100';
 
                        end else if AnsiPos(THREAD_MARK, URL) = 0 then begin
                        //\83R\83R\82Å\89ß\8b\8e\83\8d\83O\82©\82Ç\82¤\82©\83`\83F\83b\83N\81H
                                if(AnsiPos('.html/', uri.Path) > 0) then begin
-                                       Result := uri.Protocol + '://' + uri.Host + Copy(uri.Path, 1, Length(uri.Path) - 1);
+                                       Result := uri.Protocol + '://' + tmphost + Copy(uri.Path, 1, Length(uri.Path) - 1);
                                end else
                                        Result := URL;
                        end;
@@ -1267,7 +1285,7 @@ var
        uri                             : TIdURI;
        uriList         : TStringList;
        foundPos        : Integer;
-       dir                             : string;
+       dir, tmphost                    : string;
 begin
 
        foundPos := AnsiPos( '?', URL );
@@ -1278,10 +1296,15 @@ begin
                try
                        ExtractHttpFields( ['/'], [], uri.Path, uriList );
                        dir := uriList[ 1 ];
+
+                       tmphost := uri.Host;
+                       if tmphost = 'jbbs.livedoor.com'  then
+                               tmphost := 'jbbs.shitaraba.com';
+
                        ExtractHttpFields( ['&'], [], Copy( URL, foundPos + 1, MaxInt ), uriList );
                        // http://jbbs.shitaraba.com/bbs/read.cgi?DIR=game&BBS=1578&KEY=1067968274
                        Result :=
-                               uri.Protocol + '://' + uri.Host + '/bbs/rawmode.cgi/' +
+                               uri.Protocol + '://' + tmphost + '/bbs/rawmode.cgi/' +
                                dir + '/' + uriList.Values[ 'BBS' ] + '/' + uriList.Values[ 'KEY' ] + '/';
                finally
                        uri.Free;
@@ -1295,15 +1318,19 @@ begin
                uriList := TStringList.Create;
                try
                        ExtractHttpFields( ['/'], [], uri.Path, uriList );
+
+                       tmphost := uri.Host;
+                       if tmphost = 'jbbs.livedoor.com'  then
+                               tmphost := 'jbbs.shitaraba.com';
                        // http://jbbs.shitaraba.com/bbs/read.cgi/game/1578/1067968274/l100
                        if( AnsiPos(THREAD_MARK, URL) > 0) and (uriList.Count > 5) then begin
                                Result :=
-                                       uri.Protocol + '://' + uri.Host + '/bbs/rawmode.cgi/' +
+                                       uri.Protocol + '://' + tmphost + '/bbs/rawmode.cgi/' +
                                        uriList[ 3 ] + '/' + uriList[ 4 ] + '/' + uriList[ 5 ] + '/';
                        end else if AnsiPos(THREAD_MARK, URL) = 0 then begin
                        //\83R\83R\82Å\89ß\8b\8e\83\8d\83O\82©\82Ç\82¤\82©\83`\83F\83b\83N\81H
                                if(AnsiPos('.html/', uri.Path) > 0) then begin
-                                       Result := uri.Protocol + '://' + uri.Host + Copy(uri.Path, 1, Length(uri.Path) - 1);
+                                       Result := uri.Protocol + '://' + tmphost + Copy(uri.Path, 1, Length(uri.Path) - 1);
                                end else
                                        Result := URL;
                        end;