The NNTP patch is a joke, let's drop it altogether.
[apps/madmutt.git] / lib-ui / curs_main.c
index 2103d25..6fdbc16 100644 (file)
 
 #include <imap/imap_private.h>
 
-#ifdef USE_NNTP
-#include "nntp.h"
-#endif
-
 static const char *No_mailbox_is_open = N_("No mailbox is open.");
 static const char *There_are_no_messages = N_("There are no messages.");
 static const char *Mailbox_is_read_only = N_("Mailbox is read-only.");
@@ -600,8 +596,7 @@ int mutt_index_menu (void)
       }
 
       mutt_clear_error ();
-    }
-    else {
+    } else {
       if (menu->current < menu->max)
         menu->oldcurrent = menu->current;
       else
@@ -610,10 +605,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) {
 
       /* ----------------------------------------------------------------------
@@ -663,110 +654,6 @@ 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;
@@ -1065,15 +952,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 ||
-#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;
@@ -1084,26 +963,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());
@@ -1120,14 +983,7 @@ int mutt_index_menu (void)
         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;
@@ -1834,16 +1690,6 @@ 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_t *) Context->data)->group))
-          menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
-      }
-      break;
-#endif
-
     case OP_DISPLAY_ADDRESS:
       CHECK_MSGCOUNT;
       CHECK_VISIBLE;
@@ -1997,44 +1843,6 @@ 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_t *) 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;
@@ -2175,10 +1983,6 @@ 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
   }
 
   mutt_menuDestroy (&menu);