aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-02-28 22:03:26 +0100
committerGravatar keis <keijser@gmail.com>2011-02-28 22:03:26 +0100
commite44414affde4e5497386ce398cc2c40356c4e466 (patch)
treee169cdbe8c22cffb8688fa273a76128a38101e50
parent4bb757e944c074ab4969a859a67bc33b4b9698e0 (diff)
add clear_cookies command
-rw-r--r--README2
-rw-r--r--src/uzbl-core.c15
-rw-r--r--src/uzbl-core.h4
3 files changed, 17 insertions, 4 deletions
diff --git a/README b/README
index 3ac9a28..6709bf5 100644
--- a/README
+++ b/README
@@ -260,6 +260,8 @@ The following commands are recognized:
* 'delete_cookie <domain> <path> <name> <value> [<scheme> <expires>]`
- Deletes a matching cookie from the cookie jar. scheme and expire time
is currently not considered when matching.
+* 'clear_cookies`
+ - Clears all cookies from the cookie jar
### VARIABLES AND CONSTANTS
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index bc75d87..3303797 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -551,7 +551,8 @@ CommandInfo cmdlist[] =
{ "include", include, TRUE },
{ "show_inspector", show_inspector, 0 },
{ "add_cookie", add_cookie, 0 },
- { "delete_cookie", delete_cookie, 0 }
+ { "delete_cookie", delete_cookie, 0 },
+ { "clear_cookies", clear_cookies, 0 }
};
void
@@ -725,6 +726,18 @@ delete_cookie(WebKitWebView *page, GArray *argv, GString *result) {
uzbl.net.soup_cookie_jar->in_manual_add = 0;
}
+
+void
+clear_cookies(WebKitWebView *page, GArray *argv, GString *result) {
+ (void) page; (void) argv; (void) result;
+
+ // Replace the current cookie jar with a new empty jar
+ soup_session_remove_feature (uzbl.net.soup_session, uzbl.net.soup_cookie_jar);
+ g_object_unref (G_OBJECT (uzbl.net.soup_cookie_jar));
+ uzbl.net.soup_cookie_jar = uzbl_cookie_jar_new ();
+ soup_session_add_feature(uzbl.net.soup_session, uzbl.net.soup_cookie_jar);
+}
+
void
act_dump_config() {
dump_config();
diff --git a/src/uzbl-core.h b/src/uzbl-core.h
index a4e055f..56f4fac 100644
--- a/src/uzbl-core.h
+++ b/src/uzbl-core.h
@@ -315,9 +315,6 @@ void handle_authentication (SoupSession *session,
SoupAuth *auth,
gboolean retrying,
gpointer user_data);
-void handle_cookies (SoupSession *session,
- SoupMessage *msg,
- gpointer user_data);
gboolean valid_name(const gchar* name);
void set_var(WebKitWebView *page, GArray *argv, GString *result);
void act_dump_config();
@@ -339,6 +336,7 @@ void include(WebKitWebView *page, GArray *argv, GString *result);
void show_inspector(WebKitWebView *page, GArray *argv, GString *result);
void add_cookie(WebKitWebView *page, GArray *argv, GString *result);
void delete_cookie(WebKitWebView *page, GArray *argv, GString *result);
+void clear_cookies(WebKitWebView *pag, GArray *argv, GString *result);
void builtins();
typedef void (*Command)(WebKitWebView*, GArray *argv, GString *result);