]> granicus.if.org Git - mutt/commitdiff
Handle sort_aux="threads" somewhat different, and probably more
authorThomas Roessler <roessler@does-not-exist.org>
Sat, 22 Apr 2000 09:27:07 +0000 (09:27 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sat, 22 Apr 2000 09:27:07 +0000 (09:27 +0000)
safely.  Problem and principle of fix noted by Gero Treuner and
Michael Tatge <Michael.Tatge@studserv.uni-stuttgart.de>.

init.c
init.h
thread.c

diff --git a/init.c b/init.c
index 68429cbfe3e9ac918d9245aa8af64f6716432807..be4e3458178539ff52478c92b8c70db477e76b44 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1127,6 +1127,9 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
          map = SortKeyMethods;
          break;
 #endif
+       case DT_SORT_AUX:
+         map = SortAuxMethods;
+         break;
        default:
          map = SortMethods;
          break;
diff --git a/init.h b/init.h
index d1880c43a6887ff4f43f0e72b5ded0416a71b7db..02022ff8014754965bb5b47be9f7cdbb3c23b63c 100644 (file)
--- a/init.h
+++ b/init.h
@@ -44,6 +44,7 @@
 #define DT_SORT_ALIAS  0x10
 #define DT_SORT_BROWSER 0x20
 #define DT_SORT_KEYS   0x40
+#define DT_SORT_AUX    0x80
 
 /* flags to parse_set() */
 #define M_SET_INV      (1<<0)  /* default is to invert all vars */
@@ -1823,7 +1824,7 @@ struct option_t MuttVars[] = {
   ** .  unsorted (leave in order specified in .muttrc)
   ** .te
   */
-  { "sort_aux",                DT_SORT, R_INDEX|R_RESORT_BOTH, UL &SortAux, SORT_DATE },
+  { "sort_aux",                DT_SORT|DT_SORT_AUX, R_INDEX|R_RESORT_BOTH, UL &SortAux, SORT_DATE },
   /*
   ** .pp
   ** When sorting by threads, this variable controls how threads are sorted
@@ -2120,6 +2121,25 @@ const struct mapping_t SortMethods[] = {
   { NULL,              0 }
 };
 
+/* same as SortMethods, but with "threads" replaced by "date" */
+
+const struct mapping_t SortAuxMethods[] = {
+  { "date",            SORT_DATE },
+  { "date-sent",       SORT_DATE },
+  { "date-received",   SORT_RECEIVED },
+  { "mailbox-order",   SORT_ORDER },
+  { "subject",         SORT_SUBJECT },
+  { "from",            SORT_FROM },
+  { "size",            SORT_SIZE },
+  { "threads",         SORT_DATE },    /* note: sort_aux == threads
+                                        * isn't possible. 
+                                        */
+  { "to",              SORT_TO },
+  { "score",           SORT_SCORE },
+  { NULL,              0 }
+};
+  
+
 const struct mapping_t SortBrowserMethods[] = {
   { "alpha",   SORT_SUBJECT },
   { "date",    SORT_DATE },
index 3c12c28d92d7175a4412036504fa75e5a7bba517..34af7446ed983a9807c4e61a7a765261d2cb8441 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -537,12 +537,6 @@ void mutt_sort_threads (CONTEXT *ctx, int init)
   oldsort = Sort;
   Sort = SortAux;
   
-  /* get secondary sorting method.  we can't have threads, so use the date
-   * if the user specified it
-   */
-  if ((Sort & SORT_MASK) == SORT_THREADS)
-    Sort = (Sort & ~SORT_MASK) | SORT_DATE;
-  
   /* if the SORT_LAST bit is set, we save sorting for later */
   if (!(Sort & SORT_LAST))
     usefunc = mutt_get_sort_func (Sort);