* Create help for explaining how encrypted password file support
[alpine.git] / pith / thread.h
blob40b09bb0fb87292b2d5466cb104f6cea4a18b189
1 /*
2 * $Id: thread.h 761 2007-10-23 22:35:18Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006 University of Washington
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * ========================================================================
16 #ifndef PITH_THREAD_INCLUDED
17 #define PITH_THREAD_INCLUDED
20 #include "../pith/msgno.h"
21 #include "../pith/indxtype.h"
22 #include "../pith/state.h"
23 #include "../pith/conf.h"
26 #define THD_TOP 0x0000 /* start of an individual thread */
27 #define THD_NEXT 0x0001
28 #define THD_BRANCH 0x0004
30 typedef struct pine_thrd {
31 unsigned long rawno; /* raw msgno of this message */
32 unsigned long thrdno; /* thread number */
33 unsigned long flags;
34 unsigned long next; /* msgno of first reply to us */
35 unsigned long branch; /* like THREADNODE branch, next replier */
36 unsigned long parent; /* message that this is a reply to */
37 unsigned long nextthd; /* next thread, only tops have this */
38 unsigned long prevthd; /* previous thread, only tops have this */
39 unsigned long top; /* top of this thread */
40 unsigned long head; /* head of the whole thread list */
41 } PINETHRD_S;
45 * Some macros useful for threading
48 /* Sort is a threaded sort */
49 #define SORT_IS_THREADED(msgmap) \
50 (mn_get_sort(msgmap) == SortThread \
51 || mn_get_sort(msgmap) == SortSubject2)
53 #define SEP_THRDINDX() \
54 (ps_global->thread_index_style == THRDINDX_SEP \
55 || ps_global->thread_index_style == THRDINDX_SEP_AUTO)
57 #define COLL_THRDS() \
58 (ps_global->thread_index_style == THRDINDX_COLL)
60 #define THRD_AUTO_VIEW() \
61 (ps_global->thread_index_style == THRDINDX_SEP_AUTO)
63 /* We are threading now, pay attention to all the other variables */
64 #define THREADING() \
65 (!ps_global->turn_off_threading_temporarily \
66 && SORT_IS_THREADED(ps_global->msgmap) \
67 && (SEP_THRDINDX() \
68 || ps_global->thread_disp_style != THREAD_NONE))
70 /* If we were to view the folder, we would get a thread index */
71 #define THRD_INDX_ENABLED() \
72 (SEP_THRDINDX() \
73 && THREADING())
75 /* We are in the thread index (or would be if we weren't in an index menu) */
76 #define THRD_INDX() \
77 (THRD_INDX_ENABLED() \
78 && !sp_viewing_a_thread(ps_global->mail_stream))
80 /* The thread command ought to work now */
81 #define THRD_COLLAPSE_ENABLE() \
82 (THREADING() \
83 && !THRD_INDX() \
84 && ps_global->thread_disp_style != THREAD_NONE)
87 /* exported protoypes */
88 PINETHRD_S *fetch_thread(MAILSTREAM *, unsigned long);
89 PINETHRD_S *fetch_head_thread(MAILSTREAM *);
90 void set_flags_for_thread(MAILSTREAM *, MSGNO_S *, int, PINETHRD_S *, int);
91 void erase_threading_info(MAILSTREAM *, MSGNO_S *);
92 void sort_thread_callback(MAILSTREAM *, THREADNODE *);
93 void collapse_threads(MAILSTREAM *, MSGNO_S *, PINETHRD_S *);
94 PINETHRD_S *msgno_thread_info(MAILSTREAM *, unsigned long, PINETHRD_S *, unsigned);
95 void collapse_or_expand(struct pine *, MAILSTREAM *, MSGNO_S *, unsigned long);
96 void select_thread_stmp(struct pine *, MAILSTREAM *, MSGNO_S *);
97 unsigned long count_flags_in_thread(MAILSTREAM *, PINETHRD_S *, long);
98 unsigned long count_lflags_in_thread(MAILSTREAM *, PINETHRD_S *, MSGNO_S *, int);
99 int thread_has_some_visible(MAILSTREAM *, PINETHRD_S *);
100 int mark_msgs_in_thread(MAILSTREAM *, PINETHRD_S *, MSGNO_S *);
101 void set_thread_lflags(MAILSTREAM *, PINETHRD_S *, MSGNO_S *, int, int);
102 char status_symbol_for_thread(MAILSTREAM *, PINETHRD_S *, IndexColType);
103 char to_us_symbol_for_thread(MAILSTREAM *, PINETHRD_S *, int);
104 void set_thread_subtree(MAILSTREAM *, PINETHRD_S *, MSGNO_S *, int, int);
105 int view_thread(struct pine *, MAILSTREAM *, MSGNO_S *, int);
106 int unview_thread(struct pine *, MAILSTREAM *, MSGNO_S *);
107 PINETHRD_S *find_thread_by_number(MAILSTREAM *, MSGNO_S *, long, PINETHRD_S *);
108 void set_search_bit_for_thread(MAILSTREAM *, PINETHRD_S *, SEARCHSET **);
111 #endif /* PITH_THREAD_INCLUDED */