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)
** .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" },
/*
** 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
** 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
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);
}
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;
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);
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.
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);
}
OPTREVALIAS,
OPTREVNAME,
OPTREVREAL,
- OPTSAVEADDRESS,
- OPTSAVEEMPTY,
- OPTSAVENAME,
OPTSCORE,
OPTSIGDASHES,
OPTSORTRE,
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';