From: Pierre Habouzit Date: Sun, 18 Mar 2007 23:50:30 +0000 (+0100) Subject: make luaM_checkquadopt accept some string arguments. ("yes", "no", "ask-yes", "ask... X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=f4a82d92ca0d015424b203887579802f003cfac8 make luaM_checkquadopt accept some string arguments. ("yes", "no", "ask-yes", "ask-no") Signed-off-by: Pierre Habouzit --- diff --git a/init.h b/init.h index 136876f..ab8d050 100644 --- a/init.h +++ b/init.h @@ -3464,8 +3464,6 @@ struct option_t MuttVars[] = { */ #endif /*--*/ - {"strict_mime", DT_BOOL, R_NONE, OPTSTRICTMIME, "no" }, - {"rfc2047_parameters", DT_BOOL, R_NONE, OPTRFC2047PARAMS, "yes"}, { NULL, -1, R_NONE, -1, NULL } }; diff --git a/lib-lua/lua-token.sh b/lib-lua/lua-token.sh index 8c5540c..c5ea76c 100644 --- a/lib-lua/lua-token.sh +++ b/lib-lua/lua-token.sh @@ -112,6 +112,8 @@ exit 0 ############ Put tokens here ############ ## alias_file ## alias_format +## ask-no +## ask-yes ## beep ## beep_new ## bindir @@ -123,6 +125,7 @@ exit 0 ## gecos_mask ## hcache_backend ## homedir +## no ## quit ## sendmail ## shell @@ -130,3 +133,4 @@ exit 0 ## tmpdir ## username ## version +## yes diff --git a/lib-lua/runtime.c b/lib-lua/runtime.c index ac724af..f7401e2 100644 --- a/lib-lua/runtime.c +++ b/lib-lua/runtime.c @@ -75,8 +75,21 @@ int luaM_wrap(void (*errfun)(const char *fmt, ...), int status) quadopt_t luaM_checkquadopt(lua_State *Ls, int narg) { const char *s; - int i = luaL_checkinteger(Ls, narg); + int i; + + if (lua_type(Ls, narg) == LUA_TSTRING) { + s = lua_tostring(Ls, narg); + switch (mlua_which_token(s, -1)) { + case LTK_YES: return M_YES; + case LTK_NO: return M_NO; + case LTK_ASK_YES: return M_ASKYES; + case LTK_ASK_NO: return M_ASKNO; + default: + break; + } + } + i = luaL_checkinteger(Ls, narg); if (i & ~3) { s = lua_pushfstring(Ls, "int in [0-3] expected, got %d", i); return luaL_argerror(Ls, narg, s); diff --git a/mutt.h b/mutt.h index d30984f..3bab146 100644 --- a/mutt.h +++ b/mutt.h @@ -310,7 +310,6 @@ enum { OPTREVALIAS, OPTREVNAME, OPTREVREAL, - OPTRFC2047PARAMS, OPTSAVEADDRESS, OPTSAVEEMPTY, OPTSAVENAME, @@ -321,7 +320,6 @@ enum { OPTSPAMSEP, OPTSTATUSONTOP, OPTSTRICTMAILTO, - OPTSTRICTMIME, OPTSTRICTTHREADS, OPTSTRIPWAS, OPTSTUFFQUOTED,