package w3m tag 190167 patch tag 190167 - wontfix thanks Hi,
Here is a patch which makes it possible to disable the internal mailer completely calling the external mailer either just with the email address (ignoring the options in the mailto: URL) or with the full mailto: URL. Regards, -- Karsten Schölzel | Email: [EMAIL PROTECTED] Väderleden 9 4:98 | Jabber: [EMAIL PROTECTED] 97633 Luleå | VoIP: sip:[EMAIL PROTECTED] Sweden | sip:[EMAIL PROTECTED] | Tel: +4918015855857712
Now we can decide what to do with mailto: URLs with options - use internal mailer - ignore the options (never call internal mailer if Mailer is set) - call Mailer with the full mailto: URL --- commit 94271604a3d86e59535073e83c22549dc3f6e301 tree f8278a14e38e39e813024bddd980e27026ed590d parent 84475d826a57ae466f2422db6e2bc64677187dfe author Karsten Schoelzel <[EMAIL PROTECTED]> Thu, 04 May 2006 02:03:33 +0200 committer Karsten Schoelzel <[EMAIL PROTECTED]> Thu, 04 May 2006 02:03:33 +0200 fm.h | 6 ++++ main.c | 88 +++++++++++++++++++++++++++++----------------------------------- rc.c | 12 +++++++++ 3 files changed, 58 insertions(+), 48 deletions(-) diff --git a/fm.h b/fm.h index 1a1a60c..a593a3f 100644 --- a/fm.h +++ b/fm.h @@ -932,6 +932,12 @@ global char *Mailer init(NULL); #else global char *Mailer init(DEF_MAILER); #endif +#ifdef USE_W3MMAILER +#define MAILTO_OPTIONS_USE_W3MMAILER 0 +#endif +#define MAILTO_OPTIONS_IGNORE 1 +#define MAILTO_OPTIONS_USE_MAILTO_URL 2 +global int MailtoOptions init(MAILTO_OPTIONS_IGNORE); global char *ExtBrowser init(DEF_EXT_BROWSER); global char *ExtBrowser2 init(NULL); global char *ExtBrowser3 init(NULL); diff --git a/main.c b/main.c index 9026775..6e11806 100644 --- a/main.c +++ b/main.c @@ -2871,6 +2871,44 @@ 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 && + strchr(url, '?') != NULL)) + 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") { @@ -2920,31 +2958,8 @@ DEFUN(followA, GOTO_LINK, "Go to current 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 */ @@ -3957,31 +3972,8 @@ cmd_loadURL(char *url, ParsedURL *curren { 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 */ diff --git a/rc.c b/rc.c index 95afd95..2860a35 100644 --- a/rc.c +++ b/rc.c @@ -138,6 +138,7 @@ static int OptionEncode = FALSE; #define CMT_URIMETHODMAP N_("List of urimethodmap files") #define CMT_EDITOR N_("Editor") #define CMT_MAILER N_("Mailer") +#define CMT_MAILTO_OPTIONS N_("How to call Mailer for mailto URLs with options") #define CMT_EXTBRZ N_("External Browser") #define CMT_EXTBRZ2 N_("Second External Browser") #define CMT_EXTBRZ3 N_("Third External Browser") @@ -309,6 +310,15 @@ static struct sel_c badcookiestr[] = { }; #endif /* USE_COOKIE */ +static struct sel_c mailtooptionsstr[] = { +#ifdef USE_W3MMAILER + {N_S(MAILTO_OPTIONS_USE_W3MMAILER), N_("use internal mailer instead")}, +#endif + {N_S(MAILTO_OPTIONS_IGNORE), N_("ignore options and use only the address")}, + {N_S(MAILTO_OPTIONS_USE_MAILTO_URL), N_("use full mailto URL")}, + {0, NULL, NULL} +}; + #ifdef USE_M17N static wc_ces_list *display_charset_str = NULL; static wc_ces_list *document_charset_str = NULL; @@ -519,6 +529,8 @@ struct param_ptr params6[] = { #endif {"editor", P_STRING, PI_TEXT, (void *)&Editor, CMT_EDITOR, NULL}, {"mailer", P_STRING, PI_TEXT, (void *)&Mailer, CMT_MAILER, NULL}, + {"mailto_options", P_INT, PI_SEL_C, (void *)&MailtoOptions, + CMT_MAILTO_OPTIONS, (void *)mailtooptionsstr}, {"extbrowser", P_STRING, PI_TEXT, (void *)&ExtBrowser, CMT_EXTBRZ, NULL}, {"extbrowser2", P_STRING, PI_TEXT, (void *)&ExtBrowser2, CMT_EXTBRZ2, NULL},