X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..57dfa08c90608b82597b77862a69f6ed083c772c:/imap/browse.c?ds=sidebyside diff --git a/imap/browse.c b/imap/browse.c index 750a65d..8b60bc7 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -1,6 +1,6 @@ /* * Copyright (C) 1996-9 Brandon Long - * Copyright (C) 1999-2007 Brendan Cully + * Copyright (C) 1999-2008 Brendan Cully * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,11 +72,13 @@ int imap_browse (char* path, struct browser_state* state) if (mx.mbox && mx.mbox[0] != '\0') { int rc; + char *ptr; imap_fix_path (idata, mx.mbox, mbox, sizeof (mbox)); - imap_munge_mbox_name (buf, sizeof (buf), mbox); - imap_unquote_string(buf); /* As kludgy as it gets */ + ptr = safe_strdup (mbox); + imap_utf7_encode (&ptr); mbox[sizeof (mbox) - 1] = '\0'; - strncpy (mbox, buf, sizeof (mbox) - 1); + strncpy (mbox, ptr, sizeof (mbox) - 1); + FREE (&ptr); n = mutt_strlen (mbox); dprint (3, (debugfile, "imap_browse: mbox: %s\n", mbox)); @@ -228,7 +230,7 @@ int imap_mailbox_state (const char* path, struct mailbox_state* state) return -1; } - if (!imap_mxcmp(mx.mbox, idata->mailbox)) + if (idata->ctx && !imap_mxcmp(mx.mbox, idata->mailbox)) { state->new = idata->ctx->new; state->messages = idata->ctx->msgcount; @@ -239,6 +241,8 @@ int imap_mailbox_state (const char* path, struct mailbox_state* state) state->messages = status->messages; } + FREE (&mx.mbox); + return 0; } @@ -329,7 +333,9 @@ int imap_mailbox_rename(const char* mailbox) goto fail; } - if (imap_rename_mailbox (idata, &mx, newname) < 0) { + imap_fix_path (idata, newname, buf, sizeof (buf)); + + if (imap_rename_mailbox (idata, &mx, buf) < 0) { mutt_error (_("Rename failed: %s"), imap_get_qualifier (idata->buf)); mutt_sleep (1); goto fail;