1 /*
2  * Copyright (C) 2002 Laird Breyer
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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA.
17  *
18  * Author:   Laird Breyer <laird@lbreyer.com>
19  */
20 #ifndef MAILINSPECT_H
21 #define MAILINSPECT_H
22 
23 #ifdef HAVE_CONFIG_H
24 #undef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
27 
28 #include "dbacl.h"
29 
30 typedef long seek_t;
31 typedef u_int32_t line_count_t;
32 typedef u_int32_t email_count_t;
33 typedef u_int16_t rank_t;
34 
35 #define INITIAL_LIST_SIZE 256
36 #define PIPE_BUFLEN 2048
37 #define HEADER_BUFLEN 128
38 
39 
40 
41 #define SORT_INCREASING  1
42 #define SORT_DECREASING -1
43 
44 #define TAGRE_INCLUDE   0
45 #define TAGRE_EXCLUDE   1
46 
47 #define MAX_FORMATS     2
48 #define MAX_SCORES      4
49 
50 /* make sure these options don't interfere with those options
51    defined in dbacl.h which we want to use */
52 
53 #define U_OPTION_INTERACTIVE 29
54 #define U_OPTION_REVSORT     30
55 #define U_OPTION_FORMAT      31
56 
57 #define STATE_TAGGED       2
58 #define STATE_LIMITED      3
59 
60 
61 /* data structures */
62 typedef struct {
63   char from[HEADER_BUFLEN];
64   char subject[HEADER_BUFLEN];
65 } email_header;
66 
67 typedef struct {
68   seek_t seekpos;
69   char *description[MAX_FORMATS];
70   weight_t score[MAX_SCORES];
71   char state;
72 } mbox_item;
73 
74 typedef struct {
75   mbox_item *list;
76   mbox_item **llist;
77   email_header header;
78   email_count_t list_size;
79   email_count_t num_limited;
80   email_count_t num_emails;
81   int sortedby;
82   char *filename;
83   unsigned char index_format;
84   unsigned char score_type;
85 } Emails;
86 
87 typedef struct {
88   int num_rows;
89   int num_cols;
90   bool_t delay_sigwinch;
91   int highlighted;
92   email_count_t first_visible;
93   char *fkey_cmd[10];
94 } display_state;
95 
96 
97 void redraw_current_state();
98 
99 #endif
100