--- config.def.h | 8 ++++++++ surf.c | 18 ++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index 6718a81..55883d7 100644 --- a/config.def.h +++ b/config.def.h _AT_@ -53,6 +53,14 @@ static Bool allowgeolocation = TRUE; } \ } +/* MAIL(recipient) */ +#define MAIL(t) { \ + .v = (char *[]){ "/bin/sh", "-c", \ + "urxvt -e /bin/sh -c \"mutt \"$0\";\"", \ + t, NULL \ + } \ +} + /* styles */ static SiteStyle styles[] = { /* regexp file in $styledir */ diff --git a/surf.c b/surf.c index a229994..97ad67b 100644 --- a/surf.c +++ b/surf.c _AT_@ -95,7 +95,7 @@ static SoupCache *diskcache = NULL; static void addaccelgroup(Client *c); static void beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r, WebKitNetworkRequest *req, - WebKitNetworkResponse *resp, gpointer d); + WebKitNetworkResponse *resp, Client *c); static char *buildpath(const char *path); static gboolean buttonrelease(WebKitWebView *web, GdkEventButton *e, GList *gl); _AT_@ -137,6 +137,7 @@ static void gettogglestat(Client *c); static void getpagestat(Client *c); static char *geturi(Client *c); static gchar *getstyle(const char *uri); +static void handle_mailto(Client *c, WebKitWebView *w, const gchar *uri); static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c); _AT_@ -209,11 +210,15 @@ addaccelgroup(Client *c) { static void beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r, WebKitNetworkRequest *req, WebKitNetworkResponse *resp, - gpointer d) { + Client *c) { const gchar *uri = webkit_network_request_get_uri(req); if(g_str_has_suffix(uri, "/favicon.ico")) webkit_network_request_set_uri(req, "about:blank"); + + if(g_str_has_prefix(uri, "mailto:")) { + handle_mailto(c, w, uri); + } } static char * _AT_@ -1450,6 +1455,15 @@ updatewinid(Client *c) { } static void +handle_mailto(Client *c, WebKitWebView *w, const gchar *uri) { + Arg arg; + + webkit_web_view_stop_loading(w); + arg = (Arg)MAIL((char*)uri); + spawn(c, &arg); +} + +static void usage(void) { die("usage: %s [-bBfFgGiIkKnNpPsSvx]" " [-a cookiepolicies ] " -- 1.9.1 --bg08WKrSYDhXBjb5--Received on Mon Sep 17 2001 - 00:00:00 CEST
This archive was generated by hypermail 2.3.0 : Mon Jan 19 2015 - 19:24:07 CET