From thomas at xteddy.org Sat Oct 9 18:41:47 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 9 Oct 2010 19:41:47 +0100 Subject: [Vimprobable-users] [PATCH 1/2] Allow for "-c" on the command-line for configfile. Message-ID: <20101009184144.GA8547@shuttle.home> Defaults to RCFILE if -c is not present. All other warnings if the file can't be openened, etc., are handled via echo() in the usual way. --- main.c | 11 ++++++++++- utilities.c | 8 +++----- utilities.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 81e1f78..6cf11be 100644 --- a/main.c +++ b/main.c @@ -117,6 +117,7 @@ static gboolean echo_active = TRUE; WebKitWebInspector *inspector; static GdkNativeWindow embed = 0; +static char *configfile = NULL; static char *winid = NULL; static char rememberedURI[128] = ""; @@ -2138,9 +2139,11 @@ main(int argc, char *argv[]) { static Arg a; static char url[256] = ""; static gboolean ver = false; + static const char *cfile = NULL; static GOptionEntry opts[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &ver, "print version", NULL }, { "embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "embedded", NULL }, + { "configfile", 'c', 0, G_OPTION_ARG_STRING, &cfile, "config file", NULL }, { NULL } }; static GError *err; @@ -2158,6 +2161,11 @@ main(int argc, char *argv[]) { return EXIT_SUCCESS; } + if (cfile) + configfile = g_strdup_printf(cfile); + else + configfile = g_strdup_printf(RCFILE); + if (!g_thread_supported()) g_thread_init(NULL); @@ -2169,7 +2177,8 @@ main(int argc, char *argv[]) { setup_gui(); /* read config file */ - if (!read_rcfile()) { + if (!read_rcfile(configfile)) { + free(configfile); a.i = Error; a.s = g_strdup_printf("Error in config file"); echo(&a); diff --git a/utilities.c b/utilities.c index d3850e1..d20e3eb 100644 --- a/utilities.c +++ b/utilities.c @@ -16,17 +16,15 @@ extern int lastcommand, maxcommands, commandpointer; extern KeyList *keylistroot; extern Key keys[]; -gboolean read_rcfile(void) +gboolean read_rcfile(const char *config) { int t; char s[255]; - const char *rcfile; FILE *fpin; gboolean returnval = TRUE; - rcfile = g_strdup_printf(RCFILE); - if ((fpin = fopen(rcfile, "r")) == NULL) - return TRUE; + if ((fpin = fopen(config, "r")) == NULL) + return FALSE; while (fgets(s, 254, fpin)) { /* * ignore lines that begin with #, / and such diff --git a/utilities.h b/utilities.h index ba5cc02..733f2bf 100644 --- a/utilities.h +++ b/utilities.h @@ -11,7 +11,7 @@ /* max entries in command history */ #define COMMANDHISTSIZE 50 -gboolean read_rcfile(void); +gboolean read_rcfile(const char *config); void save_command_history(char *line); gboolean process_save_qmark(const char *bm, WebKitWebView *webview); void make_keyslist(void); -- 1.6.6.196.g1f735 From thomas at xteddy.org Sat Oct 9 18:43:05 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 9 Oct 2010 19:43:05 +0100 Subject: [Vimprobable-users] [PATCH 2/2] Introduce SYNOPSIS/OPTIONS to manpage. Message-ID: <20101009184302.GA8628@shuttle.home> This updates the manpage for vimprobable2 to give a usage synopsis and an overview of the command-line options it accepts. --- vimprobable2.1 | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/vimprobable2.1 b/vimprobable2.1 index c36f83b..b5bba48 100644 --- a/vimprobable2.1 +++ b/vimprobable2.1 @@ -4,6 +4,30 @@ .TH VIMPROBABLE2 1 "JANUARY 2010" "Linux User Manuals" .SH NAME Vimprobable \- A WWW browser based on webkit with keybindings inspired by vim, the great editor. + +.SH SYNOPSIS +.B vimprobable2 +.OP \fL\-c|\-\-config +.OP \fL\-e|\-\-embed +.OP \fL\-h|\-\-help +.OP \fL\-v|\-\-version +.OP URI + +.SH OPTIONS +.TP +.BI -c " config file" +Use the specified config file. If none found, defaults to +.I $HOME/.config/vimprobable/vimprobablerc +.TP +.BI -e " windowid" +Given the windowid of an XEmbed-aware application, Vimprobable will use that as its parent. +.TP +.BI -h +Prints out a short usage summary. +.TP +.BI -v +Prints the version of Vimprobable. + .SH DESCRIPTION Vimprobable is a WWW browser that is build around the webkit library. Vimprobable is fast. Vimprobable comes without buttons and other graphic widgets. It is aimed at being controlled -- 1.6.6.196.g1f735 From hannes at yllr.net Sun Oct 10 09:11:25 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 10 Oct 2010 11:11:25 +0200 Subject: [Vimprobable-users] [PATCH 1/8] Instal manpages into the appropriate directory in ${PREFIX} In-Reply-To: <1285824088-30272-2-git-send-email-tyler@monkeypox.org> References: <1285824088-30272-1-git-send-email-tyler@monkeypox.org> <1285824088-30272-2-git-send-email-tyler@monkeypox.org> Message-ID: <20101010111125.3e5fa36b@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun Oct 10 09:11:38 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 10 Oct 2010 11:11:38 +0200 Subject: [Vimprobable-users] [PATCH 2/8] Adding an ignore file In-Reply-To: <1285824088-30272-3-git-send-email-tyler@monkeypox.org> References: <1285824088-30272-1-git-send-email-tyler@monkeypox.org> <1285824088-30272-3-git-send-email-tyler@monkeypox.org> Message-ID: <20101010111138.59dfbea5@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun Oct 10 09:21:51 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 10 Oct 2010 11:21:51 +0200 Subject: [Vimprobable-users] [PATCH 8/8] Disable Java by default In-Reply-To: <1285824088-30272-9-git-send-email-tyler@monkeypox.org> References: <1285824088-30272-1-git-send-email-tyler@monkeypox.org> <1285824088-30272-9-git-send-email-tyler@monkeypox.org> Message-ID: <20101010112151.19689af5@workstation> I picked up this idea and made this configurable via :set. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun Oct 10 09:27:39 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 10 Oct 2010 11:27:39 +0200 Subject: [Vimprobable-users] [PATCH 1/2] Allow for "-c" on the command-line for configfile. In-Reply-To: <20101009184144.GA8547@shuttle.home> References: <20101009184144.GA8547@shuttle.home> Message-ID: <20101010112739.5bca5983@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun Oct 10 09:27:52 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 10 Oct 2010 11:27:52 +0200 Subject: [Vimprobable-users] [PATCH 2/2] Introduce SYNOPSIS/OPTIONS to manpage. In-Reply-To: <20101009184302.GA8628@shuttle.home> References: <20101009184302.GA8628@shuttle.home> Message-ID: <20101010112752.06cd374d@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From matto at matto.nl Sun Oct 10 20:41:24 2010 From: matto at matto.nl (Matto Fransen) Date: Sun, 10 Oct 2010 22:41:24 +0200 Subject: [Vimprobable-users] Patch to give a bit feedback Message-ID: <20101010204123.GA8492@aspire.tradesystem.nl> Hi, Below please find a patch that gives the user a bit feedback after saving a new bookmark. Cheers, Matto diff -u vimp-nieuw/main.c vimp-test/main.c --- vimp-nieuw/main.c 2010-10-10 19:48:12.000000000 +0000 +++ vimp-test/main.c 2010-10-10 20:25:39.000000000 +0000 @@ -1127,16 +1127,14 @@ gboolean yank(const Arg *arg) { - const char *url; - Arg a = { .i = Info }; + const char *url, *feedback; if (arg->i & SourceURL) { url = webkit_web_view_get_uri(webview); if (!url) return TRUE; - a.s = g_strdup_printf("Yanked %s", url); - echo(&a); - g_free(a.s); + feedback = g_strconcat("Yanked ", url, NULL); + give_feedback(feedback); if (arg->i & ClipboardPrimary) gtk_clipboard_set_text(clipboards[0], url, -1); if (arg->i & ClipboardGTK) @@ -1526,6 +1524,7 @@ } fprintf(f, "%s", "\n"); fclose(f); + give_feedback( "Bookmark saved" ); return TRUE; } else { set_error("Bookmarks file not found."); @@ -1845,15 +1844,12 @@ void toggle_proxy(gboolean onoff) { SoupURI *proxy_uri; - Arg a; char *filename, *new; int len; if (onoff == FALSE) { g_object_set(session, "proxy-uri", NULL, NULL); - a.i = Info; - a.s = "Proxy deactivated"; - echo(&a); + give_feedback("Proxy deactivated"); } else { filename = (char *)g_getenv("http_proxy"); @@ -1874,9 +1870,7 @@ proxy_uri = soup_uri_new(filename); } g_object_set(session, "proxy-uri", proxy_uri, NULL); - a.i = Info; - a.s = "Proxy activated"; - echo(&a); + give_feedback("Proxy activated"); } } } diff -u vimp-nieuw/utilities.c vimp-test/utilities.c --- vimp-nieuw/utilities.c 2010-10-10 19:48:12.000000000 +0000 +++ vimp-test/utilities.c 2010-10-10 19:45:25.000000000 +0000 @@ -396,3 +396,13 @@ error_msg = g_strdup_printf("%s", error); } } + +void +give_feedback(const char *feedback) +{ + Arg a = { .i = Info }; + + a.s = g_strdup_printf(feedback); + echo(&a); + g_free(a.s); +} diff -u vimp-nieuw/utilities.h vimp-test/utilities.h --- vimp-nieuw/utilities.h 2010-10-10 19:48:12.000000000 +0000 +++ vimp-test/utilities.h 2010-10-10 19:45:24.000000000 +0000 @@ -23,3 +23,5 @@ gboolean mappings(const Arg *arg); gboolean build_taglist(const Arg *arg, FILE *f); void set_error(const char *error); +void give_feedback(const char *feedback); + From matto at matto.nl Mon Oct 11 02:22:16 2010 From: matto at matto.nl (Matto Fransen) Date: Mon, 11 Oct 2010 04:22:16 +0200 Subject: [Vimprobable-users] Patch to print current url Message-ID: <20101011022215.GA2755@aspire.tradesystem.nl> Hi, Below please find a patch to allow printing the current URL :) :print will open a print-dialog, which either send the rendered URL to the printer or creates a fine pdf. Cheers, Matto diff -u vimp-test/config.h vimp-print/config.h --- vimp-test/config.h 2010-10-11 02:07:47.000000000 +0000 +++ vimp-print/config.h 2010-10-11 02:06:58.000000000 +0000 @@ -114,6 +114,7 @@ { "stop", navigate, {NavigationCancel} }, { "t", open, {TargetNew} }, { "tabopen", open, {TargetNew} }, + { "print", print_frame, {0} }, { "bma", bookmark, {0} }, { "bookmark", bookmark, {0} }, { "source", view_source, {0} }, diff -u vimp-test/main.c vimp-print/main.c --- vimp-test/main.c 2010-10-11 02:08:11.000000000 +0000 +++ vimp-print/main.c 2010-10-11 02:14:39.000000000 +0000 @@ -54,6 +54,7 @@ static gboolean quickmark(const Arg *arg); static gboolean quit(const Arg *arg); static gboolean revive(const Arg *arg); +static gboolean print_frame(const Arg *arg); static gboolean search(const Arg *arg); static gboolean set(const Arg *arg); static gboolean script(const Arg *arg); @@ -1203,6 +1204,14 @@ return FALSE; } +static +gboolean print_frame(const Arg *arg) +{ + WebKitWebFrame *frame = webkit_web_view_get_main_frame(webview); + webkit_web_frame_print (frame); + return TRUE; +} + gboolean search(const Arg *arg) { count = count ? count : 1; @@ -1744,6 +1753,11 @@ toggle_proxy(boolval); } + /* print */ + if (strlen(my_pair.what) == 5 && strncmp("print", my_pair.what, 5) == 0) { + print_frame(NULL); + } + /* Toggle scrollbars. */ if (strlen(my_pair.what) == 10 && strncmp("scrollbars", my_pair.what, 10) == 0) toggle_scrollbars(boolval); diff -u vimp-test/vimprobable2.1 vimp-print/vimprobable2.1 --- vimp-test/vimprobable2.1 2010-10-10 18:10:38.000000000 +0000 +++ vimp-print/vimprobable2.1 2010-10-11 02:12:59.000000000 +0000 @@ -215,6 +215,10 @@ Shortcut: d +.IP ":print" + +Print the current URL + .SH QUICKMARKS Up to 9 quickmarks can be defined. These are stored as quickmark 1 up to From thomas at xteddy.org Mon Oct 11 07:04:00 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 11 Oct 2010 08:04:00 +0100 Subject: [Vimprobable-users] Patch to print current url In-Reply-To: <20101011022215.GA2755@aspire.tradesystem.nl> References: <20101011022215.GA2755@aspire.tradesystem.nl> Message-ID: Hi! On 11 October 2010 03:22, Matto Fransen wrote: > +static > +gboolean print_frame(const Arg *arg) [...] > + ? ? ? ? ? ?if (strlen(my_pair.what) == 5 && strncmp("print", my_pair.what, 5) == 0) { > + ? ? ? ? ? ? ? ?print_frame(NULL); Unless I missed something, you never pass in a struct Arg, so why isn't the function definition simply the following? static gboolean print_frame(void); Other than that, I like this patch! -- Thomas Adam From matto at matto.nl Mon Oct 11 08:04:42 2010 From: matto at matto.nl (Matto Fransen) Date: Mon, 11 Oct 2010 10:04:42 +0200 Subject: [Vimprobable-users] Patch to print current url In-Reply-To: References: <20101011022215.GA2755@aspire.tradesystem.nl> Message-ID: <20101011080440.GA1794@aspire.tradesystem.nl> Hi, On Mon, Oct 11, 2010 at 08:04:00AM +0100, Thomas Adam wrote: > > + ? ? ? ? ? ?if (strlen(my_pair.what) == 5 && strncmp("print", my_pair.what, 5) == 0) { > > + ? ? ? ? ? ? ? ?print_frame(NULL); > > Unless I missed something, you never pass in a struct Arg, so why > isn't the function definition simply the following? > > static gboolean print_frame(void); This function-definition delivers problems in config.h. The functions that are referenced from config.h seem to must have a Arg struct in their format. That is why I choose for this solution. A bit ugly, but it was 05:00 or so in the morning when I wrote it :) Cheers, Matto -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From thomas at fvwm.org Mon Oct 11 08:33:30 2010 From: thomas at fvwm.org (Thomas Adam) Date: Mon, 11 Oct 2010 09:33:30 +0100 Subject: [Vimprobable-users] Patch to print current url In-Reply-To: <20101011080440.GA1794@aspire.tradesystem.nl> References: <20101011022215.GA2755@aspire.tradesystem.nl> <20101011080440.GA1794@aspire.tradesystem.nl> Message-ID: <20101011083327.GA2941@abacus.soton.smoothwall.net> On Mon, Oct 11, 2010 at 10:04:42AM +0200, Matto Fransen wrote: > Hi, > > On Mon, Oct 11, 2010 at 08:04:00AM +0100, Thomas Adam wrote: > > > > + ? ? ? ? ? ?if (strlen(my_pair.what) == 5 && strncmp("print", my_pair.what, 5) == 0) { > > > + ? ? ? ? ? ? ? ?print_frame(NULL); > > > > Unless I missed something, you never pass in a struct Arg, so why > > isn't the function definition simply the following? > > > > static gboolean print_frame(void); > > This function-definition delivers problems in config.h. Ah, yes of course. It's because struct Command always assumes const Arg *. Hmm, that's a tad fail to me -- it would be nice if that were nothing more than a void *, so that we could circumvent those cases where we don't need this. There's nothing we should do about this for now -- in which case, as a little ugly as it is, your patch will have to do. :) -- Thomas Adam From thomas at xteddy.org Mon Oct 11 17:29:12 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 11 Oct 2010 18:29:12 +0100 Subject: [Vimprobable-users] Patch to give a bit feedback In-Reply-To: <20101010204123.GA8492@aspire.tradesystem.nl> References: <20101010204123.GA8492@aspire.tradesystem.nl> Message-ID: <20101011172910.GB3692@shuttle.home> On Sun, Oct 10, 2010 at 10:41:24PM +0200, Matto Fransen wrote: > Hi, > > Below please find a patch that gives the user a bit > feedback after saving a new bookmark. Matto and I discussed this on IRC -- it looks fine to me, although there might be other places where this give_feedback() function could be used, but the obvious places have been found. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hannes at yllr.net Tue Oct 12 09:01:05 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Tue, 12 Oct 2010 11:01:05 +0200 Subject: [Vimprobable-users] Patch to give a bit feedback In-Reply-To: <20101010204123.GA8492@aspire.tradesystem.nl> References: <20101010204123.GA8492@aspire.tradesystem.nl> Message-ID: <20101012110105.7b82cfcb@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Tue Oct 12 09:03:53 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Tue, 12 Oct 2010 11:03:53 +0200 Subject: [Vimprobable-users] Patch to print current url In-Reply-To: <20101011022215.GA2755@aspire.tradesystem.nl> References: <20101011022215.GA2755@aspire.tradesystem.nl> Message-ID: <20101012110353.260b5a03@workstation> Merged -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Sun Oct 17 13:46:35 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:46:35 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. Message-ID: <20101017134630.GA18179@shuttle.home> Currently, Vimprobable implements cookies by only referencing the cookie-jar when that specific instance of Vimprobable loads -- if there's more than one Vimprobable instance which then sets cookies, there's no way of other instances to "share" cookies. This is annoying on sites like gmail, where despite having a gmail window open, clicking a link to go to the calendar, will force the user to reauthenticate. So instead, parse the headers of each request (via libsoup) to conditionally set the cookie, by always looking in our cookie-jar first to see if it's available, and if so, use it. Thomas Adam (6): Rename open() to open_arg() to avoid POSIX open(2) Use Define cookie-related function protoypes. Setup signal-handling for cookies Implement persistent-cookie support. Introduce mop_up() config.h | 10 ++-- includes.h | 1 + keymap.h | 4 +- main.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 131 insertions(+), 26 deletions(-) From thomas at xteddy.org Sun Oct 17 13:48:19 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:48:19 +0100 Subject: [Vimprobable-users] [PATCH 2/6] Use Message-ID: <20101017134816.GA18270@shuttle.home> Needed for LOCK_* symbols, used with cookie-handling support. --- includes.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/includes.h b/includes.h index fe7d9bf..2e57539 100644 --- a/includes.h +++ b/includes.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include -- 1.7.1 From thomas at xteddy.org Sun Oct 17 13:50:20 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:50:20 +0100 Subject: [Vimprobable-users] [PATCH 5/6] Implement persistent-cookie support. Message-ID: <20101017135017.GA18364@shuttle.home> Previously, Vimprobable only defined one cookie-store per running instance; effectively, this meant that cookies set by one instance of Vimprobable could never see the newer cookies, because the cookiejar was only ever queried once; when it loaded. Introduce parsing of the header requests we receive so that we can interrogate cookies per-request. This will give the allusion of "shared" cookies. --- main.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index bb29495..64bc145 100644 --- a/main.c +++ b/main.c @@ -2175,6 +2175,86 @@ setup_signals() { "inspect-web-view", (GCallback)inspector_inspect_web_view_cb, NULL); } +#ifdef ENABLE_COOKIE_SUPPORT +/* TA: XXX - we should be using this callback for any header-requests we + * receive (hence the name "new_generic_request" -- but for now, its use + * is limited to handling cookies. + */ +void +new_generic_request(SoupSession *session, SoupMessage *soup_msg, gpointer unused) { + SoupMessageHeaders *soup_msg_h; + SoupURI *uri; + const char *cookie_str; + + soup_msg_h = soup_msg->request_headers; + soup_message_headers_remove(soup_msg_h, "Cookie"); + uri = soup_message_get_uri(soup_msg); + if( (cookie_str = get_cookies(uri)) ) + soup_message_headers_append(soup_msg_h, "Cookie", cookie_str); + + g_signal_connect_after(G_OBJECT(soup_msg), "got-headers", G_CALLBACK(handle_cookie_request), NULL); +} + +const char * +get_cookies(SoupURI *soup_uri) { + const char *cookie_str; + SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, TRUE); + cookie_str = soup_cookie_jar_get_cookies(jar, soup_uri, TRUE); + g_object_unref(jar); + return cookie_str; +} + +void +handle_cookie_request(SoupMessage *soup_msg, gpointer unused) { + GSList *resp_cookie; + + for(resp_cookie = soup_cookies_from_response(soup_msg); + resp_cookie; + resp_cookie = g_slist_next(resp_cookie)) + { + set_single_cookie((SoupCookie *)resp_cookie->data); + } +} + +void +set_single_cookie(SoupCookie *cookie) { + int lock; + + if (!cookie) + { + /* TA: Then what? This shouldn't happen. */ + { + Arg arg_error; + arg_error.i = Error; + arg_error.s = g_strdup("Invalid cookie from header"); + echo(&arg_error); + g_free(arg_error.s); + } + + return; + } + + lock = open(cookie_store, 0); + flock(lock, LOCK_EX); + + SoupDate *soup_date; + SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, FALSE); + cookie = soup_cookie_copy(cookie); + + if (cookie_timeout && cookie->expires == NULL) { + soup_date = soup_date_new_from_time_t(time(NULL) + cookie_timeout); + soup_cookie_set_expires(cookie, soup_date); + } + + soup_cookie_jar_add_cookie(jar, cookie); + g_object_unref(jar); + + flock(lock, LOCK_UN); + close(lock); +} +#endif + + int main(int argc, char *argv[]) { static Arg a; -- 1.7.1 From thomas at xteddy.org Sun Oct 17 13:50:53 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:50:53 +0100 Subject: [Vimprobable-users] [PATCH 6/6] Introduce mop_up() Message-ID: <20101017135050.GA18401@shuttle.home> Generic function to do any clean up work -- such as free()ing values, unlocking files, etc., etc. --- main.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index 64bc145..f51b19f 100644 --- a/main.c +++ b/main.c @@ -86,7 +86,7 @@ void toggle_scrollbars(gboolean onoff); gboolean process_keypress(GdkEventKey *event); void fill_suggline(char * suggline, const char * command, const char *fill_with); GtkWidget * fill_eventbox(const char * completion_line); - +static void mop_up(void); #include "main.h" @@ -2254,6 +2254,14 @@ set_single_cookie(SoupCookie *cookie) { } #endif +void +mop_up(void) { + /* Free up any nasty globals before exiting. */ + if (cookie_store) + g_free(cookie_store); + + return; +} int main(int argc, char *argv[]) { @@ -2318,5 +2326,7 @@ main(int argc, char *argv[]) { open_arg(&a); gtk_main(); + mop_up(); + return EXIT_SUCCESS; } -- 1.7.1 From thomas at xteddy.org Sun Oct 17 13:47:41 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:47:41 +0100 Subject: [Vimprobable-users] [PATCH 1/6] Rename open() to open_arg() to avoid POSIX open(2) Message-ID: <20101017134737.GA18233@shuttle.home> Vimprobable defines an open prototype of open(const Arg *) -- which is fine, but this has potential to clash with the more common open(2) syscall. Redefine Vimprobable's version to not conflict. --- config.h | 10 +++++----- keymap.h | 4 ++-- main.c | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config.h b/config.h index 5fcce2c..f9fbab6 100644 --- a/config.h +++ b/config.h @@ -101,8 +101,8 @@ Command commands[] = { { "fo", navigate, {NavigationForward} }, { "forward", navigate, {NavigationForward} }, { "javascript", script, {Silent} }, - { "o", open, {TargetCurrent} }, - { "open", open, {TargetCurrent} }, + { "o", open_arg, {TargetCurrent} }, + { "open", open_arg, {TargetCurrent} }, { "q", quit, {0} }, { "quit", quit, {0} }, { "re", navigate, {NavigationReload} }, @@ -112,8 +112,8 @@ Command commands[] = { { "qt", search_tag, {0} }, { "st", navigate, {NavigationCancel} }, { "stop", navigate, {NavigationCancel} }, - { "t", open, {TargetNew} }, - { "tabopen", open, {TargetNew} }, + { "t", open_arg, {TargetNew} }, + { "tabopen", open_arg, {TargetNew} }, { "print", print_frame, {0} }, { "bma", bookmark, {0} }, { "bookmark", bookmark, {0} }, @@ -141,7 +141,7 @@ static Mouse mouse[] = { /* modmask, modkey, button, function, argument */ { 0, 0, MOUSE_BUTTON_2, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK, rememberedURI} }, { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_2, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, - { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open, {TargetNew, rememberedURI} }, + { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open_arg, {TargetNew, rememberedURI} }, }; /* settings (arguments of :set command) */ diff --git a/keymap.h b/keymap.h index c6d0f10..125a2c0 100644 --- a/keymap.h +++ b/keymap.h @@ -75,8 +75,8 @@ Key keys[] = { { 0, GDK_g, GDK_u, descend, {NthSubdir} }, { GDK_SHIFT_MASK, GDK_g, GDK_U, descend, {Rootdir} }, - { 0, GDK_g, GDK_h, open, {TargetCurrent, startpage} }, - { GDK_SHIFT_MASK, GDK_g, GDK_H, open, {TargetNew, startpage} }, + { 0, GDK_g, GDK_h, open_arg, {TargetCurrent, startpage} }, + { GDK_SHIFT_MASK, GDK_g, GDK_H, open_arg, {TargetNew, startpage} }, { 0, 0, GDK_p, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK} }, { GDK_SHIFT_MASK, 0, GDK_P, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, diff --git a/main.c b/main.c index a8f2ba1..5a6c212 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ static gboolean focus_input(const Arg *arg); static gboolean input(const Arg *arg); static gboolean navigate(const Arg *arg); static gboolean number(const Arg *arg); -static gboolean open(const Arg *arg); +static gboolean open_arg(const Arg *arg); static gboolean paste(const Arg *arg); static gboolean quickmark(const Arg *arg); static gboolean quit(const Arg *arg); @@ -197,7 +197,7 @@ webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpo if (strlen(rememberedURI) > 0) { a.s = rememberedURI; } - open(&a); + open_arg(&a); return FALSE; } @@ -205,7 +205,7 @@ gboolean webview_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *action, WebKitWebPolicyDecision *decision, gpointer user_data) { Arg a = { .i = TargetNew, .s = (char*)webkit_network_request_get_uri(request) }; - open(&a); + open_arg(&a); webkit_web_policy_decision_ignore(decision); return TRUE; } @@ -1065,7 +1065,7 @@ number(const Arg *arg) { } gboolean -open(const Arg *arg) { +open_arg(const Arg *arg) { char *argv[6]; char *s = arg->s, *p, *new; Arg a = { .i = NavigationReload }; @@ -1152,7 +1152,7 @@ paste(const Arg *arg) { /* If we're over a link, open it in a new target. */ if (strlen(rememberedURI) > 0) { Arg new_target = { .i = TargetNew, .s = arg->s }; - open(&new_target); + open_arg(&new_target); return TRUE; } @@ -1161,7 +1161,7 @@ paste(const Arg *arg) { if (!a.s && arg->i & ClipboardGTK) a.s = gtk_clipboard_wait_for_text(clipboards[1]); if (a.s) - open(&a); + open_arg(&a); return TRUE; } @@ -1198,7 +1198,7 @@ revive(const Arg *arg) { } if (strlen(buffer) > 0) { a.s = buffer; - open(&a); + open_arg(&a); return TRUE; } return FALSE; @@ -1343,7 +1343,7 @@ quickmark(const Arg *a) { char *ptr = strrchr(buf, '\n'); *ptr = '\0'; Arg x = { .s = buf }; - if ( strlen(buf)) return open(&x); + if ( strlen(buf)) return open_arg(&x); else { x.i = Error; @@ -1395,7 +1395,7 @@ script(const Arg *arg) { a.i = TargetCurrent; memset(followTarget, 0, 8); a.s = (value + 5); - open(&a); + open_arg(&a); } } g_free(value); @@ -1838,7 +1838,7 @@ search_tag(const Arg * a) { while (s[i] && !isspace(s[i])) url[k++] = s[i++]; url[k] = '\0'; Arg x = { .i = TargetNew, .s = url }; - open (&x); + open_arg(&x); } } intag = 0; @@ -2221,7 +2221,7 @@ main(int argc, char *argv[]) { a.i = TargetCurrent; a.s = url; - open(&a); + open_arg(&a); gtk_main(); return EXIT_SUCCESS; -- 1.7.1 From thomas at xteddy.org Sun Oct 17 13:48:52 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:48:52 +0100 Subject: [Vimprobable-users] [PATCH 3/6] Define cookie-related function protoypes. Message-ID: <20101017134849.GA18302@shuttle.home> This adds in all the cookie-related prototypes needed to handle cookies persistently. --- main.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 5a6c212..76f97a4 100644 --- a/main.c +++ b/main.c @@ -139,6 +139,18 @@ int maxcommands = 0; int commandpointer = 0; KeyList *keylistroot = NULL; +/* Cookie-related information. + * + * Note that this cannot be surrounded by #ifdef blocks for + * ENABLE_COOKIE_SUPPORT + */ +static time_t cookie_timeout = 4800; +static char *cookie_store; +static void handle_cookie_request(SoupMessage *soup_msg, gpointer unused); +static const char *get_cookies(SoupURI *soup_uri); +static void set_single_cookie(SoupCookie *cookie); +static void new_generic_request(SoupSession *soup_ses, SoupMessage *soup_msg, gpointer unused); + /* callbacks */ void window_destroyed_cb(GtkWidget *window, gpointer func_data) { -- 1.7.1 From thomas at xteddy.org Sun Oct 17 13:49:36 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 14:49:36 +0100 Subject: [Vimprobable-users] [PATCH 4/6] Setup signal-handling for cookies Message-ID: <20101017134927.GA18327@shuttle.home> Conditionally hook into the GObject system (assuming ENABLE_COOKIES has been set) so that we can then parse the cookie fromt the response headers. --- main.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 76f97a4..bb29495 100644 --- a/main.c +++ b/main.c @@ -2095,9 +2095,7 @@ setup_settings() { SoupURI *proxy_uri; char *filename, *new; int len; -#ifdef ENABLE_COOKIE_SUPPORT - SoupCookieJar *cookiejar; -#endif + session = webkit_get_default_session(); g_object_set((GObject*)settings, "default-font-size", DEFAULT_FONT_SIZE, NULL); g_object_set((GObject*)settings, "enable-scripts", enablePlugins, NULL); @@ -2110,11 +2108,11 @@ setup_settings() { g_object_get((GObject*)settings, "zoom-step", &zoomstep, NULL); webkit_web_view_set_settings(webview, settings); #ifdef ENABLE_COOKIE_SUPPORT - filename = g_strdup_printf(COOKIES_STORAGE_FILENAME); - cookiejar = soup_cookie_jar_text_new(filename, COOKIES_STORAGE_READONLY); - g_free(filename); - soup_session_add_feature(session, (SoupSessionFeature*)cookiejar); + cookie_store = g_strdup_printf(COOKIES_STORAGE_FILENAME); + soup_session_remove_feature_by_type(session, soup_cookie_get_type()); + soup_session_remove_feature_by_type(session, soup_cookie_jar_get_type()); #endif + /* proxy */ if (use_proxy == TRUE) { filename = (char *)g_getenv("http_proxy"); @@ -2135,6 +2133,10 @@ setup_settings() { void setup_signals() { +#ifdef ENABLE_COOKIE_SUPPORT + /* Headers. */ + g_signal_connect_after((GObject*)session, "request-started", (GCallback)new_generic_request, NULL); +#endif /* window */ g_object_connect((GObject*)window, "signal::destroy", (GCallback)window_destroyed_cb, NULL, -- 1.7.1 From hannes at yllr.net Sun Oct 17 14:30:22 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 17 Oct 2010 16:30:22 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101017134630.GA18179@shuttle.home> References: <20101017134630.GA18179@shuttle.home> Message-ID: <20101017163022.6ba7cbf0@workstation> main.c: In function ?set_single_cookie?: main.c:2253: warning: implicit declaration of function ?close? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Sun Oct 17 14:37:47 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 17 Oct 2010 15:37:47 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101017163022.6ba7cbf0@workstation> References: <20101017134630.GA18179@shuttle.home> <20101017163022.6ba7cbf0@workstation> Message-ID: <20101017143746.GA3517@shuttle.home> On Sun, Oct 17, 2010 at 04:30:22PM +0200, Hannes Sch?ller wrote: > main.c: In function ?set_single_cookie?: > main.c:2253: warning: implicit declaration of function ?close? Oops. That's embarrassing. See attached. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) -------------- next part -------------- A non-text attachment was scrubbed... Name: fix-missing-unistd.patch Type: text/x-diff Size: 281 bytes Desc: not available URL: From hannes at yllr.net Mon Oct 18 18:25:32 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Mon, 18 Oct 2010 20:25:32 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101017134630.GA18179@shuttle.home> References: <20101017134630.GA18179@shuttle.home> Message-ID: <20101018182531.GB22633@laptop2.lan.localhost> Hi! Functionality-wise, this seems to work great, but it ignores the option COOKIES_STORAGE_READONLY. Even if set to TRUE, cookies will be saved persistently. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From thomas at xteddy.org Mon Oct 18 18:54:29 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 18 Oct 2010 19:54:29 +0100 Subject: [Vimprobable-users] [PATCH] Saner config file checking. Message-ID: <20101018185425.GA9138@shuttle.home> Don't moan if RCFILE cannot be opened -- instead, use give_feedback() if an explicit config file was passed on the command-line, but couldn't be opened. For everything else, use an explicit error, because we assume the file could be opened, but not parsed for some reason. --- I broke this by mistake when I introduced "-c" on the command line. Hopefully, this is a bit better. Note tha the inclusion might conflict with my cookie handling stuff. includes.h | 1 + main.c | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/includes.h b/includes.h index fe7d9bf..470284d 100644 --- a/includes.h +++ b/includes.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/main.c b/main.c index a8f2ba1..726176a 100644 --- a/main.c +++ b/main.c @@ -2166,6 +2166,7 @@ main(int argc, char *argv[]) { static Arg a; static char url[256] = ""; static gboolean ver = false; + static gboolean configfile_exists = false; static const char *cfile = NULL; static GOptionEntry opts[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &ver, "print version", NULL }, @@ -2203,13 +2204,27 @@ main(int argc, char *argv[]) { make_keyslist(); setup_gui(); + /* Check if the specified file exists. */ + /* And only warn the user, if they explicitly asked for a config on the + * command line + */ + if (!(access(configfile, F_OK) == 0) && cfile) { + char *feedback_str; + + feedback_str = g_strdup_printf("Config file '%s' doesn't exist", cfile); + give_feedback(feedback_str); + g_free(feedback_str); + } else if ((access(configfile, F_OK) == 0)) + configfile_exists = true; + /* read config file */ - if (!read_rcfile(configfile)) { - free(configfile); + /* But only report errors if we failed, and the file existed. */ + if (!read_rcfile(configfile) && configfile_exists) { a.i = Error; - a.s = g_strdup_printf("Error in config file"); + a.s = g_strdup_printf("Error in config file '%s'", configfile); echo(&a); g_free(a.s); + g_free(configfile); } /* command line argument: URL */ -- 1.7.1 From thomas at xteddy.org Mon Oct 18 19:04:34 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 18 Oct 2010 20:04:34 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101018182531.GB22633@laptop2.lan.localhost> References: <20101017134630.GA18179@shuttle.home> <20101018182531.GB22633@laptop2.lan.localhost> Message-ID: <20101018190432.GA3525@shuttle.home> On Mon, Oct 18, 2010 at 08:25:32PM +0200, Hannes Sch?ller wrote: > Hi! > > Functionality-wise, this seems to work great, but it ignores the option > COOKIES_STORAGE_READONLY. Even if set to TRUE, cookies will be saved > persistently. Try this: diff --git a/main.c b/main.c index f51b19f..bc548c8 100644 --- a/main.c +++ b/main.c @@ -2198,7 +2198,7 @@ new_generic_request(SoupSession *session, SoupMessage *soup_msg, gpointer unused const char * get_cookies(SoupURI *soup_uri) { const char *cookie_str; - SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, TRUE); + SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, COOKIES_STORAGE_READONLY); cookie_str = soup_cookie_jar_get_cookies(jar, soup_uri, TRUE); g_object_unref(jar); return cookie_str; -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hpdeifel at gmx.de Mon Oct 18 19:45:12 2010 From: hpdeifel at gmx.de (Hans-Peter Deifel) Date: Mon, 18 Oct 2010 21:45:12 +0200 Subject: [Vimprobable-users] [PATCH] Don't concatenate the last two bookmark tags Message-ID: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> --- utilities.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/utilities.c b/utilities.c index 36298f7..8413c72 100644 --- a/utilities.c +++ b/utilities.c @@ -380,6 +380,7 @@ build_taglist(const Arg *arg, FILE *f) { k++; } if (in_tag) { + t = 0; while (marker < strlen(arg->s) && t < MAXTAGSIZE) foundtab[t++] = arg->s[marker++]; foundtab[t] = '\0'; fprintf(f, " [%s]", foundtab ); -- 1.7.2.2 From thomas at xteddy.org Mon Oct 18 20:06:18 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 18 Oct 2010 21:06:18 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101018190432.GA3525@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101018182531.GB22633@laptop2.lan.localhost> <20101018190432.GA3525@shuttle.home> Message-ID: <20101018200617.GB3525@shuttle.home> On Mon, Oct 18, 2010 at 08:04:34PM +0100, Thomas Adam wrote: > On Mon, Oct 18, 2010 at 08:25:32PM +0200, Hannes Sch?ller wrote: > > Hi! > > > > Functionality-wise, this seems to work great, but it ignores the option > > COOKIES_STORAGE_READONLY. Even if set to TRUE, cookies will be saved > > persistently. > > Try this: I'm talking nonsense. Sorry, Hannes. Try the following attached instead! It's been a long day! -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0013-Use-a-single-point-of-reference-for-cookie-jar.patch Type: text/x-diff Size: 2230 bytes Desc: not available URL: From hannes at yllr.net Mon Oct 18 20:35:04 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Mon, 18 Oct 2010 22:35:04 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101018200617.GB3525@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101018182531.GB22633@laptop2.lan.localhost> <20101018190432.GA3525@shuttle.home> <20101018200617.GB3525@shuttle.home> Message-ID: <20101018203503.GD22633@laptop2.lan.localhost> On Mon, Oct 18, 2010 at 09:06:18PM +0100, Thomas Adam wrote: > On Mon, Oct 18, 2010 at 08:04:34PM +0100, Thomas Adam wrote: > > On Mon, Oct 18, 2010 at 08:25:32PM +0200, Hannes Sch?ller wrote: > > > Hi! > > > > > > Functionality-wise, this seems to work great, but it ignores the option > > > COOKIES_STORAGE_READONLY. Even if set to TRUE, cookies will be saved > > > persistently. > > > > Try this: > > Try the following attached instead! It's been a long day! Indeed it has been... sorry I sent my last mail directly to you instead of the list. This one accepts the cookie settings, but if COOKIES_STORAGE_READONLY is TRUE, the cookie sharing doesn't work. I'm not sure this is solvable - what do you say? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From thomas at xteddy.org Tue Oct 19 06:54:06 2010 From: thomas at xteddy.org (Thomas Adam) Date: Tue, 19 Oct 2010 07:54:06 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101018203503.GD22633@laptop2.lan.localhost> References: <20101017134630.GA18179@shuttle.home> <20101018182531.GB22633@laptop2.lan.localhost> <20101018190432.GA3525@shuttle.home> <20101018200617.GB3525@shuttle.home> <20101018203503.GD22633@laptop2.lan.localhost> Message-ID: <20101019065402.GC3525@shuttle.home> On Mon, Oct 18, 2010 at 10:35:04PM +0200, Hannes Sch?ller wrote: > On Mon, Oct 18, 2010 at 09:06:18PM +0100, Thomas Adam wrote: > > On Mon, Oct 18, 2010 at 08:04:34PM +0100, Thomas Adam wrote: > > > On Mon, Oct 18, 2010 at 08:25:32PM +0200, Hannes Sch?ller wrote: > > > > Hi! > > > > > > > > Functionality-wise, this seems to work great, but it ignores the option > > > > COOKIES_STORAGE_READONLY. Even if set to TRUE, cookies will be saved > > > > persistently. > > > > > > Try this: > > > > Try the following attached instead! It's been a long day! > > Indeed it has been... sorry I sent my last mail directly to you instead > of the list. > > This one accepts the cookie settings, but if COOKIES_STORAGE_READONLY is > TRUE, the cookie sharing doesn't work. I'm not sure this is solvable - > what do you say? Ah -- they are going to be somewhat mutually-exclusive, yes. I can't see a way round this; as they need to persist initially for the header modification to work when the cookie is in the jar, which you can't have if we're never storing it on disk in the first place. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From nimrodomer at gmail.com Tue Oct 19 08:02:52 2010 From: nimrodomer at gmail.com (Jane Doe) Date: Tue, 19 Oct 2010 01:02:52 -0700 (PDT) Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? Message-ID: I've been playing around with Vimprobable & Privoxy for the last couple of days, and I've noticed that I can't redirect https URI's (e.g. https://docs.google.com/Doc...). Redirecting http URI's (e.g. http://www.google.com/search...) works great, though, so I'm pretty sure I've set everything up correctly. I checked out Vimprobable's main.c, and noticed that the only references to 'proxy' are in regards to 'http', which leads me to believe that Vimprobable can ONLY be configured to use an http proxy. I don't know if this is a design feature or not, or even if the conclusions I've drawn from poking around in main.c are true. On the off-chance that this isn't a design feature AND that I'm right, it'd be awesome if someone could write a patch that would allow for https redirecting. In my poking around, it didn't look too difficult to do, but I'm a philosophy student, not a computer scientist, so what do I know? That said, if I'm doing something wrong, I think it would be just as awesome if someone could help a girl out! And if it's a design feature, it would be nice to know why it was implemented (just idle curiosity, really). I love Vimprobable, but I use Google Docs a lot, and it's a pain to have to manually append '&browserok=true' to the URI of every document I open... Thanks in advance, Janey From hannes at yllr.net Tue Oct 19 08:15:24 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Tue, 19 Oct 2010 10:15:24 +0200 Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? In-Reply-To: References: Message-ID: <20101019081522.GA2534@laptop2.lan.localhost> Hello Janey! On Tue, Oct 19, 2010 at 01:02:52AM -0700, Jane Doe wrote: > I've been playing around with Vimprobable & Privoxy for the last > couple of days, and I've noticed that I can't redirect https URI's > (e.g. https://docs.google.com/Doc...). Redirecting http URI's (e.g. > http://www.google.com/search...) works great, though, so I'm pretty > sure I've set everything up correctly. Just so that I'm sure I get this right: You're trying to access https URLs through privoxy and it isn't working? You're *not* trying to set up the proxy itself to run with an https URI? The former works fine for me. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From nimrodomer at gmail.com Tue Oct 19 08:29:37 2010 From: nimrodomer at gmail.com (Jane Doe) Date: Tue, 19 Oct 2010 01:29:37 -0700 (PDT) Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? In-Reply-To: <20101019081522.GA2534@laptop2.lan.localhost> References: <20101019081522.GA2534@laptop2.lan.localhost> Message-ID: Hi Hannes! On Tue, 19 Oct 2010, Hannes Sch?ller wrote: > Hello Janey! > > On Tue, Oct 19, 2010 at 01:02:52AM -0700, Jane Doe wrote: >> I've been playing around with Vimprobable & Privoxy for the last >> couple of days, and I've noticed that I can't redirect https URI's >> (e.g. https://docs.google.com/Doc...). Redirecting http URI's (e.g. >> http://www.google.com/search...) works great, though, so I'm pretty >> sure I've set everything up correctly. > > Just so that I'm sure I get this right: You're trying to access https > URLs through privoxy and it isn't working? You're *not* trying to set up > the proxy itself to run with an https URI? > > The former works fine for me. Accessing https URL's through privoxy works just fine for me, too. The problem is that I can't use privoxy to redirect https URL's (e.g. from https://docs.google.com/Doc?somethingsomethingsomething to https://docs.google.com/Doc?somethingsomethingsomething&browserok=true). > > Hannes > From hannes at yllr.net Tue Oct 19 08:41:23 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Tue, 19 Oct 2010 10:41:23 +0200 Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? In-Reply-To: References: <20101019081522.GA2534@laptop2.lan.localhost> Message-ID: <20101019084121.GB2534@laptop2.lan.localhost> On Tue, Oct 19, 2010 at 01:29:37AM -0700, Jane Doe wrote: > On Tue, 19 Oct 2010, Hannes Sch?ller wrote: > >On Tue, Oct 19, 2010 at 01:02:52AM -0700, Jane Doe wrote: > >>I've been playing around with Vimprobable & Privoxy for the last > >>couple of days, and I've noticed that I can't redirect https URI's > >>(e.g. https://docs.google.com/Doc...). Redirecting http URI's (e.g. > >>http://www.google.com/search...) works great, though, so I'm pretty > >>sure I've set everything up correctly. > > > >Just so that I'm sure I get this right: You're trying to access https > >URLs through privoxy and it isn't working? You're *not* trying to set up > >the proxy itself to run with an https URI? > > > >The former works fine for me. > > Accessing https URL's through privoxy works just fine for me, too. > The problem is that I can't use privoxy to redirect https URL's > (e.g. from https://docs.google.com/Doc?somethingsomethingsomething > to https://docs.google.com/Doc?somethingsomethingsomething&browserok=true). I don't get it, apparantely. Who is (or should be) redirecting whom there? The page found in the first URL should redirect you to the second one? So the webserver is initiating some sort of redirection? If so, what type? 301? 302? Or is it some client side redirection, like through Javascript? Or do you want the proxy to *always* redirect URLs matching a certain pattern to some other pattern? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From nimrodomer at gmail.com Tue Oct 19 09:43:28 2010 From: nimrodomer at gmail.com (Jane Doe) Date: Tue, 19 Oct 2010 02:43:28 -0700 (PDT) Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? In-Reply-To: <20101019084121.GB2534@laptop2.lan.localhost> References: <20101019081522.GA2534@laptop2.lan.localhost> <20101019084121.GB2534@laptop2.lan.localhost> Message-ID: On Tue, 19 Oct 2010, Hannes Sch?ller wrote: > On Tue, Oct 19, 2010 at 01:29:37AM -0700, Jane Doe wrote: >> On Tue, 19 Oct 2010, Hannes Sch?ller wrote: >>> On Tue, Oct 19, 2010 at 01:02:52AM -0700, Jane Doe wrote: >>>> I've been playing around with Vimprobable & Privoxy for the last >>>> couple of days, and I've noticed that I can't redirect https URI's >>>> (e.g. https://docs.google.com/Doc...). Redirecting http URI's (e.g. >>>> http://www.google.com/search...) works great, though, so I'm pretty >>>> sure I've set everything up correctly. >>> >>> Just so that I'm sure I get this right: You're trying to access https >>> URLs through privoxy and it isn't working? You're *not* trying to set up >>> the proxy itself to run with an https URI? >>> >>> The former works fine for me. >> >> Accessing https URL's through privoxy works just fine for me, too. >> The problem is that I can't use privoxy to redirect https URL's >> (e.g. from https://docs.google.com/Doc?somethingsomethingsomething >> to https://docs.google.com/Doc?somethingsomethingsomething&browserok=true). > > I don't get it, apparantely. Who is (or should be) redirecting whom > there? The page found in the first URL should redirect you to the second > one? So the webserver is initiating some sort of redirection? If so, > what type? 301? 302? Or is it some client side redirection, like through > Javascript? Or do you want the proxy to *always* redirect URLs matching > a certain pattern to some other pattern? > > Hannes > I've only been playing around with this stuff for the last couple of days, so please excuse my own confusion. This is what I'm trying to do, in as much detail as I can manage: I configured privoxy's user.action file, such that the action { +redirect{s@$@&browserok=true@} } is performed on pattern docs.google.com/Doc\?docid=.*(? References: <20101019081522.GA2534@laptop2.lan.localhost> <20101019084121.GB2534@laptop2.lan.localhost> Message-ID: <20101019190947.2fe97ed7@workstation> Jane Doe wrote: > I configured privoxy's user.action file, such that the action { > +redirect{s@$@&browserok=true@} } is performed on pattern > docs.google.com/Doc\?docid=.*(? works just fine; namely action { +redirect{s@$@\?browserok=true@} } > on pattern docs.google.com/.*(? both URL's a couple of times, but for some reason, the former only > accepts '&browser..' and the latter '?browser...'. That's why I don't > just have a single action for both.) Altight, I understand now what you're trying to do. Thanks for the detailed explanation. The proxy handling is a feature of libsoup. According to their reference [1], it doesn't distinguish between http and https proxies. So there is no way to set one for https explicitely and I have to assume proxy-uri is used for all protocols. Quick experimentation confirms this: Trying to call an ftp:// URL, for example, gives me a privoxy error about not supporting this protocol - so the browser definitely passes the request to the proxy. The blocks I have defined work for https:// prefixed URLs as well. So the setting really is universal. Which gets me back to the problem you're experiencing. My first suggestion would be to triple check the regex condition which isn't producing any matches. Second, what is it you're really trying to achieve? I gather you want to tell that website to accept your browser as a 'valid' one which can handle all the technology used there. Have you tried simply setting Vimprobable's user agent string to something Google will know and recognise? This is just a stab in the dark, of course, but problems with Google pop up here on the list quite frequently, and this seems to help with most of them. Hannes [1] http://library.gnome.org/devel/libsoup/stable/SoupSession.html#SoupSession--proxy-uri -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Tue Oct 19 17:12:20 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Tue, 19 Oct 2010 19:12:20 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101019065402.GC3525@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101018182531.GB22633@laptop2.lan.localhost> <20101018190432.GA3525@shuttle.home> <20101018200617.GB3525@shuttle.home> <20101018203503.GD22633@laptop2.lan.localhost> <20101019065402.GC3525@shuttle.home> Message-ID: <20101019191220.0df6882d@workstation> Thomas Adam wrote: > On Mon, Oct 18, 2010 at 10:35:04PM +0200, Hannes Sch?ller wrote: > > On Mon, Oct 18, 2010 at 09:06:18PM +0100, Thomas Adam wrote: > > > On Mon, Oct 18, 2010 at 08:04:34PM +0100, Thomas Adam wrote: > > > > On Mon, Oct 18, 2010 at 08:25:32PM +0200, Hannes Sch?ller wrote: > > > > > Hi! > > > > > > > > > > Functionality-wise, this seems to work great, but it ignores > > > > > the option COOKIES_STORAGE_READONLY. Even if set to TRUE, > > > > > cookies will be saved persistently. > > > > > > > > Try this: > > > > > > Try the following attached instead! It's been a long day! > > > > Indeed it has been... sorry I sent my last mail directly to you > > instead of the list. > > > > This one accepts the cookie settings, but if > > COOKIES_STORAGE_READONLY is TRUE, the cookie sharing doesn't work. > > I'm not sure this is solvable - what do you say? > > Ah -- they are going to be somewhat mutually-exclusive, yes. I can't > see a way round this; as they need to persist initially for the header > modification to work when the cookie is in the jar, which you can't > have if we're never storing it on disk in the first place. That is what I assumed. I can't think of a way to have both at the same time, either. So what does everyone else think? Is this a good feature keeping the restriction (which we'll have to explain constantly to new users) in mind? Personally, I think so, but this is your chance to protest or support. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From nimrodomer at gmail.com Tue Oct 19 20:52:44 2010 From: nimrodomer at gmail.com (Jane Doe) Date: Tue, 19 Oct 2010 13:52:44 -0700 (PDT) Subject: [Vimprobable-users] Setting up Vimprobable2 with an https proxy? In-Reply-To: <20101019190947.2fe97ed7@workstation> References: <20101019081522.GA2534@laptop2.lan.localhost> <20101019084121.GB2534@laptop2.lan.localhost> <20101019190947.2fe97ed7@workstation> Message-ID: On Tue, 19 Oct 2010, Hannes Sch?ller wrote: > Altight, I understand now what you're trying to do. Thanks for the > detailed explanation. The proxy handling is a feature of libsoup. > According to their reference [1], it doesn't distinguish between http > and https proxies. So there is no way to set one for https explicitely > and I have to assume proxy-uri is used for all protocols. > > Quick experimentation confirms this: Trying to call an ftp:// URL, for > example, gives me a privoxy error about not supporting this protocol - > so the browser definitely passes the request to the proxy. The blocks I > have defined work for https:// prefixed URLs as well. So the setting > really is universal. I did some of these quick experimentations myself just now. When I tried to call an ftp:// URL, I got an error message saying that the specified location was not mounted (I have no idea what that means). I didn't test blocks, but I did a basic redirect action on https:// & http:// URL's I know exist: { +redirect{http://www.schlockmercenary.com} } secure.wikimedia.org/wikipedia/en/wiki/Schlock_Mercenary en.wikipedia.org/wiki/Schlock_Mercenary The first, an https:// URL, did not redirect, so I assume it failed to match, but the second, an http:// URL, redirected successfully, so I assume it succeeded to match. Does this mean anything to you? > > Which gets me back to the problem you're experiencing. My first > suggestion would be to triple check the regex condition which isn't > producing any matches. I'm pretty sure the regex condition is good, especially since a basic redirect without any regex also fails. > Second, what is it you're really trying to > achieve? I gather you want to tell that website to accept your browser > as a 'valid' one which can handle all the technology used there. Have > you tried simply setting Vimprobable's user agent string to something > Google will know and recognise? This is just a stab in the dark, of > course, but problems with Google pop up here on the list quite > frequently, and this seems to help with most of them. > I feel kind of dumb for not thinking of setting the user agent to something a little more common, especially after having gone through the mailing list archives before sending out my initial email! Well, it's certainly letting me do what I tried to accomplish with the Privoxy redirect action! I'm using docs.google.com without a hitch. That said, I'm still curious as to why I can't redirect https:// URL's. Is this a problem with just my setup, or is this a more general problem? I'm curious to know whether the trivial Privoxy redirect example above works for you, Hannes. Whatever's going on, my main problem is pretty much resolved. Thanks a lot! Janey From kasmra at vimprobable.mail.kapsi.fi Wed Oct 20 16:41:03 2010 From: kasmra at vimprobable.mail.kapsi.fi (Sami =?iso-8859-1?Q?M=E4ki?=) Date: Wed, 20 Oct 2010 19:41:03 +0300 Subject: [Vimprobable-users] About back/forward navigation Message-ID: <20101020164103.GA2582@debel> * Already sent this one to mailing-list but from a non-member email. Admin can freely delete that one. Here goes again, properly. * Hi, just out of curiousity: as a long-time Vimperator user (though I'm using Vimprobable more and more nowadays) I'm used to Vimperator's default keybinds for back (Ctrl-o) and forward (Ctrl-i). In Vimprobable, by default, these are mapped the other way around, Ctrl-o for forward and Ctrl-i for back. Of course, it's trivial to edit the two lines accordingly in config.h before compiling and that's usually the first thing I do (if the config.h has been changed significantly between versions). So I'm just wondering, why the decision to behave differently from Vimperator in this case? Thanks. -- Sami :wq From thomas at xteddy.org Wed Oct 20 17:06:25 2010 From: thomas at xteddy.org (Thomas Adam) Date: Wed, 20 Oct 2010 18:06:25 +0100 Subject: [Vimprobable-users] About back/forward navigation In-Reply-To: <20101020164103.GA2582@debel> References: <20101020164103.GA2582@debel> Message-ID: <20101020170621.GA3332@shuttle.home> On Wed, Oct 20, 2010 at 07:41:03PM +0300, Sami M?ki wrote: > * Already sent this one to mailing-list but from a non-member email. > Admin can freely delete that one. Here goes again, properly. * > > Hi, > > just out of curiousity: as a long-time Vimperator user (though I'm > using Vimprobable more and more nowadays) I'm used to Vimperator's > default keybinds for back (Ctrl-o) and forward (Ctrl-i). In > Vimprobable, by default, these are mapped the other way around, Ctrl-o > for forward and Ctrl-i for back. Horses for courses, really. If you really want an explanation, I'd guess and say that, when you consider that in other browsers; Left arrow key == back. Right arrow key == forward. And that you then consider: "i" key left of "o" key == back. "o" key right of "i" key == forward. Maybe that matches up? :) > Of course, it's trivial to edit the two lines accordingly in config.h > before compiling and that's usually the first thing I do (if the > config.h has been changed significantly between versions). > > So I'm just wondering, why the decision to behave differently from > Vimperator in this case? Because matching Vimperator exactly isn't a goal -- it has some interesting features, is all. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From kasmra at vimprobable.mail.kapsi.fi Wed Oct 20 17:25:51 2010 From: kasmra at vimprobable.mail.kapsi.fi (Sami =?iso-8859-1?Q?M=E4ki?=) Date: Wed, 20 Oct 2010 20:25:51 +0300 Subject: [Vimprobable-users] About back/forward navigation Message-ID: <20101020172551.GA8595@debel> On Wed, Oct 20, 2010 at 06:06:25PM +0100, Thomas Adam wrote: > Horses for courses, really. If you really want an explanation, I'd guess > and say that, when you consider that in other browsers; > > Left arrow key == back. > Right arrow key == forward. > > And that you then consider: > > "i" key left of "o" key == back. > "o" key right of "i" key == forward. > > Maybe that matches up? :) To put it that way, it actually makes sense. The "Ctrl-o == back" is just so deeply rooted in my muscle memory that I didn't even think about such obvious explanation. Cheers for the guess :) -- Sami :wq From thomas at xteddy.org Wed Oct 20 20:15:26 2010 From: thomas at xteddy.org (Thomas Adam) Date: Wed, 20 Oct 2010 21:15:26 +0100 Subject: [Vimprobable-users] [PATCH] Fix ftp:// and ftp. support. Message-ID: <20101020201522.GA16739@shuttle.home> libwebkit has no direct support for opening FTP sites, but will allow so over HTTP. That's fine, but Vimprobable has to support this by doing the following: (String prependage.) ftp.example.com => http://ftp.example.com (String prependage, having removed ftp:// prefix, hence): ftp://ftp.example.com => http://ftp.example.com --- main.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index a8f2ba1..cdc7f39 100644 --- a/main.c +++ b/main.c @@ -1105,7 +1105,23 @@ open(const Arg *arg) { ++s; } *p = '\0'; - } else if (strcspn(arg->s, "/") == 0 || strcspn(arg->s, "./") == 0) { /* prepend "file://" */ + + /* TA: This isn't ideal, but because a URL entered as: + * + * ftp://example.com + * + * Would already have been caught by the strstr() check above, + * we have to check for this here. + */ + if (g_str_has_prefix(arg->s, "ftp://")) { + /* Remove the "ftp://" prefix, and prepend it with + * "http://" + */ + new = g_strjoinv("http://", g_strsplit(arg->s, "ftp://", -1)); + } + } else if (g_str_has_prefix(arg->s, "ftp.")) { + new = g_strdup_printf("http://%s", arg->s); + } else if (strcspn(arg->s, "/") == 0 || strcspn(arg->s, "./") == 0) { /* prepend "file://" */ new = g_malloc(sizeof("file://") + len); strcpy(new, "file://"); memcpy(&new[sizeof("file://") - 1], arg->s, len + 1); -- 1.7.1 From tyler at monkeypox.org Thu Oct 21 03:10:43 2010 From: tyler at monkeypox.org (R. Tyler Croy) Date: Wed, 20 Oct 2010 20:10:43 -0700 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101017134630.GA18179@shuttle.home> References: <20101017134630.GA18179@shuttle.home> Message-ID: <20101021031042.GF23514@kiwi.local> On Sun, 17 Oct 2010, Thomas Adam wrote: > Currently, Vimprobable implements cookies by only referencing the cookie-jar > when that specific instance of Vimprobable loads -- if there's more than one > Vimprobable instance which then sets cookies, there's no way of other > instances to "share" cookies. This is annoying on sites like gmail, where > despite having a gmail window open, clicking a link to go to the calendar, > will force the user to reauthenticate. > > So instead, parse the headers of each request (via libsoup) to conditionally > set the cookie, by always looking in our cookie-jar first to see if it's > available, and if so, use it. FWIW, I've been testing this a bit, I use Vimprobable with some Yahoo! services such as Calendar for lack of a good Linux app, and the persistent cookie support works as advertised. Put me on the list of folks interested in seeing this work merged :) > > Thomas Adam (6): > Rename open() to open_arg() to avoid POSIX open(2) > Use > Define cookie-related function protoypes. > Setup signal-handling for cookies > Implement persistent-cookie support. > Introduce mop_up() > > config.h | 10 ++-- > includes.h | 1 + > keymap.h | 4 +- > main.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- > 4 files changed, 131 insertions(+), 26 deletions(-) > _______________________________________________ > Vimprobable-users mailing list > Vimprobable-users at vimprobable.org > http://vimprobable.org/mailman/listinfo/vimprobable-users - R. Tyler Croy -------------------------------------- GitHub: http://github.com/rtyler Twitter: http://twitter.com/agentdero -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From jasonwryan at gmail.com Thu Oct 21 22:56:20 2010 From: jasonwryan at gmail.com (Jason Ryan) Date: Fri, 22 Oct 2010 11:56:20 +1300 Subject: [Vimprobable-users] [PATCH] trivial errors in man page for V2 In-Reply-To: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> References: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> Message-ID: <4CC0C514.7060209@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - --- a/vimprobable2.1 2010-10-22 11:51:19.687347452 +1300 +++ b/vimprobable2.1 2010-10-22 11:52:45.415742166 +1300 @@ -93,7 +93,7 @@ .I " " zo Zoom text out - -.I " " zo +.I " " zO Zoom full content out .I " " zz @@ -113,7 +113,7 @@ .I " " gu Load URL one directory up - -.I " " gu +.I " " gU Load rootdirectory of current URL .I " " gh -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBAgAGBQJMwMUUAAoJEEReUuqxvU5ArTwH/1kdsbjS5wuUhdu5r6b4rFqC BmO3xYG4NL6L+yXQ8ITcCTqrOkambU5UDa7ZsJpRk76dwLKfp5gVQlbiCKPPPAp4 sqbA5DufXsN3NDZqxmz1dHQmvqHh0HLQKOJQATKqJ/zFKxhlqXECQPwUKdK12a3X Q7w9n5Wvj9Czbcs4wS9LMBD0mFh7eUwKRoKMugtTbB8oQK4/fULXzU75FdvaqhQP ug9SXGH9yHantGS+wOB04dLEYh4viXgs2izedgQ1dNtFcsJJ4q+Yu41YLWzdTryJ YL8VzlKqpIWcLiE8NEciKXdh/9S+QUdsj3Pv37miWVEslB0tE5wr91HCEQTvlkk= =21p4 -----END PGP SIGNATURE----- From thomas at xteddy.org Fri Oct 22 01:17:24 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 02:17:24 +0100 Subject: [Vimprobable-users] [PATCH] trivial errors in man page for V2 In-Reply-To: <4CC0C514.7060209@gmail.com> References: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> <4CC0C514.7060209@gmail.com> Message-ID: Hi, This patch needs a commit message; a justification for the change, etc. At first glance, this patch seems pointless. -- Thomas Adam From jasonwryan at gmail.com Fri Oct 22 01:21:59 2010 From: jasonwryan at gmail.com (Jason Ryan) Date: Fri, 22 Oct 2010 14:21:59 +1300 Subject: [Vimprobable-users] [PATCH] trivial errors in man page for V2 In-Reply-To: References: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> <4CC0C514.7060209@gmail.com> Message-ID: <4CC0E737.5040600@gmail.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/22/2010 02:17 PM, Thomas Adam wrote: > Hi, > > This patch needs a commit message; a justification for the change, > etc. At first glance, this patch seems pointless. > > -- Thomas Adam Forgive me: I flagged it as trivial because it is. I was just trying to get some typos in the man page fixed - please excuse a clumsy attempt made in good faith to improve the documentation. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAEBAgAGBQJMwOc3AAoJEEReUuqxvU5AexgH/jISzuuF0AjnAIh8KDulBjte OA0E3TYeKPiNox3LlelbnyfBTmmFGAVR/P8aYjR2U+G2LD5uHIDz6/Awh5eLiqfp qeMFkE6DLO2xkUiWiioQ40WWdgFQuQ3sCjFuyhATih8Q5rRc12n/3ESouSh8LzNb c8/OrMQ8OMtji0D0C44CDF/FGA0/8CQ+5M+ih6QW4z692Gzsvxd9IVp4EyCT2Lsz Mv8edqTkZpHGIHeWugFpt2crnr6Cz+zF0rAOWQDmWGe6TNmUljroAdAwQUyLE7eb 2BeBS4VCRZIN3H3aYaxABZmfElepxjh/gzI19znbQkXIWW5cW1oRwI8m6DtGjS8= =/wsu -----END PGP SIGNATURE----- From thomas at xteddy.org Fri Oct 22 08:24:40 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 09:24:40 +0100 Subject: [Vimprobable-users] [PATCH] trivial errors in man page for V2 In-Reply-To: <4CC0E737.5040600@gmail.com> References: <1287431112-26978-1-git-send-email-hpdeifel@gmx.de> <4CC0C514.7060209@gmail.com> <4CC0E737.5040600@gmail.com> Message-ID: <20101022082437.GA2871@abacus.soton.smoothwall.net> Hi! On Fri, Oct 22, 2010 at 02:21:59PM +1300, Jason Ryan wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 10/22/2010 02:17 PM, Thomas Adam wrote: > > Hi, > > > > This patch needs a commit message; a justification for the change, > > etc. At first glance, this patch seems pointless. > > > > -- Thomas Adam > > Forgive me: I flagged it as trivial because it is. > > I was just trying to get some typos in the man page fixed - please > excuse a clumsy attempt made in good faith to improve the documentation. Oh, I'm all for documentation fixes, it's just that your patch had some issues: * It makes claim to fixing vimprobable2's manpage, but that doesn't contain same information as stated in the patch. * You're actually fixing the man page for vimprobable1. * Your patch seems to be hand-crafted, or completely and utterly mangled by your MUA; I can't tell which. * I had to fix your patch up manually, by basically doing the changes as your patch couldn't be applied to vimprobable.1 at all. How did you go about generating this patch? It's a good effort, but this one annoyance where (in this case), my time was wasted more fixing up trivial mistakes. See attached -- is this what you meant? -- Thomas Adam -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Fix-keybinding-mappings-in-vimprobable1-manpage.patch Type: text/x-diff Size: 920 bytes Desc: not available URL: From thomas at xteddy.org Fri Oct 22 09:18:07 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 10:18:07 +0100 Subject: [Vimprobable-users] [PATCH] Free values in echo() by default. Message-ID: <20101022091752.GA8158@abacus.soton.smoothwall.net> There's too many instances where the caller of echo() has malloc()d a char* but never frees it, resulting in annoying memory-leaks. Try and reduce this by always freeing the data received to echo(). --- main.c | 30 +++++++++++++++--------------- utilities.c | 3 --- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/main.c b/main.c index a8f2ba1..865ed1a 100644 --- a/main.c +++ b/main.c @@ -325,7 +325,7 @@ webview_keypress_cb(WebKitWebView *webview, GdkEventKey *event) { memset(inputBuffer, 0, 65); if (event->keyval == GDK_Escape) { a.i = Info; - a.s = ""; + a.s = g_strdup(""); echo(&a); } else if (current_modkey == 0 && ((event->keyval >= GDK_1 && event->keyval <= GDK_9) || (event->keyval == GDK_0 && count))) { @@ -569,7 +569,6 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { a.i = Error; a.s = g_strdup_printf("Not a browser command: %s", &text[1]); echo(&a); - g_free(a.s); } else if (!success) { a.i = Error; if (error_msg != NULL) { @@ -580,7 +579,6 @@ inputbox_activate_cb(GtkEntry *entry, gpointer user_data) { a.s = g_strdup_printf("Unknown error. Please file a bug report!"); } echo(&a); - g_free(a.s); } } else if ((forward = text[0] == '/') || text[0] == '?') { webkit_web_view_unmark_text_matches(webview); @@ -997,6 +995,12 @@ echo(const Arg *arg) { set_widget_font_and_color(inputbox, urlboxfont[index], urlboxbgcolor[index], urlboxcolor[index]); gtk_entry_set_text(GTK_ENTRY(inputbox), !arg->s ? "" : arg->s); + /* TA: Always free arg->s here, rather than relying on the caller to do + * this. + */ + if (arg->s) + g_free(arg->s); + return TRUE; } @@ -1239,7 +1243,6 @@ search(const Arg *arg) { direction ? "BOTTOM" : "TOP", direction ? "TOP" : "BOTTOM"); echo(&a); - g_free(a.s); } else break; } else @@ -1250,7 +1253,6 @@ search(const Arg *arg) { a.i = Error; a.s = g_strdup_printf("Pattern not found: %s", search_handle); echo(&a); - g_free(a.s); } return TRUE; } @@ -1269,15 +1271,15 @@ set(const Arg *arg) { gtk_widget_grab_focus(GTK_WIDGET(webview)); break; case ModePassThrough: - a.s = "-- PASS THROUGH --"; + a.s = g_strdup("-- PASS THROUGH --"); echo(&a); break; case ModeSendKey: - a.s = "-- PASS TROUGH (next) --"; + a.s = g_strdup("-- PASS TROUGH (next) --"); echo(&a); break; case ModeInsert: /* should not be called manually but automatically */ - a.s = "-- INSERT --"; + a.s = g_strdup("-- INSERT --"); echo(&a); break; case ModeHints: @@ -1349,7 +1351,6 @@ quickmark(const Arg *a) { x.i = Error; x.s = g_strdup_printf("Quickmark %d not defined", b); echo(&x); - g_free(x.s); return false; } } @@ -1372,7 +1373,7 @@ script(const Arg *arg) { } if (arg->i != Silent && value) { a.i = arg->i; - a.s = value; + a.s = g_strdup(value); echo(&a); } if (value) { @@ -1444,7 +1445,7 @@ fake_key_event(const Arg *a) { err.i = Error; Display *xdpy; if ( (xdpy = XOpenDisplay(NULL)) == NULL ) { - err.s = "Couldn't find the XDisplay."; + err.s = g_strdup("Couldn't find the XDisplay."); echo(&err); return FALSE; } @@ -1459,7 +1460,7 @@ fake_key_event(const Arg *a) { xk.state = a->i; if( ! a->s ) { - err.s = "Zero pointer as argument! Check your config.h"; + err.s = g_strdup("Zero pointer as argument! Check your config.h"); echo(&err); return FALSE; } @@ -1472,14 +1473,14 @@ fake_key_event(const Arg *a) { } if( (xk.keycode = XKeysymToKeycode(xdpy, keysym)) == NoSymbol ) { - err.s = "Couldn't translate keysym to keycode"; + err.s = g_strdup("Couldn't translate keysym to keycode"); echo(&err); return FALSE; } xk.type = KeyPress; if( !XSendEvent(xdpy, embed, True, KeyPressMask, (XEvent *)&xk) ) { - err.s = "XSendEvent failed"; + err.s = g_strdup("XSendEvent failed"); echo(&err); return FALSE; } @@ -2209,7 +2210,6 @@ main(int argc, char *argv[]) { a.i = Error; a.s = g_strdup_printf("Error in config file"); echo(&a); - g_free(a.s); } /* command line argument: URL */ diff --git a/utilities.c b/utilities.c index 36298f7..281b30e 100644 --- a/utilities.c +++ b/utilities.c @@ -76,7 +76,6 @@ process_save_qmark(const char *bm, WebKitWebView *webview) a.i = Error; a.s = g_strdup_printf("Invalid quickmark, only 1-9"); echo(&a); - g_free(a.s); return TRUE; } if ( uri == NULL ) return FALSE; @@ -113,7 +112,6 @@ process_save_qmark(const char *bm, WebKitWebView *webview) a.i = Error; a.s = g_strdup_printf("Saved as quickmark %d: %s", mark, uri); echo(&a); - g_free(a.s); return TRUE; } @@ -404,5 +402,4 @@ give_feedback(const char *feedback) a.s = g_strdup_printf(feedback); echo(&a); - g_free(a.s); } -- 1.7.1 From hannes at yllr.net Fri Oct 22 17:50:19 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 22 Oct 2010 19:50:19 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101017134630.GA18179@shuttle.home> References: <20101017134630.GA18179@shuttle.home> Message-ID: <20101022195019.76b7be88@workstation> I've been using this in a production environment for a few days now. I can't really objectify this, of course, but there is the definite impression that any sessions based on cookie information now seem to end quite quickly/abrubtly. I seem to find myself being logged out constantly where before, nothing along these lines ever happened. Any ideas what could be causing this? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Fri Oct 22 20:19:50 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 21:19:50 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101022195019.76b7be88@workstation> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> Message-ID: <20101022201933.GA4573@shuttle.home> On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > I've been using this in a production environment for a few days now. I > can't really objectify this, of course, but there is the definite > impression that any sessions based on cookie information now seem to > end quite quickly/abrubtly. I seem to find myself being logged out > constantly where before, nothing along these lines ever happened. Any > ideas what could be causing this? Likely the lifetime of the cookie, as defined by "sessiontime". Try upping the value or setting it to zero, perhaps? It's not something I've encountered, but for some sites, perhaps it's too low. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From thomas at xteddy.org Fri Oct 22 20:23:10 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 21:23:10 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101022201933.GA4573@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> <20101022201933.GA4573@shuttle.home> Message-ID: <20101022202309.GB4573@shuttle.home> On Fri, Oct 22, 2010 at 09:19:50PM +0100, Thomas Adam wrote: > On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > > I've been using this in a production environment for a few days now. I > > can't really objectify this, of course, but there is the definite > > impression that any sessions based on cookie information now seem to > > end quite quickly/abrubtly. I seem to find myself being logged out > > constantly where before, nothing along these lines ever happened. Any > > ideas what could be causing this? > > Likely the lifetime of the cookie, as defined by "sessiontime". Try upping s/sessiontime/cookie_timeout/ > the value or setting it to zero, perhaps? It's not something I've > encountered, but for some sites, perhaps it's too low. > > -- Thomas Adam > > -- > "Deep in my heart I wish I was wrong. But deep in my heart I know I am > not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hannes at yllr.net Fri Oct 22 20:53:19 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Fri, 22 Oct 2010 22:53:19 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101022201933.GA4573@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> <20101022201933.GA4573@shuttle.home> Message-ID: <20101022225319.6413ba04@workstation> Sorry, sent this to Thomas directly again. Either something is wrong with your mails' headers or my client's interpretation of them. Thomas Adam wrote: > On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > > I've been using this in a production environment for a few days > > now. I can't really objectify this, of course, but there is the > > definite impression that any sessions based on cookie information > > now seem to end quite quickly/abrubtly. I seem to find myself being > > logged out constantly where before, nothing along these lines ever > > happened. Any ideas what could be causing this? > > Likely the lifetime of the cookie, as defined by "sessiontime". Try > upping the value or setting it to zero, perhaps? It's not something > I've encountered, but for some sites, perhaps it's too low. It's not a problem of the websites. This is what happens: When I don't call a website which reads or writes cookies for too long, the next call /to/ one with cookies will cause the cookies file to be emptied and recreated with /just/ the cookies of that site last called. All other cookies are lost. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Fri Oct 22 20:54:41 2010 From: thomas at xteddy.org (Thomas Adam) Date: Fri, 22 Oct 2010 21:54:41 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101022225319.6413ba04@workstation> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> <20101022201933.GA4573@shuttle.home> <20101022225319.6413ba04@workstation> Message-ID: <20101022205439.GC4573@shuttle.home> On Fri, Oct 22, 2010 at 10:53:19PM +0200, Hannes Sch?ller wrote: > Sorry, sent this to Thomas directly again. Either something is wrong > with your mails' headers or my client's interpretation of them. > > Thomas Adam wrote: > > On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > > > I've been using this in a production environment for a few days > > > now. I can't really objectify this, of course, but there is the > > > definite impression that any sessions based on cookie information > > > now seem to end quite quickly/abrubtly. I seem to find myself being > > > logged out constantly where before, nothing along these lines ever > > > happened. Any ideas what could be causing this? > > > > Likely the lifetime of the cookie, as defined by "sessiontime". Try > > upping the value or setting it to zero, perhaps? It's not something > > I've encountered, but for some sites, perhaps it's too low. > > It's not a problem of the websites. This is what happens: When I don't > call a website which reads or writes cookies for too long, the next > call /to/ one with cookies will cause the cookies file to be emptied > and recreated with /just/ the cookies of that site last called. All > other cookies are lost. Do you have an example? I don't see this at all with the sites I visit. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From tyler at monkeypox.org Fri Oct 22 23:33:32 2010 From: tyler at monkeypox.org (R. Tyler Croy) Date: Fri, 22 Oct 2010 16:33:32 -0700 Subject: [Vimprobable-users] vimprobable2 opening on the wrong workspace Message-ID: <20101022233331.GC4599@kiwi.sharlinx.com> I'm using ScrotWM and I'm noticing that tabopened windows retain a "workspace affinity". For example, on Workspace 1 (WS1) I open vimprobable2. While browsing around I decide to :tabopen http://www.bing.com. The subsequent window is moved to WS2. In that new window, anything I :tabopen or right click and "open in a new window" will open up on WS1, despite the window being focused on WS2. Is this behavior anybody else has noticed? Is it a bug to be fixed or shall I patch it in my local builds of vimprobable2? Cheers - R. Tyler Croy -------------------------------------- GitHub: http://github.com/rtyler Twitter: http://twitter.com/agentdero -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Sat Oct 23 04:37:57 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 23 Oct 2010 05:37:57 +0100 Subject: [Vimprobable-users] vimprobable2 opening on the wrong workspace In-Reply-To: <20101022233331.GC4599@kiwi.sharlinx.com> References: <20101022233331.GC4599@kiwi.sharlinx.com> Message-ID: <20101023043755.GA3418@shuttle.home> On Fri, Oct 22, 2010 at 04:33:32PM -0700, R. Tyler Croy wrote: > I'm using ScrotWM and I'm noticing that tabopened windows retain a "workspace > affinity". > > For example, on Workspace 1 (WS1) I open vimprobable2. While browsing around I > decide to :tabopen http://www.bing.com. The subsequent window is moved to WS2. > > > In that new window, anything I :tabopen or right click and "open in a new > window" will open up on WS1, despite the window being focused on WS2. > > > Is this behavior anybody else has noticed? Is it a bug to be fixed or shall I > patch it in my local builds of vimprobable2? I dread to think what ScotWM does, but this has nothing to do with Vimprobable. The window class is consistently Vimprobable2 (in version 2's case) which you should be using to place Vimprobable windows on workspaces, since the window title changes all the time, which is the only reason I can think of as to why you're seeing this behaviour. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hannes at yllr.net Sat Oct 23 08:39:02 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sat, 23 Oct 2010 10:39:02 +0200 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101022205439.GC4573@shuttle.home> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> <20101022201933.GA4573@shuttle.home> <20101022225319.6413ba04@workstation> <20101022205439.GC4573@shuttle.home> Message-ID: <20101023103902.01448a92@workstation> Thomas Adam wrote: > On Fri, Oct 22, 2010 at 10:53:19PM +0200, Hannes Sch?ller wrote: > > Sorry, sent this to Thomas directly again. Either something is wrong > > with your mails' headers or my client's interpretation of them. > > > > Thomas Adam wrote: > > > On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > > > > I've been using this in a production environment for a few days > > > > now. I can't really objectify this, of course, but there is the > > > > definite impression that any sessions based on cookie > > > > information now seem to end quite quickly/abrubtly. I seem to > > > > find myself being logged out constantly where before, nothing > > > > along these lines ever happened. Any ideas what could be > > > > causing this? > > > > > > Likely the lifetime of the cookie, as defined by "sessiontime". > > > Try upping the value or setting it to zero, perhaps? It's not > > > something I've encountered, but for some sites, perhaps it's too > > > low. > > > > It's not a problem of the websites. This is what happens: When I > > don't call a website which reads or writes cookies for too long, > > the next call /to/ one with cookies will cause the cookies file to > > be emptied and recreated with /just/ the cookies of that site last > > called. All other cookies are lost. > > Do you have an example? I don't see this at all with the sites I > visit. Any PHPBB based forum seems to be doing this. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Sat Oct 23 08:51:57 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 23 Oct 2010 09:51:57 +0100 Subject: [Vimprobable-users] [PATCH 0/6] Revamp cookie support. In-Reply-To: <20101023103902.01448a92@workstation> References: <20101017134630.GA18179@shuttle.home> <20101022195019.76b7be88@workstation> <20101022201933.GA4573@shuttle.home> <20101022225319.6413ba04@workstation> <20101022205439.GC4573@shuttle.home> <20101023103902.01448a92@workstation> Message-ID: <20101023085155.GB3418@shuttle.home> On Sat, Oct 23, 2010 at 10:39:02AM +0200, Hannes Sch?ller wrote: > Thomas Adam wrote: > > On Fri, Oct 22, 2010 at 10:53:19PM +0200, Hannes Sch?ller wrote: > > > Sorry, sent this to Thomas directly again. Either something is wrong > > > with your mails' headers or my client's interpretation of them. > > > > > > Thomas Adam wrote: > > > > On Fri, Oct 22, 2010 at 07:50:19PM +0200, Hannes Sch?ller wrote: > > > > > I've been using this in a production environment for a few days > > > > > now. I can't really objectify this, of course, but there is the > > > > > definite impression that any sessions based on cookie > > > > > information now seem to end quite quickly/abrubtly. I seem to > > > > > find myself being logged out constantly where before, nothing > > > > > along these lines ever happened. Any ideas what could be > > > > > causing this? > > > > > > > > Likely the lifetime of the cookie, as defined by "sessiontime". > > > > Try upping the value or setting it to zero, perhaps? It's not > > > > something I've encountered, but for some sites, perhaps it's too > > > > low. > > > > > > It's not a problem of the websites. This is what happens: When I > > > don't call a website which reads or writes cookies for too long, > > > the next call /to/ one with cookies will cause the cookies file to > > > be emptied and recreated with /just/ the cookies of that site last > > > called. All other cookies are lost. > > > > Do you have an example? I don't see this at all with the sites I > > visit. > > Any PHPBB based forum seems to be doing this. I see it now, thanks -- expect a patch later on today. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From matto at matto.nl Sun Oct 24 21:12:09 2010 From: matto at matto.nl (Matto Fransen) Date: Sun, 24 Oct 2010 23:12:09 +0200 Subject: [Vimprobable-users] Patch to add tabcompletion on tags Message-ID: <20101024211207.GA3758@aspire.tradesystem.nl> Hi, The attached patch will implement tab-completion on tags in :qt -tab It is still a bit rough, but perhaps somebody will have a look at it :) Cheers, Matto -------------- next part -------------- A non-text attachment was scrubbed... Name: tagcompletion.patch Type: text/x-diff Size: 2351 bytes Desc: not available URL: From thomas at xteddy.org Mon Oct 25 15:03:53 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:03:53 +0100 Subject: [Vimprobable-users] [PATCH v2 0/9] Revamp cookie support Message-ID: <20101025150342.GA8916@abacus.soton.smoothwall.net> Much the same as series 1, except the internal cookie-handling is now done with two cookie jars -- one is the persistent storage on disk as before. Patch 9/9 is likely the only one people will care about, although I'm re-rolling the series here for completeness. Unlike the original implementation though where the entire thing relied around looking in a single cookie-jar, each Vimprobable session now has its own session cookie jar which it uses to handle cookies -- this is updated each time cookie modifications happens, and the session store per Vimprobable instances is repopulated with the on-store cookie contents. This is far from ideal -- the comment block in update_cookie_jar() explains most of the reasons, although from my soak testing of it here, it seems to work OK. Yes, file truncations are going to happen, although this is somewhat mitigated by the session cookie-jar refreshing -- I've certainly not encountered any issues witn it; not since I realised how/why the truncation was happening in the first place. libsoup implements a "changed" signal for when the cookie-jar is updated, although this has problems because it's impossible to differentiate between what's changed in the jar; this has huge problems in terms of cookie-sharing between Vimprobable instances, hence why it's not used. I'd be very interested to know who is testing this, and if it's an improvement over the first series I sent out. I apologise for the history of these patches -- I can always rebase them to make them look cleaner, although patch 9/9 shows the bulk of the logic rework, hence why I've left it in. Any questions, do shout! -- Thomas Adam Thomas Adam (9): Rename open() to open_arg() to avoid POSIX open(2) Use Define cookie-related function protoypes. Setup signal-handling for cookies Implement persistent-cookie support. Introduce mop_up() Include for close() Use a single point-of-reference for cookie-jar Further redefine cookie stores. --- config.h | 10 ++-- includes.h | 2 + keymap.h | 4 +- main.c | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 215 insertions(+), 28 deletions(-) From thomas at xteddy.org Mon Oct 25 15:04:41 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:04:41 +0100 Subject: [Vimprobable-users] [PATCH v2 1/9] Rename open() to open_arg() to avoid POSIX open(2) Message-ID: <20101025150433.GA9305@abacus.soton.smoothwall.net> Vimprobable defines an open prototype of open(const Arg *) -- which is fine, but this has potential to clash with the more common open(2) syscall. Redefine Vimprobable's version to not conflict. --- config.h | 10 +++++----- keymap.h | 4 ++-- main.c | 22 +++++++++++----------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config.h b/config.h index 5fcce2c..f9fbab6 100644 --- a/config.h +++ b/config.h @@ -101,8 +101,8 @@ Command commands[] = { { "fo", navigate, {NavigationForward} }, { "forward", navigate, {NavigationForward} }, { "javascript", script, {Silent} }, - { "o", open, {TargetCurrent} }, - { "open", open, {TargetCurrent} }, + { "o", open_arg, {TargetCurrent} }, + { "open", open_arg, {TargetCurrent} }, { "q", quit, {0} }, { "quit", quit, {0} }, { "re", navigate, {NavigationReload} }, @@ -112,8 +112,8 @@ Command commands[] = { { "qt", search_tag, {0} }, { "st", navigate, {NavigationCancel} }, { "stop", navigate, {NavigationCancel} }, - { "t", open, {TargetNew} }, - { "tabopen", open, {TargetNew} }, + { "t", open_arg, {TargetNew} }, + { "tabopen", open_arg, {TargetNew} }, { "print", print_frame, {0} }, { "bma", bookmark, {0} }, { "bookmark", bookmark, {0} }, @@ -141,7 +141,7 @@ static Mouse mouse[] = { /* modmask, modkey, button, function, argument */ { 0, 0, MOUSE_BUTTON_2, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK, rememberedURI} }, { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_2, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, - { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open, {TargetNew, rememberedURI} }, + { GDK_CONTROL_MASK, 0, MOUSE_BUTTON_1, open_arg, {TargetNew, rememberedURI} }, }; /* settings (arguments of :set command) */ diff --git a/keymap.h b/keymap.h index c6d0f10..125a2c0 100644 --- a/keymap.h +++ b/keymap.h @@ -75,8 +75,8 @@ Key keys[] = { { 0, GDK_g, GDK_u, descend, {NthSubdir} }, { GDK_SHIFT_MASK, GDK_g, GDK_U, descend, {Rootdir} }, - { 0, GDK_g, GDK_h, open, {TargetCurrent, startpage} }, - { GDK_SHIFT_MASK, GDK_g, GDK_H, open, {TargetNew, startpage} }, + { 0, GDK_g, GDK_h, open_arg, {TargetCurrent, startpage} }, + { GDK_SHIFT_MASK, GDK_g, GDK_H, open_arg, {TargetNew, startpage} }, { 0, 0, GDK_p, paste, {TargetCurrent | ClipboardPrimary | ClipboardGTK} }, { GDK_SHIFT_MASK, 0, GDK_P, paste, {TargetNew | ClipboardPrimary | ClipboardGTK} }, diff --git a/main.c b/main.c index a8f2ba1..5a6c212 100644 --- a/main.c +++ b/main.c @@ -49,7 +49,7 @@ static gboolean focus_input(const Arg *arg); static gboolean input(const Arg *arg); static gboolean navigate(const Arg *arg); static gboolean number(const Arg *arg); -static gboolean open(const Arg *arg); +static gboolean open_arg(const Arg *arg); static gboolean paste(const Arg *arg); static gboolean quickmark(const Arg *arg); static gboolean quit(const Arg *arg); @@ -197,7 +197,7 @@ webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, gpo if (strlen(rememberedURI) > 0) { a.s = rememberedURI; } - open(&a); + open_arg(&a); return FALSE; } @@ -205,7 +205,7 @@ gboolean webview_new_window_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetworkRequest *request, WebKitWebNavigationAction *action, WebKitWebPolicyDecision *decision, gpointer user_data) { Arg a = { .i = TargetNew, .s = (char*)webkit_network_request_get_uri(request) }; - open(&a); + open_arg(&a); webkit_web_policy_decision_ignore(decision); return TRUE; } @@ -1065,7 +1065,7 @@ number(const Arg *arg) { } gboolean -open(const Arg *arg) { +open_arg(const Arg *arg) { char *argv[6]; char *s = arg->s, *p, *new; Arg a = { .i = NavigationReload }; @@ -1152,7 +1152,7 @@ paste(const Arg *arg) { /* If we're over a link, open it in a new target. */ if (strlen(rememberedURI) > 0) { Arg new_target = { .i = TargetNew, .s = arg->s }; - open(&new_target); + open_arg(&new_target); return TRUE; } @@ -1161,7 +1161,7 @@ paste(const Arg *arg) { if (!a.s && arg->i & ClipboardGTK) a.s = gtk_clipboard_wait_for_text(clipboards[1]); if (a.s) - open(&a); + open_arg(&a); return TRUE; } @@ -1198,7 +1198,7 @@ revive(const Arg *arg) { } if (strlen(buffer) > 0) { a.s = buffer; - open(&a); + open_arg(&a); return TRUE; } return FALSE; @@ -1343,7 +1343,7 @@ quickmark(const Arg *a) { char *ptr = strrchr(buf, '\n'); *ptr = '\0'; Arg x = { .s = buf }; - if ( strlen(buf)) return open(&x); + if ( strlen(buf)) return open_arg(&x); else { x.i = Error; @@ -1395,7 +1395,7 @@ script(const Arg *arg) { a.i = TargetCurrent; memset(followTarget, 0, 8); a.s = (value + 5); - open(&a); + open_arg(&a); } } g_free(value); @@ -1838,7 +1838,7 @@ search_tag(const Arg * a) { while (s[i] && !isspace(s[i])) url[k++] = s[i++]; url[k] = '\0'; Arg x = { .i = TargetNew, .s = url }; - open (&x); + open_arg(&x); } } intag = 0; @@ -2221,7 +2221,7 @@ main(int argc, char *argv[]) { a.i = TargetCurrent; a.s = url; - open(&a); + open_arg(&a); gtk_main(); return EXIT_SUCCESS; -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:05:18 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:05:18 +0100 Subject: [Vimprobable-users] [PATCH v2 2/9] Use Message-ID: <20101025150512.GA9638@abacus.soton.smoothwall.net> Needed for LOCK_* symbols, used with cookie-handling support. --- includes.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/includes.h b/includes.h index fe7d9bf..2e57539 100644 --- a/includes.h +++ b/includes.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:05:48 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:05:48 +0100 Subject: [Vimprobable-users] [PATCH v2 3/9] Define cookie-related function protoypes. Message-ID: <20101025150539.GA9827@abacus.soton.smoothwall.net> This adds in all the cookie-related prototypes needed to handle cookies persistently. --- main.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index 5a6c212..76f97a4 100644 --- a/main.c +++ b/main.c @@ -139,6 +139,18 @@ int maxcommands = 0; int commandpointer = 0; KeyList *keylistroot = NULL; +/* Cookie-related information. + * + * Note that this cannot be surrounded by #ifdef blocks for + * ENABLE_COOKIE_SUPPORT + */ +static time_t cookie_timeout = 4800; +static char *cookie_store; +static void handle_cookie_request(SoupMessage *soup_msg, gpointer unused); +static const char *get_cookies(SoupURI *soup_uri); +static void set_single_cookie(SoupCookie *cookie); +static void new_generic_request(SoupSession *soup_ses, SoupMessage *soup_msg, gpointer unused); + /* callbacks */ void window_destroyed_cb(GtkWidget *window, gpointer func_data) { -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:06:17 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:06:17 +0100 Subject: [Vimprobable-users] [PATCH v2 4/9] Setup signal-handling for cookies Message-ID: <20101025150608.GA10013@abacus.soton.smoothwall.net> Conditionally hook into the GObject system (assuming ENABLE_COOKIES has been set) so that we can then parse the cookie fromt the response headers. --- main.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index 76f97a4..bb29495 100644 --- a/main.c +++ b/main.c @@ -2095,9 +2095,7 @@ setup_settings() { SoupURI *proxy_uri; char *filename, *new; int len; -#ifdef ENABLE_COOKIE_SUPPORT - SoupCookieJar *cookiejar; -#endif + session = webkit_get_default_session(); g_object_set((GObject*)settings, "default-font-size", DEFAULT_FONT_SIZE, NULL); g_object_set((GObject*)settings, "enable-scripts", enablePlugins, NULL); @@ -2110,11 +2108,11 @@ setup_settings() { g_object_get((GObject*)settings, "zoom-step", &zoomstep, NULL); webkit_web_view_set_settings(webview, settings); #ifdef ENABLE_COOKIE_SUPPORT - filename = g_strdup_printf(COOKIES_STORAGE_FILENAME); - cookiejar = soup_cookie_jar_text_new(filename, COOKIES_STORAGE_READONLY); - g_free(filename); - soup_session_add_feature(session, (SoupSessionFeature*)cookiejar); + cookie_store = g_strdup_printf(COOKIES_STORAGE_FILENAME); + soup_session_remove_feature_by_type(session, soup_cookie_get_type()); + soup_session_remove_feature_by_type(session, soup_cookie_jar_get_type()); #endif + /* proxy */ if (use_proxy == TRUE) { filename = (char *)g_getenv("http_proxy"); @@ -2135,6 +2133,10 @@ setup_settings() { void setup_signals() { +#ifdef ENABLE_COOKIE_SUPPORT + /* Headers. */ + g_signal_connect_after((GObject*)session, "request-started", (GCallback)new_generic_request, NULL); +#endif /* window */ g_object_connect((GObject*)window, "signal::destroy", (GCallback)window_destroyed_cb, NULL, -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:06:42 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:06:42 +0100 Subject: [Vimprobable-users] [PATCH v2 5/9] Implement persistent-cookie support. Message-ID: <20101025150635.GA10187@abacus.soton.smoothwall.net> Previously, Vimprobable only defined one cookie-store per running instance; effectively, this meant that cookies set by one instance of Vimprobable could never see the newer cookies, because the cookiejar was only ever queried once; when it loaded. Introduce parsing of the header requests we receive so that we can interrogate cookies per-request. This will give the allusion of "shared" cookies. --- main.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index bb29495..64bc145 100644 --- a/main.c +++ b/main.c @@ -2175,6 +2175,86 @@ setup_signals() { "inspect-web-view", (GCallback)inspector_inspect_web_view_cb, NULL); } +#ifdef ENABLE_COOKIE_SUPPORT +/* TA: XXX - we should be using this callback for any header-requests we + * receive (hence the name "new_generic_request" -- but for now, its use + * is limited to handling cookies. + */ +void +new_generic_request(SoupSession *session, SoupMessage *soup_msg, gpointer unused) { + SoupMessageHeaders *soup_msg_h; + SoupURI *uri; + const char *cookie_str; + + soup_msg_h = soup_msg->request_headers; + soup_message_headers_remove(soup_msg_h, "Cookie"); + uri = soup_message_get_uri(soup_msg); + if( (cookie_str = get_cookies(uri)) ) + soup_message_headers_append(soup_msg_h, "Cookie", cookie_str); + + g_signal_connect_after(G_OBJECT(soup_msg), "got-headers", G_CALLBACK(handle_cookie_request), NULL); +} + +const char * +get_cookies(SoupURI *soup_uri) { + const char *cookie_str; + SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, TRUE); + cookie_str = soup_cookie_jar_get_cookies(jar, soup_uri, TRUE); + g_object_unref(jar); + return cookie_str; +} + +void +handle_cookie_request(SoupMessage *soup_msg, gpointer unused) { + GSList *resp_cookie; + + for(resp_cookie = soup_cookies_from_response(soup_msg); + resp_cookie; + resp_cookie = g_slist_next(resp_cookie)) + { + set_single_cookie((SoupCookie *)resp_cookie->data); + } +} + +void +set_single_cookie(SoupCookie *cookie) { + int lock; + + if (!cookie) + { + /* TA: Then what? This shouldn't happen. */ + { + Arg arg_error; + arg_error.i = Error; + arg_error.s = g_strdup("Invalid cookie from header"); + echo(&arg_error); + g_free(arg_error.s); + } + + return; + } + + lock = open(cookie_store, 0); + flock(lock, LOCK_EX); + + SoupDate *soup_date; + SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, FALSE); + cookie = soup_cookie_copy(cookie); + + if (cookie_timeout && cookie->expires == NULL) { + soup_date = soup_date_new_from_time_t(time(NULL) + cookie_timeout); + soup_cookie_set_expires(cookie, soup_date); + } + + soup_cookie_jar_add_cookie(jar, cookie); + g_object_unref(jar); + + flock(lock, LOCK_UN); + close(lock); +} +#endif + + int main(int argc, char *argv[]) { static Arg a; -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:07:25 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:07:25 +0100 Subject: [Vimprobable-users] [PATCH v2 6/9] Introduce mop_up() Message-ID: <20101025150717.GA10342@abacus.soton.smoothwall.net> Generic function to do any clean up work -- such as free()ing values, unlocking files, etc., etc. --- main.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/main.c b/main.c index 64bc145..f51b19f 100644 --- a/main.c +++ b/main.c @@ -86,7 +86,7 @@ void toggle_scrollbars(gboolean onoff); gboolean process_keypress(GdkEventKey *event); void fill_suggline(char * suggline, const char * command, const char *fill_with); GtkWidget * fill_eventbox(const char * completion_line); - +static void mop_up(void); #include "main.h" @@ -2254,6 +2254,14 @@ set_single_cookie(SoupCookie *cookie) { } #endif +void +mop_up(void) { + /* Free up any nasty globals before exiting. */ + if (cookie_store) + g_free(cookie_store); + + return; +} int main(int argc, char *argv[]) { @@ -2318,5 +2326,7 @@ main(int argc, char *argv[]) { open_arg(&a); gtk_main(); + mop_up(); + return EXIT_SUCCESS; } -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:07:54 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:07:54 +0100 Subject: [Vimprobable-users] [PATCH v2 7/9] Include for close() Message-ID: <20101025150747.GA10625@abacus.soton.smoothwall.net> Needed when calling close() --- includes.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/includes.h b/includes.h index 2e57539..f809827 100644 --- a/includes.h +++ b/includes.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:08:19 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:08:19 +0100 Subject: [Vimprobable-users] [PATCH v2 8/9] Use a single point-of-reference for cookie-jar Message-ID: <20101025150813.GA10791@abacus.soton.smoothwall.net> We can only ever use one instance of the cookie jar if we want to retain or throw-away persistency. --- main.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index f51b19f..7093f73 100644 --- a/main.c +++ b/main.c @@ -144,6 +144,7 @@ KeyList *keylistroot = NULL; * Note that this cannot be surrounded by #ifdef blocks for * ENABLE_COOKIE_SUPPORT */ +static SoupCookieJar *cookie_jar = NULL; static time_t cookie_timeout = 4800; static char *cookie_store; static void handle_cookie_request(SoupMessage *soup_msg, gpointer unused); @@ -2109,6 +2110,7 @@ setup_settings() { webkit_web_view_set_settings(webview, settings); #ifdef ENABLE_COOKIE_SUPPORT cookie_store = g_strdup_printf(COOKIES_STORAGE_FILENAME); + cookie_jar = soup_cookie_jar_text_new(cookie_store, COOKIES_STORAGE_READONLY); soup_session_remove_feature_by_type(session, soup_cookie_get_type()); soup_session_remove_feature_by_type(session, soup_cookie_jar_get_type()); #endif @@ -2198,9 +2200,7 @@ new_generic_request(SoupSession *session, SoupMessage *soup_msg, gpointer unused const char * get_cookies(SoupURI *soup_uri) { const char *cookie_str; - SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, TRUE); - cookie_str = soup_cookie_jar_get_cookies(jar, soup_uri, TRUE); - g_object_unref(jar); + cookie_str = soup_cookie_jar_get_cookies(cookie_jar, soup_uri, TRUE); return cookie_str; } @@ -2238,7 +2238,6 @@ set_single_cookie(SoupCookie *cookie) { flock(lock, LOCK_EX); SoupDate *soup_date; - SoupCookieJar *jar = soup_cookie_jar_text_new(cookie_store, FALSE); cookie = soup_cookie_copy(cookie); if (cookie_timeout && cookie->expires == NULL) { @@ -2246,8 +2245,7 @@ set_single_cookie(SoupCookie *cookie) { soup_cookie_set_expires(cookie, soup_date); } - soup_cookie_jar_add_cookie(jar, cookie); - g_object_unref(jar); + soup_cookie_jar_add_cookie(cookie_jar, cookie); flock(lock, LOCK_UN); close(lock); -- 1.7.1 From thomas at xteddy.org Mon Oct 25 15:08:52 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 16:08:52 +0100 Subject: [Vimprobable-users] [PATCH v2 9/9] Further redefine cookie stores. Message-ID: <20101025150844.GA10960@abacus.soton.smoothwall.net> Rather than relying always on the on-disk store to be updated -- each Vimprobable instance defines its own running-instance of a cookie store which is serialised to disk each time a new request is entered, and then repopulated with the entries for the on-disk store in the session. --- main.c | 167 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 125 insertions(+), 42 deletions(-) diff --git a/main.c b/main.c index 7093f73..45dc9b1 100644 --- a/main.c +++ b/main.c @@ -139,19 +139,21 @@ int maxcommands = 0; int commandpointer = 0; KeyList *keylistroot = NULL; -/* Cookie-related information. - * - * Note that this cannot be surrounded by #ifdef blocks for - * ENABLE_COOKIE_SUPPORT - */ -static SoupCookieJar *cookie_jar = NULL; +/* Cookie support. */ +#ifdef ENABLE_COOKIE_SUPPORT +static SoupCookieJar *session_cookie_jar = NULL; +static SoupCookieJar *file_cookie_jar = NULL; static time_t cookie_timeout = 4800; static char *cookie_store; -static void handle_cookie_request(SoupMessage *soup_msg, gpointer unused); +static void setup_cookies(void); static const char *get_cookies(SoupURI *soup_uri); -static void set_single_cookie(SoupCookie *cookie); +static void load_all_cookies(void); +static void save_all_cookies(void); static void new_generic_request(SoupSession *soup_ses, SoupMessage *soup_msg, gpointer unused); - +static void update_cookie_jar(SoupCookie *new); +static void handle_cookie_request(SoupMessage *soup_msg, gpointer unused); +static int lock; +#endif /* callbacks */ void window_destroyed_cb(GtkWidget *window, gpointer func_data) { @@ -2108,12 +2110,6 @@ setup_settings() { g_object_set((GObject*)settings, "user-agent", useragent, NULL); g_object_get((GObject*)settings, "zoom-step", &zoomstep, NULL); webkit_web_view_set_settings(webview, settings); -#ifdef ENABLE_COOKIE_SUPPORT - cookie_store = g_strdup_printf(COOKIES_STORAGE_FILENAME); - cookie_jar = soup_cookie_jar_text_new(cookie_store, COOKIES_STORAGE_READONLY); - soup_session_remove_feature_by_type(session, soup_cookie_get_type()); - soup_session_remove_feature_by_type(session, soup_cookie_jar_get_type()); -#endif /* proxy */ if (use_proxy == TRUE) { @@ -2178,6 +2174,32 @@ setup_signals() { } #ifdef ENABLE_COOKIE_SUPPORT +void +setup_cookies() +{ + if (file_cookie_jar) + g_object_unref(file_cookie_jar); + + if (session_cookie_jar) + g_object_unref(session_cookie_jar); + + session_cookie_jar = soup_cookie_jar_new(); + cookie_store = g_strdup_printf(COOKIES_STORAGE_FILENAME); + + lock = open(cookie_store, 0); + flock(lock, LOCK_EX); + + load_all_cookies(); + + flock(lock, LOCK_UN); + close(lock); + + soup_session_add_feature(session, SOUP_SESSION_FEATURE(session_cookie_jar)); + soup_session_add_feature(session, SOUP_SESSION_FEATURE(file_cookie_jar)); + + return; +} + /* TA: XXX - we should be using this callback for any header-requests we * receive (hence the name "new_generic_request" -- but for now, its use * is limited to handling cookies. @@ -2195,69 +2217,127 @@ new_generic_request(SoupSession *session, SoupMessage *soup_msg, gpointer unused soup_message_headers_append(soup_msg_h, "Cookie", cookie_str); g_signal_connect_after(G_OBJECT(soup_msg), "got-headers", G_CALLBACK(handle_cookie_request), NULL); + + return; } const char * get_cookies(SoupURI *soup_uri) { const char *cookie_str; - cookie_str = soup_cookie_jar_get_cookies(cookie_jar, soup_uri, TRUE); + + cookie_str = soup_cookie_jar_get_cookies(session_cookie_jar, soup_uri, TRUE); + return cookie_str; } void -handle_cookie_request(SoupMessage *soup_msg, gpointer unused) { - GSList *resp_cookie; +handle_cookie_request(SoupMessage *soup_msg, gpointer unused) +{ + GSList *resp_cookie = NULL; + SoupCookie *cookie; for(resp_cookie = soup_cookies_from_response(soup_msg); resp_cookie; resp_cookie = g_slist_next(resp_cookie)) { - set_single_cookie((SoupCookie *)resp_cookie->data); + SoupDate *soup_date; + cookie = soup_cookie_copy((SoupCookie *)resp_cookie->data); + + if (cookie_timeout && cookie->expires == NULL) { + soup_date = soup_date_new_from_time_t(time(NULL) + cookie_timeout * 10); + soup_cookie_set_expires(cookie, soup_date); + } + soup_cookie_jar_add_cookie(session_cookie_jar, cookie); + update_cookie_jar(cookie); } + + return; } void -set_single_cookie(SoupCookie *cookie) { - int lock; - - if (!cookie) - { - /* TA: Then what? This shouldn't happen. */ - { - Arg arg_error; - arg_error.i = Error; - arg_error.s = g_strdup("Invalid cookie from header"); - echo(&arg_error); - g_free(arg_error.s); - } - +update_cookie_jar(SoupCookie *new) +{ + if (!new) { + /* Nothing to do. */ return; } + /* TA: Note that this locking is merely advisory -- because there's + * no linking between different vimprobable processes, the cookie jar, + * when being written to here, *WILL* be truncated and overwritten + * with cookie contents from the specific session saving its cookies + * at that time. + * + * This may or may not contain cookies stored in other Vimprobable + * instances, although when those instances save their cookies, + * they'll just replace the cookie store's contents. + * + * The locking should probably be changed to be fcntl() based one day + * -- but the caveat with that is all Vimprobable instances would then + * block waiting for the cookie file to become availabe. The + * advisory locking used here so far seems to work OK, but if we run + * into problems in the future, we'll know where to look. + * + * Ideally, if Vimprobable were ever to want to do this cleanly, + * something like using libunique to pass messages between registered + * sessions. + */ lock = open(cookie_store, 0); flock(lock, LOCK_EX); - SoupDate *soup_date; - cookie = soup_cookie_copy(cookie); + save_all_cookies(); + load_all_cookies(); + + flock(lock, LOCK_UN); + close(lock); + + return; +} + +void +save_all_cookies() +{ + GSList *session_cookie_list = soup_cookie_jar_all_cookies(session_cookie_jar); + + for (; session_cookie_list; + session_cookie_list = session_cookie_list->next) + { + soup_cookie_jar_add_cookie(file_cookie_jar, session_cookie_list->data); + } + + soup_cookies_free(session_cookie_list); - if (cookie_timeout && cookie->expires == NULL) { - soup_date = soup_date_new_from_time_t(time(NULL) + cookie_timeout); - soup_cookie_set_expires(cookie, soup_date); + return; +} + +void +load_all_cookies() +{ + file_cookie_jar = soup_cookie_jar_text_new(cookie_store, COOKIES_STORAGE_READONLY); + + /* Put them back in the session store. */ + GSList *cookies_from_file = soup_cookie_jar_all_cookies(file_cookie_jar); + + for (; cookies_from_file; + cookies_from_file = cookies_from_file->next) + { + soup_cookie_jar_add_cookie(session_cookie_jar, cookies_from_file->data); } - soup_cookie_jar_add_cookie(cookie_jar, cookie); + soup_cookies_free(cookies_from_file); - flock(lock, LOCK_UN); - close(lock); + return; } + #endif void mop_up(void) { /* Free up any nasty globals before exiting. */ +#ifdef ENABLE_COOKIE_SUPPORT if (cookie_store) g_free(cookie_store); - +#endif return; } @@ -2302,6 +2382,9 @@ main(int argc, char *argv[]) { setup_modkeys(); make_keyslist(); setup_gui(); +#ifdef ENABLE_COOKIE_SUPPORT + setup_cookies(); +#endif /* read config file */ if (!read_rcfile(configfile)) { -- 1.7.1 From hannes at yllr.net Mon Oct 25 15:56:36 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 25 Oct 2010 17:56:36 +0200 Subject: [Vimprobable-users] [PATCH v2 0/9] Revamp cookie support In-Reply-To: <20101025150342.GA8916@abacus.soton.smoothwall.net> References: <20101025150342.GA8916@abacus.soton.smoothwall.net> Message-ID: <20101025175636.02623853@workstation> Thomas Adam wrote: > I'd be very interested to know who is testing this Please give me a few days. Last time, I only noticed the issues after an extended period of time, so I have to give it the same amount this time around. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Mon Oct 25 16:42:00 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 17:42:00 +0100 Subject: [Vimprobable-users] [PATCH v2 0/9] Revamp cookie support In-Reply-To: <20101025175636.02623853@workstation> References: <20101025150342.GA8916@abacus.soton.smoothwall.net> <20101025175636.02623853@workstation> Message-ID: <20101025164158.GA3445@shuttle.home> On Mon, Oct 25, 2010 at 05:56:36PM +0200, Hannes Sch?ller wrote: > Thomas Adam wrote: > > I'd be very interested to know who is testing this > > Please give me a few days. Last time, I only noticed the issues after > an extended period of time, so I have to give it the same amount this > time around. Oh, absolutely! That's great, I appreciate that. I also do the same thing at work, where I use Vimprobable daily, so we might even get to compare notes, although I don't always get the luxury of keeping an eye on it at work as much as I'd like. ;) -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hannes at yllr.net Mon Oct 25 16:47:30 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 25 Oct 2010 18:47:30 +0200 Subject: [Vimprobable-users] Patch to add tabcompletion on tags In-Reply-To: <20101024211207.GA3758@aspire.tradesystem.nl> References: <20101024211207.GA3758@aspire.tradesystem.nl> Message-ID: <20101025184730.2868d92f@workstation> Hi! Unfortunately, due to completely chaotic indentation, it is hard to read where this is actually supposed to hook into the code. I *think* I got it, though. I haven't done a functional test yet, so this is just from reading the code: > tag[255], woord[255]; Apart from the typo (?) in 'word', it would be better to initialise these with empty strings, because later, you're just copying and catting something into them (well, at least tag, woord should be ok, but it's still safer to initialise) which will not guarantee the strings to be properly terminated. > if (strlen (command) == 2 && strncmp (command, "qt", 2) == 0) This is directly after the :set block - why not "else if"? There is no scenario where both need to be tested. Also, I think you're probably making the same mistake after this which I also put into the block before this one: You're not actually checking there *is* anything other than a NULL byte after the space, yet you're pointing "searchfor" to it. I'm not sure what strstr does if its second argument is a pointer to NULL. It seems to work for :set (listing all possible settings, then), but please double-check if you get the desired result (all possible tags listed?) with an empty argument (and that the browser isn't crashing). > url = strstr (entry, tag); I see you just want to reuse the existing url variable here, which is ok with me (I do these things all the time), but it's actually not an url you're pointing to here, is it? At the end, I'm not completely sure how it flows into bookmark and history completion. Again, it's virtually impossible to see with this wild mix of tabs and spaces as well as differing schemes for braces. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Mon Oct 25 17:02:38 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 18:02:38 +0100 Subject: [Vimprobable-users] Patch to add tabcompletion on tags In-Reply-To: <20101024211207.GA3758@aspire.tradesystem.nl> References: <20101024211207.GA3758@aspire.tradesystem.nl> Message-ID: <20101025170236.GB3445@shuttle.home> On Sun, Oct 24, 2010 at 11:12:09PM +0200, Matto Fransen wrote: Hi -- I'm only eye-balling this, Matto. Your indentation is way off though -- might want to fix that, and also the code's hideous -- but that's not your fault at all -- the entire function needs be taken out back and shot. :) > + filename = g_strdup_printf (BOOKMARKS_STORAGE_FILENAME); No where that I can see in the entirety of this function (which is admittedly outside the scope of your patch), that filename ever g_free()d -- plus it's reused in other blocks, so it's leaking memory. :) > + f = fopen (filename, "r"); > + if (f != NULL) if ((f = fopen(...)) != NULL) ? > + { > + > + while (finished != TRUE) > + { > + if ((char *) NULL == fgets (entry, 512, f)) > + { > + if (!feof (f)) > + { > + break; > + } > + finished = TRUE; > + continue; > + } Is this not better written as: while ((fgets(...)) && (!eof(f))) { ..... } > + if (strstr (entry, tag) != NULL) > + { > + url = strstr (entry, tag); > + url++; > + tmp_i=0; > + while (url[tmp_i]!=']' && tmp_i < 250) { woord[tmp_i]=url[tmp_i++]; } > + woord[tmp_i]='\0'; > + fill_suggline (suggline, command, woord); > + suggurls[n] = > + (char *) malloc (sizeof (char) * 512 + 1); > + strncpy (suggurls[n], suggline, 512); Ah -- this won't cater for extraneous characters, will it? For example, if I select an element from the completion list, and press space a few times, and press return, that will try looking for: "default " rather than: "default" (Assuming the tag it had found was called "default", of course.) The reuse of "url" here is confusing, as it's not a URL, although I assume you're doing this just for reuse? Which editor do you use? Perhaps I can help suggest some options, if it's Vim. :) It is Vim, right? :) -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From hannes at yllr.net Mon Oct 25 17:45:18 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Mon, 25 Oct 2010 19:45:18 +0200 Subject: [Vimprobable-users] Patch to add tabcompletion on tags In-Reply-To: <20101025170236.GB3445@shuttle.home> References: <20101024211207.GA3758@aspire.tradesystem.nl> <20101025170236.GB3445@shuttle.home> Message-ID: <20101025194518.75dee780@workstation> Thomas Adam wrote: > > + strncpy (suggurls[n], suggline, > > 512); > > Ah -- this won't cater for extraneous characters, will it? For > example, if I select an element from the completion list, and press > space a few times, and press return, that will try looking for: > > "default " > > rather than: > > "default" Same thing with leading spaces, by the way, since you're just jumping to the first space. Another thing: So far, the completion tasks for the bookmarks and history look for matches within the whole string which is searched. The way you're doing it, the user is forced to type not any substring of the tag he's looking for, but the beginning. Is this intended? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Mon Oct 25 18:52:59 2010 From: thomas at xteddy.org (Thomas Adam) Date: Mon, 25 Oct 2010 19:52:59 +0100 Subject: [Vimprobable-users] Patch to add tabcompletion on tags In-Reply-To: <20101025194518.75dee780@workstation> References: <20101024211207.GA3758@aspire.tradesystem.nl> <20101025170236.GB3445@shuttle.home> <20101025194518.75dee780@workstation> Message-ID: <20101025185258.GC3445@shuttle.home> On Mon, Oct 25, 2010 at 07:45:18PM +0200, Hannes Sch?ller wrote: > Thomas Adam wrote: > > > + strncpy (suggurls[n], suggline, > > > 512); > > > > Ah -- this won't cater for extraneous characters, will it? For > > example, if I select an element from the completion list, and press > > space a few times, and press return, that will try looking for: > > > > "default " > > > > rather than: > > > > "default" > > Same thing with leading spaces, by the way, since you're just jumping > to the first space. > > Another thing: So far, the completion tasks for the bookmarks and > history look for matches within the whole string which is searched. > The way you're doing it, the user is forced to type not any substring > of the tag he's looking for, but the beginning. Is this intended? I think it should match the other forms of completion, it's not too much work. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From matto at matto.nl Wed Oct 27 19:15:08 2010 From: matto at matto.nl (Matto Fransen) Date: Wed, 27 Oct 2010 21:15:08 +0200 Subject: [Vimprobable-users] improved patch for tag-completion Message-ID: <20101027191506.GA2001@aspire.tradesystem.nl> Hi guys, Thanks for the feedback on the previous patch. I did a rewrite and tried to work out all the remarks. I created a function that fills a linked-list with matching tags. This list is than loaded into suggline. Perhaps this mechanism can be used for some other parts in the complete() function. The completion now works not only on the beginning of tags. Suppose there is a tag 'hitchhikersguide'. This tag can be found by hitting tab after: :qt hi :qt gui :gt de Entering :qt without an argument (typing :qt ) completes to all tags. Attached please find the patch :) Cheers, Matto -------------- next part -------------- diff -u a/config.h b/config.h --- a/config.h 2010-10-27 19:01:08.000000000 +0000 +++ b/config.h 2010-10-27 18:41:41.000000000 +0000 @@ -49,9 +49,6 @@ #define COOKIES_STORAGE_FILENAME "%s/.config/vimprobable/cookies", getenv("HOME") #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */ -/* bookmarks */ -#define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME") - /* history */ #define HISTORY_MAX_ENTRIES 1000 #define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME") diff -u a/main.c b/main.c --- a/main.c 2010-10-27 19:01:08.000000000 +0000 +++ b/main.c 2010-10-27 18:58:23.000000000 +0000 @@ -730,6 +730,7 @@ char *str, *s, *p, *markup, *entry, *searchfor, command[32] = "", suggline[512] = "", *url, **suggurls; size_t listlen, len, cmdlen; int i, spacepos; + Tagelement * taglist, * tagpointer; gboolean highlight = FALSE, finished = FALSE; GtkBox *row; GtkWidget *row_eventbox, *el; @@ -834,7 +835,30 @@ } } - } else { + } + else if (strlen (command) == 2 + && strncmp (command, "qt", 2) == 0) + { + /* completion on tags */ + spacepos = strcspn (str, " "); + searchfor = (str + spacepos + 1); + taglist = ( complete_tags( searchfor )); + tagpointer = taglist; + while (tagpointer != NULL ) + { + fill_suggline(suggline, command, tagpointer->tag); + suggurls[n] = (char *)malloc(sizeof(char) * 512 + 1); + strncpy(suggurls[n], suggline, 512); + suggestions[n] = suggurls[n]; + row_eventbox = fill_eventbox(suggline); + gtk_box_pack_start(_table, GTK_WIDGET(row_eventbox), FALSE, FALSE, 0); + widgets[n++] = row_eventbox; + tagpointer=tagpointer->next; + } + free_taglist(taglist); + } + + else { /* URL completion using the current command */ filename = g_strdup_printf(BOOKMARKS_STORAGE_FILENAME); f = fopen(filename, "r"); diff -u a/utilities.c b/utilities.c --- a/utilities.c 2010-10-27 19:01:08.000000000 +0000 +++ b/utilities.c 2010-10-27 18:59:17.000000000 +0000 @@ -406,3 +406,94 @@ echo(&a); g_free(a.s); } + +Tagelement * +complete_tags (const char *searchfor) +{ + FILE *f; + const char *filename; + Tagelement *taglist; + char s[255], readtag[MAXTAGSIZE + 1]; + int i, t; + + taglist = NULL; + + /* look for tags in bookmarkfile */ + filename = g_strdup_printf (BOOKMARKS_STORAGE_FILENAME); + f = fopen (filename, "r"); + if (f == NULL) + { + free ((void *) filename); + return (NULL); + } + + while (fgets (s, 254, f)) + { + i = 0; + while (s[i] && i < 254) + { + while (s[i] != '[' && s[i]) + i++; + if (s[i] != '[') + continue; + i++; + t = 0; + while (s[i] != ']' && s[i] && t < MAXTAGSIZE) + readtag[t++] = s[i++]; + readtag[t] = '\0'; + if (!strlen (searchfor) || strstr( readtag, searchfor ) != NULL ) + taglist = addtag (readtag, taglist); + i++; + } + } + free ((void *) filename); + return (taglist); +} + +Tagelement * +addtag (const char *tag, Tagelement * taglist) +{ + int n; + + Tagelement *newtag, *tagpointer, *lasttag; + + if (taglist == NULL) /* first element */ + { + newtag = malloc (sizeof (Tagelement)); + if (newtag == NULL) return (NULL); + strcpy (newtag->tag, tag); + newtag->next = NULL; + return (newtag); + } + tagpointer = taglist; + n = strlen (tag); + + /* check if tag is allready in taglist */ + while (tagpointer != NULL) + { + if (strncmp (tagpointer->tag, tag, n) == 0) return (taglist); + lasttag = tagpointer; + tagpointer = tagpointer->next; + } + /* add to list */ + newtag = malloc (sizeof (Tagelement)); + if (newtag == NULL) + return (taglist); + lasttag->next = newtag; + strcpy (newtag->tag, tag); + newtag->next = NULL; + return (taglist); +} + +void +free_taglist (Tagelement * taglist) +{ + Tagelement *tagpointer; + + while (taglist != NULL) + { + tagpointer = taglist->next; + free (taglist); + taglist = tagpointer; + } +} diff -u a/utilities.h b/utilities.h --- a/utilities.h 2010-10-27 19:01:08.000000000 +0000 +++ b/utilities.h 2010-10-27 18:39:36.000000000 +0000 @@ -24,4 +24,7 @@ gboolean build_taglist(const Arg *arg, FILE *f); void set_error(const char *error); void give_feedback(const char *feedback); +Tagelement * complete_tags( const char *searchfor ); +Tagelement * addtag(const char * tag, Tagelement *taglist); +void free_taglist( Tagelement *taglist ); diff -u a/vimprobable.h b/vimprobable.h --- a/vimprobable.h 2010-10-27 19:01:08.000000000 +0000 +++ b/vimprobable.h 2010-10-27 18:46:13.000000000 +0000 @@ -141,6 +141,11 @@ char value[240]; } my_pair; +typedef struct { + void *next; + char tag[255]; +} Tagelement ; + /* constants */ #define MOUSE_BUTTON_1 1 #define MOUSE_BUTTON_2 2 @@ -150,6 +155,9 @@ #define BUFFERSIZE 255 #define MAXTAGSIZE 200 +/* bookmarks */ +#define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME") + /* quickmarks */ #define QUICKMARK_FILE "%s/.config/vimprobable/quickmarks", getenv("HOME") -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From thomas at xteddy.org Wed Oct 27 22:56:32 2010 From: thomas at xteddy.org (Thomas Adam) Date: Wed, 27 Oct 2010 23:56:32 +0100 Subject: [Vimprobable-users] improved patch for tag-completion In-Reply-To: <20101027191506.GA2001@aspire.tradesystem.nl> References: <20101027191506.GA2001@aspire.tradesystem.nl> Message-ID: <20101027225629.GA3694@shuttle.home> On Wed, Oct 27, 2010 at 09:15:08PM +0200, Matto Fransen wrote: > I created a function that fills a linked-list with matching tags. > This list is than loaded into suggline. Perhaps this mechanism > can be used for some other parts in the complete() function. Looks much better, thanks. :) I do have some further comments though -- what do you think? > diff -u a/config.h b/config.h > --- a/config.h 2010-10-27 19:01:08.000000000 +0000 > +++ b/config.h 2010-10-27 18:41:41.000000000 +0000 > @@ -49,9 +49,6 @@ > #define COOKIES_STORAGE_FILENAME "%s/.config/vimprobable/cookies", getenv("HOME") > #define COOKIES_STORAGE_READONLY FALSE /* if TRUE new cookies will be lost if you quit */ > > -/* bookmarks */ > -#define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME") > - Where's that going, and why? > /* history */ > #define HISTORY_MAX_ENTRIES 1000 > #define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME") > diff -u a/main.c b/main.c > --- a/main.c 2010-10-27 19:01:08.000000000 +0000 > +++ b/main.c 2010-10-27 18:58:23.000000000 +0000 > @@ -730,6 +730,7 @@ > char *str, *s, *p, *markup, *entry, *searchfor, command[32] = "", suggline[512] = "", *url, **suggurls; > size_t listlen, len, cmdlen; > int i, spacepos; > + Tagelement * taglist, * tagpointer; Why not use a GSList? http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html > + /* completion on tags */ > + spacepos = strcspn (str, " "); > + searchfor = (str + spacepos + 1); > + taglist = ( complete_tags( searchfor )); > + tagpointer = taglist; ... which would make this easier. > + while (tagpointer != NULL ) > + { > + fill_suggline(suggline, command, tagpointer->tag); > + suggurls[n] = (char *)malloc(sizeof(char) * 512 + 1); > + strncpy(suggurls[n], suggline, 512); > + suggestions[n] = suggurls[n]; > + row_eventbox = fill_eventbox(suggline); > + gtk_box_pack_start(_table, GTK_WIDGET(row_eventbox), FALSE, FALSE, 0); > + widgets[n++] = row_eventbox; > + tagpointer=tagpointer->next; > + } > + free_taglist(taglist); > + } ... and this. :) > + else { > /* URL completion using the current command */ > filename = g_strdup_printf(BOOKMARKS_STORAGE_FILENAME); > f = fopen(filename, "r"); > diff -u a/utilities.c b/utilities.c > --- a/utilities.c 2010-10-27 19:01:08.000000000 +0000 > +++ b/utilities.c 2010-10-27 18:59:17.000000000 +0000 > @@ -406,3 +406,94 @@ > echo(&a); > g_free(a.s); > } > + > +Tagelement * > +complete_tags (const char *searchfor) > +{ > + FILE *f; > + const char *filename; > + Tagelement *taglist; > + char s[255], readtag[MAXTAGSIZE + 1]; > + int i, t; > + > + taglist = NULL; > + > + /* look for tags in bookmarkfile */ > + filename = g_strdup_printf (BOOKMARKS_STORAGE_FILENAME); > + f = fopen (filename, "r"); > + if (f == NULL) > + { > + free ((void *) filename); filename is defined as g_strdup_*, therefore you should be using: gfree() > + return (NULL); > + } > + > + while (fgets (s, 254, f)) > + { > + i = 0; > + while (s[i] && i < 254) > + { > + while (s[i] != '[' && s[i]) > + i++; > + if (s[i] != '[') > + continue; > + i++; > + t = 0; > + while (s[i] != ']' && s[i] && t < MAXTAGSIZE) > + readtag[t++] = s[i++]; > + readtag[t] = '\0'; > + if (!strlen (searchfor) || strstr( readtag, searchfor ) != NULL ) > + taglist = addtag (readtag, taglist); > + i++; > + } > + } > + free ((void *) filename); Again, gfree() > + return (taglist); > +} > + > +Tagelement * > +addtag (const char *tag, Tagelement * taglist) > +{ > + int n; > + > + Tagelement *newtag, *tagpointer, *lasttag; > + > + if (taglist == NULL) /* first element */ > + { > + newtag = malloc (sizeof (Tagelement)); > + if (newtag == NULL) return (NULL); > + strcpy (newtag->tag, tag); > + newtag->next = NULL; > + return (newtag); > + } Do you really like using, I believe it's called the Whitesmiths style of bracing? > + tagpointer = taglist; > + n = strlen (tag); If you were to use a GSList, then this is simplified (>) by using: g_slist_insert() -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From thomas at xteddy.org Thu Oct 28 16:26:40 2010 From: thomas at xteddy.org (Thomas Adam) Date: Thu, 28 Oct 2010 17:26:40 +0100 Subject: [Vimprobable-users] [PATCH 1/1] Introduce the SubmittingPatches document Message-ID: <20101028162635.GA2523@debian> First draft of how to submit patches to Vimprobable. --- Matto -- this one's for you. :) SubmittingPatches | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 129 insertions(+), 0 deletions(-) create mode 100644 SubmittingPatches diff --git a/SubmittingPatches b/SubmittingPatches new file mode 100644 index 0000000..46ff323 --- /dev/null +++ b/SubmittingPatches @@ -0,0 +1,129 @@ +Submitting Patches +================== + +Repository Overview +=================== + +Vimprobable uses git [1], a distributed revision control system. This +document is not intended to explain the git internals, for that there's +already a wealth of documentation on the Internet. + +The main Vimprobable git repository [2] has two main branches: + +vimprobable1 +vimprobable2 + +which reflect the two supported versions of Vimprobable. + +When submitting a patch, the feature should be made on top of the +vimprobable2 branch, unless there is a good reason for knowing that the fix +is wholly applicable to vimprobable1. In the general case though, most +features are submitted against vimprobable2, and then manually ported to +vimprobable1 where applicable by the maintainer. Not all features of +Vimprobable2 are applicable to Vimprobable1. + +If such a patch were made against vimprobable1, then this should be noted in +the commit email -- but more about that later. + +Preamble +======== + +If you've never used git before, git tracks meta-data about the committer +and the author, as part of a commit, hence: + +$ git config [--global] user.name "Your name" +$ git config [--global] user.email "you at yourdomain.com" + +Note that, if you already have this in the global ~/.gitconfig option, then +this will be used. Setting this per-repository would involve not using the +"--global" flag above. If you wish to use the same credentials always, +pass the "--global" option, as shown. + +This is a one-off operation once the repository has been cloned. + +Use of topic branches +===================== + +Git's use of branches makes it very easy to separate out different topics +from one another -- hence, for any feature or patch developed, they should +be done in their own topic branch, which is branched from the current HEAD +of origin/vimprobable. Hence: + +$ git checkout vimprobable2 +$ git pull +$ git checkout -b my-new-feature + +Which at this point on means that you're on the "my-new-feature" branch, and +can then hack away. When you've got a series of changes, it's best to +consider how to commit them. Blindly doing: + +$ git commit -a + +which would commit all changes, won't make for a easy patch review, and will +likely just pollute the main git history with unnecessary noise. Not to +mention, if a bug is discovered, finding it in amongst a huge code commit +like that would be rather annoying. So instead, stage all the changes +you're doing logically together -- break up the feature into four or five +patches, or how ever many made sense. + +For example, if you were writing a new feature, you might have: + +* A patch to include any new header files. +* A patch for any new function prototypes. +* A patch per new function as it's written (or more, depending on the + complexity). + +This is nothing more than doing a: + +$ git add foo.h +$ git commit + +[Write commit message] + +... do some more hacking. + +$ git add main.c +$ git add utilities.c +$ git commit + +Working out what's changed +========================== + +Once you're happy with the commits on the "my-new-feature" branch, you'll +obviously want to check that they still work on top of any new code that +might have been committed to the vimprobable* branches since you creates the +"my-new-feature" branch. This is important as you'll be basing your patches +against that. Hence: + +$ git checkout vimprobable2 +$ git pull +$ git checkout my-new-feature + +(Note: It's conceivable here that the "my-new-feature" branch might undergo +rebasing against origin/vimprobable2 -- although that's not being mentioned +here in the general case, but would equally be acceptable.) + +Generating patches to send to the mailing list +============================================== + +So, you've been working hard on your new feature, all your changes are sat +in a local topic branch; "my-new-feature", and you want to submit them to +the list. You've already updated your copy of the vimprobable2 branch, and +your "my-new-feature" branch is checked-out, hence: + +$ git format-patch -M -n --cover-letter -o patch_store vimprobable2 + +Which will place a series of numbered commits in a directory called +"patch_store". These can then be sent to the list [3] using the +"git send-email" command. + +Note that if this is more a bug-fix, or a single patch, it's not always +necessary to generate a cover-letter -- so that option to "git format-patch" +can be elided if necessary, but it doesn't really matter. + +References +========== + +[1] http://git-scm.com +[2] http://www.yllr.net/vimprobable/vimprobable.git +[3] vimprobable-users at vimprobable.org -- 1.7.1 From thomas at xteddy.org Thu Oct 28 19:00:52 2010 From: thomas at xteddy.org (Thomas Adam) Date: Thu, 28 Oct 2010 20:00:52 +0100 Subject: [Vimprobable-users] improved patch for tag-completion In-Reply-To: <20101027225629.GA3694@shuttle.home> References: <20101027191506.GA2001@aspire.tradesystem.nl> <20101027225629.GA3694@shuttle.home> Message-ID: <20101028190051.GA3772@shuttle.home> On Wed, Oct 27, 2010 at 11:56:32PM +0100, Thomas Adam wrote: > On Wed, Oct 27, 2010 at 09:15:08PM +0200, Matto Fransen wrote: > > I created a function that fills a linked-list with matching tags. > > This list is than loaded into suggline. Perhaps this mechanism > > can be used for some other parts in the complete() function. > > Looks much better, thanks. :) I do have some further comments though -- > what do you think? I should have meant: s/gfree/g_free/g; -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From thomas at xteddy.org Thu Oct 28 19:28:12 2010 From: thomas at xteddy.org (Thomas Adam) Date: Thu, 28 Oct 2010 20:28:12 +0100 Subject: [Vimprobable-users] [PATCH v2 1/1] Introduce the SubmittingPatches document Message-ID: <20101028192808.GA11658@shuttle.home> First draft of how to submit patches to Vimprobable. --- Fixed a tiny typo, and added a clause about pull-requests. SubmittingPatches | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+), 0 deletions(-) create mode 100644 SubmittingPatches diff --git a/SubmittingPatches b/SubmittingPatches new file mode 100644 index 0000000..99ae5bd --- /dev/null +++ b/SubmittingPatches @@ -0,0 +1,134 @@ +Submitting Patches +================== + +Repository Overview +=================== + +Vimprobable uses git [1], a distributed revision control system. This +document is not intended to explain the git internals, for that there's +already a wealth of documentation on the Internet. + +The main Vimprobable git repository [2] has two main branches: + +vimprobable1 +vimprobable2 + +which reflect the two supported versions of Vimprobable. + +When submitting a patch, the feature should be made on top of the +vimprobable2 branch, unless there is a good reason for knowing that the fix +is wholly applicable to vimprobable1. In the general case though, most +features are submitted against vimprobable2, and then manually ported to +vimprobable1 where applicable by the maintainer. Not all features of +Vimprobable2 are applicable to Vimprobable1. + +Preamble +======== + +If you've never used git before, git tracks meta-data about the committer +and the author, as part of a commit, hence: + +$ git config [--global] user.name "Your name" +$ git config [--global] user.email "you at yourdomain.com" + +Note that, if you already have this in the global ~/.gitconfig option, then +this will be used. Setting this per-repository would involve not using the +"--global" flag above. If you wish to use the same credentials always, +pass the "--global" option, as shown. + +This is a one-off operation once the repository has been cloned, assuming +this information has ever been set before. + +Use of topic branches +===================== + +Git's use of branches makes it very easy to separate out different topics +from one another -- hence, for any feature or patch developed, they should +be done in their own topic branch, which is branched from the current HEAD +of origin/vimprobable. Hence: + +$ git checkout vimprobable2 +$ git pull +$ git checkout my-new-feature + +Which at this point on means that you're on the "my-new-feature" branch, and +can then hack away. When you've got a series of changes, it's best to +consider how to commit them. Blindly doing: + +$ git commit -a + +which would commit all changes, won't make for a easy patch review, and will +likely just pollute the main git history with unnecessary noise. Not to +mention, if a bug is discovered, finding it in amongst a huge code commit +like that would be rather annoying. So instead, stage all the changes +you're doing logically together -- break up the feature into four or five +patches, or how ever many made sense. + +For example, if you were writing a new feature, you might have: + +* A patch to include any new header files. +* A patch for any new function prototypes. +* A patch per new function as it's written (or more, depending on the + complexity). + +This is nothing more than doing a: + +$ git add foo.h +$ git commit + +[Write commit message] + +... do some more hacking. + +$ git add main.c +$ git add utilities.c +$ git commit + +Working out what's changed +========================== + +Once you're happy with the commits on the "my-new-feature" branch, you'll +obviously want to check that they still work on top of any new code that +might have been committed to the vimprobable* branches since you creates the +"my-new-feature" branch. This is important as you'll be basing your patches +against that. Hence: + +$ git checkout vimprobable2 +$ git pull +$ git checkout my-new-feature + +(Note: It's conceivable here that the "my-new-feature" branch might undergo +rebasing against origin/vimprobable2 -- although that's not being mentioned +here in the general case, but would equally be acceptable.) + +Generating patches to send to the mailing list +============================================== + +So, you've been working hard on your new feature, all your changes are sat +in a local topic branch; "my-new-feature", and you want to submit them to +the list. You've already updated your copy of the vimprobable2 branch, and +your "my-new-feature" branch is checked-out, hence: + +$ git format-patch -M -n --cover-letter -o patch_store vimprobable2 + +Which will place a series of numbered commits in a directory called +"patch_store". These can then be sent to the list [3] using the +"git send-email" command. + +Note that if this is more a bug-fix, or a single patch, it's not always +necessary to generate a cover-letter -- so that option to "git format-patch" +can be elided if necessary, but it doesn't really matter. + +External hosting and pull-requests +================================== + +Alternatively, if using a hosted Git service [4], then it's acceptable +that a pull-request can be issued on a branch against a repository. + +References +========== + +[1] http://git-scm.com +[2] http://www.yllr.net/vimprobable/vimprobable.git +[3] vimprobable-users at vimprobable.org +[4] http://repo.or.cz -- or -- http://github.com -- 1.7.1 From matto at matto.nl Thu Oct 28 19:47:09 2010 From: matto at matto.nl (Matto Fransen) Date: Thu, 28 Oct 2010 21:47:09 +0200 Subject: [Vimprobable-users] improved patch for tag-completion In-Reply-To: <20101027225629.GA3694@shuttle.home> References: <20101027191506.GA2001@aspire.tradesystem.nl> <20101027225629.GA3694@shuttle.home> Message-ID: <20101028194707.GA2582@aspire.tradesystem.nl> Hi, On Wed, Oct 27, 2010 at 11:56:32PM +0100, Thomas Adam wrote: > On Wed, Oct 27, 2010 at 09:15:08PM +0200, Matto Fransen wrote: > > I created a function that fills a linked-list with matching tags. > > This list is than loaded into suggline. Perhaps this mechanism > > can be used for some other parts in the complete() function. > > Looks much better, thanks. :) Thanks. > I do have some further comments though -- > what do you think? [ ... ] > > -/* bookmarks */ > > -#define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME") > > - > > Where's that going, and why? It moved to vimproblable.h This is because config.h can not be included from utilities.c [ ... ] > > + Tagelement * taglist, * tagpointer; > > Why not use a GSList? http://library.gnome.org/devel/glib/unstable/glib-Singly-Linked-Lists.html I will look into that. [ ... ] > > +Tagelement * > > +addtag (const char *tag, Tagelement * taglist) > > +{ > > + int n; > > + > > + Tagelement *newtag, *tagpointer, *lasttag; > > + > > + if (taglist == NULL) /* first element */ > > + { > > + newtag = malloc (sizeof (Tagelement)); > > + if (newtag == NULL) return (NULL); > > + strcpy (newtag->tag, tag); > > + newtag->next = NULL; > > + return (newtag); > > + } > > > Do you really like using, I believe it's called the Whitesmiths style of > bracing? Yes indeed, I do like that, I think it clearifies a lot of things. I should have re-indented them to match the favorite indenting style of Hannes, but forgot to do that. > > + tagpointer = taglist; > > + n = strlen (tag); > > If you were to use a GSList, then this is simplified (>) by using: > > g_slist_insert() Like I mentioned above, I will look into those GSLists. Cheers, Matto -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From skottish97215 at gmail.com Fri Oct 29 03:07:34 2010 From: skottish97215 at gmail.com (Skottish) Date: Thu, 28 Oct 2010 20:07:34 -0700 Subject: [Vimprobable-users] Feature request: Case insensitive bookmark searching Message-ID: I have a feature request for case insensitive bookmark and tab searching. It's easy to miss a bookmark only because a search term uses a capital letter. For instance, I have a bookmark that I used when getting HTML5 set up: http://snapshot.opera.com/resources/BigBuckBunny.html so 'o' 'bi' isn't going to help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From matto at matto.nl Fri Oct 29 08:29:39 2010 From: matto at matto.nl (Matto Fransen) Date: Fri, 29 Oct 2010 10:29:39 +0200 Subject: [Vimprobable-users] Feature request: Case insensitive bookmark searching In-Reply-To: References: Message-ID: <20101029082936.GA1802@aspire.tradesystem.nl> Hi Skottish, On Thu, Oct 28, 2010 at 08:07:34PM -0700, Skottish wrote: > I have a feature request for case insensitive bookmark and tab searching. > It's easy to miss a bookmark only because a search term uses a capital > letter. For instance, I have a bookmark that I used when getting HTML5 set > up: > > http://snapshot.opera.com/resources/BigBuckBunny.html > > so 'o' 'bi' isn't going to help. Thanks for this suggetion. On first sight this is something that is not hard to implement. We will look into it. Cheers, Matto -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From matto at matto.nl Fri Oct 29 13:18:53 2010 From: matto at matto.nl (Matto Fransen) Date: Fri, 29 Oct 2010 15:18:53 +0200 Subject: [Vimprobable-users] Patch to make tabcompletion on bookmarks case-insensitive Message-ID: <20101029131850.GA3066@aspire.tradesystem.nl> Hello, Below a small patch to make tabcompletion on bookmarks case-insensitive :) Cheers, Matto diff --git a/vimprobable/main.c b/vimprobable-werk/main.c index a8f2ba1..8b7f68a 100644 --- a/vimprobable/main.c +++ b/vimprobable-werk/main.c @@ -836,6 +836,10 @@ complete(const Arg *arg) { } } else { /* URL completion using the current command */ + /* turn argument into lowercase for case-insensitive search */ + s = g_strdup( searchfor ); + g_strdown( s ); + filename = g_strdup_printf(BOOKMARKS_STORAGE_FILENAME); f = fopen(filename, "r"); if (f != NULL) { @@ -849,7 +853,8 @@ complete(const Arg *arg) { finished = TRUE; continue; } - if (strstr(entry, searchfor) != NULL) { + g_strdown( entry ); + if (strstr(entry, s) != NULL) { /* found in bookmarks */ if (strchr(entry, ' ') != NULL) { url = strtok(entry, " "); @@ -869,6 +874,7 @@ complete(const Arg *arg) { } } fclose(f); + g_free(s); /* history */ if (n < listlen) { filename = g_strdup_printf(HISTORY_STORAGE_FILENAME); From hannes at yllr.net Fri Oct 29 15:16:11 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Fri, 29 Oct 2010 17:16:11 +0200 Subject: [Vimprobable-users] Patch to make tabcompletion on bookmarks case-insensitive In-Reply-To: <20101029131850.GA3066@aspire.tradesystem.nl> References: <20101029131850.GA3066@aspire.tradesystem.nl> Message-ID: <20101029151610.GA19146@laptop2.lan.localhost> Hi! On Fri, Oct 29, 2010 at 03:18:53PM +0200, Matto Fransen wrote: > Below a small patch to make tabcompletion on bookmarks case-insensitive :) Thanks! I'll merge this into the next version, extended to be a configurable option :) Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From hannes at yllr.net Fri Oct 29 15:20:52 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Fri, 29 Oct 2010 17:20:52 +0200 Subject: [Vimprobable-users] [PATCH v2 0/9] Revamp cookie support In-Reply-To: <20101025150342.GA8916@abacus.soton.smoothwall.net> References: <20101025150342.GA8916@abacus.soton.smoothwall.net> Message-ID: <20101029152052.GB19146@laptop2.lan.localhost> I haven't encountered any issues with this new patch series. Unless anyone else encounters anything strange until then, I'll merge this on Sunday or Monday. Great work, Thomas! Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From hannes at yllr.net Fri Oct 29 15:28:26 2010 From: hannes at yllr.net (Hannes =?iso-8859-1?Q?Sch=FCller?=) Date: Fri, 29 Oct 2010 17:28:26 +0200 Subject: [Vimprobable-users] improved patch for tag-completion In-Reply-To: <20101027191506.GA2001@aspire.tradesystem.nl> References: <20101027191506.GA2001@aspire.tradesystem.nl> Message-ID: <20101029152825.GC19146@laptop2.lan.localhost> Hi! On Wed, Oct 27, 2010 at 09:15:08PM +0200, Matto Fransen wrote: > Thanks for the feedback on the previous patch. I did a rewrite and > tried to work out all the remarks. I'm OK with this patch, just the two free/g_free issues which Thomas pointed out (but I can easily adapt that myself before applying the patch). I don't care much for glist/whatever as opposed to a regular linked list, especially considering you already got this working with the latter. So I don't feel strongly one way or the other. Matto, just say whether you want to go over this again or if I should just use it as it is. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL: From matto at matto.nl Fri Oct 29 18:49:51 2010 From: matto at matto.nl (Matto Fransen) Date: Fri, 29 Oct 2010 20:49:51 +0200 Subject: [Vimprobable-users] improved patch for tag-completion In-Reply-To: <20101029152825.GC19146@laptop2.lan.localhost> References: <20101027191506.GA2001@aspire.tradesystem.nl> <20101029152825.GC19146@laptop2.lan.localhost> Message-ID: <20101029184948.GA5799@aspire.tradesystem.nl> Hello, On Fri, Oct 29, 2010 at 05:28:26PM +0200, Hannes Sch?ller wrote: > On Wed, Oct 27, 2010 at 09:15:08PM +0200, Matto Fransen wrote: > > Thanks for the feedback on the previous patch. I did a rewrite and > > tried to work out all the remarks. > > I'm OK with this patch, just the two free/g_free issues which Thomas > pointed out (but I can easily adapt that myself before applying the > patch). Ah, great :) > I don't care much for glist/whatever as opposed to a regular > linked list, especially considering you already got this working with > the latter. So I don't feel strongly one way or the other. Matto, just > say whether you want to go over this again or if I should just use it as > it is. My guess is that using this technique, we can reduce the complexity of complete() a bit. I want to investigate this a little further. When working this out, the linked list can also be converted to a GList :) So, I would say: for now, apply the patch. In time, if and when the work mentioned above gets done, we move to GList :) Cheers, Matto -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From thomas at xteddy.org Sat Oct 30 13:30:46 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 30 Oct 2010 14:30:46 +0100 Subject: [Vimprobable-users] [Toy Patch 0/1] Crude flash blocker (by mimetype) Message-ID: <20101030133042.GA18673@shuttle.home> Hi all, This isn't meant to be taken seriously for inclusion into Vimprobable (hence why it's a toy patch) but this patch series implements a very crude flash-blocker by default, by hiding the flash object with a GtkWidget, and setting a garish background colour with a stock icon until it's clicked on. Thomas Adam (1): Implement crude mime-type blocking. main.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vimprobable.h | 6 ++++ 2 files changed, 84 insertions(+), 0 deletions(-) From thomas at xteddy.org Sat Oct 30 13:31:45 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sat, 30 Oct 2010 14:31:45 +0100 Subject: [Vimprobable-users] [Toy Patch 1/1] Implement crude mime-type blocking. Message-ID: <20101030133141.GA18729@shuttle.home> This is a proof-of-concept for hiding flash objects using mimetype detection -- emulating what "flashblock" for Firefox does. --- main.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ vimprobable.h | 6 ++++ 2 files changed, 84 insertions(+), 0 deletions(-) diff --git a/main.c b/main.c index a8f2ba1..e5fe714 100644 --- a/main.c +++ b/main.c @@ -37,6 +37,9 @@ static gboolean webview_open_in_new_window_cb(WebKitWebView *webview, WebKitWebF static void webview_progress_changed_cb(WebKitWebView *webview, int progress, gpointer user_data); static void webview_title_changed_cb(WebKitWebView *webview, WebKitWebFrame *frame, char *title, gpointer user_data); static void window_destroyed_cb(GtkWidget *window, gpointer func_data); +static gboolean webview_unblock_cb(GtkWidget *widget, GdkEventButton *button_event, gpointer data); +static GtkWidget *webview_block_plugin_cb(WebKitWebView *webview, gchar *mimetype, gchar *uri, + GHashTable *unused_param, gpointer data); /* functions */ static gboolean bookmark(const Arg *arg); @@ -129,6 +132,7 @@ static char followTarget[8] = ""; char *error_msg = NULL; GList *activeDownloads; +GSList *unblocked_urls = NULL; #include "config.h" #include "keymap.h" @@ -221,6 +225,71 @@ webview_mimetype_cb(WebKitWebView *webview, WebKitWebFrame *frame, WebKitNetwork } } +GtkWidget *webview_block_plugin_cb(WebKitWebView *webview, gchar *mimetype, gchar *uri, + GHashTable *unused_param, gpointer data) +{ + GSList *le; + GdkColor bg_color; + + /* Don't do this if plugins aren't enabled. */ + if (!enablePlugins) + return NULL; + + /* Also, don't do this if we're not a flash object. */ + /* XXX - we could have a list of valid mimetypes */ + if (strstr(mimetype, "flash") == NULL) + return NULL; + + for(le = unblocked_urls; le; le = g_slist_next(le)) + { + if (strcmp((gchar *)le->data, uri) == 0) { + unblocked_urls = g_slist_delete_link(unblocked_urls, le); + return NULL; + } + } + + Canvas *canvas = g_malloc( sizeof(Canvas) ); + memset(canvas, '\0', sizeof(Canvas)); + + canvas->image = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_LARGE_TOOLBAR); + canvas->cover = gtk_event_box_new(); + canvas->url = g_strdup(uri); + + /* Set the background colour of the eventbox. */ + gdk_color_parse("#5EC75E", &bg_color); + gtk_widget_modify_bg(canvas->cover, GTK_STATE_NORMAL, &bg_color); + + gtk_container_add (GTK_CONTAINER(canvas->cover), canvas->image); + g_signal_connect(G_OBJECT(canvas->cover), "button-press-event", G_CALLBACK(webview_unblock_cb), canvas); + + gtk_widget_show_all(canvas->cover); + update_state(); + + return canvas->cover; +} + +gboolean +webview_unblock_cb(GtkWidget *widget, GdkEventButton *button_event, gpointer data) +{ + Canvas *canvas = (Canvas*)data; + + GtkWidget *parent = gtk_widget_get_parent(canvas->cover); + gtk_container_remove(GTK_CONTAINER(parent), canvas->cover); + + unblocked_urls = g_slist_append(unblocked_urls, g_strdup(canvas->url)); + + if (canvas->url) + g_free(canvas->url); + + g_free(canvas); + + /* reload */ + webkit_web_view_reload(WEBKIT_WEB_VIEW(parent)); + + return TRUE; +} + + static WebKitWebView* inspector_inspect_web_view_cb(gpointer inspector, WebKitWebView* web_view) { gchar* inspector_title; @@ -2142,6 +2211,7 @@ setup_signals() { "signal::console-message", (GCallback)webview_console_cb, NULL, "signal::create-web-view", (GCallback)webview_open_in_new_window_cb, NULL, "signal::event", (GCallback)notify_event_cb, NULL, + "signal::create-plugin-widget", (GCallback)webview_block_plugin_cb, NULL, NULL); /* webview adjustment */ g_object_connect((GObject*)adjust_v, @@ -2224,5 +2294,13 @@ main(int argc, char *argv[]) { open(&a); gtk_main(); + { + GSList *list; + for(list = unblocked_urls; list; list = g_slist_next(list)) + g_free(list->data); + + g_slist_free(unblocked_urls); + } + return EXIT_SUCCESS; } diff --git a/vimprobable.h b/vimprobable.h index 4b83084..621597c 100644 --- a/vimprobable.h +++ b/vimprobable.h @@ -141,6 +141,12 @@ struct map_pair { char value[240]; } my_pair; +typedef struct { + GtkWidget *cover; + GtkWidget *image; + gchar *url; +} Canvas; + /* constants */ #define MOUSE_BUTTON_1 1 #define MOUSE_BUTTON_2 2 -- 1.7.1 From skottish97215 at gmail.com Sat Oct 30 14:04:46 2010 From: skottish97215 at gmail.com (Skottish) Date: Sat, 30 Oct 2010 07:04:46 -0700 Subject: [Vimprobable-users] Patch to make tabcompletion on bookmarks case-insensitive In-Reply-To: <20101029151610.GA19146@laptop2.lan.localhost> References: <20101029131850.GA3066@aspire.tradesystem.nl> <20101029151610.GA19146@laptop2.lan.localhost> Message-ID: Yay! Thanks Matto. 2010/10/29 Hannes Sch?ller > Hi! > > On Fri, Oct 29, 2010 at 03:18:53PM +0200, Matto Fransen wrote: > > Below a small patch to make tabcompletion on bookmarks case-insensitive > :) > > Thanks! I'll merge this into the next version, extended to be a > configurable option :) > > Hannes > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAkzK5ToACgkQmR0MDT+hJJrW9ACgttnYOTalrjeXu5TpcwYvDzJB > yBUAn0wr1srO1yubUtKkaXYl4fiy6oS1 > =uV6k > -----END PGP SIGNATURE----- > > _______________________________________________ > Vimprobable-users mailing list > Vimprobable-users at vimprobable.org > http://vimprobable.org/mailman/listinfo/vimprobable-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas at xteddy.org Sun Oct 31 16:22:17 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 16:22:17 +0000 Subject: [Vimprobable-users] [PATCH 0/2] Allow for "-b tagname" on the command-line Message-ID: <20101031162214.GA6279@shuttle.home> These patches allow for -b to be used to open up a set of valid URLs defined with a tag name. Documentation also included. Thomas Adam (2): Introduce -b to open up bookmarked URLs with tag Documentation for -b tagname. main.c | 48 +++++++++++++++++++++++++++++++++++++----------- vimprobable2.1 | 4 ++++ 2 files changed, 41 insertions(+), 11 deletions(-) From thomas at xteddy.org Sun Oct 31 16:22:44 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 16:22:44 +0000 Subject: [Vimprobable-users] [PATCH 1/2] Introduce -b to open up bookmarked URLs with tag Message-ID: <20101031162241.GA6317@shuttle.home> Currently, one has to open up an instance of Vimprobable just to be able to then open up URLs with a given bookmark tag. Change this, by allowing a bookmark tag be specificied on the command-line instead with "-b". Signed-Off-By: Thomas Adam --- main.c | 48 +++++++++++++++++++++++++++++++++++++----------- 1 files changed, 37 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index a8f2ba1..bfcfcd5 100644 --- a/main.c +++ b/main.c @@ -1792,6 +1792,7 @@ search_tag(const Arg * a) { const char *tag = a->s; char s[BUFFERSIZE], foundtag[40], url[BUFFERSIZE]; int t, i, intag, k; + gboolean foundtagname = FALSE; if (!tag) { /* The user must give us something to load up. */ @@ -1838,8 +1839,11 @@ search_tag(const Arg * a) { while (s[i] && !isspace(s[i])) url[k++] = s[i++]; url[k] = '\0'; Arg x = { .i = TargetNew, .s = url }; - open (&x); - } + open (&x); + + foundtagname = TRUE; + } else + foundtagname = FALSE; } intag = 0; } @@ -1847,7 +1851,7 @@ search_tag(const Arg * a) { t--; } } - return TRUE; + return foundtagname; } void @@ -2167,10 +2171,13 @@ main(int argc, char *argv[]) { static char url[256] = ""; static gboolean ver = false; static const char *cfile = NULL; + static const char *bmarktag = NULL; + static gboolean skip_url_opening = false; static GOptionEntry opts[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &ver, "print version", NULL }, { "embed", 'e', 0, G_OPTION_ARG_STRING, &winid, "embedded", NULL }, { "configfile", 'c', 0, G_OPTION_ARG_STRING, &cfile, "config file", NULL }, + { "bookmarktag", 'b', 0, G_OPTION_ARG_STRING, &bmarktag, "bookmark tag", NULL }, { NULL } }; static GError *err; @@ -2188,6 +2195,19 @@ main(int argc, char *argv[]) { return EXIT_SUCCESS; } + if (bmarktag) { + /* Then try and open the windows associated with bmarktag. */ + a.s = g_strdup(bmarktag); + + if (!search_tag(&a)) + give_feedback( + g_strdup_printf("Couldn't open bookmark tag \"%s\"", bmarktag)); + else + skip_url_opening = TRUE; + + g_free(a.s); + } + if (cfile) configfile = g_strdup_printf(cfile); else @@ -2213,15 +2233,21 @@ main(int argc, char *argv[]) { } /* command line argument: URL */ - if (argc > 1) { - strncpy(url, argv[argc - 1], 255); - } else { - strncpy(url, startpage, 255); + /* Some options, such as bookmarktag (-b) should always override anything + * else on the command-line, such as a URL, so if skip_url_opening is set + * to TRUE, we never do anything with a potential URL. + */ + if (!skip_url_opening) { + if (argc > 1) { + strncpy(url, argv[argc - 1], 255); + } else { + strncpy(url, startpage, 255); + } + + a.i = TargetCurrent; + a.s = url; + open(&a); } - - a.i = TargetCurrent; - a.s = url; - open(&a); gtk_main(); return EXIT_SUCCESS; -- 1.7.1 From thomas at xteddy.org Sun Oct 31 16:23:08 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 16:23:08 +0000 Subject: [Vimprobable-users] [PATCH 2/2] Documentation for -b tagname. Message-ID: <20101031162305.GA6339@shuttle.home> Document "-b" as a valid command-line option. --- vimprobable2.1 | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/vimprobable2.1 b/vimprobable2.1 index 9425258..b3dc37b 100644 --- a/vimprobable2.1 +++ b/vimprobable2.1 @@ -7,6 +7,7 @@ Vimprobable \- A WWW browser based on webkit with keybindings inspired by vim, t .SH SYNOPSIS .B vimprobable2 +.OP \fL\-b|\-\-bookmarktag .OP \fL\-c|\-\-config .OP \fL\-e|\-\-embed .OP \fL\-h|\-\-help @@ -15,6 +16,9 @@ Vimprobable \- A WWW browser based on webkit with keybindings inspired by vim, t .SH OPTIONS .TP +.BI -b " bookmark tag" +Open URLs specified with the given tag. +.TP .BI -c " config file" Use the specified config file. If none found, defaults to .I $HOME/.config/vimprobable/vimprobablerc -- 1.7.1 From hannes at yllr.net Sun Oct 31 18:05:39 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 31 Oct 2010 19:05:39 +0100 Subject: [Vimprobable-users] [Toy Patch 0/1] Crude flash blocker (by mimetype) In-Reply-To: <20101030133042.GA18673@shuttle.home> References: <20101030133042.GA18673@shuttle.home> Message-ID: <20101031190539.0039e1f1@workstation> Hi! Thomas Adam wrote: > by default, by hiding the flash object with a > GtkWidget, and setting a garish background colour with a stock icon > until it's clicked on. This doesn't actually *block* anything, though, does it? It only prevents the user from *seeing* flash animations which are called and downloaded anyway. So what's the point? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From hannes at yllr.net Sun Oct 31 18:07:11 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 31 Oct 2010 19:07:11 +0100 Subject: [Vimprobable-users] [PATCH 0/2] Allow for "-b tagname" on the command-line In-Reply-To: <20101031162214.GA6279@shuttle.home> References: <20101031162214.GA6279@shuttle.home> Message-ID: <20101031190711.3b4eae34@workstation> Hi! Thomas Adam wrote: > These patches allow for -b to be used to open up a set of valid URLs > defined with a tag name. Seems to be quite a bit of code for something which is basically an 'alternate workflow' of existing functionality. What's wrong with firing up the browser and opening a tag set from there? Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From thomas at xteddy.org Sun Oct 31 18:09:30 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 18:09:30 +0000 Subject: [Vimprobable-users] [Toy Patch 0/1] Crude flash blocker (by mimetype) In-Reply-To: <20101031190539.0039e1f1@workstation> References: <20101030133042.GA18673@shuttle.home> <20101031190539.0039e1f1@workstation> Message-ID: <20101031180929.GA3259@shuttle.home> On Sun, Oct 31, 2010 at 07:05:39PM +0100, Hannes Sch?ller wrote: > Hi! > > Thomas Adam wrote: > > by default, by hiding the flash object with a > > GtkWidget, and setting a garish background colour with a stock icon > > until it's clicked on. > > This doesn't actually *block* anything, though, does it? It only Semantics aside, no. > prevents the user from *seeing* flash animations which are called and > downloaded anyway. So what's the point? It's a toy -- nothing more. I personally found it useful for things like flash adverts, etc. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From thomas at xteddy.org Sun Oct 31 18:11:20 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 18:11:20 +0000 Subject: [Vimprobable-users] [PATCH 0/2] Allow for "-b tagname" on the command-line In-Reply-To: <20101031190711.3b4eae34@workstation> References: <20101031162214.GA6279@shuttle.home> <20101031190711.3b4eae34@workstation> Message-ID: <20101031181119.GB3259@shuttle.home> On Sun, Oct 31, 2010 at 07:07:11PM +0100, Hannes Sch?ller wrote: > Hi! > > Thomas Adam wrote: > > These patches allow for -b to be used to open up a set of valid URLs > > defined with a tag name. > > Seems to be quite a bit of code for something which is basically an > 'alternate workflow' of existing functionality. What's wrong with > firing up the browser and opening a tag set from there? Nothing -- other than I then have to go and close that window afterwards, I suppose. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From mtreibton at googlemail.com Sun Oct 31 20:13:55 2010 From: mtreibton at googlemail.com (Michael Treibton) Date: Sun, 31 Oct 2010 20:13:55 +0000 Subject: [Vimprobable-users] yahoo/gmail single sign-in Message-ID: hi all! ive been using vimprobable2 for a few weeks - i think its really cool! thank you to Hannes for all the hard work youve put into it! i have one question - when i sign-in to gmail or yahoo - and click the "keep me logged in" option, vimprobable2 doesnt honor this - rather, it will always ask me to re-sign in, even when linking to calendars from the same page ive signed in from already i hope this is making sence - what could be wrong? is there an easy solution to this? thank you once again! Michael From hannes at yllr.net Sun Oct 31 20:47:14 2010 From: hannes at yllr.net (Hannes =?UTF-8?B?U2Now7xsbGVy?=) Date: Sun, 31 Oct 2010 21:47:14 +0100 Subject: [Vimprobable-users] yahoo/gmail single sign-in In-Reply-To: References: Message-ID: <20101031214714.7d71a590@workstation> Michael Treibton wrote: > i have one question - when i sign-in to gmail or yahoo - and click the > "keep me logged in" option, vimprobable2 doesnt honor this - rather, > it will always ask me to re-sign in, even when linking to calendars > from the same page ive signed in from already Do these open in a new window? If so, please wait for the next release which will address this thanks to Thomas' great cookie handling patch posted here on the list a week ago. Hannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From mtreibton at googlemail.com Sun Oct 31 21:11:20 2010 From: mtreibton at googlemail.com (Michael Treibton) Date: Sun, 31 Oct 2010 21:11:20 +0000 Subject: [Vimprobable-users] yahoo/gmail single sign-in In-Reply-To: <20101031214714.7d71a590@workstation> References: <20101031214714.7d71a590@workstation> Message-ID: 2010/10/31 Hannes Sch?ller : > Michael Treibton wrote: >> i have one question - when i sign-in to gmail or yahoo - and click the >> "keep me logged in" option, vimprobable2 doesnt honor this - rather, >> it will always ask me to re-sign in, even when linking to calendars >> from the same page ive signed in from already > > Do these open in a new window? If so, please wait for the next release > which will address this thanks to Thomas' great cookie handling patch > posted here on the list a week ago. oh - thats really good! thanks Hannes!! when is the next release? and yes, they do open in new windows Michael From mtreibton at googlemail.com Sun Oct 31 21:14:03 2010 From: mtreibton at googlemail.com (Michael Treibton) Date: Sun, 31 Oct 2010 21:14:03 +0000 Subject: [Vimprobable-users] tabbed interface for vimprobable2? Message-ID: hi, i know its in the faq - but why doesnt vimprobable consider using native tabs? wouldnt this help with sharing data between diffrent vimprobable windows? i am sure its not much code? thanks! Michael From thomas at xteddy.org Sun Oct 31 21:31:43 2010 From: thomas at xteddy.org (Thomas Adam) Date: Sun, 31 Oct 2010 21:31:43 +0000 Subject: [Vimprobable-users] tabbed interface for vimprobable2? In-Reply-To: References: Message-ID: <20101031213142.GD3259@shuttle.home> On Sun, Oct 31, 2010 at 09:14:03PM +0000, Michael Treibton wrote: > hi, > > i know its in the faq - but why doesnt vimprobable consider using > native tabs? wouldnt this help with sharing data between diffrent > vimprobable windows? i am sure its not much code? Hmm -- there are some benefits to this I suppose -- the main one would be for session-sharing of data, yes, although for that, the use of libunique would do it -- but I don't quite see what or why Vimprobable would need this for. It would have been more applicable for inter-session communication for cookie support, but I've very crudely solved this already. Hence, having an inherent tabbed interface for anything else just seems pointless to me -- when something like "tabbed" (from the suckless project) works just fine if you really need it, and your window manager doesn't support this somehow. -- Thomas Adam -- "Deep in my heart I wish I was wrong. But deep in my heart I know I am not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.) From mtreibton at googlemail.com Sun Oct 31 22:05:25 2010 From: mtreibton at googlemail.com (Michael Treibton) Date: Sun, 31 Oct 2010 22:05:25 +0000 Subject: [Vimprobable-users] tabbed interface for vimprobable2? In-Reply-To: <20101031213142.GD3259@shuttle.home> References: <20101031213142.GD3259@shuttle.home> Message-ID: On 31 October 2010 21:31, Thomas Adam wrote: > On Sun, Oct 31, 2010 at 09:14:03PM +0000, Michael Treibton wrote: >> hi, >> >> i know its in the faq - but why doesnt vimprobable consider using >> native tabs? wouldnt this help with sharing data between diffrent >> vimprobable windows? i am sure its not much code? > > Hmm -- there are some benefits to this I suppose -- the main one would be > for session-sharing of data, yes, although for that, the use of libunique > would do it -- but I don't quite see what or why Vimprobable would need this > for. ok - but if its easy to do - why not do it for consistency and then thered be no need for an extra program the user would have to fetch and download - in this case tabbed. Michael From mtreibton at googlemail.com Sun Oct 31 22:08:12 2010 From: mtreibton at googlemail.com (Michael Treibton) Date: Sun, 31 Oct 2010 22:08:12 +0000 Subject: [Vimprobable-users] opening lots of URLS at once? Message-ID: hi, is it possible to open up a lot of urls at once with vimprobable? what about via bookmarks? Thanks! Michael