1 /*
2  * $Id: options.h 101 2006-08-10 22:53:04Z mikes@u.washington.edu $
3  *
4  * ========================================================================
5  * Copyright 2013-2021 Eduardo Chappa
6  * Copyright 2006-2008 University of Washington
7  *
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
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * ========================================================================
15  */
16 
17 #ifndef PITH_OPTIONS_INCLUDED
18 #define PITH_OPTIONS_INCLUDED
19 
20 /*
21  * function hooks to fill in optional/user-selectable behaviors in pith functions
22  *
23  * You'll find a very brief explanation of what they do here, but you'll need to
24  * look at the places they're called to fully understand how they're intended to
25  * be called and what they're intended to provide.
26  */
27 
28 
29 #include "indxtype.h"			/* for ICE_S */
30 #include "thread.h"			/* for PINETHRD_S */
31 #include "handle.h"			/* for HANDLE_S */
32 #include "filttype.h"			/* for gf_io_t */
33 #include "state.h"			/* for struct pine */
34 #include "adrbklib.h"			/* for SAVE_STATE_S */
35 #ifdef	ENABLE_LDAP
36 #include "ldap.h"
37 #endif
38 
39 
40 /*
41  * optional call in mailindx.c:{from,subject}_str to shrink thread
42  * relationship cue if desired
43  */
44 extern int (*pith_opt_condense_thread_cue)(PINETHRD_S *, ICE_S *, char **, size_t *, int, int);
45 
46 
47 /*
48  * optional call in mailindx.c:setup_header_widths to save various bits
49  * of format state
50  */
51 extern void (*pith_opt_save_index_state)(int);
52 
53 
54 /*
55  * optional call in mailindx.c:load_overview to paint the gathered overview data
56  * on the display
57  */
58 extern void (*pith_opt_paint_index_hline)(MAILSTREAM *, long, ICE_S *);
59 
60 /*
61  * optional hook in mailview.c:format_message to allow for inserting an
62  * [editorial comment] in message text to indicate the message contains
63  * list-management pointers
64  */
65 extern int  (*pith_opt_rfc2369_editorial)(long, HANDLE_S **, int, int, gf_io_t);
66 
67 #ifdef	ENABLE_LDAP
68 /*
69  * optional hook in ldap.c:wp_lookups to ask user where to save chosen LDAP result
70  */
71 extern void (*pith_opt_save_ldap_entry)(struct pine *, LDAP_CHOOSE_S *, int);
72 #endif
73 
74 /*
75  * optional hook in addrbook.c:bunch-of-funcs to allow saving/restoring
76  * state (screen state and such) before and after calls that might be
77  * reentered
78  */
79 extern void (*pith_opt_save_and_restore)(int, SAVE_STATE_S *);
80 
81 /*
82  * optional hooks in newmail.c:new_mail to allow for various indicators
83  * during the new mail check/arrival and checkpoint process
84  */
85 extern void (*pith_opt_newmail_announce)(MAILSTREAM *, long, long);
86 extern void (*pith_opt_newmail_check_cue)(int);
87 extern void (*pith_opt_checkpoint_cue)(int);
88 extern void (*pith_opt_icon_text)(char *, int);
89 
90 /*
91  * optional hook in remote.c to provide name for storing address book
92  * metadata
93  */
94 extern char *(*pith_opt_rd_metadata_name)(void);
95 
96 /*
97  * optional hook in conf.c:read_pinerc to let caller deal with hard
98  * unreadable remote config file error
99  * Return TRUE to continue, FALSE otherwise
100  */
101 extern int (*pith_opt_remote_pinerc_failure)(void);
102 
103 /*
104  * optional hook in mailcmd.c:do_broach_folder allowing for user prompt
105  * of closed folder open.
106  * Return -1 on cancel, zero otherwise.  Set second arg by reference
107  * to TRUE for reopen.
108  */
109 extern int (*pith_opt_reopen_folder)(struct pine *, int *);
110 
111 /*
112  * optional call in mailcmd.c:expunge_and_close to prompt for read message removal
113  */
114 extern int (*pith_opt_read_msg_prompt)(long, char *);
115 
116 /*
117  * optional hook in mailcmd.c:expunge_and_close to prompt for expunge
118  * confirmation.  Return 'y' to expunge/delete. Do not allow cancel.
119  */
120 extern int (*pith_opt_expunge_prompt)(MAILSTREAM *, char *, long);
121 
122 /*
123  * optional hook in mailcmd.c:expunge_and_close called when a folder is
124  * about to be closed and expunged.  Flags passed to expunge_and_close are
125  * in turn passed in this call.
126  */
127 extern void (*pith_opt_begin_closing)(int, char *);
128 
129 /*
130  * optional hook in reply.c:reply_harvet to allow for user selection
131  * of reply-to vs. from address
132  * Return 'y' to use "reply-to" field.
133  */
134 extern int (*pith_opt_replyto_prompt)(void);
135 
136 
137 /*
138  * optional hook in reply.c:reply_harvet to allow for user choice
139  * of reply to all vs just sender
140  * Return -1 to cancel reply altogether, set reply flag by reference
141  */
142 extern int (*pith_opt_reply_to_all_prompt)(int *);
143 
144 
145 /*
146  * optional hook in save.c:create_for_save to allow for user confirmation
147  * of folder being created.
148  * Return: 1 for proceed, -1 for decline, 0 for error
149  */
150 extern int (*pith_opt_save_create_prompt)(CONTEXT_S *, char *, int);
151 
152 
153 /*
154  * optional hook in send.c:check_addresses to allow for user confirmation
155  * of sending to MAILER-DAEMON
156  */
157 extern int (*pith_opt_daemon_confirm)(void);
158 
159 
160 /*
161  * optional hook in save.c to prompt for permission to continue save
162  * in spite of size error.  Return 'y' to continue or 'a' to answer
163  * yes to all until next reinitialization of the function.
164  */
165 extern int (*pith_opt_save_size_changed_prompt)(long, int);
166 
167 
168 /*
169  * optional hook to process filter patterns using external command
170  * on message contents
171  */
172 extern void (*pith_opt_filter_pattern_cmd)(char **, SEARCHSET *, MAILSTREAM *, long, INTVL_S *);
173 
174 
175 /*
176  * Hook to read signature from local file
177  */
178 extern char *(*pith_opt_get_signature_file)(char *, int, int, int);
179 
180 
181 /*
182  * Hook to make variable names pretty in help text
183  */
184 extern char *(*pith_opt_pretty_var_name)(char *);
185 
186 
187 /*
188  * Hook to make feature names pretty in help text
189  */
190 extern char *(*pith_opt_pretty_feature_name)(char *, int);
191 
192 
193 /*
194  * optional hook in mailindx.c:{from,subject}_str to cause the returned
195  * string to be truncated at the formatted width. 1 truncates.
196  * This is useful because the truncated string ends slightly
197  * differently than it would if it weren't truncated, for
198  * example it might end ... or something like that.
199  */
200 extern int (*pith_opt_truncate_sfstr)(void);
201 
202 
203 /*
204  * A stream is being closed. If there is something in the
205  * application that needs to react to that handle it here.
206  */
207 extern void (*pith_opt_closing_stream)(MAILSTREAM *);
208 
209 
210 /*
211  * Callback from mm_expunged to let us know the "current"
212  * message was expunged
213  */
214 extern void (*pith_opt_current_expunged)(long unsigned int);
215 
216 /*
217  * Option User-Agent Header Prefix
218  */
219 extern char *(*pith_opt_user_agent_prefix)(void);
220 
221 
222 /*
223  * optional call to prompt for S/MIME passphase
224  */
225 extern int (*pith_opt_smime_get_passphrase)(void);
226 
227 /*
228  * Required call to interface for input of file to import.
229  */
230 extern int (*pith_smime_import_certificate)(char *, char *, char *, size_t);
231 
232 /*
233  * Required call to ask user to enter a password, with a given char * prompt
234  */
235 extern int (*pith_smime_enter_password)(char *, char *, size_t);
236 
237 /*
238  * required call to ask the user to confirm to save a certificate in the
239  * store
240  */
241 extern int (*pith_smime_confirm_save)(char *);
242 
243 #endif /* PITH_OPTIONS_INCLUDED */
244