summaryrefslogtreecommitdiff
path: root/alpine/mailview.h
blob: 9df7aeb6d6f87619fa8033be43934fbc98e1a4f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * $Id: mailview.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
 *
 * ========================================================================
 * Copyright 2006-2008 University of Washington
 * Copyright 2013-2020 Eduardo Chappa
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * ========================================================================
 */

#ifndef PINE_MAILVIEW_INCLUDED
#define PINE_MAILVIEW_INCLUDED


#include <general.h>
#include "../pith/mailview.h"
#include "titlebar.h"
#include "keymenu.h"
#include "../pith/handle.h"
#include "../pith/store.h"
#include "../pith/bitmap.h"


/*
 * display_output_file mode flags
 */
#define	DOF_NONE	0
#define	DOF_EMPTY	1
#define	DOF_BRIEF	2


#define STYLE_NAME(s)   ((s)->text.desc ? (s)->text.desc : "text")


/*
 * Struct defining scrolltool operating parameters.
 */
typedef	struct scrolltool_s {
    struct {			/* Data and its attributes to scroll	 */
	void	   *text;	/* what to scroll			 */
	SourceType  src;	/* it's form (char **,char *,FILE *)	 */
	char	   *desc;	/* Description of "type" of data shown	 */
	HANDLE_S   *handles;	/* embedded data descriptions		 */
    } text;
    struct {			/* titlebar state			 */
	char	     *title;	/* screen's title			 */
	TitleBarType  style;	/* it's type				 */
	COLOR_PAIR   *color;
    } bar;
    struct {			/* screen's keymenu/command bindings	 */
	struct key_menu	 *menu;
	bitmap_t	  bitmap;
	OtherMenu	  what;
	void		(*each_cmd)(struct scrolltool_s *, int);
    } keys;
    struct {			/* help for this attachment		 */
	HelpType  text;		/* help text				 */
	char	 *title;	/* title for help screen		 */
    } help;
    struct {
	int (*click)(struct scrolltool_s *);
	int (*clickclick)(struct scrolltool_s *);
#ifdef	_WINDOWS
	/*
	 * For systems that support it, allow caller to do popup menu
	 */
	int (*popup)(struct scrolltool_s *, int);
#endif
    } mouse;
    struct {			/* where to start paging from		 */
	enum {FirstPage = 0, LastPage, Fragment, Offset, Handle} on;
	union {
	    char	*frag;	/* fragment in html text to start on	 */
	    long	 offset;
	} loc;
    } start;
    struct {			/* Non-default Command Processor	 */
	int (*tool)(int, MSGNO_S *, struct scrolltool_s *);
	/* The union below is opaque as far as scrolltool itself is
	 * concerned, but is provided as a container to pass data
	 * between the scrolltool caller and the given "handler"
	 * callback (or any other callback that takes a scrolltool_s *).
	 */
	union {
	    void *p;
	    int	  i;
	} data;
    } proc;
				/* End of page processing		 */
    int	       (*end_scroll)(struct scrolltool_s *);
				/* Handler for invalid command input	 */
    int	       (*bogus_input)(UCS);
    unsigned	 resize_exit:1;	/* Return from scrolltool if resized	 */
    unsigned	 body_valid:1;	/* Screen's body already displayed	 */
    unsigned	 no_stat_msg:1;	/* Don't display status messages	 */
    unsigned	 vert_handle:1;	/* hunt up and down on arrows/ctrl-[np]  */
    unsigned	 srch_handle:1;	/* search to next handle		 */
    unsigned	 quell_help:1;	/* Don't show handle nav help message    */
    unsigned	 quell_newmail:1; /* Don't check for new mail		 */
    unsigned	 quell_first_view:1; /* Don't act special first time through */
    unsigned	 jump_is_debug:1;
    unsigned	 use_indexline_color:1;
} SCROLL_S;


/* exported prototypes */
char	   *get_url_external_handler(char *, int);
int	    do_url_launch(char *, char *);
void	    mail_view_screen(struct pine *);
url_tool_t  url_local_handler(char *);
int	    url_local_mailto(char *);
int	    url_local_mailto_and_atts(char *, PATMT *);
int	    url_local_fragment(char *);
int	    scrolltool(SCROLL_S *);
int         ng_scroll_edit(CONTEXT_S *, int);
int         folder_select_update(CONTEXT_S *, int);
int         scroll_add_listmode(CONTEXT_S *, int);
void	    display_output_file(char *, char *, char *, int);
int	    rfc2369_editorial(long, HANDLE_S **, int, int, gf_io_t);
void	    view_writec_init(STORE_S *, HANDLE_S **, int, int);
void	    view_writec_destroy(void);
int	    view_writec(int);


#endif /* PINE_MAILVIEW_INCLUDED */