From: Pierre Habouzit Date: Sun, 13 May 2007 14:10:32 +0000 (+0200) Subject: useless options, cluttering the codebase that can be emulated if needed in fcc-hooks. X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=2ac2bb6e436cef59dcbb88031b276aa81a109785 useless options, cluttering the codebase that can be emulated if needed in fcc-hooks. Signed-off-by: Pierre Habouzit --- diff --git a/hook.c b/hook.c index 0e6a689..a71724c 100644 --- a/hook.c +++ b/hook.c @@ -356,23 +356,10 @@ void mutt_default_save (char *path, ssize_t pathlen, HEADER * hdr) void mutt_select_fcc (char *path, ssize_t pathlen, HEADER * hdr) { - address_t *adr; - char buf[_POSIX_PATH_MAX]; - ENVELOPE *env = hdr->env; - - if (mutt_addr_hook (path, pathlen, M_FCCHOOK, NULL, hdr) != 0) { - if ((option (OPTSAVENAME) || option (OPTFORCENAME)) && - (env->to || env->cc || env->bcc)) { - adr = env->to ? env->to : (env->cc ? env->cc : env->bcc); - mutt_safe_path (buf, sizeof (buf), adr); - mutt_concat_path(path, pathlen, NONULL(Maildir), buf); - if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0) + if (mutt_addr_hook (path, pathlen, M_FCCHOOK, NULL, hdr) != 0) { m_strcpy(path, pathlen, NONULL(MAlias.record)); } - else - m_strcpy(path, pathlen, NONULL(MAlias.record)); - } - mutt_pretty_mailbox (path); + mutt_pretty_mailbox (path); } static const char *_mutt_string_hook (const char *match, int hook) diff --git a/init.h b/init.h index 77b12cb..9bb31f1 100644 --- a/init.h +++ b/init.h @@ -375,7 +375,7 @@ struct option_t MuttVars[] = { ** .pp ** This variable controls whether or not copies of your outgoing messages ** will be saved for later references. Also see ``$$record'', - ** ``$$save_name'', ``$$force_name'' and ``$fcc-hook''. + ** and ``$fcc-hook''. */ {"crypt_autopgp", DT_BOOL, R_NONE, OPTCRYPTAUTOPGP, "yes" }, /* @@ -599,15 +599,6 @@ struct option_t MuttVars[] = { ** message via mail. */ #endif - {"force_name", DT_BOOL, R_NONE, OPTFORCENAME, "no" }, - /* - ** .pp - ** This variable is similar to ``$$save_name'', except that Madmutt will - ** store a copy of your outgoing message by the username of the address - ** you are sending to even if that mailbox does not exist. - ** .pp - ** Also see the ``$$record'' variable. - */ {"force_buffy_check", DT_BOOL, R_NONE, OPTFORCEBUFFYCHECK, "no" }, /* ** .pp @@ -2171,36 +2162,6 @@ struct option_t MuttVars[] = { ** possibly including eventual real names. When it is \fIunset\fP, Madmutt will ** override any such real names with the setting of the $realname variable. */ - {"save_address", DT_BOOL, R_NONE, OPTSAVEADDRESS, "no" }, - /* - ** .pp - ** If \fIset\fP, Madmutt will take the sender's full address when choosing a - ** default folder for saving a mail. If ``$$save_name'' or ``$$force_name'' - ** is \fIset\fP too, the selection of the fcc folder will be changed as well. - */ - {"save_empty", DT_BOOL, R_NONE, OPTSAVEEMPTY, "yes" }, - /* - ** .pp - ** When \fIunset\fP, mailboxes which contain no saved messages will be removed - ** when closed (the exception is ``$$spoolfile'' which is never removed). - ** If \fIset\fP, mailboxes are never removed. - ** .pp - ** \fBNote:\fP This only applies to mbox folders, Madmutt does not - ** delete MH and Maildir directories. - */ - {"save_name", DT_BOOL, R_NONE, OPTSAVENAME, "no" }, - /* - ** .pp - ** This variable controls how copies of outgoing messages are saved. - ** When set, a check is made to see if a mailbox specified by the - ** recipient address exists (this is done by searching for a mailbox in - ** the ``$$folder'' directory with the \fIusername\fP part of the - ** recipient address). If the mailbox exists, the outgoing message will - ** be saved to that mailbox, otherwise the message is saved to the - ** ``$$record'' mailbox. - ** .pp - ** Also see the ``$$force_name'' variable. - */ {"score", DT_BOOL, R_NONE, OPTSCORE, "yes" }, /* ** .pp diff --git a/lib-mx/compress.c b/lib-mx/compress.c index 93a383d..62a0815 100644 --- a/lib-mx/compress.c +++ b/lib-mx/compress.c @@ -310,11 +310,7 @@ void mutt_fast_close_compressed (CONTEXT * ctx) m_fclose(&ctx->fp); /* if the folder was removed, remove the gzipped folder too */ - if (access (ctx->path, F_OK) != 0 && !option (OPTSAVEEMPTY)) - remove (ctx->realpath); - else - remove_file (ctx); - + remove_file (ctx); restore_path (ctx); p_delete(&ctx->cinfo); } diff --git a/lib-mx/mx.c b/lib-mx/mx.c index 05c9e8a..6a64115 100644 --- a/lib-mx/mx.c +++ b/lib-mx/mx.c @@ -272,24 +272,6 @@ int mx_unlock_file (const char *path, int fd, int dot) return 0; } -static void mx_unlink_empty (const char *path) -{ - int fd; - - if ((fd = open (path, O_RDWR)) == -1) - return; - - if (mx_lock_file (path, fd, 1, 0, 1) == -1) { - close (fd); - return; - } - - invoke_dotlock(path, DL_FL_UNLINK, 1); - - mx_unlock_file (path, fd, 0); - close (fd); -} - /* try to figure out what type of mailbox ``path'' is */ int mx_get_magic (const char *path) { int i = 0; @@ -816,12 +798,6 @@ static int _mx_close_mailbox (CONTEXT * ctx, int *index_hint) mutt_message (_("%d kept, %d deleted."), ctx->msgcount - ctx->deleted, ctx->deleted); - if (ctx->msgcount == ctx->deleted && ctx->magic == M_MBOX - && !mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY)) - { - mx_unlink_empty (ctx->path); - } - if (ctx->cinfo && mutt_slow_close_compressed (ctx)) return (-1); @@ -995,20 +971,11 @@ static int _mx_sync_mailbox (CONTEXT * ctx, int *index_hint) if (rc == 0) { if (ctx->magic == M_IMAP && !purge) mutt_message (_("Mailbox checkpointed.")); - else mutt_message (_("%d kept, %d deleted."), msgcount - deleted, deleted); mutt_sleep (0); - if (ctx->msgcount == ctx->deleted && ctx->magic == M_MBOX - && !mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY)) - { - unlink (ctx->path); - mx_fastclose_mailbox (ctx); - return 0; - } - /* if we haven't deleted any messages, we don't need to resort */ /* ... except for certain folder formats which need "unsorted" * sort order in order to synchronize folders. diff --git a/lib-ui/hdrline.c b/lib-ui/hdrline.c index 50049ef..30b43df 100644 --- a/lib-ui/hdrline.c +++ b/lib-ui/hdrline.c @@ -498,7 +498,7 @@ hdr_format_str(char *dest, ssize_t destlen, case 'O': if (!optional) { make_from_addr (hdr->env, buf2, sizeof (buf2), 1); - if (!option (OPTSAVEADDRESS) && (p = strpbrk (buf2, "%@"))) + if ((p = strpbrk (buf2, "%@"))) *p = 0; mutt_format_s (dest, destlen, prefix, buf2); } diff --git a/mutt.h b/mutt.h index 023e254..5b790d0 100644 --- a/mutt.h +++ b/mutt.h @@ -283,9 +283,6 @@ enum { OPTREVALIAS, OPTREVNAME, OPTREVREAL, - OPTSAVEADDRESS, - OPTSAVEEMPTY, - OPTSAVENAME, OPTSCORE, OPTSIGDASHES, OPTSORTRE, diff --git a/muttlib.c b/muttlib.c index 3f223a6..c595af6 100644 --- a/muttlib.c +++ b/muttlib.c @@ -278,13 +278,7 @@ int mutt_check_overwrite (const char *attname, const char *path, void mutt_save_path(char *d, ssize_t dsize, address_t *a) { if (a && a->mailbox) { - m_strcpy(d, dsize, a->mailbox); - - if (!option(OPTSAVEADDRESS)) { - char *p = strpbrk(d, "%@"); - if (p) - *p = '\0'; - } + m_strncpy(d, dsize, a->mailbox, strcspn(d, "%@")); m_strtolower(d); } else { *d = '\0';