Annotation of libwww/Library/src/HTAlert.html, revision 2.25
2.6 timbl 1: <HTML>
2: <HEAD>
2.20 frystyk 3: <TITLE>Displaying and Promting User Messages</TITLE>
2.25 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 1-Sep-1995 -->
2.6 timbl 5: <NEXTID N="z3">
6: </HEAD>
7: <BODY>
2.12 frystyk 8:
2.20 frystyk 9: <H1>Displaying and Promting User Messages</H1>
2.10 frystyk 10:
2.12 frystyk 11: <PRE>
12: /*
2.18 frystyk 13: ** (c) COPYRIGHT MIT 1995.
2.12 frystyk 14: ** Please first read the full copyright statement in the file COPYRIGH.
15: */
16: </PRE>
17:
2.15 frystyk 18: This module may be overridden for GUI clients. It allows progress
2.12 frystyk 19: indications and warning messages to be communicated to the user in a
2.15 frystyk 20: portable way using stdio. Yes, I know that not all platforms have
21: stdio :-(. It contain two parts:
22:
23: <UL>
24: <LI><A HREF="#Interactive">A User Interactive part</A>
25: <LI><A HREF="#NonInteractive">A part for sending messages to the user</A>
26: </UL>
2.10 frystyk 27:
2.6 timbl 28: <UL>
29: <LI>May 92 Created By C.T. Barker
30: <LI>Feb 93 Portablized etc TBL
2.15 frystyk 31: <LI>Mar 95 Updated by Henrik
2.6 timbl 32: </UL>
2.12 frystyk 33:
34: This module is implemented by <A HREF="HTAlert.c">HTAlert.c</A>, and
35: it is a part of the <A
2.19 frystyk 36: HREF="http://www.w3.org/hypertext/WWW/Library/">
37: W3C Reference Library</A>.
2.12 frystyk 38:
2.11 frystyk 39: <PRE>
2.12 frystyk 40: #ifndef HTALERT_H
41: #define HTALERT_H
2.17 frystyk 42:
43: #include "HTAccess.h"
2.11 frystyk 44: </PRE>
45:
2.15 frystyk 46: <A NAME="Interactive"><H2>User Interactive Functions</H2></A>
47:
48: These functions require the user to interact in some way
49:
50: <H3>Flags for This Module</H3>
51:
52: If you really don't want the library to prompt for anything at all
53: then enable this constant. The default value is <EM>OFF</EM>. All
54: functions returning a <EM>string</EM> return a dynamic string which
55: must be freed by the caller.
2.8 luotonen 56:
2.11 frystyk 57: <PRE>
2.22 frystyk 58: extern void HTPrompt_setInteractive PARAMS((BOOL interative));
59: extern BOOL HTPrompt_interactive NOPARAMS;
2.6 timbl 60: </PRE>
2.11 frystyk 61:
2.15 frystyk 62: <H3>Display a message, then wait for 'YES' or 'NO'</H3>
2.11 frystyk 63:
2.15 frystyk 64: This function prompts the user for a confirmation on the message
65: passed as a parameter. If the user reacts in the affirmative, returns
66: <EM>TRUE</EM>, returns <EM>FALSE</EM> otherwise.
2.11 frystyk 67:
2.15 frystyk 68: <PRE>
2.23 frystyk 69: extern BOOL HTConfirm PARAMS((HTRequest *request, CONST char * Msg));
2.15 frystyk 70: </PRE>
71:
72: <H3>Prompt the User a Question</H3>
73:
74: Prompt for answer and get text back. Reply text is either NULL on
75: error or a dynamic string which the caller must free.
2.6 timbl 76:
77: <PRE>
2.23 frystyk 78: extern char * HTPrompt PARAMS((HTRequest *request, CONST char * Msg,
79: CONST char * deflt));
2.15 frystyk 80: </PRE>
81:
82: <H3>Prompt for a Password</H3>
83:
84: Prompt for password without echoing the reply. Reply text is weither
85: NULL on error or a dynamic string which the caller must free. <P>
86:
87: <B>NOTE:</B> The current version uses <EM>getpass</EM> which on many
88: systems returns a string of 8 or 16 bytes.
89:
90: <PRE>
2.23 frystyk 91: extern char * HTPromptPassword PARAMS((HTRequest *request, CONST char * Msg));
2.15 frystyk 92: </PRE>
93:
2.16 frystyk 94: <H3>Prompt for a UserID and a Password</H3>
2.15 frystyk 95:
96: This is just a composite function using <EM>HTPrompt</EM> and
97: <EM>HTPromptPassword</EM>. The strings returned must be freed by
98: caller.
1.1 timbl 99:
2.8 luotonen 100: <PRE>
2.23 frystyk 101: extern void HTPromptUsernameAndPassword PARAMS((HTRequest *request,
102: CONST char * Msg,
2.8 luotonen 103: char ** username,
104: char ** password));
2.15 frystyk 105: </PRE>
1.1 timbl 106:
2.17 frystyk 107: <A NAME="NonInteractive"><H2>Messages, Warnings, and Errors</H2></A>
2.15 frystyk 108:
109: These functions are used to inform the user of an event which requires
110: no response form the user.
111:
112: <H3>Display a Message</H3>
113:
114: This function simply puts out the message passed.
2.6 timbl 115:
116: <PRE>
2.23 frystyk 117: extern void HTAlert PARAMS((HTRequest *request, CONST char * Msg));
2.6 timbl 118: </PRE>
119:
2.25 ! frystyk 120: <H3>Progress Notification</H3>
2.6 timbl 121:
2.15 frystyk 122: This function can be used to indicate the current status of a certain
2.24 frystyk 123: action. In order to avoid having strings directly in the core parts of
124: the Library, this function is passed a "state" argument from which the
125: message can be generated in this module. The "param" argument is for
126: additional information to be passed.
127:
128: <PRE>
129: typedef enum _HTProgressState {
130: HT_PROG_DNS = 0,
131: HT_PROG_CONNECT,
132: HT_PROG_READ,
133: HT_PROG_WRITE,
2.25 ! frystyk 134: HT_PROG_DONE
2.24 frystyk 135: } HTProgressState;
2.6 timbl 136:
2.24 frystyk 137: extern void HTProgress PARAMS((HTRequest *request, HTProgressState state,
138: void * param));
2.17 frystyk 139: </PRE>
140:
141: <H3>Generating an Error Message of a request</H3>
142:
143: This function outputs the content of the error_stack to standard
144: output (used in Line Mode Browser), but smart clients and servers
145: might overwrite this function so that the error messages can be
146: handled to the user in a nice(r) way. That is the reason for putting
147: the actual implementation in <A HREF="HTAlert.c">HTAlert.c</A>.<P>
148:
149: <B>Note:</B> If a stream <EM>has</EM> been put up (and maybe taken
150: down again) inside the Library, then request->error_block has been
151: set to YES. This indicates that it is NOT possible any more to use the
152: stream as output for the message.
153:
154: <PRE>
2.23 frystyk 155: extern void HTErrorMsg PARAMS((HTRequest * request));
2.6 timbl 156:
2.12 frystyk 157: #endif
158: </PRE>
2.6 timbl 159:
2.12 frystyk 160: </BODY>
2.6 timbl 161: </HTML>
Webmaster