mutt stable branch with some hacks
1/*
2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#define SORT_DATE 1 /* the date the mail was sent. */
20#define SORT_SIZE 2
21#define SORT_SUBJECT 3
22#define SORT_ALPHA 3 /* makedoc.c requires this */
23#define SORT_FROM 4
24#define SORT_ORDER 5 /* the order the messages appear in the mailbox. */
25#define SORT_THREADS 6
26#define SORT_RECEIVED 7 /* when the message were delivered locally */
27#define SORT_TO 8
28#define SORT_SCORE 9
29#define SORT_ALIAS 10
30#define SORT_ADDRESS 11
31#define SORT_KEYID 12
32#define SORT_TRUST 13
33#define SORT_SPAM 14
34#define SORT_COUNT 15
35#define SORT_UNREAD 16
36#define SORT_FLAGGED 17
37#define SORT_PATH 18
38#define SORT_LABEL 19
39
40/* Sort and sort_aux are shorts, and are a composite of a
41 * constant sort operation number and a set of compounded
42 * bitflags.
43 *
44 * Everything below SORT_MASK is a constant. There's room for
45 * SORT_MASK constant SORT_ values.
46 *
47 * Everything above is a bitflag. It's OK to move SORT_MASK
48 * down by powers of 2 if we need more, so long as we don't
49 * collide with the constants above. (Or we can just expand
50 * sort and sort_aux to uint32_t.)
51 */
52#define SORT_MASK ((1<<8) - 1)
53#define SORT_REVERSE (1<<8)
54#define SORT_LAST (1<<9)
55
56typedef int sort_t (const void *, const void *);
57sort_t *mutt_get_sort_func (int);
58
59void mutt_clear_threads (CONTEXT *);
60void mutt_sort_headers (CONTEXT *, int);
61void mutt_sort_threads (CONTEXT *, int);
62int mutt_select_sort (int);
63THREAD *mutt_sort_subthreads (THREAD *, int);
64
65WHERE short BrowserSort INITVAL (SORT_SUBJECT);
66WHERE short Sort INITVAL (SORT_DATE);
67WHERE short SortAux INITVAL (SORT_DATE); /* auxiliary sorting method */
68WHERE short SortAlias INITVAL (SORT_ALIAS);
69WHERE short SidebarSortMethod INITVAL (SORT_ORDER);
70
71/* FIXME: This one does not belong to here */
72WHERE short PgpSortKeys INITVAL (SORT_ADDRESS);
73
74#include "mapping.h"
75extern const struct mapping_t SortMethods[];