summaryrefslogtreecommitdiff
path: root/mail/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/file.c')
-rw-r--r--mail/file.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/mail/file.c b/mail/file.c
index 517a6b7db..bc94f130e 100644
--- a/mail/file.c
+++ b/mail/file.c
@@ -27,13 +27,13 @@ static char *prev_name;
*/
char *
mail_expand_name (const char *name)
{
int status = 0;
char *exp = NULL;
-
+
if (strcmp (name, "#") == 0)
{
if (!prev_name)
{
mu_error (_("No previous file"));
return NULL;
@@ -81,40 +81,49 @@ mail_file (int argc, char **argv)
mu_mailbox_t newbox = NULL;
char *name = mail_expand_name (argv[1]);
int status;
if (!name)
return 1;
-
- if ((status = mu_mailbox_create (&newbox, name)) != 0
- || (status = mu_mailbox_open (newbox, MU_STREAM_RDWR)) != 0)
+
+ status = mu_mailbox_create (&newbox, name);
+ if (status)
+ {
+ mu_error(_("Cannot create mailbox %s: %s"), name,
+ mu_strerror (status));
+ free (name);
+ return 1;
+ }
+ mu_mailbox_attach_ticket (newbox);
+
+ if ((status = mu_mailbox_open (newbox, MU_STREAM_RDWR)) != 0)
{
mu_mailbox_destroy (&newbox);
mu_error(_("Cannot open mailbox %s: %s"), name, mu_strerror (status));
free (name);
return 1;
}
free (name); /* won't need it any more */
page_invalidate (1); /* Invalidate current page map */
-
+
mu_mailbox_get_url (mbox, &url);
pname = mu_strdup (mu_url_to_string (url));
if (mail_mbox_close ())
{
if (pname)
free (pname);
mu_mailbox_close (newbox);
mu_mailbox_destroy (&newbox);
return 1;
}
-
+
if (prev_name)
free (prev_name);
prev_name = pname;
-
+
mbox = newbox;
mu_mailbox_messages_count (mbox, &total);
set_cursor (1);
if (mailvar_is_true ("header"))
{
util_do_command ("summary");
@@ -125,7 +134,6 @@ mail_file (int argc, char **argv)
else
{
mu_error (_("%s takes only one argument"), argv[0]);
}
return 1;
}
-

Return to:

Send suggestions and report system problems to the System administrator.