2
* $Id: indxtype.h 380 2007-01-23 00:09:18Z hubert@u.washington.edu $
4
* ========================================================================
5
* Copyright 2006-2007 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_INDXTYPE_INCLUDED
17
#define PITH_INDXTYPE_INCLUDED
19
#include "../pith/osdep/color.h"
21
#include "../pith/msgno.h"
22
#include "../pith/charset.h"
26
* Flags for msgline_hidden.
28
* MH_NONE means we should only consider messages which are or would be
29
* visible in the index view. That is, messages which are not hidden due
30
* to zooming, not hidden because they are in a collapsed part of a
31
* thread, and not hidden because we are in one thread and they are in
32
* another and the view we are using only shows one thread.
33
* MH_THISTHD changes that a little bit. It considers more messages
34
* to be visible. In particular, messages in this thread which are
35
* hidden due to collapsing are considered to be visible instead of hidden.
36
* This is useful if we are viewing a message and hit Next, and want
37
* to see the next message in the thread even if it was in a
38
* collapsed thread. This only makes sense when using the separate
39
* thread index and viewing a thread. "This thread" is the thread that
40
* is being viewed, not the thread that msgno is part of. So it is the
41
* thread that has been marked MN_CHID2.
42
* MH_ANYTHD adds more visibility. It doesn't matter if the message is in
43
* the same thread or if it is collapsed or not. If a message is not
44
* hidden due to zooming, then it is not hidden. Notice that ANYTHD
48
#define MH_THISTHD 0x1
52
typedef enum {iNothing, iStatus, iFStatus, iIStatus,
53
iDate, iLDate, iS1Date, iS2Date, iS3Date, iS4Date, iSDate,
55
iSDateIso, iSDateIsoS, iSDateS1, iSDateS2, iSDateS3, iSDateS4,
57
iSDateTimeIso, iSDateTimeIsoS, iSDateTimeS1,
58
iSDateTimeS2, iSDateTimeS3, iSDateTimeS4,
60
iSDateTimeIso24, iSDateTimeIsoS24, iSDateTimeS124,
61
iSDateTimeS224, iSDateTimeS324, iSDateTimeS424,
64
iCurDate, iCurDateIso, iCurDateIsoS, iCurTime24, iCurTime12,
65
iCurDay, iCurDay2Digit, iCurDayOfWeek, iCurDayOfWeekAbb,
66
iCurMon, iCurMon2Digit, iCurMonLong, iCurMonAbb,
67
iCurYear, iCurYear2Digit,
68
iLstMon, iLstMon2Digit, iLstMonLong, iLstMonAbb,
69
iLstMonYear, iLstMonYear2Digit,
70
iLstYear, iLstYear2Digit,
71
iMessNo, iAtt, iMsgID,
72
iSubject, iSubjKey, iSubjKeyInit,
73
iSubjectText, iSubjKeyText, iSubjKeyInitText,
75
iSize, iSizeComma, iSizeNarrow, iDescripSize,
76
iNewsAndTo, iToAndNews, iNewsAndRecips, iRecipsAndNews,
77
iFromTo, iFromToNotNews, iFrom, iTo, iSender, iCc, iNews, iRecips,
79
iMailbox, iAddress, iInit, iCursorPos,
80
iDay2Digit, iMon2Digit, iYear2Digit,
83
iScore, iDayOfWeekAbb, iDayOfWeek,
84
iDay, iDayOrdinal, iMonAbb, iMonLong, iMon, iYear} IndexColType;
86
typedef enum {AllAuto, Fixed, Percent, WeCalculate, Special} WidthType;
88
typedef enum {eText = 0, eKeyWord, eThreadCount, eThreadInfo, eOpening} ElemType;
90
typedef enum {Left, Right} ColAdj;
92
typedef struct index_parse_tokens {
99
/* these are flags for the what_for field in INDEX_PARSE_T */
100
#define FOR_NOTHING 0x00
101
#define FOR_INDEX 0x01
102
#define FOR_REPLY_INTRO 0x02
103
#define FOR_TEMPLATE 0x04 /* or for signature */
104
#define FOR_FILT 0x08
105
#define DELIM_USCORE 0x10
106
#define DELIM_PAREN 0x20
109
#define DEFAULT_REPLY_INTRO "default"
112
typedef struct col_description {
123
* Ensure that all the data in an index_elem (in the data member)
124
* is stored in UTF-8. The writing routines (paint_index_line() for pine)
125
* should then assume UTF-8 when using the data. The process of putting
126
* data into an index_elem will likely involve a conversion into UTF-8.
127
* For example, the Subject or From fields may have data in some arbitrary
130
typedef struct index_elem {
131
struct index_elem *next;
133
COLOR_PAIR *color; /* color, if any, for this element */
134
char *data; /* ptr to full text for this element */
135
unsigned int datalen; /* not counting terminating null */
136
ElemType type; /* part of field data represents */
137
unsigned freedata:1; /* free data when done */
138
unsigned freecolor:1; /* free color when done */
139
unsigned freeprintf:8; /* how much alloced for print_format */
140
unsigned wid:8; /* redundant, width from print_format */
145
* 3 is room for '%', '.', and 's'. You need to add one for '\0';
146
* The format string looks like:
148
* %13.13s or %-13.13s
150
* The '-' is there if left is set and the 13 is the 'width' in the call.
152
#define PRINT_FORMAT_LEN(width,left) (3 + ((left) ? 1 : 0) + 2 * ((width) > 999 ? 4 : (width) > 99 ? 3 : (width) > 9 ? 2 : 1))
156
* Each field consists of a list of elements. The leftadj bit means we
157
* should left adjust the whole thing in the field width, padding on the
158
* right with spaces or truncating on the right. We haven't yet fully
159
* implemented right adjust, except that it is easy for a single element
160
* field. So be careful with multi-element, right-adjusted fields.
162
typedef struct index_field {
163
struct index_field *next;
165
unsigned width:8; /* width of whole field */
166
unsigned leftadj:1; /* left adjust elements in field */
167
IELEM_S *ielem; /* list of elements in this field */
172
* If the index_cache_entry has an ifield list, it is assumed that the
173
* ifields have had their ielement lists filled in.
174
* The widths_done bit is set after the widths and print formats are setup
175
* to do the correct width. A width change could be done by unsetting
176
* the widths_done bit and then recalculating the widths in the ifields
177
* and resetting the print_format strings in the ielems.
179
typedef struct index_cache_entry {
180
IFIELD_S *ifield; /* list of fields */
181
COLOR_PAIR *linecolor;
183
unsigned color_lookup_done:1; /* efficiency hacks */
184
unsigned widths_done:1;
188
unsigned long id; /* hash value */
189
struct index_cache_entry *tice; /* thread index header line */
194
* Pieces needed to construct a valid folder index entry, and to
195
* control what can be fetched when (due to callbacks and such)
197
typedef struct index_data {
199
ADDRESS *from, /* always valid */
200
*to, /* check valid bit, fetch as req'd */
201
*cc, /* check valid bit, fetch as req'd */
202
*sender; /* check valid bit, fetch as req'd */
203
char *newsgroups, /* check valid bit, fetch as req'd */
204
*subject, /* always valid */
205
*date; /* always valid */
206
long msgno, /* tells us what we're looking at */
208
size; /* always valid */
209
unsigned no_fetch:1, /* lit when we're in a callback */
210
bogus:2, /* lit when there were problems */
211
valid_to:1, /* trust struct's "to" pointer */
212
valid_cc:1, /* trust struct's "cc" pointer */
213
valid_sender:1, /* trust struct's "sender" pointer */
214
valid_news:1, /* trust struct's "news" pointer */
215
valid_resent_to:1, /* trust struct's "resent-to" ptr */
216
resent_to_us:1; /* lit when we know its true */
221
* Line_hash can't return LINE_HASH_N, so we use it in a couple places as
222
* a special value that we can assign knowing it can't be a real hash value.
224
#define LINE_HASH_N 0xffffffff
227
typedef enum {NoKW, KW, KWInit} SubjKW;
230
/* exported protoypes */
233
#endif /* PITH_INDXTYPE_INCLUDED */