X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=hook.c;h=a71724c6e9348983367b3351c8334bb9f592c682;hp=315a1c169d747c576b17e833f39c5e3eef7a7e2c;hb=e3acf47563fd21378bb5e955948af13ee19774d6;hpb=576172ff50f9dd94dd2f5cc91d247c1e50dbe7fc diff --git a/hook.c b/hook.c index 315a1c1..a71724c 100644 --- a/hook.c +++ b/hook.c @@ -123,8 +123,7 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, p_delete(&pattern.data); return 0; } - } - else { + } else { /* other hooks only allow one command per pattern, so update the * entry with the new command. this currently does not change the * order of execution of the hooks, which i think is desirable since @@ -140,18 +139,16 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, break; } - if (data & - (M_SENDHOOK | M_SEND2HOOK | M_SAVEHOOK | M_FCCHOOK | M_MESSAGEHOOK | - M_REPLYHOOK)) { + if (data & (M_SENDHOOK | M_SEND2HOOK | M_SAVEHOOK | M_FCCHOOK | + M_MESSAGEHOOK | M_REPLYHOOK)) + { if ((pat = mutt_pattern_comp (pattern.data, (data & (M_SENDHOOK | M_SEND2HOOK | M_FCCHOOK)) ? 0 : M_FULL_MSG, err)) == NULL) goto error; - } - else { + } else { rx = p_new(regex_t, 1); -#ifdef M_CRYPTHOOK if ((rc = REGCOMP(rx, NONULL(pattern.data), ((data & M_CRYPTHOOK) ? REG_ICASE : 0))) != 0) { @@ -160,15 +157,14 @@ int mutt_parse_hook (BUFFER * buf __attribute__ ((unused)), BUFFER * s, p_delete(&rx); goto error; } -#endif /* M_CRYPTHOOK */ } if (ptr) { ptr->next = p_new(hook_t, 1); ptr = ptr->next; - } - else + } else { Hooks = ptr = p_new(hook_t, 1); + } ptr->type = data; ptr->command = command.data; ptr->pattern = pat; @@ -360,23 +356,10 @@ void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr) void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr) { - address_t *adr; - char buf[_POSIX_PATH_MAX]; - ENVELOPE *env = hdr->env; - - if (mutt_addr_hook (path, pathlen, M_FCCHOOK, NULL, hdr) != 0) { - if ((option (OPTSAVENAME) || option (OPTFORCENAME)) && - (env->to || env->cc || env->bcc)) { - adr = env->to ? env->to : (env->cc ? env->cc : env->bcc); - mutt_safe_path (buf, sizeof (buf), adr); - mutt_concat_path(path, pathlen, NONULL(Maildir), buf); - if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0) + if (mutt_addr_hook (path, pathlen, M_FCCHOOK, NULL, hdr) != 0) { m_strcpy(path, pathlen, NONULL(MAlias.record)); } - else - m_strcpy(path, pathlen, NONULL(MAlias.record)); - } - mutt_pretty_mailbox (path); + mutt_pretty_mailbox (path); } static const char *_mutt_string_hook (const char *match, int hook)