OSDN Git Service

・板一覧更新で同一板が別カテゴリに別名で存在する場合に対応
authorzako <zako@users.sourceforge.jp>
Wed, 21 Jan 2015 12:44:34 +0000 (21:44 +0900)
committerzako <zako@users.sourceforge.jp>
Wed, 21 Jan 2015 12:44:34 +0000 (21:44 +0900)
・書き込み時のクッキーメッセージ判定を整理

BoardGroup.pas
Editor.pas
NewBoard.pas
gikoNavi.res

index cfe191a..322ceed 100644 (file)
@@ -42,6 +42,7 @@ type
                function FindBBSID(const BBSID: string): TBoard;
                function FindBoardFromTitle(const Title: string): TBoard;
                function FindBoardFromTitleAndCategory(const CategoryTitle: string; const BoardTitle: string): TBoard;
+        function FindBoardFromURLAndCategory(const CategoryTitle: string; const BoardURL: string): TBoard;
                function FindBoardFromURL(const inURL: string): TBoard;
                function FindThreadFromURL(const inURL : string ) : TThreadItem;
                function FindThreadItem(const BBSID, FileName: string): TThreadItem;
@@ -85,6 +86,7 @@ type
                function FindBBSID(const BBSID: string): TBoard;
                function FindBoardFromTitle(const Title: string): TBoard;
                function FindBoardFromURL(const inURL: string): TBoard;
+        function FindBoardFromURL2(const inURL: string): TBoard;
                function FindThreadFromURL(const inURL : string ) : TThreadItem;
                function IsMidoku: Boolean;
 
@@ -696,6 +698,25 @@ begin
 end;
 
 //*************************************************************************
+// \83J\83e\83S\83\8a\96¼\82Æ\94ÂURL\82Ì\88ê\92v\82·\82é\94Â\82ð\92T\82·
+//*************************************************************************)
+function TBBS.FindBoardFromURLAndCategory(const CategoryTitle: string; const BoardURL: string): TBoard;
+var
+       i: Integer;
+begin
+       if not IsBoardFileRead then
+       GikoSys.ReadBoardFile( Self );
+       for i := Count - 1 downto 0 do begin
+        if AnsiCompareStr(Items[ i ].Title, CategoryTitle) = 0 then begin
+            Result := Items[ i ].FindBoardFromURL2(BoardURL);
+            if Result <> nil then
+                Exit;
+       end;
+       end;
+       Result := nil;
+end;
+
+//*************************************************************************
 // URL \82ð\8eó\82¯\95t\82¯\82é\94Â\82ð\92T\82·
 //*************************************************************************)
 function TBBS.FindBoardFromURL(const inURL: string): TBoard;
@@ -871,6 +892,40 @@ begin
 end;
 
 //*************************************************************************
+// \83z\83X\83g\96¼\82ð\8f\9c\82¢\82½URL\82Å\94Â\82ð\92T\82·\81i2ch.net/bbspink.com\8cÀ\92è\81j
+//*************************************************************************)
+function TCategory.FindBoardFromURL2(const inURL: string): TBoard;
+const
+       HOST_NAME: array[0..1] of string = ('.2ch.net', '.bbspink.com');
+var
+       i       : Integer;
+    idx: Integer;
+    chkURL: String;
+    chkLen: Integer;
+begin
+    Result := nil;
+    for i := 0 to Length(HOST_NAME) - 1 do begin
+        idx := Pos(HOST_NAME[i], inURL);
+        if (idx > 0) then begin
+            chkLen := Length(inURL) - idx + 1;
+            chkURL := Copy(inURL, idx, chkLen);
+            Break;
+        end;
+    end;
+    if (chkLen > 0) then begin
+        for i := 0 to Count - 1 do begin
+            idx := Pos(ChkURL, Strings[i]);
+            if (idx > 0) then begin
+                if (Length(Strings[i]) - idx + 1 = chkLen) then begin
+                    Result := TBoard( Objects[ i ] );
+                    Break;
+                end;
+            end;
+        end;
+    end;
+end;
+
+//*************************************************************************
 // URL \82ð\8eó\82¯\95t\82¯\82é\83X\83\8c\83b\83h\82ð\92T\82·
 //*************************************************************************)
 function TCategory.FindThreadFromURL(const inURL: string): TThreadItem;
index 02f43cc..96058ff 100644 (file)
@@ -1075,6 +1075,7 @@ begin
        else if ( AnsiPos('\83N\83b\83L\81[\82ª\82È\82¢\82©\8aú\8cÀ\90Ø\82ê\82Å\82·', ResponseText) > 0) or
                                        (AnsiPos('<title>\83N\83b\83L\81[\8am\94F\81I</title>', ResponseText) > 0)    or
                                        (AnsiPos('<title>\81¡\83N\83b\83L\81[\8am\94F\81I\81¡</title>', ResponseText) > 0) or
+                    (AnsiPos('(cookie\82ð\90Ý\92è\82·\82é\82Æ\82±\82Ì\89æ\96Ê\82Í\82Å\82È\82­\82È\82è\82Ü\82·\81B)', ResponseText) > 0) or
                     (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then
                Result := grtCookie
        else if (AnsiPos('<font size=+2 color=#FF0000>\8f\91\82«\8d\9e\82Ý\83`\83F\83b\83N\81I </font>', ResponseText) > 0)   or
@@ -1087,9 +1088,6 @@ begin
        else if (AnsiPos('\81E\93\8a\8de\8eÒ\82Í\81A\8cf\8e¦\94Â\89^\89c\8eÒ\82É\91Î\82µ\82Ä\81A\92\98\8dì\8eÒ\90l\8ai\8c \82ð\88ê\90Ø\8ds\8eg\82µ\82È\82¢\82±\82Æ\82ð\8f³\91ø\82µ\82Ü\82·\81B<br>', ResponseText) > 0) or
                                         (AnsiPos('\81i\92\98\8dì\8c \96@\91æ21\8fð\82È\82¢\82µ\91æ28\8fð\82É\8bK\92è\82³\82ê\82é\8c \97\98\82à\8aÜ\82Þ\81j\82»\82Ì\91¼\82Ì\8c \97\98\82É\82Â\82«\81A', ResponseText) > 0) then
                 Result := grtCookie
-    else if (AnsiPos('\8f\91\82«\82±\82Ý\81\95\83N\83b\83L\81[\8am\94F', ResponseText) > 0) or
-            (AnsiPos('(cookie\82ð\90Ý\92è\82·\82é\82Æ\82±\82Ì\89æ\96Ê\82Í\82Å\82È\82­\82È\82è\82Ü\82·\81B)', ResponseText) > 0) then
-        Result := grtCookie
     else
         Result := grtError;
 end;
index 8c3a9a8..c18140e 100644 (file)
@@ -286,6 +286,8 @@ begin
                                 Board := nil;
                             end else begin
                                 Board := BBSs[ 0 ].FindBoardFromTitleAndCategory(cate, Title);
+                                if Board = nil then
+                                    Board := BBSs[ 0 ].FindBoardFromURLAndCategory(cate, URL);
                             end;
                             if Board = nil then begin
                                MessageMemo.Lines.Add('\90V\94Â\92Ç\89Á\81u' + Title + '(' + URL + ')\81v');
index dfd00e5..eab8db2 100644 (file)
Binary files a/gikoNavi.res and b/gikoNavi.res differ