[hackers] [surf] Sessioncookies made persistant. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Sat, 17 Oct 2009 10:39:18 +0000 (UTC)

changeset: 132:9934372b17ad
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Sat Oct 17 12:41:40 2009 +0200
files: config.def.h surf.c
description:
Sessioncookies made persistant.

diff -r ba69af3ca2c3 -r 9934372b17ad config.def.h
--- a/config.def.h Sat Oct 17 09:23:28 2009 +0200
+++ b/config.def.h Sat Oct 17 12:41:40 2009 +0200
@@ -4,8 +4,10 @@
 static char *progress_trust = "#00FF00";
 static char *stylefile = ".surf/style.css";
 static char *scriptfile = ".surf/script.js";
-static char *cookiefile = ".surf/cookie.txt";
+static char *cookiefile = ".surf/cookies.txt";
 static char *dldir = ".surf/dl";
+static time_t sessiontime = 3600;
+
 #define MODKEY GDK_CONTROL_MASK
 static Key keys[] = {
     /* modifier keyval function arg Focus */
diff -r ba69af3ca2c3 -r 9934372b17ad surf.c
--- a/surf.c Sat Oct 17 09:23:28 2009 +0200
+++ b/surf.c Sat Oct 17 12:41:40 2009 +0200
@@ -630,8 +630,22 @@
 
 void
 reloadcookie(void) {
+ GSList *p, *l;
+ SoupCookie *c;
         SoupSession *s;
+ SoupDate *e;
 
+ e = soup_date_new_from_time_t(time(NULL) + sessiontime);
+ for(l = p = soup_cookie_jar_all_cookies(cookiejar); p; p = p->next) {
+ c = (SoupCookie *)l->data;
+ if(c->expires == NULL) {
+ soup_cookie_set_expires(c, e);
+ soup_cookie_jar_add_cookie(cookiejar,
+ soup_cookie_copy(c));
+ }
+ }
+ soup_cookies_free(l);
+ soup_date_free(e);
         /* This forces the cookie to be written to hdd */
         s = webkit_get_default_session();
         soup_session_remove_feature(s, SOUP_SESSION_FEATURE(cookiejar));
@@ -670,7 +684,7 @@
 
         dpy = GDK_DISPLAY();
         session = webkit_get_default_session();
- uriprop = XInternAtom(dpy, "_SURF_uri", False);
+ uriprop = XInternAtom(dpy, "_SURF_URI", False);
 
         /* create dirs and files */
         cookiefile = buildpath(cookiefile);
Received on Sat Oct 17 2009 - 10:39:18 UTC

This archive was generated by hypermail 2.2.0 : Sat Oct 17 2009 - 10:48:05 UTC