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