From 892df7e70376da43374d834b8a825ea2d59efd06 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 18 Mar 2007 14:41:28 +0100 Subject: [PATCH] split ml_core into MCore and MTransport modules. move more settings to MTransport Signed-off-by: Pierre Habouzit --- commands.c | 2 +- globals.h | 2 -- init.h | 27 --------------------------- lib-lua/lua-token.sh | 2 ++ lib-lua/madmutt.cpkg | 12 +++++++++--- lib-lua/runtime.c | 3 ++- lib-mx/mx.c | 2 +- lib-ui/curs_lib.c | 2 +- lib-ui/curs_main.c | 8 ++++---- lib-ui/curses.h | 2 +- sendlib.c | 10 +++++----- 11 files changed, 26 insertions(+), 46 deletions(-) diff --git a/commands.c b/commands.c index ed99c4a..8b5444b 100644 --- a/commands.c +++ b/commands.c @@ -520,7 +520,7 @@ void mutt_shell_escape (void) buf[0] = 0; if (mutt_get_field (_("Shell command: "), buf, sizeof (buf), M_CMD) == 0) { if (!buf[0]) - m_strcpy(buf, sizeof(buf), ml_core.shell); + m_strcpy(buf, sizeof(buf), MCore.shell); if (buf[0]) { CLEARLINE (LINES - 1); mutt_endwin (NULL); diff --git a/globals.h b/globals.h index 82633db..cf27213 100644 --- a/globals.h +++ b/globals.h @@ -34,8 +34,6 @@ WHERE char *ContentType; WHERE char *DefaultHook; WHERE char *DateFmt; WHERE char *DisplayFilter; -WHERE char *DsnNotify; -WHERE char *DsnReturn; WHERE char *EditorHeaders; WHERE char *FileCharset; WHERE char *FolderFormat; diff --git a/init.h b/init.h index a5e6ca3..fa5af82 100644 --- a/init.h +++ b/init.h @@ -533,33 +533,6 @@ struct option_t MuttVars[] = { ** is viewed it is passed as standard input to $$display_filter, and the ** filtered message is read from the standard output. */ - {"dsn_notify", DT_STR, R_NONE, UL &DsnNotify, ""}, - /* - ** .pp - ** \fBNote:\fP you should not enable this unless you are using Sendmail - ** 8.8.x or greater or in connection with the SMTP support via libESMTP. - ** .pp - ** This variable sets the request for when notification is returned. The - ** string consists of a comma separated list (no spaces!) of one or more - ** of the following: \fInever\fP, to never request notification, - ** \fIfailure\fP, to request notification on transmission failure, - ** \fIdelay\fP, to be notified of message delays, \fIsuccess\fP, to be - ** notified of successful transmission. - ** .pp - ** Example: \fTset dsn_notify="failure,delay"\fP - */ - {"dsn_return", DT_STR, R_NONE, UL &DsnReturn, ""}, - /* - ** .pp - ** \fBNote:\fP you should not enable this unless you are using Sendmail - ** 8.8.x or greater or in connection with the SMTP support via libESMTP. - ** .pp - ** This variable controls how much of your message is returned in DSN - ** messages. It may be set to either \fIhdrs\fP to return just the - ** message header, or \fIfull\fP to return the full message. - ** .pp - ** Example: \fTset dsn_return=hdrs\fP - */ {"duplicate_threads", DT_BOOL, R_RESORT|R_RESORT_INIT|R_INDEX, OPTDUPTHREADS, "yes" }, /* ** .pp diff --git a/lib-lua/lua-token.sh b/lib-lua/lua-token.sh index 3f45eb5..ddc2847 100644 --- a/lib-lua/lua-token.sh +++ b/lib-lua/lua-token.sh @@ -115,6 +115,8 @@ exit 0 ## bindir ## docdir ## dotlock +## dsn_notify +## dsn_return ## editor ## hcache_backend ## quit diff --git a/lib-lua/madmutt.cpkg b/lib-lua/madmutt.cpkg index 9d1ffd7..aefb74f 100644 --- a/lib-lua/madmutt.cpkg +++ b/lib-lua/madmutt.cpkg @@ -77,7 +77,7 @@ static const char *luaM_path_post(const char *val) # define HCACHE_BACKEND "unknown" #endif -@package madmutt { +@package MCore { const string_t version = VERSION; const string_t sysconfdir = SYSCONFDIR; const string_t bindir = BINDIR; @@ -86,7 +86,6 @@ static const char *luaM_path_post(const char *val) path_t dotlock = BINDIR "/mutt_dotlock"; path_t editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi"; - path_t sendmail = SENDMAIL " -eom -oi"; path_t shell = madmutt_init_shell(); quadopt_t quit = M_YES; @@ -94,6 +93,13 @@ static const char *luaM_path_post(const char *val) bool beep_new = 0; const string_t pwd(void) = madmutt_pwd(); -} ml_core; +} MCore; + +@package MTransport { + path_t sendmail = SENDMAIL " -eom -oi"; + + string_t dsn_notify = NULL; + string_t dsn_return = NULL; +} MTransport; /* vim:set ft=c: */ diff --git a/lib-lua/runtime.c b/lib-lua/runtime.c index 34de3bb..21503a8 100644 --- a/lib-lua/runtime.c +++ b/lib-lua/runtime.c @@ -33,7 +33,8 @@ void luaM_initialize(void) {LUA_STRLIBNAME, luaopen_string}, {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, - {"madmutt", luaopen_madmutt}, + {"MCore", luaopen_MCore}, + {"MTransport", luaopen_MTransport}, }; int i; diff --git a/lib-mx/mx.c b/lib-mx/mx.c index 90a46f4..231d140 100644 --- a/lib-mx/mx.c +++ b/lib-mx/mx.c @@ -70,7 +70,7 @@ static int invoke_dotlock (const char *path, int flags, int retry) mutt_quote_filename (f, sizeof (f), path); snprintf(cmd, sizeof(cmd), "%s %s%s%s%s%s%s%s", - ml_core.dotlock, + MCore.dotlock, flags & DL_FL_TRY ? "-t " : "", flags & DL_FL_UNLOCK ? "-u " : "", flags & DL_FL_USEPRIV ? "-p " : "", diff --git a/lib-ui/curs_lib.c b/lib-ui/curs_lib.c index 571f285..66ffbb4 100644 --- a/lib-ui/curs_lib.c +++ b/lib-ui/curs_lib.c @@ -144,7 +144,7 @@ void mutt_edit_file(const char *data) char cmd[LONG_STRING]; mutt_endwin (NULL); - m_quotefile_fmt(cmd, sizeof (cmd), ml_core.editor, data); + m_quotefile_fmt(cmd, sizeof (cmd), MCore.editor, data); if (mutt_system (cmd) == -1) mutt_error (_("Error running \"%s\"!"), cmd); keypad (stdscr, TRUE); diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 600932a..5abbf49 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -479,7 +479,7 @@ int mutt_index_menu (void) sidebar_draw (); mutt_message (_("New mail in this mailbox.")); - if (ml_core.beep_new) + if (MCore.beep_new) beep (); } else if (check == M_FLAGS) @@ -506,7 +506,7 @@ int mutt_index_menu (void) menu->redraw |= REDRAW_SIDEBAR; } if (do_buffy_notify) { - if (buffy_notify () && ml_core.beep_new) + if (buffy_notify () && MCore.beep_new) beep (); } else @@ -974,7 +974,7 @@ int mutt_index_menu (void) break; } - if (query_quadoption2(ml_core.quit, _("Quit Madmutt?")) == M_YES) { + if (query_quadoption2(MCore.quit, _("Quit Madmutt?")) == M_YES) { int check; oldcount = Context ? Context->msgcount : 0; @@ -1302,7 +1302,7 @@ int mutt_index_menu (void) } if ((menu->menu == MENU_MAIN) - && (query_quadoption2(ml_core.quit, + && (query_quadoption2(MCore.quit, _("Exit Madmutt without saving?")) == M_YES)) { if (Context) { diff --git a/lib-ui/curses.h b/lib-ui/curses.h index c86b651..e0612fe 100644 --- a/lib-ui/curses.h +++ b/lib-ui/curses.h @@ -62,7 +62,7 @@ #define CLEARLINE_WIN(x) move(x,(option(OPTMBOXPANE)?SidebarWidth:0)), clrtoeol() #define CLEARLINE(x) move(x,0), clrtoeol() #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) -#define BEEP() do { if (ml_core.beep) beep(); } while (0) +#define BEEP() do { if (MCore.beep) beep(); } while (0) #if ! (defined(USE_SLANG_CURSES) || defined(HAVE_CURS_SET)) #define curs_set(x) diff --git a/sendlib.c b/sendlib.c index ed4bbb9..cc456b3 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1849,7 +1849,7 @@ static int mutt_invoke_sendmail (address_t * from, /* the sender */ } else #endif { - m_strcpy(cmd, sizeof(cmd), ml_core.sendmail); + m_strcpy(cmd, sizeof(cmd), MTransport.sendmail); } ps = cmd; @@ -1890,13 +1890,13 @@ static int mutt_invoke_sendmail (address_t * from, /* the sender */ args = add_args (args, &argslen, &argsmax, f); } } - if (DsnNotify) { + if (MTransport.dsn_notify) { args = add_option (args, &argslen, &argsmax, "-N"); - args = add_option (args, &argslen, &argsmax, DsnNotify); + args = add_option (args, &argslen, &argsmax, MTransport.dsn_notify); } - if (DsnReturn) { + if (MTransport.dsn_return) { args = add_option (args, &argslen, &argsmax, "-R"); - args = add_option (args, &argslen, &argsmax, DsnReturn); + args = add_option (args, &argslen, &argsmax, MTransport.dsn_return); } args = add_option (args, &argslen, &argsmax, "--"); args = add_args (args, &argslen, &argsmax, to); -- 2.20.1