about summary refs log tree commit diff stats
path: root/src/HTAlert.h
blob: 89f60e263905542463a095803b5ca4de58f1886d (plain) (blame)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*      Displaying messages and getting input for WWW Library
 *      =====================================================
 *
 *         May 92 Created By C.T. Barker
 *         Feb 93 Portablized etc TBL
 */

#ifndef HTALERT_H
#define HTALERT_H 1

#include <LYCookie.h>

#ifdef __cplusplus
extern "C" {
#endif
#define ALERT_PREFIX_LEN 5
/*      Display a message and get the input
 *
 *      On entry,
 *              Msg is the message.
 *
 *      On exit,
 *              Return value is malloc'd string which must be freed.
 */ extern char *HTPrompt(const char *Msg, const char *deflt);

/*      Display a message, don't wait for input
 *
 *      On entry,
 *              The input is a list of parameters for printf.
 */
    extern void HTAlert(const char *Msg);
    extern void HTAlwaysAlert(const char *extra_prefix, const char *Msg);
    extern void HTInfoMsg(const char *Msg);
    extern void HTUserMsg(const char *Msg);
    extern void HTUserMsg2(const char *Msg, const char *Arg);

/*      Display a progress message for information (and diagnostics) only
 *
 *      On entry,
 *              The input is a list of parameters for printf.
 */
    extern const char *HTProgressUnits(int kilobytes);
    extern void HTProgress(const char *Msg);
    extern void HTReadProgress(long bytes, long total);

#define _HTProgress(msg)	mustshow = TRUE, HTProgress(msg)

/*
 *  Indicates whether last HTConfirm was cancelled (^G or ^C) and
 *  resets flag. (so only call once!) - kw
 */
    extern BOOL HTLastConfirmCancelled(void);

/*
 *	Supports logic for forced yes/no prompt results.
 */
    extern int HTForcedPrompt(int Opt, const char *Msg, int Dft);

/*      Display a message, then wait for 'yes' or 'no', allowing default
 *	response if a return or left-arrow is used.
 *
 *      On entry,
 *              Takes a list of parameters for printf.
 *
 *      On exit,
 *              If the user enters 'YES', returns TRUE, returns FALSE
 *              otherwise.
 */
    extern int HTConfirmDefault(const char *Msg, int Dft);

/*      Display a message, then wait for 'yes' or 'no'.
 *
 *      On entry,
 *              Takes a list of parameters for printf.
 *
 *      On exit,
 *              If the user enters 'YES', returns TRUE, returns FALSE
 *              otherwise.
 */
    extern BOOL HTConfirm(const char *Msg);

    extern BOOL confirm_post_resub(const char *address,
				   const char *title,
				   int if_imgmap,
				   int if_file);

/*      Prompt for password without echoing the reply
 */
    extern char *HTPromptPassword(const char *Msg);

/*      Prompt both username and password       HTPromptUsernameAndPassword()
 *      ---------------------------------
 * On entry,
 *      Msg             is the prompting message.
 *      *username and
 *      *password       are char pointers; they are changed
 *                      to point to result strings.
 *	IsProxy		should be TRUE if this is for
 *			proxy authentication.
 *
 *                      If *username is not NULL, it is taken
 *                      to point to  a default value.
 *                      Initial value of *password is
 *                      completely discarded.
 *
 * On exit,
 *      *username and *password point to newly allocated
 *      strings -- original strings pointed to by them
 *      are NOT freed.
 *
 */
    extern void HTPromptUsernameAndPassword(const char *Msg,
					    char **username,
					    char **password,
					    BOOL IsProxy);

/*	Confirm a cookie operation.			HTConfirmCookie()
 *	---------------------------
 *
 *  On entry,
 *	server			is the server sending the Set-Cookie.
 *	domain			is the domain of the cookie.
 *	path			is the path of the cookie.
 *	name			is the name of the cookie.
 *	value			is the value of the cookie.
 *
 *  On exit,
 *	Returns FALSE on cancel,
 *		TRUE if the cookie should be set.
 */
    extern BOOL HTConfirmCookie(domain_entry * dp, const char *server,
				const char *name,
				const char *value);

/*      Confirm redirection of POST.		HTConfirmPostRedirect()
 *	----------------------------
 *  On entry,
 *      Redirecting_url             is the Location.
 *	server_status		    is the server status code.
 *
 *  On exit,
 *      Returns 0 on cancel,
 *	  1 for redirect of POST with content,
 *	303 for redirect as GET without content
 */
    extern int HTConfirmPostRedirect(const char *Redirecting_url,
				     int server_status);

    extern void LYSleepAlert(void);
    extern void LYSleepDebug(void);
    extern void LYSleepInfo(void);
    extern void LYSleepMsg(void);
    extern void LYSleepReplay(void);

#ifdef HAVE_STRERROR
#define LYStrerror strerror
#else
    extern char *LYStrerror(int code);
#endif				/* HAVE_STRERROR */

#ifdef __cplusplus
}
#endif
#endif				/* HTALERT_H */