package w3m
tag 253547 patch
thanks

On Wed, Jun 09, 2004 at 08:13:54PM -0400, Wakko Warner wrote:
> 
> When going to a site that has many cookies, it takes (IMO) too long for each
> cookie received.  Would be nice to have a config option or just not show
> cookies received.
> 
The attached patch introduces a option show_cookie which disables the
display of cookie related messages if set to NO. Additionally it makes
it possible to accept bad cookies without asking. Thus no delay because
of cookies is experienced.

Regards,
-- 
Karsten Schölzel        | Email:  [EMAIL PROTECTED]
Väderleden 9 4:98       | Jabber: [EMAIL PROTECTED]
97633 Luleå             | VoIP:   sip:[EMAIL PROTECTED]
Sweden                  |         sip:[EMAIL PROTECTED]
                        | Tel:    +4918015855857712
Introduce option show_cookie to be able to hide messages concerning
cookies and let the user accept bad cookies if they do not care.

---
commit a05657dfe77157cc3a0633df4ea1f979abfd9fa4
tree 8f3fb85ca588ad12e59d1a683a82196b0e0e3d32
parent dcc1c97fe6a980ff0c9a05cd5260565e18409150
author Karsten Schoelzel <[EMAIL PROTECTED]> Tue, 09 May 2006 17:38:34 +0200
committer Karsten Schoelzel <[EMAIL PROTECTED]> Tue, 09 May 2006 17:38:34 +0200

 file.c |   16 ++++++++++------
 fm.h   |    1 +
 rc.c   |    5 +++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/file.c b/file.c
index 3318681..f544a07 100644
--- a/file.c
+++ b/file.c
@@ -836,13 +836,15 @@ readHeader(URLFile *uf, Buffer *newBuf, 
            }
            if (pu && name->length > 0) {
                int err;
-               if (flag & COO_SECURE)
-                   disp_message_nsec("Received a secured cookie", FALSE, 1,
+               if (show_cookie) {
+                   if (flag & COO_SECURE)
+                       disp_message_nsec("Received a secured cookie", FALSE, 1,
                                      TRUE, FALSE);
-               else
-                   disp_message_nsec(Sprintf("Received cookie: %s=%s",
+                   else
+                       disp_message_nsec(Sprintf("Received cookie: %s=%s",
                                              name->ptr, value->ptr)->ptr,
                                      FALSE, 1, TRUE, FALSE);
+               }
                err =
                    add_cookie(pu, name, value, expires, domain, path, flag,
                               comment, version, port, commentURL);
@@ -874,10 +876,12 @@ readHeader(URLFile *uf, Buffer *newBuf, 
                            emsg =
                                "This cookie was rejected to prevent security 
violation.";
                        record_err_message(emsg);
-                       disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+                       if (show_cookie)
+                           disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
                    }
                    else
-                       disp_message_nsec(Sprintf
+                       if (show_cookie)
+                           disp_message_nsec(Sprintf
                                          ("Accepting invalid cookie: %s=%s",
                                           name->ptr, value->ptr)->ptr, FALSE,
                                          1, TRUE, FALSE);
diff --git a/fm.h b/fm.h
index 288426a..e26a9e3 100644
--- a/fm.h
+++ b/fm.h
@@ -1076,6 +1076,7 @@ global MouseAction mouse_action;
 #ifdef USE_COOKIE
 global int default_use_cookie init(TRUE);
 global int use_cookie init(FALSE);
+global int show_cookie init(TRUE);
 global int accept_cookie init(FALSE);
 #define ACCEPT_BAD_COOKIE_DISCARD      0
 #define ACCEPT_BAD_COOKIE_ACCEPT       1
diff --git a/rc.c b/rc.c
index 1b3e496..f57b564 100644
--- a/rc.c
+++ b/rc.c
@@ -192,6 +192,7 @@ static int OptionEncode = FALSE;
 #endif                         /* USE_SSL */
 #ifdef USE_COOKIE
 #define CMT_USECOOKIE   N_("Enable cookie processing")
+#define CMT_SHOWCOOKIE  N_("Print a message when receiving a cookie")
 #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")
@@ -301,9 +302,7 @@ static struct sel_c dnsorders[] = {
 #ifdef USE_COOKIE
 static struct sel_c badcookiestr[] = {
     {N_S(ACCEPT_BAD_COOKIE_DISCARD), N_("discard")},
-#if 0
     {N_S(ACCEPT_BAD_COOKIE_ACCEPT), N_("accept")},
-#endif
     {N_S(ACCEPT_BAD_COOKIE_ASK), N_("ask")},
     {0, NULL, NULL}
 };
@@ -552,6 +551,8 @@ struct param_ptr params7[] = {
 #ifdef USE_COOKIE
 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},
     {"accept_cookie", P_INT, PI_ONOFF, (void *)&accept_cookie,
      CMT_ACCEPTCOOKIE, NULL},
     {"accept_bad_cookie", P_INT, PI_SEL_C, (void *)&accept_bad_cookie,

Reply via email to