From: Pierre Habouzit Date: Sun, 18 Nov 2007 11:05:45 +0000 (+0100) Subject: simplifications X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=84b3808a5aead62dd058b977ba27b99f11a059ce simplifications Signed-off-by: Pierre Habouzit --- diff --git a/hook.c b/hook.c index efda902..95fd551 100644 --- a/hook.c +++ b/hook.c @@ -17,6 +17,7 @@ #include "crypt.h" #include "pattern.h" +#if 0 typedef struct hook_t { int type; /* hook type */ rx_t rx; /* regular expression */ @@ -36,26 +37,11 @@ DO_SLIST(hook_t, hook, hook_delete); static hook_t *Hooks = NULL; static unsigned long current_hook_type = 0; - -/* Deletes all hooks of type ``type'', or all defined hooks if ``type'' is 0 */ -void mutt_folder_hook (char *path) -{ - lua_State *L = luaM_getruntime(); - lua_getglobal(L, "mod_core"); /* push mod_core 1 */ - lua_getfield(L, -1, "folder_hook"); /* push folder_hook() 2 */ - if (lua_isfunction(L, -1)) { - lua_pushstring(L, LastFolder); - lua_pushstring(L, CurrentFolder); - if (lua_pcall(L, 2, 0, 0)) { - lua_pop(L, 3); - return; - } - } - lua_pop(L, 2); -} +#endif void mutt_message_hook (CONTEXT * ctx, HEADER * hdr, int type) { +#if 0 BUFFER err, token; hook_t *hook; char buf[STRING]; @@ -78,6 +64,24 @@ void mutt_message_hook (CONTEXT * ctx, HEADER * hdr, int type) } p_delete(&token.data); current_hook_type = 0; +#endif +} + +/* Deletes all hooks of type ``type'', or all defined hooks if ``type'' is 0 */ +void mutt_folder_hook (char *path) +{ + lua_State *L = luaM_getruntime(); + lua_getglobal(L, "mod_core"); /* push mod_core 1 */ + lua_getfield(L, -1, "folder_hook"); /* push folder_hook() 2 */ + if (lua_isfunction(L, -1)) { + lua_pushstring(L, LastFolder); + lua_pushstring(L, CurrentFolder); + if (lua_pcall(L, 2, 0, 0)) { + lua_pop(L, 3); + return; + } + } + lua_pop(L, 2); } void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr) @@ -104,9 +108,3 @@ void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr) *path = 0; } } - -void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr) -{ - m_strcpy(path, pathlen, NONULL(MAlias.record)); - mutt_pretty_mailbox(path); -} diff --git a/protos.h b/protos.h index 037e3fe..8677928 100644 --- a/protos.h +++ b/protos.h @@ -72,7 +72,6 @@ void mutt_pipe_message (HEADER *); void mutt_print_message (HEADER *); void mutt_safe_path (char *s, ssize_t l, address_t * a); void mutt_save_path (char *s, ssize_t l, address_t * a); -void mutt_select_fcc (char *, ssize_t, HEADER *); void mutt_message_hook (CONTEXT *, HEADER *, int); void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int); diff --git a/send.c b/send.c index 55b8854..c29ffb6 100644 --- a/send.c +++ b/send.c @@ -1340,7 +1340,8 @@ int ci_send_message (int flags, /* send mode */ killfrom = 1; /* no need to check $use_from because if the user specified a from address it would have already been set by now */ } - mutt_select_fcc (fcc, sizeof (fcc), msg); + m_strcpy(fcc, sizeof(fcc), NONULL(MAlias.record)); + mutt_pretty_mailbox(fcc); if (killfrom) { address_list_wipe(&msg->env->from); killfrom = 0;