[w3m-dev 04375] Re: w3m's bugs from bugs.debian.org

[email protected] Mon, 9 Aug 2010 19:23:49 +0900
Newsgroups gmane.comp.web.w3m.devel
Message-ID <[email protected]>
On Sat, Jul 24, 2010 at 10:14:15PM +0900, [email protected] wrote:
> > > クッキー受け取った時は 0.1 秒待てば十分。
> > > http://github.com/shinh/w3m/commit/976219896b9e567f165f28ab0a4ca202bbabc8ec
> > 
> > これは show_cookie の設定で十分のような気もしますが、時間があるときに
> > ちょっと考えてみます。
> 
> off にするとクッキーを受け取ったかどうかわからなくなってしまうので、
> 多少なりとも受け取ったことは分かったほうがよいかと思いました。

名称・説明文は若干微妙ですが show_cookie_time という設定項目を追加しました。
show_cookie とは別に、メッセージを表示する時間をミリ秒で指定します。

# show_cookie を廃止して show_cookie_time が 0 なら表示しない、
# という方式も考えましたが、互換性を考慮して新たに項目を追加しました。
-- 
Regards,
	dai

GPG Fingerprint = 0B29 D88E 42E6 B765 B8D8 EA50 7839 619D D439 668E

diff -urNp CVS/display.c w3m-0809/display.c
--- CVS/display.c	2010-07-19 15:47:34.000000000 +0900
+++ w3m-0809/display.c	2010-08-09 19:01:07.000000000 +0900
@@ -1226,7 +1226,7 @@ disp_err_message(char *s, int redraw_cur
 }
 
 void
-disp_message_nsec(char *s, int redraw_current, int sec, int purge, int mouse)
+disp_message_nsec(char *s, int redraw_current, float sec, int purge, int mouse)
 {
     if (QuietMessage)
 	return;
diff -urNp CVS/file.c w3m-0809/file.c
--- CVS/file.c	2010-08-03 19:20:10.000000000 +0900
+++ w3m-0809/file.c	2010-08-09 19:11:03.000000000 +0900
@@ -842,14 +842,16 @@ readHeader(URLFile *uf, Buffer *newBuf,
 	    }
 	    if (pu && name->length > 0) {
 		int err;
-		if (show_cookie) {
+		if (show_cookie && show_cookie_time > 0) {
 		    if (flag & COO_SECURE)
-		        disp_message_nsec("Received a secured cookie", FALSE, 1,
+		        disp_message_nsec("Received a secured cookie",
+				      FALSE, (float)show_cookie_time / 1000,
 				      TRUE, FALSE);
 		    else
 		        disp_message_nsec(Sprintf("Received cookie: %s=%s",
 					      name->ptr, value->ptr)->ptr,
-				      FALSE, 1, TRUE, FALSE);
+				      FALSE, (float)show_cookie_time / 1000,
+				      TRUE, FALSE);
 		}
 		err =
 		    add_cookie(pu, name, value, expires, domain, path, flag,
diff -urNp CVS/fm.h w3m-0809/fm.h
--- CVS/fm.h	2010-08-08 19:33:00.000000000 +0900
+++ w3m-0809/fm.h	2010-08-09 19:04:27.000000000 +0900
@@ -1109,6 +1109,7 @@ global MouseAction mouse_action;
 global int default_use_cookie init(TRUE);
 global int use_cookie init(FALSE);
 global int show_cookie init(TRUE);
+global int show_cookie_time init(1000);
 global int accept_cookie init(FALSE);
 #define ACCEPT_BAD_COOKIE_DISCARD	0
 #define ACCEPT_BAD_COOKIE_ACCEPT	1
diff -urNp CVS/po/stamp-po w3m-0809/po/stamp-po
--- CVS/po/stamp-po	1970-01-01 09:00:00.000000000 +0900
+++ w3m-0809/po/stamp-po	2010-08-09 19:05:00.000000000 +0900
@@ -0,0 +1 @@
+timestamp
diff -urNp CVS/proto.h w3m-0809/proto.h
--- CVS/proto.h	2010-07-26 09:16:54.000000000 +0900
+++ w3m-0809/proto.h	2010-08-09 19:00:50.000000000 +0900
@@ -298,7 +298,7 @@ extern void record_err_message(char *s);
 extern Buffer *message_list_panel(void);
 extern void message(char *s, int return_x, int return_y);
 extern void disp_err_message(char *s, int redraw_current);
-extern void disp_message_nsec(char *s, int redraw_current, int sec, int purge,
+extern void disp_message_nsec(char *s, int redraw_current, float sec, int purge,
 			      int mouse);
 extern void disp_message(char *s, int redraw_current);
 #ifdef USE_MOUSE
@@ -497,7 +497,7 @@ extern void flush_tty(void);
 extern void toggle_stand(void);
 extern char getch(void);
 extern void bell(void);
-extern int sleep_till_anykey(int sec, int purge);
+extern int sleep_till_anykey(float sec, int purge);
 #ifdef USE_IMAGE
 extern void touch_cursor();
 #endif
diff -urNp CVS/rc.c w3m-0809/rc.c
--- CVS/rc.c	2010-08-04 23:57:21.000000000 +0900
+++ w3m-0809/rc.c	2010-08-09 19:11:59.000000000 +0900
@@ -196,6 +196,7 @@ static int OptionEncode = FALSE;
 #ifdef USE_COOKIE
 #define CMT_USECOOKIE   N_("Enable cookie processing")
 #define CMT_SHOWCOOKIE  N_("Print a message when receiving a cookie")
+#define CMT_SHOWCOOKIE_TIME  N_("Time for printing a message (msec)")
 #define CMT_ACCEPTCOOKIE N_("Accept cookies")
 #define CMT_ACCEPTBADCOOKIE N_("Action to be taken on invalid cookie")
 #define CMT_COOKIE_REJECT_DOMAINS N_("Domains to reject cookies from")
@@ -581,6 +582,8 @@ struct param_ptr params8[] = {
     {"use_cookie", P_INT, PI_ONOFF, (void *)&use_cookie, CMT_USECOOKIE, NULL},
     {"show_cookie", P_INT, PI_ONOFF, (void *)&show_cookie,
      CMT_SHOWCOOKIE, NULL},
+    {"show_cookie_time", P_INT, PI_TEXT, (void *)&show_cookie_time,
+     CMT_SHOWCOOKIE_TIME, NULL},
     {"accept_cookie", P_INT, PI_ONOFF, (void *)&accept_cookie,
      CMT_ACCEPTCOOKIE, NULL},
     {"accept_bad_cookie", P_INT, PI_SEL_C, (void *)&accept_bad_cookie,
diff -urNp CVS/terms.c w3m-0809/terms.c
--- CVS/terms.c	2010-08-04 23:57:21.000000000 +0900
+++ w3m-0809/terms.c	2010-08-09 19:00:16.000000000 +0900
@@ -1983,7 +1983,7 @@ skip_escseq(void)
 }
 
 int
-sleep_till_anykey(int sec, int purge)
+sleep_till_anykey(float sec, int purge)
 {
     fd_set rfd;
     struct timeval tim;
@@ -1994,7 +1994,7 @@ sleep_till_anykey(int sec, int purge)
     term_raw();
 
     tim.tv_sec = sec;
-    tim.tv_usec = 0;
+    tim.tv_usec = (sec - (int)sec) * 1000000;
 
     FD_ZERO(&rfd);
     FD_SET(tty, &rfd);