void mutt_select_fcc (char *path, size_t pathlen, HEADER *hdr) { ADDRESS *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, NONULL(Maildir), buf, pathlen); if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0) strfcpy (path, NONULL (Outbox), pathlen); } else strfcpy (path, NONULL (Outbox), pathlen); } mutt_pretty_mailbox (path, pathlen); }
/* returns 0 if OK to proceed, -1 to abort, 1 to retry */ int mutt_save_confirm (const char *s, struct stat *st) { char tmp[_POSIX_PATH_MAX]; int ret = 0; int rc; int magic = 0; magic = mx_get_magic (s); #ifdef USE_POP if (magic == M_POP) { mutt_error _("Can't save message to POP mailbox."); return 1; } #endif #ifdef USE_NNTP if (magic == M_NNTP) { mutt_error _("Can't save message to newsserver."); return 0; } #endif if (magic > 0 && !mx_access (s, W_OK)) { if (option (OPTCONFIRMAPPEND) && (!TrashPath || (str_cmp (s, TrashPath) != 0))) { /* if we're appending to the trash, there's no point in asking */ snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s); if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO) ret = 1; else if (rc == -1) ret = -1; } } if (stat (s, st) != -1) { if (magic == -1) { mutt_error (_("%s is not a mailbox!"), s); return 1; } } else { #ifdef USE_IMAP if (magic != M_IMAP) #endif /* execute the block unconditionally if we don't use imap */ { st->st_mtime = 0; st->st_atime = 0; if (errno == ENOENT) { if (option (OPTCONFIRMCREATE)) { snprintf (tmp, sizeof (tmp), _("Create %s?"), s); if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO) ret = 1; else if (rc == -1) ret = -1; } } else { mutt_perror (s); return 1; } } } CLEARLINE (LINES - 1); return (ret); }