* SMIME: Change the default signature digest from sha1 to sha-256,
[alpine.git] / pith / indxtype.h
blob0b7adba2961bfd72954c01c9c9b8cf2417d1158e
1 /*
2 * $Id: indxtype.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006-2008 University of Washington
6 * Copyright 2013-2016 Eduardo Chappa
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_INDXTYPE_INCLUDED
18 #define PITH_INDXTYPE_INCLUDED
20 #include "../pith/osdep/color.h"
22 #include "../pith/msgno.h"
23 #include "../pith/charset.h"
27 * Flags for msgline_hidden.
29 * MH_NONE means we should only consider messages which are or would be
30 * visible in the index view. That is, messages which are not hidden due
31 * to zooming, not hidden because they are in a collapsed part of a
32 * thread, and not hidden because we are in one thread and they are in
33 * another and the view we are using only shows one thread.
34 * MH_THISTHD changes that a little bit. It considers more messages
35 * to be visible. In particular, messages in this thread which are
36 * hidden due to collapsing are considered to be visible instead of hidden.
37 * This is useful if we are viewing a message and hit Next, and want
38 * to see the next message in the thread even if it was in a
39 * collapsed thread. This only makes sense when using the separate
40 * thread index and viewing a thread. "This thread" is the thread that
41 * is being viewed, not the thread that msgno is part of. So it is the
42 * thread that has been marked MN_CHID2.
43 * MH_ANYTHD adds more visibility. It doesn't matter if the message is in
44 * the same thread or if it is collapsed or not. If a message is not
45 * hidden due to zooming, then it is not hidden. Notice that ANYTHD
46 * implies THISTHD.
48 #define MH_NONE 0x0
49 #define MH_THISTHD 0x1
50 #define MH_ANYTHD 0x2
53 typedef enum {iNothing, iStatus, iFStatus, iIStatus, iSIStatus,
54 iDate, iLDate, iS1Date, iS2Date, iS3Date, iS4Date, iSDate,
55 iDateIso, iDateIsoS,
56 iSDateIso, iSDateIsoS, iSDateS1, iSDateS2, iSDateS3, iSDateS4,
57 iSDateTime,
58 iSDateTimeIso, iSDateTimeIsoS, iSDateTimeS1,
59 iSDateTimeS2, iSDateTimeS3, iSDateTimeS4,
60 iSDateTime24,
61 iSDateTimeIso24, iSDateTimeIsoS24, iSDateTimeS124,
62 iSDateTimeS224, iSDateTimeS324, iSDateTimeS424,
63 iRDate, iTimezone,
64 iTime24, iTime12,
65 iCurDate, iCurDateIso, iCurDateIsoS, iCurTime24, iCurTime12,
66 iCurDay, iCurDay2Digit, iCurDayOfWeek, iCurDayOfWeekAbb,
67 iCurMon, iCurMon2Digit, iCurMonLong, iCurMonAbb,
68 iCurYear, iCurYear2Digit,
69 iLstMon, iLstMon2Digit, iLstMonLong, iLstMonAbb,
70 iLstMonYear, iLstMonYear2Digit,
71 iLstYear, iLstYear2Digit,
72 iMessNo, iAtt, iMsgID,
73 iSubject, iSubjKey, iSubjKeyInit,
74 iSubjectText, iSubjKeyText, iSubjKeyInitText,
75 iOpeningText, iOpeningTextNQ,
76 iKey, iKeyInit,
77 iPrefDate, iPrefTime, iPrefDateTime,
78 iCurPrefDate, iCurPrefTime, iCurPrefDateTime,
79 iSize, iSizeComma, iSizeNarrow, iDescripSize,
80 iNewsAndTo, iToAndNews, iNewsAndRecips, iRecipsAndNews,
81 iFromTo, iFromToNotNews, iFrom, iTo, iSender, iCc, iNews, iRecips,
82 iCurNews, iArrow,
83 iMailbox, iAddress, iInit, iCursorPos,
84 iDay2Digit, iMon2Digit, iYear2Digit,
85 iSTime, iKSize,
86 iRoleNick, iNewLine,
87 iHeader, iText,
88 iPrio, iPrioAlpha, iPrioBang,
89 iScore, iDayOfWeekAbb, iDayOfWeek,
90 iDay, iDayOrdinal, iMonAbb, iMonLong, iMon, iYear} IndexColType;
92 typedef enum {AllAuto, Fixed, Percent, WeCalculate, Special} WidthType;
94 typedef enum {eText = 0, eKeyWord, eThreadCount, eThreadInfo, eTypeCol} ElemType;
96 typedef enum {Left, Right} ColAdj;
98 typedef struct index_parse_tokens {
99 char *name;
100 IndexColType ctype;
101 int what_for;
102 } INDEX_PARSE_T;
105 /* these are flags for the what_for field in INDEX_PARSE_T */
106 #define FOR_NOTHING 0x00
107 #define FOR_INDEX 0x01
108 #define FOR_REPLY_INTRO 0x02
109 #define FOR_TEMPLATE 0x04 /* or for signature */
110 #define FOR_FILT 0x08
111 #define DELIM_USCORE 0x10
112 #define DELIM_PAREN 0x20
113 #define DELIM_COLON 0x40
116 #define DEFAULT_REPLY_INTRO "default"
119 typedef struct hdr_token_description {
120 char *hdrname;
121 int fieldnum;
122 int fieldsepcnt;
123 ColAdj adjustment;
124 char *fieldseps;
125 } HEADER_TOK_S;
127 typedef struct col_description {
128 IndexColType ctype;
129 WidthType wtype;
130 int req_width;
131 int width;
132 int actual_length;
133 int monabb_width; /* hack */
134 ColAdj adjustment;
135 HEADER_TOK_S *hdrtok;
136 } INDEX_COL_S;
140 * Ensure that all the data in an index_elem (in the data member)
141 * is stored in UTF-8. The writing routines (paint_index_line() for pine)
142 * should then assume UTF-8 when using the data. The process of putting
143 * data into an index_elem will likely involve a conversion into UTF-8.
144 * For example, the Subject or From fields may have data in some arbitrary
145 * character set.
147 typedef struct index_elem {
148 struct index_elem *next;
149 char *print_format;
150 COLOR_PAIR *color; /* color, if any, for this element */
151 char *data; /* ptr to full text for this element */
152 unsigned int datalen; /* not counting terminating null */
153 ElemType type; /* part of field data represents */
154 unsigned freedata:1; /* free data when done */
155 unsigned freecolor:1; /* free color when done */
156 unsigned freeprintf:8; /* how much alloced for print_format */
157 unsigned wid:16; /* redundant, width from print_format */
158 } IELEM_S;
162 * 3 is room for '%', '.', and 's'. You need to add one for '\0';
163 * The format string looks like:
165 * %13.13s or %-13.13s
167 * The '-' is there if left is set and the 13 is the 'width' in the call.
169 #define PRINT_FORMAT_LEN(width,left) (3 + ((left) ? 1 : 0) + 2 * ((width) > 999 ? 4 : (width) > 99 ? 3 : (width) > 9 ? 2 : 1))
173 * Each field consists of a list of elements. The leftadj bit means we
174 * should left adjust the whole thing in the field width, padding on the
175 * right with spaces or truncating on the right. We haven't yet fully
176 * implemented right adjust, except that it is easy for a single element
177 * field. So be careful with multi-element, right-adjusted fields.
179 typedef struct index_field {
180 struct index_field *next;
181 IndexColType ctype;
182 unsigned width:16; /* width of whole field */
183 unsigned leftadj:1; /* left adjust elements in field */
184 IELEM_S *ielem; /* list of elements in this field */
185 } IFIELD_S;
189 * If the index_cache_entry has an ifield list, it is assumed that the
190 * ifields have had their ielement lists filled in.
191 * The widths_done bit is set after the widths and print formats are setup
192 * to do the correct width. A width change could be done by unsetting
193 * the widths_done bit and then recalculating the widths in the ifields
194 * and resetting the print_format strings in the ielems.
196 typedef struct index_cache_entry {
197 IFIELD_S *ifield; /* list of fields */
198 COLOR_PAIR *linecolor;
199 unsigned color_lookup_done:1; /* efficiency hacks */
200 unsigned widths_done:1;
201 unsigned to_us:1;
202 unsigned cc_us:1;
203 int plus;
204 unsigned long id; /* hash value */
205 struct index_cache_entry *tice; /* thread index header line */
206 } ICE_S;
210 * Pieces needed to construct a valid folder index entry, and to
211 * control what can be fetched when (due to callbacks and such)
213 typedef struct index_data {
214 MAILSTREAM *stream;
215 ADDRESS *from, /* always valid */
216 *to, /* check valid bit, fetch as req'd */
217 *cc, /* check valid bit, fetch as req'd */
218 *sender; /* check valid bit, fetch as req'd */
219 char *newsgroups, /* check valid bit, fetch as req'd */
220 *subject, /* always valid */
221 *date; /* always valid */
222 long msgno, /* tells us what we're looking at */
223 rawno,
224 size; /* always valid */
225 unsigned no_fetch:1, /* lit when we're in a callback */
226 bogus:2, /* lit when there were problems */
227 valid_to:1, /* trust struct's "to" pointer */
228 valid_cc:1, /* trust struct's "cc" pointer */
229 valid_sender:1, /* trust struct's "sender" pointer */
230 valid_news:1, /* trust struct's "news" pointer */
231 valid_resent_to:1, /* trust struct's "resent-to" ptr */
232 resent_to_us:1; /* lit when we know its true */
233 } INDEXDATA_S;
237 * Line_hash can't return LINE_HASH_N, so we use it in a couple places as
238 * a special value that we can assign knowing it can't be a real hash value.
240 #define LINE_HASH_N 0xffffffff
243 typedef enum {NoKW, KW, KWInit} SubjKW;
246 /* exported protoypes */
249 #endif /* PITH_INDXTYPE_INCLUDED */