* New version 2.21.999
[alpine.git] / pith / mailview.h
blob109bcfbdf86f13ff5ea3421163364bdd7d336a99
1 /*
2 * $Id: mailview.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006-2008 University of Washington
6 * Copyright 2013-2018 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_MAILVIEW_INCLUDED
18 #define PITH_MAILVIEW_INCLUDED
21 #include "../pith/store.h"
22 #include "../pith/handle.h"
23 #include "../pith/bitmap.h"
24 #include "../pith/helptext.h"
25 #include "../pith/msgno.h"
26 #include "../pith/filttype.h"
27 #include "../pith/pattern.h"
28 #include "../pith/state.h"
29 #include "../pith/charset.h"
30 #include "../pith/color.h"
33 /* format_message flags */
34 #define FM_DISPLAY 0x0001 /* result is headed for display */
35 #define FM_NEW_MESS 0x0002 /* a new message so zero out attachment descrip */
36 #define FM_NOWRAP 0x0008 /* no wrapping done */
37 #define FM_NOCOLOR 0x0010 /* no color added */
38 #define FM_NOINDENT 0x0020 /* no indents, but only works has effect if wrapping */
39 #define FM_NOEDITORIAL 0x0040 /* no editorial comments */
40 #define FM_NOHTMLREL 0x0200 /* no relative links */
41 #define FM_HTMLRELATED 0x0400 /* allow multi/related */
42 #define FM_FORCEPREFPLN 0x0800 /* force prefer-plain this time */
43 #define FM_FORCENOPREFPLN 0x1000 /* force not prefer-plain this time */
44 #define FM_HIDESERVER 0x2000 /* HIDE servername after active HTML links */
45 #define FM_HTML 0x4000 /* filter/preserve HTML markup */
46 #define FM_HTMLIMAGES 0x8000 /* filter/preserve HTML IMG tags */
48 /* Format Calendar Flags */
49 #define FC_SUMMARY 0x0001 /* Display only a summary event */
50 #define FC_FULL 0x0002 /* Display full details of event */
52 #define SIGDASHES "-- "
53 #define START_SIG_BLOCK 2
54 #define IN_SIG_BLOCK 1
55 #define OUT_SIG_BLOCK 0
59 * Which header fields should format_envelope output?
61 #define FE_FROM 0x0001
62 #define FE_SENDER 0x0002
63 #define FE_DATE 0x0004
64 #define FE_TO 0x0008
65 #define FE_CC 0x0010
66 #define FE_BCC 0x0020
67 #define FE_NEWSGROUPS 0x0040
68 #define FE_SUBJECT 0x0080
69 #define FE_MESSAGEID 0x0100
70 #define FE_REPLYTO 0x0200
71 #define FE_FOLLOWUPTO 0x0400
72 #define FE_INREPLYTO 0x0800
73 #define FE_RETURNPATH 0x1000
74 #define FE_REFERENCES 0x2000
75 #define FE_DEFAULT (FE_FROM | FE_DATE | FE_TO | FE_CC | FE_BCC \
76 | FE_NEWSGROUPS | FE_SUBJECT | FE_REPLYTO \
77 | FE_FOLLOWUPTO)
81 * Function to format
83 typedef void (*fmt_env_t)(MAILSTREAM *, long int, char *, ENVELOPE *, gf_io_t, long int, char *, int);
86 * Structure and macros to help control format_header_text
88 typedef struct header_s {
89 unsigned type:4;
90 unsigned except:1;
91 union {
92 char **l; /* list of char *'s */
93 long b; /* bit field of header fields (FE_* above) */
94 } h;
95 char charset[CSET_MAX];
96 } HEADER_S;
100 * Macro's to help sort out how we display MIME types
102 #define MCD_NONE 0x00
103 #define MCD_INTERNAL 0x01
104 #define MCD_EXTERNAL 0x02
105 #define MCD_EXT_PROMPT 0x04
108 #define HD_LIST 1
109 #define HD_BFIELD 2
110 #define HD_INIT(H, L, E, B) { \
111 if((L) && (L)[0]){ \
112 (H)->type = HD_LIST; \
113 (H)->except = (E); \
114 (H)->h.l = (L); \
116 else{ \
117 (H)->type = HD_BFIELD; \
118 (H)->h.b = (B); \
119 (H)->except = 0; \
121 (H)->charset[0] = '\0'; \
125 /* exported protoypes */
126 int format_message(long, ENVELOPE *, BODY *, HANDLE_S **, int, gf_io_t);
127 int format_attachment_list(long int, BODY *, HANDLE_S **, int, int, gf_io_t);
128 char *format_body(long int, BODY *, HANDLE_S **, HEADER_S *, int, int, gf_io_t);
129 int format_calendar(long int, BODY *, HANDLE_S **, int, int, gf_io_t);
130 int url_hilite(long, char *, LT_INS_S **, void *);
131 int handle_start_color(char *, size_t, int *, int);
132 int handle_end_color(char *, size_t, int *);
135 * BUG: BELOW IS UNIX/PC ONLY since config'd browser means nothing to webpine
138 int url_external_specific_handler(char *, int);
139 int url_imap_folder(char *, char **, imapuid_t *, imapuid_t *, char **, int);
140 int url_bogus(char *, char *);
141 void pine_rfc822_address(ADDRESS *, gf_io_t);
142 void pine_rfc822_cat(char *, const char *, gf_io_t);
143 int format_header(MAILSTREAM *, long, char *, ENVELOPE *, HEADER_S *,
144 char *, HANDLE_S **, int, fmt_env_t, gf_io_t);
145 COLOR_PAIR *hdr_color(char *, char *, SPEC_COLOR_S *);
146 char *display_parameters(PARAMETER *);
147 char *pine_fetch_header(MAILSTREAM *, long, char *, char **, long);
148 int color_signature(long, char *, LT_INS_S **, void *);
149 int scroll_handle_start_color(char *, size_t, int *);
150 int scroll_handle_end_color(char *, size_t, int *, int);
151 int width_at_this_position(unsigned char *, unsigned long);
153 /* currently mandatory to implement stubs */
155 /* this is used in rfc2369_editorial() in format_message() */
156 void rfc2369_display(MAILSTREAM *, MSGNO_S *, long);
159 #endif /* PITH_MAILVIEW_INCLUDED */