X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=hook.c;h=0a7ce546b68ee01cc7aa920b83b44db418430961;hp=a87dac93e4386dfe0c2f962bba23d8d8760b74d2;hb=df9a60705a8b714c1929339fe9173cf0a06ab3ba;hpb=ba5e3af4ea19e1d20c80941c077039871ec84258 diff --git a/hook.c b/hook.c index a87dac9..0a7ce54 100644 --- a/hook.c +++ b/hook.c @@ -12,6 +12,7 @@ #endif #include "mutt.h" +#include "buffer.h" #include "mx.h" #include "mutt_crypt.h" @@ -30,6 +31,8 @@ #include #include +#define ERROR_STOP 0 + typedef struct hook { int type; /* hook type */ rx_t rx; /* regular expression */ @@ -287,10 +290,12 @@ void mutt_folder_hook (char *path) if ((regexec (tmp->rx.rx, path, 0, NULL, 0) == 0) ^ tmp->rx.not) { if (mutt_parse_rc_line (tmp->command, &token, &err) == -1) { mutt_error ("%s", err.data); - mem_free (&token.data); mutt_sleep (1); /* pause a moment to let the user see the error */ - current_hook_type = 0; - return; + if (ERROR_STOP) { + mem_free (&token.data); + current_hook_type = 0; + return; + } } } } @@ -330,11 +335,13 @@ void mutt_message_hook (CONTEXT * ctx, HEADER * hdr, int type) if (hook->type & type) if ((mutt_pattern_exec (hook->pattern, 0, ctx, hdr) > 0) ^ hook->rx.not) if (mutt_parse_rc_line (hook->command, &token, &err) != 0) { - mem_free (&token.data); mutt_error ("%s", err.data); mutt_sleep (1); - current_hook_type = 0; - return; + if (ERROR_STOP) { + mem_free (&token.data); + current_hook_type = 0; + return; + } } } mem_free (&token.data); @@ -455,11 +462,13 @@ void mutt_account_hook (const char *url) if ((regexec (hook->rx.rx, url, 0, NULL, 0) == 0) ^ hook->rx.not) { if (mutt_parse_rc_line (hook->command, &token, &err) == -1) { - mem_free (&token.data); mutt_error ("%s", err.data); mutt_sleep (1); - - return; + if (ERROR_STOP) { + mem_free (&token.data); + current_hook_type = 0; + return; + } } } }