X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-ui%2Fcurs_main.c;h=6840fb7d6ece0402441e19dff6c502a3263ad704;hp=7b5b5ee2ac3184c92ce9916c76527b800e44abc8;hb=88d239144bf6f50ca1eda6db7742281f0ad0f97f;hpb=23e6291cb5d5b4cd2008403d8b628007fd75ff23 diff --git a/lib-ui/curs_main.c b/lib-ui/curs_main.c index 7b5b5ee..6840fb7 100644 --- a/lib-ui/curs_main.c +++ b/lib-ui/curs_main.c @@ -10,50 +10,22 @@ * please see the file GPL in the top level source directory. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#include "curses.h" +#include +#include +#include +#include + #include "menu.h" #include "mutt.h" +#include "crypt.h" +#include "pattern.h" #include "alias.h" -#include "mx.h" #include "sort.h" #include "recvattach.h" #include "buffy.h" -#include "mx.h" -#include "sidebar.h" #include "thread.h" -#include "xterm.h" - -#include - -#include - -#ifdef USE_NNTP -#include "nntp/nntp.h" -#endif - -#ifdef USE_SASL -#include "mutt_sasl.h" -#endif +#include "score.h" static const char *No_mailbox_is_open = N_("No mailbox is open."); static const char *There_are_no_messages = N_("There are no messages."); @@ -107,14 +79,12 @@ static const char *No_visible = N_("No visible messages."); #define CURHDR Context->hdrs[Context->v2r[menu->current]] #define OLDHDR Context->hdrs[Context->v2r[menu->oldcurrent]] #define UNREAD(h) mutt_thread_contains_unread (Context, h) -#define SW (option(OPTMBOXPANE)?SidebarWidth:0) extern size_t UngetCount; void index_make_entry (char *s, ssize_t l, struct menu_t * menu, int num) { - format_flag flag = - M_FORMAT_MAKEPRINT | M_FORMAT_ARROWCURSOR | M_FORMAT_INDEX; + format_flag flag = M_FORMAT_MAKEPRINT | M_FORMAT_INDEX; int edgemsgno, reverse = Sort & SORT_REVERSE; HEADER *h = Context->hdrs[Context->v2r[num]]; THREAD *tmp; @@ -185,8 +155,8 @@ static int ci_next_undeleted (int msgno) for (i = msgno + 1; i < Context->vcount; i++) if (!Context->hdrs[Context->v2r[i]]->deleted) - return (i); - return (-1); + return i; + return -1; } static int ci_previous_undeleted (int msgno) @@ -195,8 +165,8 @@ static int ci_previous_undeleted (int msgno) for (i = msgno - 1; i >= 0; i--) if (!Context->hdrs[Context->v2r[i]]->deleted) - return (i); - return (-1); + return i; + return -1; } /* Return the index of the first new message, or failing that, the first @@ -211,13 +181,13 @@ static int ci_first_message (void) if (!Context->hdrs[Context->v2r[i]]->read && !Context->hdrs[Context->v2r[i]]->deleted) { if (!Context->hdrs[Context->v2r[i]]->old) - return (i); + return i; else if (old == -1) old = i; } } if (old != -1) - return (old); + return old; /* If Sort is reverse and not threaded, the latest message is first. * If Sort is threaded, the latest message is first iff exactly one @@ -228,7 +198,7 @@ static int ci_first_message (void) ((Sort ^ SortAux) & SORT_REVERSE))) return 0; else - return (Context->vcount ? Context->vcount - 1 : 0); + return Context->vcount ? Context->vcount - 1 : 0; } return 0; } @@ -371,38 +341,12 @@ static void resort_index (MUTTMENU * menu) menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } -struct mapping_t IndexHelp[] = { - {N_("Quit"), OP_QUIT}, - {N_("Del"), OP_DELETE}, - {N_("Undel"), OP_UNDELETE}, - {N_("Save"), OP_SAVE}, - {N_("Mail"), OP_MAIL}, - {N_("Reply"), OP_REPLY}, - {N_("Group"), OP_GROUP_REPLY}, - {N_("Help"), OP_HELP}, - {NULL, OP_NULL} -}; - -#ifdef USE_NNTP -struct mapping_t IndexNewsHelp[] = { - {N_("Quit"), OP_QUIT}, - {N_("Del"), OP_DELETE}, - {N_("Undel"), OP_UNDELETE}, - {N_("Save"), OP_SAVE}, - {N_("Post"), OP_POST}, - {N_("Followup"), OP_FOLLOWUP}, - {N_("Catchup"), OP_CATCHUP}, - {N_("Help"), OP_HELP}, - {NULL, OP_NULL} -}; -#endif - /* This function handles the message index window as well as commands returned * from the pager (MENU_PAGER). */ int mutt_index_menu (void) { - char buf[LONG_STRING], helpstr[SHORT_STRING]; + char buf[LONG_STRING]; int flags; int op = OP_NULL; int done = 0; /* controls when to exit the "event" loop */ @@ -412,10 +356,10 @@ int mutt_index_menu (void) int oldcount = -1; int rc = -1; MUTTMENU *menu; - char *cp; /* temporary variable. */ + const char *cp; /* temporary variable. */ int index_hint; /* used to restore cursor position */ int do_buffy_notify = 1; - int closed = 0; /* did we OP_QUIT or OP_EXIT out of this menu? */ + int closed = 0; /* did we OP_QUIT or OP_EXIT out of this menu? */ int attach_msg = option (OPTATTACHMSG); menu = mutt_new_menu (); @@ -425,13 +369,6 @@ int mutt_index_menu (void) menu->make_entry = (void *) index_make_entry; menu->color = index_color; menu->current = ci_first_message (); - menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, -#ifdef USE_NNTP - (Context - && (Context->magic == - M_NNTP)) ? IndexNewsHelp : -#endif - IndexHelp); if (!attach_msg) { buffy_check (0); /* force the buffy check after we enter the folder */ @@ -490,10 +427,10 @@ int mutt_index_menu (void) ("Mailbox was externally modified. Flags may be wrong.")); else if (check == M_NEW_MAIL) { /* on new mail: redraw sidebar */ - sidebar_draw (CurrentMenu); + sidebar_draw (); mutt_message (_("New mail in this mailbox.")); - if (option (OPTBEEPNEW)) + if (mod_core.beep_new) beep (); } else if (check == M_FLAGS) @@ -520,7 +457,7 @@ int mutt_index_menu (void) menu->redraw |= REDRAW_SIDEBAR; } if (do_buffy_notify) { - if (buffy_notify () && option (OPTBEEPNEW)) + if (buffy_notify () && mod_core.beep_new) beep (); } else @@ -530,10 +467,10 @@ int mutt_index_menu (void) if (op != -1) mutt_curs_set (0); if (menu->redraw & REDRAW_SIDEBAR) - sidebar_draw (menu->menu); + sidebar_draw (); if (menu->redraw & REDRAW_FULL) { menu_redraw_full (menu); - sidebar_draw (menu->menu); + sidebar_draw (); mutt_show_error (); } @@ -553,21 +490,21 @@ int mutt_index_menu (void) if (menu->redraw & REDRAW_STATUS) { menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); - CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES - 2); - sidebar_draw_frames(); - SETCOLOR (MT_COLOR_STATUS); - BKGDSET (MT_COLOR_STATUS); - move(option (OPTSTATUSONTOP) ? 0 : LINES - 2,SW); - mutt_paddstr (COLS-SW, buf); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); + CLEARLINE(main_w, 0); + SETCOLOR(main_w, MT_COLOR_STATUS); + BKGDSET(main_w, MT_COLOR_STATUS); + wmove(main_w, 0, 0); + mutt_paddstr (main_w, getmaxx(main_w), buf); + SETCOLOR(main_w, MT_COLOR_NORMAL); + BKGDSET(main_w, MT_COLOR_NORMAL); sidebar_set_buffystats (Context); menu->redraw &= ~REDRAW_STATUS; if (option (OPTXTERMSETTITLES)) { - menu_status_line (buf, sizeof (buf), menu, NONULL (XtermTitle)); - mutt_xterm_set_title (buf); - menu_status_line (buf, sizeof (buf), menu, NONULL (XtermIcon)); - mutt_xterm_set_icon (buf); + menu_status_line(buf, sizeof(buf), menu, NONULL(XtermTitle)); + printf("\033]2;%s\007", buf); + menu_status_line(buf, sizeof(buf), menu, NONULL(XtermIcon)); + printf("\033]1;%s\007", buf); + fflush(stdout); } } @@ -576,34 +513,18 @@ int mutt_index_menu (void) menu->oldcurrent = menu->current; else menu->oldcurrent = -1; - - if (option (OPTARROWCURSOR)) - move (menu->current - menu->top + menu->offset, 2); - else if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, 0); - else - move (menu->current - menu->top + menu->offset, COLS - 1); mutt_refresh (); -#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) if (SigWinch) { mutt_flushinp (); - mutt_resize_screen (); + ui_layout_resize(); menu->redraw = REDRAW_FULL; menu->menu = MENU_MAIN; - SigWinch = 0; menu->top = 0; /* so we scroll the right amount */ - /* - * force a real complete redraw. clrtobot() doesn't seem to be able - * to handle every case without this. - */ - clearok (stdscr, TRUE); continue; } -#endif op = km_dokey (MENU_MAIN); - if (op == -1) continue; /* either user abort or timeout */ @@ -625,13 +546,13 @@ int mutt_index_menu (void) tag = 1; /* give visual indication that the next command is a tag- command */ - mvaddstr (LINES - 1, 0, "tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "tag-"); + wclrtoeol (stdscr); /* get the real command */ if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) { /* abort tag sequence */ - CLEARLINE (LINES - 1); + CLEARLINE(stdscr, LINES - 1); continue; } } @@ -660,20 +581,19 @@ int mutt_index_menu (void) tag = 1; /* give visual indication that the next command is a tag- command */ - mvaddstr (LINES - 1, 0, "tag-"); - clrtoeol (); + mvwaddstr (stdscr, LINES - 1, 0, "tag-"); + wclrtoeol (stdscr); /* get the real command */ if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX) { /* abort tag sequence */ - CLEARLINE (LINES - 1); + CLEARLINE(stdscr, LINES - 1); continue; } } mutt_clear_error (); - } - else { + } else { if (menu->current < menu->max) menu->oldcurrent = menu->current; else @@ -682,10 +602,6 @@ int mutt_index_menu (void) mutt_curs_set (1); /* fallback from the pager */ } -#ifdef USE_NNTP - unset_option (OPTNEWS); /* for any case */ -#endif - switch (op) { /* ---------------------------------------------------------------------- @@ -735,112 +651,7 @@ int mutt_index_menu (void) menu_current_bottom (menu); break; -#ifdef USE_NNTP - case OP_GET_MESSAGE: - case OP_GET_PARENT: - CHECK_MSGCOUNT; - if (Context->magic == M_NNTP) { - HEADER *h; - - if (op == OP_GET_MESSAGE) { - buf[0] = 0; - if (mutt_get_field (_("Enter Message-ID: "), buf, sizeof (buf), 0) - != 0 || !buf[0]) - break; - } - else { - string_list_t *ref = CURHDR->env->references; - - if (!ref) { - mutt_error (_("Article has no parent reference!")); - - break; - } - m_strcpy(buf, sizeof(buf), ref->data); - } - if (!Context->id_hash) - Context->id_hash = mutt_make_id_hash (Context); - if ((h = hash_find (Context->id_hash, buf))) { - if (h->virtual != -1) { - menu->current = h->virtual; - menu->redraw = REDRAW_MOTION_RESYNCH; - } - else if (h->collapsed) { - mutt_uncollapse_thread (Context, h); - mutt_set_virtual (Context); - menu->current = h->virtual; - menu->redraw = REDRAW_MOTION_RESYNCH; - } - else - mutt_error (_("Message not visible in limited view.")); - } - else { - if (nntp_check_msgid (Context, buf) == 0) { - h = Context->hdrs[Context->msgcount - 1]; - mutt_sort_headers (Context, 0); - menu->current = h->virtual; - menu->redraw = REDRAW_FULL; - } - else - mutt_error (_("Article %s not found on server"), buf); - } - } - break; - - case OP_GET_CHILDREN: - case OP_RECONSTRUCT_THREAD: - CHECK_MSGCOUNT; - if (Context->magic == M_NNTP) { - HEADER *h; - int old = CURHDR->index; - - if (!CURHDR->env->message_id) { - mutt_error (_("No Message-ID. Unable to perform operation")); - - break; - } - - if (!Context->id_hash) - Context->id_hash = mutt_make_id_hash (Context); - m_strcpy(buf, sizeof(buf), CURHDR->env->message_id); - - if (op == OP_RECONSTRUCT_THREAD) { - string_list_t *ref = CURHDR->env->references; - - while (ref) { - nntp_check_msgid (Context, ref->data); - /* the last msgid in References is the root message */ - if (!ref->next) - m_strcpy(buf, sizeof(buf), ref->data); - ref = ref->next; - } - } - mutt_message (_("Check for children of message...")); - - if (nntp_check_children (Context, buf) == 0) { - mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD)); - h = hash_find (Context->id_hash, buf); - /* if the root message was retrieved, move to it */ - if (h) - menu->current = h->virtual; - else /* try to restore old position */ - for (i = 0; i < Context->msgcount; i++) - if (Context->hdrs[i]->index == old) { - menu->current = Context->hdrs[i]->virtual; - /* As an added courtesy, recenter the menu - * with the current entry at the middle of the screen */ - menu_check_recenter (menu); - menu_current_middle (menu); - } - } - menu->redraw = REDRAW_FULL; - mutt_clear_error (); - } - break; -#endif - case OP_JUMP: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (isdigit (LastKey)) @@ -891,7 +702,6 @@ int mutt_index_menu (void) */ case OP_MAIN_DELETE_PATTERN: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -904,14 +714,12 @@ int mutt_index_menu (void) break; case OP_MAIN_FETCH_MAIL: - CHECK_ATTACH; pop_fetch_mail (); menu->redraw = REDRAW_FULL; break; case OP_HELP: - mutt_help (MENU_MAIN); menu->redraw = REDRAW_FULL; break; @@ -932,7 +740,6 @@ int mutt_index_menu (void) case OP_MAIN_LIMIT: case OP_TOGGLE_READ: - CHECK_IN_MAILBOX; menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < @@ -940,15 +747,14 @@ int mutt_index_menu (void) if (op == OP_TOGGLE_READ) { char buffer[LONG_STRING]; - if (!Context->pattern - || strncmp (Context->pattern, "!~R!~D~s", 8) != 0) { + if (m_strncmp (Context->pattern, "!~R!~D~s", 8) != 0) { snprintf (buffer, sizeof (buffer), "!~R!~D~s%s", Context->pattern ? Context->pattern : ".*"); set_option (OPTHIDEREAD); } else { m_strcpy(buf, sizeof(buf), Context->pattern + 8); - if (!*buf || strncmp (buf, ".*", 2) == 0) + if (m_strncmp (buf, ".*", 2) == 0) snprintf (buf, sizeof (buf), "~A"); unset_option (OPTHIDEREAD); } @@ -981,14 +787,13 @@ int mutt_index_menu (void) break; case OP_QUIT: - closed = op; if (attach_msg) { done = 1; break; } - if (query_quadoption (OPT_QUIT, _("Quit Madmutt?")) == M_YES) { + if (query_quadoption2(mod_core.quit, _("Quit Madmutt?")) == M_YES) { int check; oldcount = Context ? Context->msgcount : 0; @@ -1007,8 +812,7 @@ int mutt_index_menu (void) break; case OP_REDRAW: - - clearok (stdscr, TRUE); + clearok (main_w, TRUE); menu->redraw = REDRAW_FULL; break; @@ -1016,7 +820,6 @@ int mutt_index_menu (void) case OP_SEARCH_REVERSE: case OP_SEARCH_NEXT: case OP_SEARCH_OPPOSITE: - CHECK_MSGCOUNT; CHECK_VISIBLE; if ((menu->current = mutt_search_command (menu->current, op)) == -1) @@ -1027,7 +830,6 @@ int mutt_index_menu (void) case OP_SORT: case OP_SORT_REVERSE: - if (mutt_select_sort ((op == OP_SORT_REVERSE)) == 0) { if (Context && Context->msgcount) { resort_index (menu); @@ -1037,7 +839,6 @@ int mutt_index_menu (void) break; case OP_TAG: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (tag && !option (OPTAUTOTAG)) { @@ -1061,7 +862,6 @@ int mutt_index_menu (void) break; case OP_MAIN_TAG_PATTERN: - CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_pattern_func (M_TAG, _("Tag messages matching: ")); @@ -1069,7 +869,6 @@ int mutt_index_menu (void) break; case OP_MAIN_UNDELETE_PATTERN: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1082,7 +881,6 @@ int mutt_index_menu (void) break; case OP_MAIN_UNTAG_PATTERN: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (mutt_pattern_func (M_UNTAG, _("Untag messages matching: ")) == 0) @@ -1099,7 +897,6 @@ int mutt_index_menu (void) break; case OP_MAIN_SYNC_FOLDER: - if (Context && !Context->msgcount) break; @@ -1152,15 +949,7 @@ int mutt_index_menu (void) case OP_SIDEBAR_OPEN: case OP_MAIN_CHANGE_FOLDER: case OP_MAIN_CHANGE_FOLDER_READONLY: -#ifdef USE_NNTP - case OP_MAIN_CHANGE_GROUP: - case OP_MAIN_CHANGE_GROUP_READONLY: -#endif - if (attach_msg || option (OPTREADONLY) || -#ifdef USE_NNTP - op == OP_MAIN_CHANGE_GROUP_READONLY || -#endif - op == OP_MAIN_CHANGE_FOLDER_READONLY) + if (attach_msg || op == OP_MAIN_CHANGE_FOLDER_READONLY) flags = M_READONLY; else flags = 0; @@ -1171,26 +960,10 @@ int mutt_index_menu (void) cp = _("Open mailbox"); buf[0] = '\0'; -#ifdef USE_NNTP - unset_option (OPTNEWS); - if (op == OP_MAIN_CHANGE_GROUP || op == OP_MAIN_CHANGE_GROUP_READONLY) { - set_option (OPTNEWS); - if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer))) - break; - if (flags) - cp = _("Open newsgroup in read-only mode"); - else - cp = _("Open newsgroup"); - nntp_buffy (buf, sizeof (buf)); - } - else -#endif - { - if (Context && Context->path) - m_strcpy(buf, sizeof(buf), Context->path); - if (op != OP_SIDEBAR_OPEN) - buffy_next (buf, sizeof (buf)); - } + if (Context && Context->path) + m_strcpy(buf, sizeof(buf), Context->path); + if (op != OP_SIDEBAR_OPEN) + buffy_next (buf, sizeof (buf)); if (op == OP_SIDEBAR_OPEN) { m_strcpy(buf, sizeof(buf), sidebar_get_current()); @@ -1203,18 +976,11 @@ int mutt_index_menu (void) break; } if (!buf[0]) { - CLEARLINE (LINES - 1); + CLEARLINE(main_w, LINES - 1); break; } -#ifdef USE_NNTP - if (option (OPTNEWS)) { - unset_option (OPTNEWS); - nntp_expand_path (buf, sizeof (buf), &CurrentNewsSrv->conn->account); - } - else -#endif - mutt_expand_path (buf, sizeof (buf)); + mutt_expand_path (buf, sizeof (buf)); if (mx_get_magic (buf) <= 0) { mutt_error (_("%s is not a mailbox."), buf); break; @@ -1224,7 +990,7 @@ int mutt_index_menu (void) if (Context) { int check; - if (Context->compressinfo && Context->realpath) + if (Context->cinfo && Context->realpath) m_strreplace(&LastFolder, Context->realpath); else m_strreplace(&LastFolder, Context->path); @@ -1258,14 +1024,6 @@ int mutt_index_menu (void) menu->current = 0; sidebar_set_current (buf); -#ifdef USE_NNTP - /* buffy_check() must be done with mail-reader mode! */ - menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, - (Context - && (Context->magic == - M_NNTP)) ? IndexNewsHelp : - IndexHelp); -#endif mutt_clear_error (); buffy_check (0); /* force the buffy check after we have changed the folder */ @@ -1294,8 +1052,7 @@ int mutt_index_menu (void) menu->current = mutt_thread_next_unread (Context, CURHDR); } - if (option (OPTPGPAUTODEC) && - (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); if ((op = mutt_display_message (CURHDR)) == -1) { @@ -1308,7 +1065,6 @@ int mutt_index_menu (void) continue; case OP_EXIT: - closed = op; if (menu->menu == MENU_MAIN && attach_msg) { done = 1; @@ -1316,7 +1072,7 @@ int mutt_index_menu (void) } if ((menu->menu == MENU_MAIN) - && (query_quadoption (OPT_QUIT, + && (query_quadoption2(mod_core.quit, _("Exit Madmutt without saving?")) == M_YES)) { if (Context) { @@ -1328,7 +1084,6 @@ int mutt_index_menu (void) break; case OP_EDIT_TYPE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_ATTACH; @@ -1343,7 +1098,6 @@ int mutt_index_menu (void) break; case OP_MAIN_BREAK_THREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1373,7 +1127,6 @@ int mutt_index_menu (void) break; case OP_MAIN_LINK_THREADS: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1411,7 +1164,6 @@ int mutt_index_menu (void) break; case OP_MAIN_NEXT_UNDELETED: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (menu->current >= Context->vcount - 1) { @@ -1434,7 +1186,6 @@ int mutt_index_menu (void) break; case OP_NEXT_ENTRY: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (menu->current >= Context->vcount - 1) { @@ -1453,7 +1204,6 @@ int mutt_index_menu (void) break; case OP_MAIN_PREV_UNDELETED: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (menu->current < 1) { @@ -1475,7 +1225,6 @@ int mutt_index_menu (void) break; case OP_PREV_ENTRY: - CHECK_MSGCOUNT; CHECK_VISIBLE; if (menu->current < 1) { @@ -1534,7 +1283,6 @@ int mutt_index_menu (void) case OP_MAIN_PREV_UNREAD: case OP_MAIN_NEXT_NEW_THEN_UNREAD: case OP_MAIN_PREV_NEW_THEN_UNREAD: - { int first_unread = -1; int first_new = -1; @@ -1616,7 +1364,6 @@ int mutt_index_menu (void) break; } case OP_FLAG_MESSAGE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1649,7 +1396,6 @@ int mutt_index_menu (void) break; case OP_TOGGLE_NEW: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1691,7 +1437,6 @@ int mutt_index_menu (void) break; case OP_TOGGLE_WRITE: - CHECK_IN_MAILBOX; if (mx_toggle_write (Context) == 0) menu->redraw |= REDRAW_STATUS; @@ -1701,7 +1446,6 @@ int mutt_index_menu (void) case OP_MAIN_NEXT_SUBTHREAD: case OP_MAIN_PREV_THREAD: case OP_MAIN_PREV_SUBTHREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; switch (op) { @@ -1739,7 +1483,6 @@ int mutt_index_menu (void) break; case OP_MAIN_PARENT_MESSAGE: - CHECK_MSGCOUNT; CHECK_VISIBLE; @@ -1756,13 +1499,11 @@ int mutt_index_menu (void) case OP_MAIN_SET_FLAG: case OP_MAIN_CLEAR_FLAG: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; - if (mutt_change_flag (tag ? NULL : CURHDR, (op == OP_MAIN_SET_FLAG)) == - 0) { + if (mutt_change_flag (tag ? NULL : CURHDR, (op == OP_MAIN_SET_FLAG)) == 0) { menu->redraw = REDRAW_STATUS; if (tag) menu->redraw |= REDRAW_INDEX; @@ -1866,7 +1607,6 @@ int mutt_index_menu (void) */ case OP_BOUNCE_MESSAGE: - CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; @@ -1874,7 +1614,6 @@ int mutt_index_menu (void) break; case OP_CREATE_ALIAS: - mutt_create_alias (Context && Context->vcount ? CURHDR->env : NULL, NULL); MAYBE_REDRAW (menu->redraw); @@ -1889,7 +1628,6 @@ int mutt_index_menu (void) case OP_PURGE_MESSAGE: case OP_DELETE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1929,7 +1667,6 @@ int mutt_index_menu (void) case OP_DELETE_THREAD: case OP_DELETE_SUBTHREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1950,25 +1687,13 @@ int mutt_index_menu (void) } break; -#ifdef USE_NNTP - case OP_CATCHUP: - if (Context && Context->magic == M_NNTP) { - if (mutt_newsgroup_catchup (CurrentNewsSrv, - ((NNTP_DATA *) Context->data)->group)) - menu->redraw = REDRAW_INDEX | REDRAW_STATUS; - } - break; -#endif - case OP_DISPLAY_ADDRESS: - CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_display_address (CURHDR->env); break; case OP_ENTER_COMMAND: - CurrentMenu = MENU_MAIN; mutt_enter_command (); mutt_check_rescore (Context); @@ -1979,7 +1704,6 @@ int mutt_index_menu (void) break; case OP_EDIT_MESSAGE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -1987,8 +1711,7 @@ int mutt_index_menu (void) CHECK_MX_ACL (Context, ACL_INSERT, _("Editing")); - if (option (OPTPGPAUTODEC) - && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (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; @@ -1996,31 +1719,22 @@ int mutt_index_menu (void) break; case OP_FORWARD_MESSAGE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_ATTACH; - if (option (OPTPGPAUTODEC) && - (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDFORWARD, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; - - case OP_FORGET_PASSPHRASE: - crypt_forget_passphrase (); - break; - case OP_GROUP_REPLY: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_ATTACH; - if (option (OPTPGPAUTODEC) && - (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, Context, @@ -2029,13 +1743,11 @@ int mutt_index_menu (void) break; case OP_LIST_REPLY: - CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; - if (option (OPTPGPAUTODEC) && - (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, Context, @@ -2044,19 +1756,11 @@ int mutt_index_menu (void) break; case OP_MAIL: - CHECK_ATTACH; ci_send_message (0, NULL, NULL, Context, NULL); menu->redraw = REDRAW_FULL; break; - case OP_MAIL_KEY: - CHECK_ATTACH; - ci_send_message (SENDKEY, NULL, NULL, NULL, NULL); - menu->redraw = REDRAW_FULL; - break; - - case OP_EXTRACT_KEYS: CHECK_MSGCOUNT; CHECK_VISIBLE; @@ -2078,35 +1782,20 @@ int mutt_index_menu (void) break; case OP_PIPE: - CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_pipe_message (tag ? NULL : CURHDR); - /* in an IMAP folder index with imap_peek=no, piping could change - * * new or old messages status to read. Redraw what's needed. - */ - if (Context->magic == M_IMAP && !option (OPTIMAPPEEK)) { - menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS; - } MAYBE_REDRAW (menu->redraw); break; case OP_PRINT: - CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_print_message (tag ? NULL : CURHDR); - /* in an IMAP folder index with imap_peek=no, piping could change - * * new or old messages status to read. Redraw what's needed. - */ - if (Context->magic == M_IMAP && !option (OPTIMAPPEEK)) { - menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS; - } break; case OP_MAIN_READ_THREAD: case OP_MAIN_READ_SUBTHREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -2128,14 +1817,12 @@ int mutt_index_menu (void) break; case OP_RECALL_MESSAGE: - CHECK_ATTACH; ci_send_message (SENDPOSTPONED, NULL, NULL, Context, NULL); menu->redraw = REDRAW_FULL; break; case OP_RESEND: - CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; @@ -2153,53 +1840,12 @@ int mutt_index_menu (void) menu->redraw = REDRAW_FULL; break; -#ifdef USE_NNTP - case OP_POST: - case OP_FOLLOWUP: - case OP_FORWARD_TO_GROUP: - - CHECK_ATTACH; - 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 || - m_strcasecmp(CURHDR->env->followup_to, "poster") || - query_quadoption (OPT_FOLLOWUPTOPOSTER, - _("Reply by mail as poster prefers?")) != - M_YES) { - if (Context && Context->magic == M_NNTP - && !((NNTP_DATA *) Context->data)->allowed - && query_quadoption (OPT_TOMODERATED, - _ - ("Posting to this group not allowed, may be moderated. Continue?")) - != M_YES) - break; - if (op == OP_POST) - ci_send_message (SENDNEWS, NULL, NULL, Context, NULL); - else { - CHECK_MSGCOUNT; - if (op == OP_FOLLOWUP) - ci_send_message (SENDNEWS | SENDREPLY, NULL, NULL, Context, - tag ? NULL : CURHDR); - else - ci_send_message (SENDNEWS | SENDFORWARD, NULL, NULL, Context, - tag ? NULL : CURHDR); - } - menu->redraw = REDRAW_FULL; - break; - } -#endif - case OP_REPLY: - CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; - if (option (OPTPGPAUTODEC) && - (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) + if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); @@ -2207,14 +1853,12 @@ int mutt_index_menu (void) break; case OP_SHELL_ESCAPE: - mutt_shell_escape (); MAYBE_REDRAW (menu->redraw); break; case OP_TAG_THREAD: case OP_TAG_SUBTHREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; rc = mutt_thread_set_flag (CURHDR, M_TAG, !CURHDR->tagged, @@ -2232,7 +1876,6 @@ int mutt_index_menu (void) break; case OP_UNDELETE: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -2259,7 +1902,6 @@ int mutt_index_menu (void) case OP_UNDELETE_THREAD: case OP_UNDELETE_SUBTHREAD: - CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; @@ -2285,10 +1927,6 @@ int mutt_index_menu (void) } break; - case OP_VERSION: - mutt_version (); - break; - case OP_BUFFY_LIST: if (option (OPTFORCEBUFFYCHECK)) buffy_check (1); @@ -2308,22 +1946,15 @@ int mutt_index_menu (void) case OP_END_COND: break; - case OP_WHAT_KEY: - mutt_what_key (); - break; - - case OP_REBUILD_CACHE: - mx_rebuild_cache (); - break; - case OP_SIDEBAR_SCROLL_UP: case OP_SIDEBAR_SCROLL_DOWN: case OP_SIDEBAR_NEXT: case OP_SIDEBAR_PREV: case OP_SIDEBAR_NEXT_NEW: case OP_SIDEBAR_PREV_NEW: - sidebar_scroll (op, menu->menu); + sidebar_scroll (op); break; + default: if (menu->menu == MENU_MAIN) km_error_key (MENU_MAIN); @@ -2332,9 +1963,6 @@ int mutt_index_menu (void) if (menu->menu == MENU_PAGER) { menu->menu = MENU_MAIN; menu->redraw = REDRAW_FULL; -#if 0 - set_option (OPTWEED); /* turn header weeding back on. */ -#endif } if (done) @@ -2344,17 +1972,10 @@ int mutt_index_menu (void) if (!attach_msg) { /* Close all open IMAP connections */ imap_logout_all (); -#ifdef USE_NNTP - /* Close all open NNTP connections */ - nntp_logout_all (); -#endif -#ifdef USE_SASL - mutt_sasl_done (); -#endif } mutt_menuDestroy (&menu); - return (closed); + return closed; } void mutt_set_header_color (CONTEXT * ctx, HEADER * curhdr)