X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=hook.c;h=db0b1a98e23e75d186e7aa2b232ee2451f118f52;hp=aaf1c7c99ff4b3403610e62ff76503798f67664f;hb=5444b60629a8e4d01a78f5999615a084dd6cbd8a;hpb=711f787502b6a1a1c150b948a5ed9156c8ef9ba1 diff --git a/hook.c b/hook.c index aaf1c7c..db0b1a9 100644 --- a/hook.c +++ b/hook.c @@ -7,28 +7,13 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "mutt.h" -#include "alias.h" -#include "mx.h" +#include +#include +#include +#include #include -#include "compress.h" + +#include "alias.h" #define ERROR_STOP 0 @@ -365,7 +350,7 @@ mutt_addr_hook (char *path, ssize_t pathlen, unsigned long type, CONTEXT * ctx, return -1; } -void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr) +void mutt_default_save (char *path, ssize_t pathlen, const HEADER * hdr) { *path = 0; if (mutt_addr_hook (path, pathlen, M_SAVEHOOK, Context, hdr) != 0) { @@ -412,30 +397,29 @@ void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr) mutt_pretty_mailbox (path); } -static char *_mutt_string_hook (const char *match, int hook) +static const char *_mutt_string_hook (const char *match, int hook) { HOOK *tmp = Hooks; for (; tmp; tmp = tmp->next) { - if ((tmp->type & hook) && ((match && - regexec (tmp->rx.rx, match, 0, NULL, - 0) == 0) ^ tmp->rx.not)) + if ((tmp->type & hook) + && ((match && regexec(tmp->rx.rx, match, 0, NULL, 0) == 0) ^ tmp->rx.not)) return (tmp->command); } return (NULL); } -char *mutt_charset_hook (const char *chs) +const char *mutt_charset_hook (const char *chs) { return _mutt_string_hook (chs, M_CHARSETHOOK); } -char *mutt_iconv_hook (const char *chs) +const char *mutt_iconv_hook (const char *chs) { return _mutt_string_hook (chs, M_ICONVHOOK); } -char *mutt_crypt_hook (address_t * adr) +const char *mutt_crypt_hook (address_t * adr) { return _mutt_string_hook (adr->mailbox, M_CRYPTHOOK); }