• R/O
  • HTTP
  • SSH
  • HTTPS

gikonavi: Commit


Commit MetaInfo

Revision21504511f1c74f3d40c12e090e392e75b096ac62 (tree)
Time2015-01-21 21:44:34
Authorzako <zako@user...>
Commiterzako

Log Message

・板一覧更新で同一板が別カテゴリに別名で存在する場合に対応
・書き込み時のクッキーメッセージ判定を整理

Change Summary

Incremental Difference

--- a/BoardGroup.pas
+++ b/BoardGroup.pas
@@ -42,6 +42,7 @@ type
4242 function FindBBSID(const BBSID: string): TBoard;
4343 function FindBoardFromTitle(const Title: string): TBoard;
4444 function FindBoardFromTitleAndCategory(const CategoryTitle: string; const BoardTitle: string): TBoard;
45+ function FindBoardFromURLAndCategory(const CategoryTitle: string; const BoardURL: string): TBoard;
4546 function FindBoardFromURL(const inURL: string): TBoard;
4647 function FindThreadFromURL(const inURL : string ) : TThreadItem;
4748 function FindThreadItem(const BBSID, FileName: string): TThreadItem;
@@ -85,6 +86,7 @@ type
8586 function FindBBSID(const BBSID: string): TBoard;
8687 function FindBoardFromTitle(const Title: string): TBoard;
8788 function FindBoardFromURL(const inURL: string): TBoard;
89+ function FindBoardFromURL2(const inURL: string): TBoard;
8890 function FindThreadFromURL(const inURL : string ) : TThreadItem;
8991 function IsMidoku: Boolean;
9092
@@ -696,6 +698,25 @@ begin
696698 end;
697699
698700 //*************************************************************************
701+// カテゴリ名と板URLの一致する板を探す
702+//*************************************************************************)
703+function TBBS.FindBoardFromURLAndCategory(const CategoryTitle: string; const BoardURL: string): TBoard;
704+var
705+ i: Integer;
706+begin
707+ if not IsBoardFileRead then
708+ GikoSys.ReadBoardFile( Self );
709+ for i := Count - 1 downto 0 do begin
710+ if AnsiCompareStr(Items[ i ].Title, CategoryTitle) = 0 then begin
711+ Result := Items[ i ].FindBoardFromURL2(BoardURL);
712+ if Result <> nil then
713+ Exit;
714+ end;
715+ end;
716+ Result := nil;
717+end;
718+
719+//*************************************************************************
699720 // URL を受け付ける板を探す
700721 //*************************************************************************)
701722 function TBBS.FindBoardFromURL(const inURL: string): TBoard;
@@ -871,6 +892,40 @@ begin
871892 end;
872893
873894 //*************************************************************************
895+// ホスト名を除いたURLで板を探す(2ch.net/bbspink.com限定)
896+//*************************************************************************)
897+function TCategory.FindBoardFromURL2(const inURL: string): TBoard;
898+const
899+ HOST_NAME: array[0..1] of string = ('.2ch.net', '.bbspink.com');
900+var
901+ i : Integer;
902+ idx: Integer;
903+ chkURL: String;
904+ chkLen: Integer;
905+begin
906+ Result := nil;
907+ for i := 0 to Length(HOST_NAME) - 1 do begin
908+ idx := Pos(HOST_NAME[i], inURL);
909+ if (idx > 0) then begin
910+ chkLen := Length(inURL) - idx + 1;
911+ chkURL := Copy(inURL, idx, chkLen);
912+ Break;
913+ end;
914+ end;
915+ if (chkLen > 0) then begin
916+ for i := 0 to Count - 1 do begin
917+ idx := Pos(ChkURL, Strings[i]);
918+ if (idx > 0) then begin
919+ if (Length(Strings[i]) - idx + 1 = chkLen) then begin
920+ Result := TBoard( Objects[ i ] );
921+ Break;
922+ end;
923+ end;
924+ end;
925+ end;
926+end;
927+
928+//*************************************************************************
874929 // URL を受け付けるスレッドを探す
875930 //*************************************************************************)
876931 function TCategory.FindThreadFromURL(const inURL: string): TThreadItem;
--- a/Editor.pas
+++ b/Editor.pas
@@ -1075,6 +1075,7 @@ begin
10751075 else if ( AnsiPos('クッキーがないか期限切れです', ResponseText) > 0) or
10761076 (AnsiPos('<title>クッキー確認!</title>', ResponseText) > 0) or
10771077 (AnsiPos('<title>■クッキー確認!■</title>', ResponseText) > 0) or
1078+ (AnsiPos('(cookieを設定するとこの画面はでなくなります。)', ResponseText) > 0) or
10781079 (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then
10791080 Result := grtCookie
10801081 else if (AnsiPos('<font size=+2 color=#FF0000>書き込みチェック! </font>', ResponseText) > 0) or
@@ -1087,9 +1088,6 @@ begin
10871088 else if (AnsiPos('・投稿者は、掲示板運営者に対して、著作者人格権を一切行使しないことを承諾します。<br>', ResponseText) > 0) or
10881089 (AnsiPos('(著作権法第21条ないし第28条に規定される権利も含む)その他の権利につき、', ResponseText) > 0) then
10891090 Result := grtCookie
1090- else if (AnsiPos('書きこみ&クッキー確認', ResponseText) > 0) or
1091- (AnsiPos('(cookieを設定するとこの画面はでなくなります。)', ResponseText) > 0) then
1092- Result := grtCookie
10931091 else
10941092 Result := grtError;
10951093 end;
--- a/NewBoard.pas
+++ b/NewBoard.pas
@@ -286,6 +286,8 @@ begin
286286 Board := nil;
287287 end else begin
288288 Board := BBSs[ 0 ].FindBoardFromTitleAndCategory(cate, Title);
289+ if Board = nil then
290+ Board := BBSs[ 0 ].FindBoardFromURLAndCategory(cate, URL);
289291 end;
290292 if Board = nil then begin
291293 MessageMemo.Lines.Add('新板追加「' + Title + '(' + URL + ')」');
Binary files a/gikoNavi.res and b/gikoNavi.res differ
Show on old repository browser