mail arrives. With some modifications from tlr.
OP_BROWSER_SUBSCRIBE "subscribe to current mailbox (IMAP only)"
OP_BROWSER_UNSUBSCRIBE "unsubscribe to current mailbox (IMAP only)"
OP_BROWSER_TOGGLE_LSUB "toggle view all/subscribed mailboxes (IMAP only)"
+OP_BUFFY_LIST "list mailboxes with new mail"
OP_CHANGE_DIRECTORY "change directories"
OP_CHECK_NEW "check mailboxes for new mail"
OP_COMPOSE_ATTACH_FILE "attach a file(s) to this message"
init_menu (&state, menu, title, sizeof (title), buffy);
break;
+ case OP_BUFFY_LIST:
+ mutt_buffy_list ();
+ break;
+
case OP_BROWSER_NEW_FILE:
snprintf (buf, sizeof (buf), "%s/", LastDir);
#include "mailbox.h"
#include "mx.h"
+#include "mutt_curses.h"
+
#ifdef USE_IMAP
#include "imap.h"
#endif
return (BuffyCount);
}
-int mutt_buffy_notify (void)
+int mutt_buffy_list (void)
{
BUFFY *tmp;
char path[_POSIX_PATH_MAX];
-
- if (mutt_buffy_check (0) && BuffyNotify)
+ char buffylist[160];
+ int pos;
+ int first;
+
+ pos = 0;
+ first = 1;
+ buffylist[0] = 0;
+ pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos));
+ for (tmp = Incoming; tmp; tmp = tmp->next)
{
- for (tmp = Incoming; tmp; tmp = tmp->next)
+ /* Is there new mail in this mailbox? */
+ if (!tmp->new)
+ continue;
+
+ strfcpy (path, tmp->path, sizeof (path));
+ mutt_pretty_mailbox (path);
+
+ if (!first && pos + strlen (path) >= COLS - 7)
+ break;
+
+ if (!first)
+ pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos));
+
+ /* Prepend an asterisk to mailboxes not already notified */
+ if (!tmp->notified)
{
- if (tmp->new && !tmp->notified)
- {
- strfcpy (path, tmp->path, sizeof (path));
- mutt_pretty_mailbox (path);
- mutt_message (_("New mail in %s."), path);
- tmp->notified = 1;
- BuffyNotify--;
- return (1);
- }
+ pos += strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos));
+ tmp->notified = 1;
+ BuffyNotify--;
}
- /* there were no mailboxes needing to be notified, so clean up since
- * BuffyNotify has somehow gottten out of sync
- */
- BuffyNotify = 0;
+ pos += strlen (strncat(buffylist + pos, path, sizeof(buffylist)-1-pos));
+ first = 0;
+ }
+ if (!first && tmp)
+ {
+ strncat (buffylist + pos, ", ...", sizeof (buffylist) - 1 - pos);
+ }
+ if (!first)
+ {
+ mutt_message ("%s", buffylist);
+ return (1);
+ }
+ /* there were no mailboxes needing to be notified, so clean up since
+ * BuffyNotify has somehow gotten out of sync
+ */
+ BuffyNotify = 0;
+ return (0);
+}
+
+int mutt_buffy_notify (void)
+{
+ if (mutt_buffy_check (0) && BuffyNotify)
+ {
+ return (mutt_buffy_list ());
}
return (0);
}
mutt_version ();
break;
+ case OP_BUFFY_LIST:
+ mutt_buffy_list ();
+ break;
+
case OP_VIEW_ATTACHMENTS:
CHECK_MSGCOUNT;
CHECK_VISIBLE;
{ "set-flag", OP_MAIN_SET_FLAG, "w" },
{ "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
{ "display-message", OP_DISPLAY_MESSAGE, M_ENTER_S },
+ { "buffy-list", OP_BUFFY_LIST, "." },
{ "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" },
{ "display-address", OP_DISPLAY_ADDRESS, "@" },
{ "pipe-message", OP_PIPE, "|" },
{ "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" },
{ "shell-escape", OP_SHELL_ESCAPE, "!" },
{ "enter-command", OP_ENTER_COMMAND, ":" },
+ { "buffy-list", OP_BUFFY_LIST, "." },
{ "search", OP_SEARCH, "/" },
{ "search-reverse", OP_SEARCH_REVERSE, "\033/" },
{ "search-opposite", OP_SEARCH_OPPOSITE, NULL },
{ "check-new", OP_CHECK_NEW, NULL },
{ "toggle-mailboxes", OP_TOGGLE_MAILBOXES, "\t" },
{ "view-file", OP_BROWSER_VIEW_FILE, " " },
+ { "buffy-list", OP_BUFFY_LIST, "." },
#ifdef USE_IMAP
{ "create-mailbox", OP_CREATE_MAILBOX, "C" },
{ "delete-mailbox", OP_DELETE_MAILBOX, "d" },
mutt_version ();
break;
+ case OP_BUFFY_LIST:
+ mutt_buffy_list ();
+ break;
+
case OP_VIEW_ATTACHMENTS:
if (flags & M_PAGER_ATTACHMENT)
{
void mutt_body_handler (BODY *, STATE *);
void mutt_bounce_message (FILE *fp, HEADER *, ADDRESS *);
void mutt_buffy (char *, size_t);
+int mutt_buffy_list (void);
void mutt_canonical_charset (char *, size_t, const char *);
void mutt_check_rescore (CONTEXT *);
void mutt_clear_error (void);