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_COUNT_NEW 16
36#define SORT_FLAGGED 17
37#define SORT_PATH 18
38
39/* Sort and sort_aux are shorts, and are a composite of a
40 * constant sort operation number and a set of compounded
41 * bitflags.
42 *
43 * Everything below SORT_MASK is a constant. There's room for
44 * SORT_MASK constant SORT_ values.
45 *
46 * Everything above is a bitflag. It's OK to move SORT_MASK
47 * down by powers of 2 if we need more, so long as we don't
48 * collide with the constants above. (Or we can just expand
49 * sort and sort_aux to uint32_t.)
50 */
51#define SORT_MASK ((1<<8) - 1)
52#define SORT_REVERSE (1<<8)
53#define SORT_LAST (1<<9)
54
55typedef int sort_t (const void *, const void *);
56sort_t *mutt_get_sort_func (int);
57
58void mutt_clear_threads (CONTEXT *);
59void mutt_sort_headers (CONTEXT *, int);
60void mutt_sort_threads (CONTEXT *, int);
61int mutt_select_sort (int);
62THREAD *mutt_sort_subthreads (THREAD *, int);
63
64WHERE short BrowserSort INITVAL (SORT_SUBJECT);
65WHERE short Sort INITVAL (SORT_DATE);
66WHERE short SortAux INITVAL (SORT_DATE); /* auxiliary sorting method */
67WHERE short SortAlias INITVAL (SORT_ALIAS);
68WHERE short SidebarSortMethod INITVAL (SORT_ORDER);
69
70/* FIXME: This one does not belong to here */
71WHERE short PgpSortKeys INITVAL (SORT_ADDRESS);
72
73#include "mapping.h"
74extern const struct mapping_t SortMethods[];