+2005-02-19 16:00:24 Thomas Roessler <roessler@does-not-exist.org> (roessler)
+
+ * sendlib.c: Fix Debian 295528.
+
+2005-02-17 03:33:00 Brendan Cully <brendan@kublai.com> (brendan)
+
+ * OPS, browser.c, doc/manual.sgml.head, functions.h,
+ imap/browse.c, imap/imap.c, imap/imap.h, imap/imap_private.h: New
+ function: rename-mailbox (bound to 'r' by default).
+
+ The lack of a rename-mailbox command for IMAP finally got too annoying.
+ It's a bit of a cut-and-paste job, but I've put my dreams of cleaning
+ up the IMAP codebase on hold. Gotta grow up some time.
+
2005-02-13 17:37:31 Roland Rosenfeld <roland@spinnaker.de> (roessler)
* po/de.po: update
Changes specific to mutt-ng:
+2004-02-21:
+ * Merged past mutt changes
+ * Fixed a bug in mutt_FormatString regarding aligning the rest of a string to the right (%>)
+
2004-02-16:
* fixed segfault in curs_lib.c
* fixed names
OP_RECALL_MESSAGE "recall a postponed message"
OP_REDRAW "clear and redraw the screen"
OP_REFORMAT_WINCH "{internal}"
+OP_RENAME_MAILBOX "rename the current mailbox (IMAP only)"
OP_REPLY "reply to a message"
OP_RESEND "use the current message as a template for a new one"
OP_SAVE "save message/attachment to a file"
patch-1.5.6.tg.hcache.12
+patch-1.5.5.1.pdmef.short_mbox_name.1
rr.compressed
patch-1.5.4.fw.maildir_inode_sort
patch-1.4.admcd.gnutls.59d
}
break;
- case OP_DELETE_MAILBOX:
+ case OP_RENAME_MAILBOX:
+ if (!state.entry[menu->current].imap)
+ mutt_error (_("Rename is only supported for IMAP mailboxes"));
+ else
+ {
+ int nentry = menu->current;
+
+ if (imap_mailbox_rename (state.entry[nentry].name) >= 0) {
+ destroy_state (&state);
+ init_state (&state, NULL);
+ state.imap_browse = 1;
+ imap_browse (LastDir, &state);
+ menu->data = state.entry;
+ menu->current = 0;
+ menu->top = 0;
+ init_menu (&state, menu, title, sizeof (title), buffy);
+ MAYBE_REDRAW (menu->redraw);
+ }
+ }
+ break;
+
+ case OP_DELETE_MAILBOX:
if (!state.entry[menu->current].imap)
mutt_error (_("Delete is only supported for IMAP mailboxes"));
else
will choose to descend into the subfolder view. If you wish to view
the messages in that folder, you must use <tt>view-file</tt> instead
(bound to <tt>space</tt> by default).
-<item>You can delete mailboxes with the <tt>delete-mailbox</tt>
- command (bound to <tt>d</tt> by default. You may also
+<item>You can create, delete and rename mailboxes with the
+ <tt>create-mailbox</tt>, <tt>delete-mailbox</tt>, and
+ <tt>rename-mailbox</tt> commands (default bindings: <tt>C</tt>,
+ <tt>d</tt> and <tt>r</tt>, respectively). You may also
<tt>subscribe</tt> and <tt>unsubscribe</tt> to mailboxes (normally
these are bound to <tt>s</tt> and <tt>u</tt>, respectively).
</itemize>
#ifdef USE_IMAP
{ "create-mailbox", OP_CREATE_MAILBOX, "C" },
{ "delete-mailbox", OP_DELETE_MAILBOX, "d" },
+ { "rename-mailbox", OP_RENAME_MAILBOX, "r" },
#endif
#if defined USE_IMAP || defined USE_NNTP
{ "subscribe", OP_BROWSER_SUBSCRIBE, "s" },
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*/
-#include <stdint.h>
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+# endif
#if HAVE_CONFIG_H
#include "config.h"
return -1;
}
+int imap_mailbox_rename(const char* mailbox)
+{
+ IMAP_DATA* idata;
+ IMAP_MBOX mx;
+ char buf[LONG_STRING];
+ char newname[SHORT_STRING];
+
+ if (imap_parse_path (mailbox, &mx) < 0)
+ {
+ dprint (1, (debugfile, "imap_mailbox_rename: Bad source mailbox %s\n",
+ mailbox));
+ return -1;
+ }
+
+ if (!(idata = imap_conn_find (&mx.account, M_IMAP_CONN_NONEW)))
+ {
+ dprint (1, (debugfile, "imap_mailbox_rename: Couldn't find open connection to %s", mx.account.host));
+ goto fail;
+ }
+
+ snprintf(buf, sizeof (buf), _("Rename mailbox %s to: "), mx.mbox);
+
+ if (mutt_get_field (buf, newname, sizeof (newname), M_FILE) < 0)
+ goto fail;
+
+ if (!mutt_strlen (newname))
+ {
+ mutt_error (_("Mailbox must have a name."));
+ mutt_sleep (1);
+ goto fail;
+ }
+
+ if (imap_rename_mailbox (idata, &mx, newname) < 0) {
+ mutt_error (_("Rename failed: %s"), imap_get_qualifier (idata->cmd.buf));
+ mutt_sleep (1);
+ goto fail;
+ }
+
+ mutt_message (_("Mailbox renamed."));
+ mutt_sleep (0);
+
+ FREE (&mx.mbox);
+ return 0;
+
+ fail:
+ FREE (&mx.mbox);
+ return -1;
+}
+
static int browse_add_list_result (IMAP_DATA* idata, const char* cmd,
struct browser_state* state, short isparent)
{
return 0;
}
+int imap_rename_mailbox (IMAP_DATA* idata, IMAP_MBOX* mx, const char* newname)
+{
+ char oldmbox[LONG_STRING];
+ char newmbox[LONG_STRING];
+ char buf[LONG_STRING];
+
+ imap_munge_mbox_name (oldmbox, sizeof (oldmbox), mx->mbox);
+ imap_munge_mbox_name (newmbox, sizeof (newmbox), newname);
+
+ snprintf (buf, sizeof (buf), "RENAME %s %s", oldmbox, newmbox);
+
+ if (imap_exec (idata, buf, 0) != 0)
+ return -1;
+
+ return 0;
+}
+
int imap_delete_mailbox (CONTEXT* ctx, IMAP_MBOX mx)
{
char buf[LONG_STRING], mbox[LONG_STRING];
IMAP_DATA *idata;
if (!ctx || !ctx->data) {
- if (!(idata = imap_conn_find (&mx.account,
- option (OPTIMAPPASSIVE) ? M_IMAP_CONN_NONEW : 0)))
- {
- FREE (&mx.mbox);
- return -1;
- }
+ if (!(idata = imap_conn_find (&mx.account,
+ option (OPTIMAPPASSIVE) ? M_IMAP_CONN_NONEW : 0)))
+ {
+ FREE (&mx.mbox);
+ return -1;
+ }
} else {
- idata = ctx->data;
+ idata = ctx->data;
}
imap_munge_mbox_name (mbox, sizeof (mbox), mx.mbox);
/* browse.c */
int imap_browse (char* path, struct browser_state* state);
int imap_mailbox_create (const char* folder);
+int imap_mailbox_rename (const char* mailbox);
/* message.c */
int imap_append_message (CONTEXT* ctx, MESSAGE* msg);
#ifndef _IMAP_PRIVATE_H
#define _IMAP_PRIVATE_H 1
-#include <stdint.h>
+#include <inttypes.h>
#include "imap.h"
#include "mutt_socket.h"
/* -- private IMAP functions -- */
/* imap.c */
int imap_create_mailbox (IMAP_DATA* idata, char* mailbox);
+int imap_rename_mailbox (IMAP_DATA* idata, IMAP_MBOX* mx, const char* newname);
int imap_make_msg_set (IMAP_DATA* idata, BUFFER* buf, int flag, int changed);
int imap_open_connection (IMAP_DATA* idata);
IMAP_DATA* imap_conn_find (const ACCOUNT* account, int flags);
#include "pgp.h"
#endif
+#if HAVE_STDINT_H
#include <stdint.h>
+#elif HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
static void flush_buffer(char* buf, size_t* len, CONNECTION* conn);
static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf,
** .pp
** .dl
** .dt %b .dd number of mailboxes with new mail *
+ ** .dt %B .dd the short pathname of the current mailbox
** .dt %d .dd number of deleted messages *
** .dt %f .dd the full pathname of the current mailbox
** .dt %F .dd number of flagged messages *
if ( DrawFullLine )
count = (COLS < destlen ? COLS : destlen);
else
- count = ((COLS-SidebarWidth) < destlen ? COLS - SidebarWidth : destlen);
+ count = ((COLS-SidebarWidth) < destlen ? (COLS - SidebarWidth) : destlen);
if (count > col)
{
count -= col; /* how many columns left on this line */
wptr += count;
col += count;
}
- if (len + wlen > destlen)
+ if (wid + wlen > destlen)
len = destlen - wlen;
+ else
+ len = wid;
memcpy (wptr, buf, len);
wptr += len;
wlen += len;
wchar_t wc;
mbstate_t mbstate;
- int wrap_cols = COLS - WrapMargin - SidebarWidth;
-
+ int wrap_cols = COLS;
+ if (!(flags & (M_SHOWFLAT)))
+ wrap_cols -= WrapMargin;
+ wrap_cols -= SidebarWidth;
+
if (wrap_cols <= 0)
wrap_cols = COLS;
# include "config.h"
#endif
+#if HAVE_STDINT_H
#include <stdint.h>
+#elif HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
#include "mbyte.h"
#ifdef DEBUG
}
else
{
+ a->noconv = 1;
+ a->force_charset = 1;
+
mutt_mktemp (buff);
if ((s.fpout = safe_fopen (buff, "w")) == NULL)
{
}
/* %b = number of incoming folders with unread messages [option]
+ * %B = short mailbox path
* %d = number of deleted messages [option]
* %f = full mailbox path
* %F = number of flagged messages [option]
const char *elsestring,
unsigned long data, format_flag flags)
{
- char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp;
+ char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp, *p;
int count, optional = (flags & M_FORMAT_OPTIONAL);
MUTTMENU *menu = (MUTTMENU *) data;
optional = 0;
break;
+ case 'B':
+ snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
+#ifdef USE_COMPRESSED
+ if (Context && Context->compressinfo && Context->realpath)
+ {
+ if ((p = strrchr (Context->realpath, '/')))
+ strfcpy (tmp, p + 1, sizeof (tmp));
+ else
+ strfcpy (tmp, Context->realpath, sizeof (tmp));
+ }
+ else
+#endif
+ if (Context && Context->path)
+ {
+ if ((p = strrchr (Context->path, '/')))
+ strfcpy (tmp, p + 1, sizeof (tmp));
+ else
+ strfcpy (tmp, Context->path, sizeof (tmp));
+ }
+ else
+ strfcpy (tmp, _("no mailbox"), sizeof (tmp));
+ snprintf (buf, buflen, fmt, tmp);
+ break;
+
case 'd':
if (!optional)
{