Annotation of libwww/Library/src/HTAlert.html, revision 2.31

2.6       timbl       1: <HTML>
                      2: <HEAD>
2.20      frystyk     3: <TITLE>Displaying and Promting User Messages</TITLE>
2.31    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  7-Nov-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
2.30      frystyk    35: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     36: Reference Library</A>.
2.12      frystyk    37: 
2.11      frystyk    38: <PRE>
2.12      frystyk    39: #ifndef HTALERT_H
                     40: #define HTALERT_H
2.17      frystyk    41: 
2.27      frystyk    42: #include "HTReq.h"
2.11      frystyk    43: </PRE>
                     44: 
2.15      frystyk    45: <A NAME="Interactive"><H2>User Interactive Functions</H2></A>
                     46: 
                     47: These functions require the user to interact in some way
                     48: 
                     49: <H3>Flags for This Module</H3>
                     50: 
                     51: If you really don't want the library to prompt for anything at all
                     52: then enable this constant. The default value is <EM>OFF</EM>. All
                     53: functions returning a <EM>string</EM> return a dynamic string which
                     54: must be freed by the caller.
2.8       luotonen   55: 
2.11      frystyk    56: <PRE>
2.30      frystyk    57: extern void HTPrompt_setInteractive    (BOOL interative);
                     58: extern BOOL HTPrompt_interactive       (void);
2.6       timbl      59: </PRE>
2.11      frystyk    60: 
2.15      frystyk    61: <H3>Display a message, then wait for 'YES' or 'NO'</H3>
2.11      frystyk    62: 
2.15      frystyk    63: This function prompts the user for a confirmation on the message
                     64: passed as a parameter. If the user reacts in the affirmative, returns
                     65: <EM>TRUE</EM>, returns <EM>FALSE</EM> otherwise.
2.11      frystyk    66: 
2.15      frystyk    67: <PRE>
2.30      frystyk    68: extern BOOL HTConfirm  (HTRequest *request, CONST char * Msg);
2.15      frystyk    69: </PRE>
                     70: 
                     71: <H3>Prompt the User a Question</H3>
                     72: 
                     73: Prompt for answer and get text back. Reply text is either NULL on
                     74: error or a dynamic string which the caller must free.
2.6       timbl      75: 
                     76: <PRE>          
2.30      frystyk    77: extern char * HTPrompt (HTRequest *request, CONST char * Msg,
                     78:                        CONST char * deflt);
2.15      frystyk    79: </PRE>
                     80: 
                     81: <H3>Prompt for a Password</H3>
                     82: 
                     83: Prompt for password without echoing the reply. Reply text is weither
                     84: NULL on error or a dynamic string which the caller must free. <P>
                     85: 
                     86: <B>NOTE:</B> The current version uses <EM>getpass</EM> which on many
                     87: systems returns a string of 8 or 16 bytes.
                     88: 
                     89: <PRE>
2.30      frystyk    90: extern char * HTPromptPassword (HTRequest *request, CONST char * Msg);
2.15      frystyk    91: </PRE>
                     92: 
2.16      frystyk    93: <H3>Prompt for a UserID and a Password</H3>
2.15      frystyk    94: 
                     95: This is just a composite function using <EM>HTPrompt</EM> and
                     96: <EM>HTPromptPassword</EM>. The strings returned must be freed by
                     97: caller.
1.1       timbl      98: 
2.8       luotonen   99: <PRE>
2.30      frystyk   100: extern void HTPromptUsernameAndPassword (HTRequest *   request,
                    101:                                         CONST char *   Msg,
                    102:                                         char **        username,
                    103:                                         char **        password);
2.15      frystyk   104: </PRE>
1.1       timbl     105: 
2.17      frystyk   106: <A NAME="NonInteractive"><H2>Messages, Warnings, and Errors</H2></A>
2.15      frystyk   107: 
                    108: These functions are used to inform the user of an event which requires
                    109: no response form the user.
                    110: 
                    111: <H3>Display a Message</H3>
                    112: 
                    113: This function simply puts out the message passed.
2.6       timbl     114: 
                    115: <PRE>
2.30      frystyk   116: extern void HTAlert    (HTRequest *request, CONST char * Msg);
2.6       timbl     117: </PRE>
                    118: 
2.25      frystyk   119: <H3>Progress Notification</H3>
2.6       timbl     120: 
2.15      frystyk   121: This function can be used to indicate the current status of a certain
2.24      frystyk   122: action. In order to avoid having strings directly in the core parts of
                    123: the Library, this function is passed a "state" argument from which the
                    124: message can be generated in this module. The "param" argument is for
                    125: additional information to be passed.
                    126: 
                    127: <PRE>
                    128: typedef enum _HTProgressState {
2.28      frystyk   129:     HT_PROG_DNS = 0,                   /* Doing DNS resolution */
2.29      frystyk   130:     HT_PROG_CONNECT,                   /* Connecting Active */
                    131:     HT_PROG_ACCEPT,                    /* Connecting Passive */
2.28      frystyk   132:     HT_PROG_READ,                      /* Read data */
                    133:     HT_PROG_WRITE,                     /* Write data */
                    134:     HT_PROG_DONE,                      /* Request finished */
                    135:     HT_PROG_WAIT                       /* Wait for socket */
2.24      frystyk   136: } HTProgressState;
2.6       timbl     137: 
2.30      frystyk   138: extern void HTProgress (HTRequest *request, HTProgressState state,
                    139:                         void * param);
2.17      frystyk   140: </PRE>
                    141: 
                    142: <H3>Generating an Error Message of a request</H3>
                    143: 
2.31    ! frystyk   144: This function outputs the content of the error list to standard output
        !           145: (used in Line Mode Browser), but smart clients and servers might
        !           146: overwrite this function so that the error messages can be handled to
        !           147: the user in a nice(r) way. That is the reason for putting the actual
        !           148: implementation in <A HREF="HTAlert.c">HTAlert.c</A>.<P>
2.17      frystyk   149: 
                    150: <PRE>
2.31    ! frystyk   151: extern void HTError_print (HTRequest * request, HTList * list);
2.6       timbl     152: 
2.12      frystyk   153: #endif
                    154: </PRE>
2.6       timbl     155: 
2.12      frystyk   156: </BODY>
2.6       timbl     157: </HTML>

Webmaster