fix stupid bug regarding saving attachments
applied ajg.last-folder patch
git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@48
e385b8ad-14ed-0310-8656-
cc95a2468c6d
Changes specific to mutt-ng:
Changes specific to mutt-ng:
+2005-02-03:
+ * Fixed stupid bug regarding saving attachments
+ * applied ajg.last-folder patch
+
2005-02-02
* little change to prevent segfaults on ia64; see #285001 in debian bts for
more information
2005-02-02
* little change to prevent segfaults on ia64; see #285001 in debian bts for
more information
{
if (flags == M_SAVE_APPEND)
return fopen (path, "a");
{
if (flags == M_SAVE_APPEND)
return fopen (path, "a");
+ /* be sure not to change the following fopen to safe_fopen
+ * as safe_fopen returns w/ an error if path exists
+ */
if (flags == M_SAVE_OVERWRITE)
if (flags == M_SAVE_OVERWRITE)
- return safe_fopen (path, "w"); /* __FOPEN_CHECKED__ */
+ return fopen (path, "w"); /* __FOPEN_CHECKED__ */
return safe_fopen (path, "w");
}
return safe_fopen (path, "w");
}
/* use the raw keypress */
ch = LastKey;
/* use the raw keypress */
ch = LastKey;
+ if ((ch == '.') && (flags & (M_FILE | M_EFILE)))
+ {
+ rv = 2;
+ goto bye;
+ }
+
#ifdef KEY_ENTER
/* treat ENTER the same as RETURN */
if (ch == KEY_ENTER)
#ifdef KEY_ENTER
/* treat ENTER the same as RETURN */
if (ch == KEY_ENTER)
#include <errno.h>
static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
#include <errno.h>
static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
+static char LastSaveFolder[_POSIX_PATH_MAX] = "";
#define CHECK_READONLY if (Context->readonly) \
{\
#define CHECK_READONLY if (Context->readonly) \
{\
+int mutt_extract_path(char *filename, char *path)
+{
+ char *tmp=safe_malloc(sizeof(char) * _POSIX_PATH_MAX);
+ char *help_ptr;
+
+ help_ptr = tmp;
+
+ while(*filename != '\0')
+ {
+ if (*filename == '/')
+ {
+ *help_ptr++=*filename++;
+ *help_ptr++='\0';
+ strcat(path, tmp);
+ help_ptr = tmp;
+ }
+ *help_ptr++=*filename++;
+ }
+ safe_free((void **) &tmp);
+
+ return 0;
+}
+
void mutt_update_tree (ATTACHPTR **idx, short idxlen)
{
char buf[STRING];
void mutt_update_tree (ATTACHPTR **idx, short idxlen)
{
char buf[STRING];
{
char *prompt;
char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
{
char *prompt;
char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX];
+ char path[_POSIX_PATH_MAX]="";
int is_message;
int append = 0;
int rc;
int is_message;
int append = 0;
int rc;
- prompt = _("Save to file: ");
+ prompt = _("Save to file ('.' for last used folder): ");
- if (mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR) != 0
- || !buf[0])
+ ret = mutt_get_field (prompt, buf, sizeof (buf), M_FILE | M_CLEAR);
+ if (((ret != 0) && (ret != 2)) || (!buf[0]))
+ return -1;
+
+ if (ret == 2)
+ {
+ strfcpy (buf, LastSaveFolder, sizeof (buf));
+ strcat(buf,body->filename);
+ ret = mutt_get_field (_("Save to file: ")
+ , buf, sizeof (buf), M_FILE | M_CLEAR);
+ if ((ret != 0) || (!buf[0]))
+ }
+ else
+ {
+ mutt_extract_path(buf,path);
+ strfcpy (LastSaveFolder, path, sizeof (LastSaveFolder));
+ }
prompt = NULL;
mutt_expand_path (buf, sizeof (buf));
prompt = NULL;
mutt_expand_path (buf, sizeof (buf));