* Do not define _BSD_SOURCE but define _DEFAULT_SOURCE instead.
[alpine.git] / pith / mailview.h
blob6ee1a08fe8495f1f05776d3de62ceb5dc6585614
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-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_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 */
49 #define SIGDASHES "-- "
50 #define START_SIG_BLOCK 2
51 #define IN_SIG_BLOCK 1
52 #define OUT_SIG_BLOCK 0
56 * Which header fields should format_envelope output?
58 #define FE_FROM 0x0001
59 #define FE_SENDER 0x0002
60 #define FE_DATE 0x0004
61 #define FE_TO 0x0008
62 #define FE_CC 0x0010
63 #define FE_BCC 0x0020
64 #define FE_NEWSGROUPS 0x0040
65 #define FE_SUBJECT 0x0080
66 #define FE_MESSAGEID 0x0100
67 #define FE_REPLYTO 0x0200
68 #define FE_FOLLOWUPTO 0x0400
69 #define FE_INREPLYTO 0x0800
70 #define FE_RETURNPATH 0x1000
71 #define FE_REFERENCES 0x2000
72 #define FE_DEFAULT (FE_FROM | FE_DATE | FE_TO | FE_CC | FE_BCC \
73 | FE_NEWSGROUPS | FE_SUBJECT | FE_REPLYTO \
74 | FE_FOLLOWUPTO)
78 * Function to format
80 typedef void (*fmt_env_t)(MAILSTREAM *, long int, char *, ENVELOPE *, gf_io_t, long int, char *, int);
83 * Structure and macros to help control format_header_text
85 typedef struct header_s {
86 unsigned type:4;
87 unsigned except:1;
88 union {
89 char **l; /* list of char *'s */
90 long b; /* bit field of header fields (FE_* above) */
91 } h;
92 char charset[CSET_MAX];
93 } HEADER_S;
97 * Macro's to help sort out how we display MIME types
99 #define MCD_NONE 0x00
100 #define MCD_INTERNAL 0x01
101 #define MCD_EXTERNAL 0x02
102 #define MCD_EXT_PROMPT 0x04
105 #define HD_LIST 1
106 #define HD_BFIELD 2
107 #define HD_INIT(H, L, E, B) { \
108 if((L) && (L)[0]){ \
109 (H)->type = HD_LIST; \
110 (H)->except = (E); \
111 (H)->h.l = (L); \
113 else{ \
114 (H)->type = HD_BFIELD; \
115 (H)->h.b = (B); \
116 (H)->except = 0; \
118 (H)->charset[0] = '\0'; \
122 /* exported protoypes */
123 int format_message(long, ENVELOPE *, BODY *, HANDLE_S **, int, gf_io_t);
124 int format_attachment_list(long int, BODY *, HANDLE_S **, int, int, gf_io_t);
125 char *format_body(long int, BODY *, HANDLE_S **, HEADER_S *, int, int, gf_io_t);
126 int url_hilite(long, char *, LT_INS_S **, void *);
127 int handle_start_color(char *, size_t, int *, int);
128 int handle_end_color(char *, size_t, int *);
131 * BUG: BELOW IS UNIX/PC ONLY since config'd browser means nothing to webpine
134 int url_external_specific_handler(char *, int);
135 int url_imap_folder(char *, char **, imapuid_t *, imapuid_t *, char **, int);
136 int url_bogus(char *, char *);
137 void pine_rfc822_address(ADDRESS *, gf_io_t);
138 void pine_rfc822_cat(char *, const char *, gf_io_t);
139 int format_header(MAILSTREAM *, long, char *, ENVELOPE *, HEADER_S *,
140 char *, HANDLE_S **, int, fmt_env_t, gf_io_t);
141 COLOR_PAIR *hdr_color(char *, char *, SPEC_COLOR_S *);
142 char *display_parameters(PARAMETER *);
143 char *pine_fetch_header(MAILSTREAM *, long, char *, char **, long);
144 int color_signature(long, char *, LT_INS_S **, void *);
145 int scroll_handle_start_color(char *, size_t, int *);
146 int scroll_handle_end_color(char *, size_t, int *, int);
147 int width_at_this_position(unsigned char *, unsigned long);
149 /* currently mandatory to implement stubs */
151 /* this is used in rfc2369_editorial() in format_message() */
152 void rfc2369_display(MAILSTREAM *, MSGNO_S *, long);
155 #endif /* PITH_MAILVIEW_INCLUDED */