* respect the context while sorting. Else unexpected results will follow.
authorWilfried Göesgens <willi@citadel.org>
Wed, 28 Oct 2009 22:01:05 +0000 (22:01 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 28 Oct 2009 22:01:05 +0000 (22:01 +0000)
webcit/messages.c
webcit/subst.c

index 3e00496567e69794273886aa16fa709e0f71edf7..a3e17dbb56936d2c5d60903e989652cab8fdbb35 100644 (file)
@@ -819,7 +819,7 @@ void readloop(long oper)
        if (Stat.sortit) {
                CompareFunc SortIt;
                memset(&SubTP, 0, sizeof(WCTemplputParams));
-               SubTP.Filter.ContextType = CTX_NONE;
+               SubTP.Filter.ContextType = CTX_MAILSUM;
                SubTP.Context = NULL;
                SortIt =  RetrieveSort(&SubTP, NULL, 0,
                                       HKEY("date"), Stat.defaultsortorder);
index a4a8edea2d7f601b82fa2ab94a80b925c00b39ae..90243de86e93009ce1589a33efd3dbcd0b95561a 100644 (file)
@@ -2294,6 +2294,11 @@ void RegisterSortFunc(const char *name, long len,
        NewSort->Reverse = Reverse;
        NewSort->GroupChange = GroupChange;
        NewSort->ContextType = ContextType;
+       if (ContextType == CTX_NONE) {
+               lprintf(1, "sorting requires a context. CTX_NONE won't make it.\n");
+               exit(1);
+       }
+               
        Put(SortHash, name, len, NewSort, DestroySortStruct);
 }
 
@@ -2346,6 +2351,9 @@ CompareFunc RetrieveSort(WCTemplputParams *TP,
        }
        SortBy = (SortStruct*)vSortBy;
 
+       if (SortBy->ContextType != TP->Filter.ContextType)
+               return NULL;
+
        /** Ok, its us, lets see in which direction we should sort... */
        if (havebstr("SortOrder")) {
                SortOrder = LBSTR("SortOrder");