ギコナビ
Revision | 79d3c26df0e85d406201dc510b919987c3df2d91 (tree) |
---|---|
Zeit | 2011-02-27 10:25:25 |
Autor | h677 <h677> |
Commiter | h677 |
冒険の書→忍法帖
すいとんされた時に、Cookieを削除するように修正
@@ -22,7 +22,7 @@ uses | ||
22 | 22 | type |
23 | 23 | // TSetLayeredWindowAttributes = function(wnd: HWND; crKey: DWORD; bAlpha: BYTE; dwFlag: DWORD): Boolean; stdcall; |
24 | 24 | //«Ýßèl^Cv |
25 | - TGikoResultType = (grtOK, grtCookie, grtCheck, grtError, grtBouken, grtBoukenErr); | |
25 | + TGikoResultType = (grtOK, grtCookie, grtCheck, grtError, grtNinpou, grtNinpouErr, grtSuiton); | |
26 | 26 | |
27 | 27 | TEditorForm = class(TForm) |
28 | 28 | MainMenu: TMainMenu; |
@@ -220,6 +220,7 @@ type | ||
220 | 220 | FInputAssistKey: String; ///< üÍAVXgÌL[ |
221 | 221 | FResistWords: TStringList; ///< üÍAVXgÌ«©çÌõÊ |
222 | 222 | FSambaTimer: TSambaTimer; ///< SambaÎôÌ^C}[ |
223 | + FCookieDomain: string; ///< E@hC | |
223 | 224 | procedure Preview; |
224 | 225 | function Check: Boolean; |
225 | 226 | procedure SetNameList(sName, sMail: string); |
@@ -784,7 +785,7 @@ begin | ||
784 | 785 | Indy.Request.AcceptLanguage := 'ja'; |
785 | 786 | Indy.Request.Accept := 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*'; |
786 | 787 | Indy.Request.ContentType := 'application/x-www-form-urlencoded'; |
787 | - Indy.Request.CustomHeaders.Add(getHeaderStr(ACOOKIE, SPID, PON, GikoSys.GetBoukenCookie(URL), Board)); | |
788 | + Indy.Request.CustomHeaders.Add(getHeaderStr(ACOOKIE, SPID, PON, GikoSys.GetBouken(URL, FCookieDomain), Board)); | |
788 | 789 | TextStream := TStringStream.Create(''); |
789 | 790 | Source := TStringStream.Create(''); |
790 | 791 | try |
@@ -887,23 +888,40 @@ begin | ||
887 | 888 | CancelSend( Board, SysMenu ); |
888 | 889 | Exit; |
889 | 890 | end; |
890 | - end else if ResultType = grtBouken then begin | |
891 | + end else if ResultType = grtNinpou then begin | |
891 | 892 | MsgBox( Handle, |
892 | - 'MûÌ`¯Ìðì¬Å·Bø«Ô·Èç¢Ü¾B(QªÙÇ©©èÜ·)' + #13#10 | |
893 | + 'MûÌE@ðì¬Å·Bø«Ô·Èç¢Ü¾B(QªÙÇ©©èÜ·)' + #13#10 | |
893 | 894 | , 'mF', |
894 | - MB_OK or MB_ICONQUESTION); | |
895 | + MB_OK or MB_ICONINFORMATION); | |
896 | + if (GikoSys.Setting.UseSamba) and (FSambaTimer.Enabled) then | |
897 | + begin | |
898 | + FSambaTimer.WriteSambaTime(Now()); | |
899 | + end; | |
895 | 900 | Board.PON := ''; |
896 | 901 | Board.SPID := ''; |
897 | 902 | Board.Cookie := ''; |
898 | 903 | GetCookie(Indy.CookieManager, Board); |
899 | 904 | Exit; |
905 | + end else if ResultType = grtSuiton then begin | |
906 | + MsgBox( Handle, | |
907 | + 'MûÌE@ÍÄ©êܵ½B' + #13#10 + | |
908 | + 'E@ðíµÜµ½AÄMµÄ¾³¢B' | |
909 | + , 'mF', | |
910 | + MB_OK or MB_ICONINFORMATION); | |
911 | + // E@ª¨ðÁ· | |
912 | + GikoSys.DelBoukenCookie(FCookieDomain); | |
913 | + GikoSys.Setting.WriteBoukenSettingFile; | |
914 | + Board.PON := ''; | |
915 | + Board.SPID := ''; | |
916 | + Board.Cookie := ''; | |
917 | + Exit; | |
900 | 918 | end else begin |
901 | 919 | if (GikoSys.Setting.UseSamba) and (FSambaTimer.Enabled) then |
902 | 920 | begin |
903 | 921 | FSambaTimer.WriteSambaTime(Now()); |
904 | 922 | end; |
905 | - // `¯ÌG[ÍCookieðXV·é | |
906 | - if ResultType = grtBoukenErr then begin | |
923 | + // E@ª¨G[ÍCookieðXV·é | |
924 | + if ResultType = grtNinpouErr then begin | |
907 | 925 | GetCookie(Indy.CookieManager, Board); |
908 | 926 | end; |
909 | 927 | State := gdsError; |
@@ -981,13 +999,17 @@ function TEditorForm.GetResultType(ResponseText: string): TGikoResultType; | ||
981 | 999 | begin |
982 | 1000 | if AnsiPos('«±ÝªIíèܵ½', ResponseText) <> 0 then |
983 | 1001 | Result := grtOK |
984 | - else if (AnsiPos('dqqnqFMûÌ`¯Ìðì¬Å·', ResponseText) > 0) | |
1002 | + else if ( (AnsiPos('<b>椱»FMûÌE@ð쬵ܷBQªãÉÄx«Þ©A¨Aè¾³¢', ResponseText) > 0) or | |
1003 | + (AnsiPos('dqqnqFMûÌ`¯Ìðì¬Å·', ResponseText) > 0) ) | |
985 | 1004 | and (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then |
986 | - Result := grtBouken | |
1005 | + Result := grtNinpou | |
987 | 1006 | else if ( (AnsiPos('dqqnqFCsª«èܹñ', ResponseText) > 0) or // G[µ¢ |
988 | 1007 | (AnsiPos('dqqnqFLvª«èÈÄXbh§Ä', ResponseText) > 0) ) // G[µ¢ |
989 | 1008 | and (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then |
990 | - Result := grtBoukenErr | |
1009 | + Result := grtNinpouErr | |
1010 | + else if( AnsiPos('<b>âçê½Å²´éFLv=0 <br>³Ä©ÍÅÅ«é©È?', ResponseText) > 0) | |
1011 | + and (AnsiPos(RES2CH_COOKIE, ResponseText) > 0) then | |
1012 | + Result := grtSuiton | |
991 | 1013 | else if ( AnsiPos('NbL[ªÈ¢©úÀØêÅ·', ResponseText) > 0) or |
992 | 1014 | (AnsiPos('<title>NbL[mFI</title>', ResponseText) > 0) or |
993 | 1015 | (AnsiPos('<title>¡NbL[mFI¡</title>', ResponseText) > 0) or |
@@ -1920,6 +1942,8 @@ begin | ||
1920 | 1942 | curCookies := TStringList.Create; |
1921 | 1943 | curCookies.Delimiter := ';'; |
1922 | 1944 | curCookies.DelimitedText := ABoard.Cookie; |
1945 | + curCookies.Sort; | |
1946 | + curCookies.Duplicates := dupIgnore; | |
1923 | 1947 | ABoard.Cookie := ''; |
1924 | 1948 | try |
1925 | 1949 | for i := 0 to CookieMng.CookieCollection.Count - 1 do begin |
@@ -1941,7 +1965,7 @@ begin | ||
1941 | 1965 | if Length( curCookies.Values[ Cookie.CookieName ] ) > 0 then begin |
1942 | 1966 | // ù¶lÌt¯Ö¦ |
1943 | 1967 | curCookies[curCookies.IndexOfName(Cookie.CookieName)] := |
1944 | - Cookie.Value; | |
1968 | + Cookie.ClientCookie; | |
1945 | 1969 | end else begin |
1946 | 1970 | // ÇÁ |
1947 | 1971 | curCookies.Add(Cookie.ClientCookie); |
@@ -1949,8 +1973,8 @@ begin | ||
1949 | 1973 | end; |
1950 | 1974 | end; |
1951 | 1975 | for i := 0 to curCookies.Count - 1 do begin |
1952 | - if (curCookies.Strings[i] <> '') then begin | |
1953 | - ABoard.Cookie := ABoard.Cookie + curCookies.Strings[i] + '; '; | |
1976 | + if (curCookies[i] <> '') then begin | |
1977 | + ABoard.Cookie := ABoard.Cookie + curCookies[i] + '; '; | |
1954 | 1978 | end; |
1955 | 1979 | end; |
1956 | 1980 | finally |
@@ -265,6 +265,8 @@ type | ||
265 | 265 | procedure DelBoukenCookie(ADomain: String); |
266 | 266 | //! `¯ÌDomainêæ¾ |
267 | 267 | procedure GetBoukenDomain(var ADomain: TStringList); |
268 | + //! `¯ÌhC¼Cookieæ¾ | |
269 | + function GetBouken(AURL: String; var Domain: String): String; | |
268 | 270 | end; |
269 | 271 | |
270 | 272 | var |
@@ -3497,7 +3499,19 @@ begin | ||
3497 | 3499 | end; |
3498 | 3500 | end; |
3499 | 3501 | end; |
3500 | - | |
3502 | +function TGikoSys.GetBouken(AURL: String; var Domain: String): String; | |
3503 | +var | |
3504 | + Protocol, Host, Path, Document, Port,Bookmark : String; | |
3505 | + Cookie : String; | |
3506 | +begin | |
3507 | + Domain := ''; | |
3508 | + Cookie := ''; | |
3509 | + GikoSys.ParseURI(AURL, Protocol, Host, Path, Document, Port,Bookmark); | |
3510 | + if ( Length(Host) > 0 ) then begin | |
3511 | + Setting.GetBouken(Host, Domain, Cookie); | |
3512 | + Result := Cookie; | |
3513 | + end; | |
3514 | +end; | |
3501 | 3515 | |
3502 | 3516 | initialization |
3503 | 3517 | GikoSys := TGikoSys.Create; |
@@ -550,6 +550,7 @@ type | ||
550 | 550 | function GetExtprevieFileName: String; |
551 | 551 | function GetBoukenCookie(AHostName: String): String; |
552 | 552 | procedure SetBoukenCookie(ACookieValue, AHostName: String); |
553 | + procedure GetBouken(AHostName: String; var Domain:String; var Cookie:String); | |
553 | 554 | { |
554 | 555 | \brief NðÌÛTCYÌsetter |
555 | 556 | \param AVal Ýè·éTCY( >0) |
@@ -2503,5 +2504,19 @@ begin | ||
2503 | 2504 | FBoukenCookieList.Add(AHostName + '=' + ACookieValue); |
2504 | 2505 | end; |
2505 | 2506 | end; |
2507 | +procedure TSetting.GetBouken(AHostName: String; var Domain:String; var Cookie:String); | |
2508 | +var | |
2509 | + i : Integer; | |
2510 | +begin | |
2511 | + Cookie := ''; | |
2512 | + for i := 0 to FBoukenCookieList.Count - 1 do begin | |
2513 | + if ( AnsiPos(FBoukenCookieList.Names[i], AHostName) > 0 ) then begin | |
2514 | + Domain := FBoukenCookieList.Names[i]; | |
2515 | + Cookie := FBoukenCookieList.Values[FBoukenCookieList.Names[i]]; | |
2516 | + Break; | |
2517 | + end; | |
2518 | + end; | |
2519 | +end; | |
2520 | + | |
2506 | 2521 | end. |
2507 | 2522 |