]> code.citadel.org Git - citadel.git/blobdiff - webcit/subst.c
* respect the context while sorting. Else unexpected results will follow.
[citadel.git] / webcit / subst.c
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");