diff options
author | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-08-20 09:47:09 +0000 |
---|---|---|
committer | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-08-20 09:47:09 +0000 |
commit | 4f9d8accb7503cae4720550aa4a01ee6e5340022 (patch) | |
tree | eb321d3d04e39ef6f6270cf9a255a37a2466476c /main.c | |
parent | exit code is 1 when an error is occured (diff) | |
download | w3m-4f9d8accb7503cae4720550aa4a01ee6e5340022.tar.gz w3m-4f9d8accb7503cae4720550aa4a01ee6e5340022.zip |
Introduce option mailto_options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 88 |
1 files changed, 39 insertions, 49 deletions
@@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.268 2010/08/08 09:53:42 htrb Exp $ */ +/* $Id: main.c,v 1.269 2010/08/20 09:47:09 htrb Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -2890,6 +2890,42 @@ gotoLabel(char *label) return; } +static int +handleMailto(char *url) +{ + Str to; + char *pos; + + if (strncasecmp(url, "mailto:", 7)) + return 0; +#ifdef USE_W3MMAILER + if (! non_null(Mailer) || MailtoOptions == MAILTO_OPTIONS_USE_W3MMAILER) + return 0; +#else + if (!non_null(Mailer)) { + /* FIXME: gettextize? */ + disp_err_message("no mailer is specified", TRUE); + return 1; + } +#endif + + /* invoke external mailer */ + if (MailtoOptions == MAILTO_OPTIONS_USE_MAILTO_URL) { + to = Strnew_charp(html_unquote(url)); + } else { + to = Strnew_charp(url + 7); + if ((pos = strchr(to->ptr, '?')) != NULL) + Strtruncate(to, pos - to->ptr); + } + fmTerm(); + system(myExtCommand(Mailer, shell_quote(file_unquote(to->ptr)), + FALSE)->ptr); + fmInit(); + displayBuffer(Currentbuf, B_FORCE_REDRAW); + pushHashHist(URLHist, url); + return 1; +} + /* follow HREF link */ DEFUN(followA, GOTO_LINK, "Go to current link") { @@ -2939,31 +2975,8 @@ DEFUN(followA, GOTO_LINK, "Go to current link") return; } } - if (!strncasecmp(a->url, "mailto:", 7) -#ifdef USE_W3MMAILER - && non_null(Mailer) && strchr(a->url, '?') == NULL -#endif - ) { - /* invoke external mailer */ - Str to = Strnew_charp(a->url + 7); -#ifndef USE_W3MMAILER - char *pos; - if (!non_null(Mailer)) { - /* FIXME: gettextize? */ - disp_err_message("no mailer is specified", TRUE); - return; - } - if ((pos = strchr(to->ptr, '?')) != NULL) - Strtruncate(to, pos - to->ptr); -#endif - fmTerm(); - system(myExtCommand(Mailer, shell_quote(file_unquote(to->ptr)), - FALSE)->ptr); - fmInit(); - displayBuffer(Currentbuf, B_FORCE_REDRAW); - pushHashHist(URLHist, a->url); + if (handleMailto(a->url)) return; - } #if 0 else if (!strncasecmp(a->url, "news:", 5) && strchr(a->url, '@') == NULL) { /* news:newsgroup is not supported */ @@ -3976,31 +3989,8 @@ cmd_loadURL(char *url, ParsedURL *current, char *referer, FormList *request) { Buffer *buf; - if (!strncasecmp(url, "mailto:", 7) -#ifdef USE_W3MMAILER - && non_null(Mailer) && strchr(url, '?') == NULL -#endif - ) { - /* invoke external mailer */ - Str to = Strnew_charp(url + 7); -#ifndef USE_W3MMAILER - char *pos; - if (!non_null(Mailer)) { - /* FIXME: gettextize? */ - disp_err_message("no mailer is specified", TRUE); - return; - } - if ((pos = strchr(to->ptr, '?')) != NULL) - Strtruncate(to, pos - to->ptr); -#endif - fmTerm(); - system(myExtCommand(Mailer, shell_quote(file_unquote(to->ptr)), - FALSE)->ptr); - fmInit(); - displayBuffer(Currentbuf, B_FORCE_REDRAW); - pushHashHist(URLHist, url); + if (handleMailto(url)) return; - } #if 0 if (!strncasecmp(url, "news:", 5) && strchr(url, '@') == NULL) { /* news:newsgroup is not supported */ |