Revision | 21504511f1c74f3d40c12e090e392e75b096ac62 (tree) |
---|---|
Time | 2015-01-21 21:44:34 |
Author | zako <zako@user...> |
Commiter | zako |
・板一覧更新で同一板が別カテゴリに別名で存在する場合に対応
・書き込み時のクッキーメッセージ判定を整理
@@ -42,6 +42,7 @@ type | ||
42 | 42 | function FindBBSID(const BBSID: string): TBoard; |
43 | 43 | function FindBoardFromTitle(const Title: string): TBoard; |
44 | 44 | function FindBoardFromTitleAndCategory(const CategoryTitle: string; const BoardTitle: string): TBoard; |
45 | + function FindBoardFromURLAndCategory(const CategoryTitle: string; const BoardURL: string): TBoard; | |
45 | 46 | function FindBoardFromURL(const inURL: string): TBoard; |
46 | 47 | function FindThreadFromURL(const inURL : string ) : TThreadItem; |
47 | 48 | function FindThreadItem(const BBSID, FileName: string): TThreadItem; |
@@ -85,6 +86,7 @@ type | ||
85 | 86 | function FindBBSID(const BBSID: string): TBoard; |
86 | 87 | function FindBoardFromTitle(const Title: string): TBoard; |
87 | 88 | function FindBoardFromURL(const inURL: string): TBoard; |
89 | + function FindBoardFromURL2(const inURL: string): TBoard; | |
88 | 90 | function FindThreadFromURL(const inURL : string ) : TThreadItem; |
89 | 91 | function IsMidoku: Boolean; |
90 | 92 |
@@ -696,6 +698,25 @@ begin | ||
696 | 698 | end; |
697 | 699 | |
698 | 700 | //************************************************************************* |
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 | +//************************************************************************* | |
699 | 720 | // URL を受け付ける板を探す |
700 | 721 | //*************************************************************************) |
701 | 722 | function TBBS.FindBoardFromURL(const inURL: string): TBoard; |
@@ -871,6 +892,40 @@ begin | ||
871 | 892 | end; |
872 | 893 | |
873 | 894 | //************************************************************************* |
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 | +//************************************************************************* | |
874 | 929 | // URL を受け付けるスレッドを探す |
875 | 930 | //*************************************************************************) |
876 | 931 | function TCategory.FindThreadFromURL(const inURL: string): TThreadItem; |
@@ -1075,6 +1075,7 @@ begin | ||
1075 | 1075 | else if ( AnsiPos('クッキーがないか期限切れです', ResponseText) > 0) or |
1076 | 1076 | (AnsiPos('<title>クッキー確認!</title>', ResponseText) > 0) or |
1077 | 1077 | (AnsiPos('<title>■クッキー確認!■</title>', ResponseText) > 0) or |
1078 | + (AnsiPos('(cookieを設定するとこの画面はでなくなります。)', ResponseText) > 0) or | |
1078 | 1079 | (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then |
1079 | 1080 | Result := grtCookie |
1080 | 1081 | else if (AnsiPos('<font size=+2 color=#FF0000>書き込みチェック! </font>', ResponseText) > 0) or |
@@ -1087,9 +1088,6 @@ begin | ||
1087 | 1088 | else if (AnsiPos('・投稿者は、掲示板運営者に対して、著作者人格権を一切行使しないことを承諾します。<br>', ResponseText) > 0) or |
1088 | 1089 | (AnsiPos('(著作権法第21条ないし第28条に規定される権利も含む)その他の権利につき、', ResponseText) > 0) then |
1089 | 1090 | Result := grtCookie |
1090 | - else if (AnsiPos('書きこみ&クッキー確認', ResponseText) > 0) or | |
1091 | - (AnsiPos('(cookieを設定するとこの画面はでなくなります。)', ResponseText) > 0) then | |
1092 | - Result := grtCookie | |
1093 | 1091 | else |
1094 | 1092 | Result := grtError; |
1095 | 1093 | end; |
@@ -286,6 +286,8 @@ begin | ||
286 | 286 | Board := nil; |
287 | 287 | end else begin |
288 | 288 | Board := BBSs[ 0 ].FindBoardFromTitleAndCategory(cate, Title); |
289 | + if Board = nil then | |
290 | + Board := BBSs[ 0 ].FindBoardFromURLAndCategory(cate, URL); | |
289 | 291 | end; |
290 | 292 | if Board = nil then begin |
291 | 293 | MessageMemo.Lines.Add('新板追加「' + Title + '(' + URL + ')」'); |