Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 2 Mar 2005 22:13:02 +0000 (22:13 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Wed, 2 Mar 2005 22:13:02 +0000 (22:13 +0000)
fixed edit threads patch f*ckup (reported by Rene van Bevern)

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@137 e385b8ad-14ed-0310-8656-cc95a2468c6d

curs_main.c

index 14bb552..23604af 100644 (file)
@@ -1431,6 +1431,86 @@ 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.");
+
+#if defined (USE_IMAP) && ! defined (IMAP_EDIT_THREADS)
+        else if (Context->magic == M_IMAP)
+          mutt_error _("Compile Mutt with --enable-imap-edit-threads for break-thread support");
+#endif
+        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.");
+
+#if defined (USE_IMAP) && ! defined (IMAP_EDIT_THREADS)
+        else if (Context->magic == M_IMAP)
+          mutt_error _("Compile Mutt with --enable-imap-edit-threads for link-threads support");
+#endif
+
+        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;