X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=hook.c;h=7361bba01ead7a85af7bd216760441f756f9d907;hp=a84dc001a625e2bde176a7b6e3fc3fbd4497a87b;hb=a6352753715bbffc5c11af249756af7cbb135856;hpb=80566f6aedda1e4bdcca38f9cb27101b5ba1029f diff --git a/hook.c b/hook.c index a84dc00..7361bba 100644 --- a/hook.c +++ b/hook.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -256,6 +257,20 @@ void mutt_folder_hook (char *path) p_delete(&token.data); current_hook_type = 0; + + { + lua_State *L = luaM_getruntime(); + lua_getfield(L, LUA_GLOBALSINDEX, "MCore"); + lua_getfield(L, -1, "folder_hook"); + lua_remove(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, LastFolder); + lua_pushstring(L, CurrentFolder); + lua_pcall(L, 2, 0, 0); + } else { + lua_pop(L, 1); + } + } } char *mutt_find_hook (int type, const char *pat) @@ -356,10 +371,10 @@ void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr) mutt_safe_path (buf, sizeof (buf), adr); mutt_concat_path(path, pathlen, NONULL(Maildir), buf); if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0) - m_strcpy(path, pathlen, NONULL(Outbox)); + m_strcpy(path, pathlen, NONULL(MAlias.record)); } else - m_strcpy(path, pathlen, NONULL(Outbox)); + m_strcpy(path, pathlen, NONULL(MAlias.record)); } mutt_pretty_mailbox (path); }