1 /*
2  * $LynxId: HTAlert.h,v 1.35 2016/11/24 23:44:49 tom Exp $
3  *
4  *      Displaying messages and getting input for WWW Library
5  *      =====================================================
6  *
7  *         May 92 Created By C.T. Barker
8  *         Feb 93 Portablized etc TBL
9  */
10 
11 #ifndef HTALERT_H
12 #define HTALERT_H 1
13 
14 #include <LYCookie.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 #define ALERT_PREFIX_LEN 5
20 /*      Display a message and get the input
21  *
22  *      On entry,
23  *              Msg is the message.
24  *
25  *      On exit,
26  *              Return value is malloc'd string which must be freed.
27  */ extern char *HTPrompt(const char *Msg, const char *deflt);
28 
29 /*      Display a message, don't wait for input
30  *
31  *      On entry,
32  *              The input is a list of parameters for printf.
33  */
34     extern void HTAlert(const char *Msg);
35     extern void HTAlwaysAlert(const char *extra_prefix, const char *Msg);
36     extern void HTInfoMsg(const char *Msg);
37     extern void HTInfoMsg2(const char *Msg, const char *Arg);
38     extern void HTUserMsg(const char *Msg);
39     extern void HTUserMsg2(const char *Msg, const char *Arg);
40 
41 /*      Display a progress message for information (and diagnostics) only
42  *
43  *      On entry,
44  *              The input is a list of parameters for printf.
45  */
46     extern const char *HTProgressUnits(int kilobytes);
47     extern void HTProgress(const char *Msg);
48     extern void HTReadProgress(off_t bytes, off_t total);
49 
50 #define _HTProgress(msg)	mustshow = TRUE, HTProgress(msg)
51 
52 /*
53  *  Indicates whether last HTConfirm was cancelled (^G or ^C) and
54  *  resets flag. (so only call once!) - kw
55  */
56     extern BOOL HTLastConfirmCancelled(void);
57 
58 /*
59  *	Supports logic for forced yes/no prompt results.
60  */
61     extern int HTForcedPrompt(int Opt, const char *Msg, int Dft);
62 
63 /*      Display a message, then wait for 'yes' or 'no', allowing default
64  *	response if a return or left-arrow is used.
65  *
66  *      On entry,
67  *              Takes a list of parameters for printf.
68  *
69  *      On exit,
70  *              If the user enters 'YES', returns TRUE, returns FALSE
71  *              otherwise.
72  */
73     extern int HTConfirmDefault(const char *Msg, int Dft);
74 
75 /*      Display a message, then wait for 'yes' or 'no'.
76  *
77  *      On entry,
78  *              Takes a list of parameters for printf.
79  *
80  *      On exit,
81  *              If the user enters 'YES', returns TRUE, returns FALSE
82  *              otherwise.
83  */
84     extern BOOL HTConfirm(const char *Msg);
85 
86     extern BOOL confirm_post_resub(const char *address,
87 				   const char *title,
88 				   int if_imgmap,
89 				   int if_file);
90 
91 /*      Prompt for password without echoing the reply
92  */
93     extern char *HTPromptPassword(const char *Msg, const char *given);
94 
95 /*      Prompt both username and password       HTPromptUsernameAndPassword()
96  *      ---------------------------------
97  * On entry,
98  *      Msg             is the prompting message.
99  *      *username and
100  *      *password       are char pointers; they are changed
101  *                      to point to result strings.
102  *	IsProxy		should be TRUE if this is for
103  *			proxy authentication.
104  *
105  *                      If *username is not NULL, it is taken
106  *                      to point to  a default value.
107  *                      Initial value of *password is
108  *                      completely discarded.
109  *
110  * On exit,
111  *      *username and *password point to newly allocated
112  *      strings -- original strings pointed to by them
113  *      are NOT freed.
114  *
115  */
116     extern void HTPromptUsernameAndPassword(const char *Msg,
117 					    char **username,
118 					    char **password,
119 					    int IsProxy);
120 
121 /*	Confirm a cookie operation.			HTConfirmCookie()
122  *	---------------------------
123  *
124  *  On entry,
125  *	server			is the server sending the Set-Cookie.
126  *	domain			is the domain of the cookie.
127  *	path			is the path of the cookie.
128  *	name			is the name of the cookie.
129  *	value			is the value of the cookie.
130  *
131  *  On exit,
132  *	Returns FALSE on cancel,
133  *		TRUE if the cookie should be set.
134  */
135     extern BOOL HTConfirmCookie(domain_entry * dp, const char *server,
136 				const char *name,
137 				const char *value);
138 
139 /*      Confirm redirection of POST.		HTConfirmPostRedirect()
140  *	----------------------------
141  *  On entry,
142  *      Redirecting_url             is the Location.
143  *	server_status		    is the server status code.
144  *
145  *  On exit,
146  *      Returns 0 on cancel,
147  *	  1 for redirect of POST with content,
148  *	303 for redirect as GET without content
149  */
150     extern int HTConfirmPostRedirect(const char *Redirecting_url,
151 				     int server_status);
152 
153     extern void LYSleepAlert(void);
154     extern void LYSleepDelay(void);
155     extern void LYSleepInfo(void);
156     extern void LYSleepMsg(void);
157     extern void LYSleepReplay(void);
158 
159 #ifdef HAVE_STRERROR
160 #define LYStrerror strerror
161 #else
162     extern char *LYStrerror(int code);
163 #endif				/* HAVE_STRERROR */
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 #endif				/* HTALERT_H */
169