X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=curs_main.c;h=1e50716a25e329ae450787f7b40895977a578a51;hp=25b20e012a7e2ae73f8a8c35480bf5e00faaf276;hb=ed186ba586c10f36a8ec9219f50fbc01987bedfc;hpb=d279a20c49265b2595ffab0b68b67e601330a602 diff --git a/curs_main.c b/curs_main.c index 25b20e0..1e50716 100644 --- a/curs_main.c +++ b/curs_main.c @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "mutt_curses.h" #include "mx.h" @@ -191,7 +195,7 @@ int index_color (int index_no) { HEADER *h = Context->hdrs[Context->v2r[index_no]]; - if (h->pair) + if (h && h->pair) return h->pair; mutt_set_header_color (Context, h); @@ -475,8 +479,12 @@ int mutt_index_menu (void) #endif IndexHelp); - if (!attach_msg) + if (!attach_msg) { mutt_buffy_check(1); /* force the buffy check after we enter the folder */ + /* record folder we open to place sidebar indicator properly */ + if (Context && Context->path) + set_curbuffy(Context->path); + } FOREVER { @@ -533,6 +541,8 @@ int mutt_index_menu (void) mutt_error _("Mailbox was externally modified. Flags may be wrong."); else if (check == M_NEW_MAIL) { + /* on new mail: redraw sidebar */ + draw_sidebar (CurrentMenu); mutt_message _("New mail in this mailbox."); if (option (OPTBEEPNEW)) beep (); @@ -558,8 +568,10 @@ int mutt_index_menu (void) { /* check for new mail in the incoming folders */ oldcount = newcount; - if ((newcount = mutt_buffy_check (0)) != oldcount) + if ((newcount = mutt_buffy_check (0)) != oldcount){ menu->redraw |= REDRAW_STATUS; + menu->redraw |= REDRAW_SIDEBAR; + } if (do_buffy_notify) { if (mutt_buffy_notify () && option (OPTBEEPNEW)) @@ -571,7 +583,7 @@ int mutt_index_menu (void) if (op != -1) mutt_curs_set (0); - + if (menu->redraw & REDRAW_SIDEBAR) draw_sidebar(menu->menu); if (menu->redraw & REDRAW_FULL) { menu_redraw_full (menu); @@ -605,6 +617,7 @@ int mutt_index_menu (void) SETCOLOR (MT_COLOR_STATUS); mutt_paddstr (COLS, buf); SETCOLOR (MT_COLOR_NORMAL); + set_buffystats (Context); menu->redraw &= ~REDRAW_STATUS; if (option(OPTXTERMSETTITLES)) { @@ -1057,7 +1070,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); break; } - if (query_quadoption (OPT_QUIT, _("Quit Mutt?")) == M_YES) + if (query_quadoption (OPT_QUIT, _("Quit Mutt-ng?")) == M_YES) { int check; @@ -1121,6 +1134,9 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); else { mutt_set_flag (Context, CURHDR, M_TAG, !CURHDR->tagged); + Context->last_tag = CURHDR->tagged ? CURHDR : + ((Context->last_tag == CURHDR && !CURHDR->tagged) + ? NULL : Context->last_tag); menu->redraw = REDRAW_STATUS; if (option (OPTRESOLVE) && menu->current < Context->vcount - 1) { @@ -1175,6 +1191,9 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); case OP_MAIN_SYNC_FOLDER: + if (Context && !Context->msgcount) + break; + CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1262,7 +1281,11 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); } else #endif - mutt_buffy (buf, sizeof (buf)); + { + if (Context && Context->path) + strncpy (buf, Context->path, sizeof (buf)); + mutt_buffy (buf, sizeof (buf)); + } if ( op == OP_SIDEBAR_OPEN ) { if(!CurBuffy) @@ -1291,11 +1314,18 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); mutt_error (_("%s is not a mailbox."), buf); break; } + mutt_str_replace (&CurrentFolder, buf); if (Context) { int check; +#ifdef USE_COMPRESSED + if (Context->compressinfo && Context->realpath) + mutt_str_replace (&LastFolder, Context->realpath); + else +#endif + mutt_str_replace (&LastFolder, Context->path); oldcount = Context ? Context->msgcount : 0; @@ -1383,7 +1413,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); if ((menu->menu == MENU_MAIN) && (query_quadoption (OPT_QUIT, - _("Exit Mutt without saving?")) == M_YES)) + _("Exit Mutt-ng without saving?")) == M_YES)) { if (Context) { @@ -1410,6 +1440,75 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); menu->redraw = REDRAW_CURRENT; break; + case OP_MAIN_BREAK_THREAD: + + CHECK_MSGCOUNT; + CHECK_VISIBLE; + CHECK_READONLY; + + if ((Sort & SORT_MASK) != SORT_THREADS) + mutt_error _("Threading is not enabled."); + else + { + { + HEADER *oldcur = CURHDR; + + mutt_break_thread (CURHDR); + mutt_sort_headers (Context, 1); + menu->current = oldcur->virtual; + } + + Context->changed = 1; + mutt_message _("Thread broken"); + + if (menu->menu == MENU_PAGER) + { + op = OP_DISPLAY_MESSAGE; + continue; + } + else + menu->redraw |= REDRAW_INDEX; + } + break; + + case OP_MAIN_LINK_THREADS: + + CHECK_MSGCOUNT; + CHECK_VISIBLE; + CHECK_READONLY; + + if ((Sort & SORT_MASK) != SORT_THREADS) + mutt_error _("Threading is not enabled."); + else if (!CURHDR->env->message_id) + mutt_error _("No Message-ID: header available to link thread"); + else if (!tag && (!Context->last_tag || !Context->last_tag->tagged)) + mutt_error _("First, please tag a message to be linked here"); + else + { + HEADER *oldcur = CURHDR; + + if (mutt_link_threads (CURHDR, tag ? NULL : Context->last_tag, + Context)) + { + mutt_sort_headers (Context, 1); + menu->current = oldcur->virtual; + + Context->changed = 1; + mutt_message _("Threads linked"); + } + else + mutt_error _("No thread linked"); + } + + if (menu->menu == MENU_PAGER) + { + op = OP_DISPLAY_MESSAGE; + continue; + } + else + menu->redraw |= REDRAW_STATUS | REDRAW_INDEX; + break; + case OP_MAIN_NEXT_UNDELETED: CHECK_MSGCOUNT; @@ -2071,6 +2170,8 @@ CHECK_IMAP_ACL(IMAP_ACL_INSERT); } #endif + if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); mutt_edit_message (Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; @@ -2139,7 +2240,9 @@ CHECK_IMAP_ACL(IMAP_ACL_INSERT); break; CHECK_MSGCOUNT; CHECK_VISIBLE; - mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) + mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); + if (menu->menu == MENU_PAGER) { op = OP_DISPLAY_MESSAGE; @@ -2221,7 +2324,11 @@ CHECK_IMAP_ACL(IMAP_ACL_SEEN); case OP_FORWARD_TO_GROUP: CHECK_ATTACH; - if (op != OP_FOLLOWUP || !CURHDR->env->followup_to || + if ((op == OP_FOLLOWUP || op == OP_FORWARD_TO_GROUP) && + Context && Context->msgcount == 0) { + mutt_error (_("There are no messages.")); + sleep (2); + } else if (op != OP_FOLLOWUP || !CURHDR->env->followup_to || mutt_strcasecmp (CURHDR->env->followup_to, "poster") || query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES) { @@ -2351,6 +2458,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); case OP_BUFFY_LIST: mutt_buffy_list (); + menu->redraw = REDRAW_FULL; break; case OP_VIEW_ATTACHMENTS: @@ -2373,6 +2481,8 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE); case OP_SIDEBAR_SCROLL_DOWN: case OP_SIDEBAR_NEXT: case OP_SIDEBAR_PREV: + case OP_SIDEBAR_NEXT_NEW: + case OP_SIDEBAR_PREV_NEW: scroll_sidebar(op, menu->menu); break; default: