Real men don't need the stupid silly help on top/bottom of the screen.
[apps/madmutt.git] / lib-ui / curs_main.c
index 31c11bf..2748e7e 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <lib-ui/sidebar.h>
 #include <lib-mx/mx.h>
-#include <pop/pop.h>
+#include "pop.h"
 
 #include "curses.h"
 #include "menu.h"
 #include "recvattach.h"
 #include "buffy.h"
 #include "thread.h"
-#include "mutt_sasl.h"
+#include "score.h"
 
 #include <imap/imap_private.h>
 
 #ifdef USE_NNTP
-#include <nntp/nntp.h>
+#include "nntp.h"
 #endif
 
 static const char *No_mailbox_is_open = N_("No mailbox is open.");
@@ -98,9 +98,6 @@ void index_make_entry (char *s, ssize_t l, struct menu_t * menu, int num)
   HEADER *h = Context->hdrs[Context->v2r[num]];
   THREAD *tmp;
 
-  if (option(OPTARROWCURSOR))
-      flag |= M_FORMAT_ARROWCURSOR;
-
   if ((Sort & SORT_MASK) == SORT_THREADS && h->tree) {
     flag |= M_FORMAT_TREE;      /* display the thread tree */
     if (h->display_subject)
@@ -384,7 +381,7 @@ struct mapping_t IndexNewsHelp[] = {
  */
 int mutt_index_menu (void)
 {
-  char buf[LONG_STRING], helpstr[STRING];
+  char buf[LONG_STRING];
   int flags;
   int op = OP_NULL;
   int done = 0;                 /* controls when to exit the "event" loop */
@@ -394,10 +391,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 ();
@@ -407,13 +404,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 */
@@ -475,7 +465,7 @@ int mutt_index_menu (void)
           sidebar_draw ();
           mutt_message (_("New mail in this mailbox."));
 
-          if (MCore.beep_new)
+          if (mod_core.beep_new)
             beep ();
         }
         else if (check == M_FLAGS)
@@ -502,7 +492,7 @@ int mutt_index_menu (void)
         menu->redraw |= REDRAW_SIDEBAR;
       }
       if (do_buffy_notify) {
-        if (buffy_notify () && MCore.beep_new)
+        if (buffy_notify () && mod_core.beep_new)
           beep ();
       }
       else
@@ -560,15 +550,12 @@ int mutt_index_menu (void)
       else
         menu->oldcurrent = -1;
 
-      if (option (OPTARROWCURSOR))
-        move (menu->current - menu->top + menu->offset, 2);
-       else if (option (OPTBRAILLEFRIENDLY))
+      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 ();
@@ -583,10 +570,8 @@ int mutt_index_menu (void)
         clearok (stdscr, TRUE);
         continue;
       }
-#endif
 
       op = km_dokey (MENU_MAIN);
-
       if (op == -1)
         continue;               /* either user abort or timeout */
 
@@ -970,7 +955,7 @@ int mutt_index_menu (void)
         break;
       }
 
-      if (query_quadoption2(MCore.quit, _("Quit Madmutt?")) == M_YES) {
+      if (query_quadoption2(mod_core.quit, _("Quit Madmutt?")) == M_YES) {
         int check;
 
         oldcount = Context ? Context->msgcount : 0;
@@ -1240,14 +1225,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 */
@@ -1276,8 +1253,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) {
@@ -1298,7 +1274,7 @@ int mutt_index_menu (void)
       }
 
       if ((menu->menu == MENU_MAIN)
-          && (query_quadoption2(MCore.quit,
+          && (query_quadoption2(mod_core.quit,
                                 _("Exit Madmutt without saving?")) == M_YES))
       {
         if (Context) {
@@ -1743,8 +1719,7 @@ int mutt_index_menu (void)
       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;
@@ -1936,7 +1911,7 @@ int mutt_index_menu (void)
     case OP_CATCHUP:
       if (Context && Context->magic == M_NNTP) {
         if (mutt_newsgroup_catchup (CurrentNewsSrv,
-                                    ((NNTP_DATA *) Context->data)->group))
+                                    ((nntp_data_t *) Context->data)->group))
           menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
       }
       break;
@@ -1969,8 +1944,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;
@@ -1983,8 +1957,7 @@ int mutt_index_menu (void)
       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;
@@ -1996,8 +1969,7 @@ int mutt_index_menu (void)
       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,
@@ -2011,8 +1983,7 @@ int mutt_index_menu (void)
       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,
@@ -2048,35 +2019,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;
@@ -2140,7 +2096,7 @@ int mutt_index_menu (void)
                                  _("Reply by mail as poster prefers?")) !=
                M_YES) {
         if (Context && Context->magic == M_NNTP
-            && !((NNTP_DATA *) Context->data)->allowed
+            && !((nntp_data_t *) Context->data)->allowed
             && query_quadoption (OPT_TOMODERATED,
                                  _
                                  ("Posting to this group not allowed, may be moderated. Continue?"))
@@ -2168,8 +2124,7 @@ int mutt_index_menu (void)
       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);
@@ -2282,10 +2237,6 @@ int mutt_index_menu (void)
       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:
@@ -2315,7 +2266,6 @@ int mutt_index_menu (void)
   /* Close all open NNTP connections */
     nntp_logout_all ();
 #endif
-    mutt_sasl_done ();
   }
 
   mutt_menuDestroy (&menu);