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

2.6       timbl       1: <HTML>
                      2: <HEAD>
2.32    ! frystyk     3: <TITLE>Library Interface for Displaying and Promting Messages</TITLE>
        !             4: <!-- Changed by: Henrik Frystyk Nielsen, 19-Nov-1995 -->
2.6       timbl       5: <NEXTID N="z3">
                      6: </HEAD>
                      7: <BODY>
2.12      frystyk     8: 
2.32    ! frystyk     9: <H1>Library Interface for Displaying and Promting 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.32    ! frystyk    18: This module is a platform independent and language independent
        !            19: interface to User messages and prompting. The Library does not provide
        !            20: any messages on its own as they must be language independent. These
        !            21: can be provided by the application in a language that suits the
        !            22: user. The module is a registration of call back functions to the
        !            23: application.<P>
2.12      frystyk    24: 
                     25: This module is implemented by <A HREF="HTAlert.c">HTAlert.c</A>, and
2.30      frystyk    26: it is a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     27: Reference Library</A>.
2.12      frystyk    28: 
2.11      frystyk    29: <PRE>
2.12      frystyk    30: #ifndef HTALERT_H
                     31: #define HTALERT_H
2.17      frystyk    32: 
2.27      frystyk    33: #include "HTReq.h"
2.11      frystyk    34: </PRE>
                     35: 
2.32    ! frystyk    36: <H2>Declaration of Callback Function</H2>
2.15      frystyk    37: 
2.32    ! frystyk    38: The callback functions are defined as a generic callback where the
        !            39: caller can pass a set of input parameters and the callee can return a
        !            40: set of outptu parameters. Also note that all the <CODE>*_PROG_*</CODE>
        !            41: opcodes are a subset of <CODE>HT_A_PROGRESS</CODE>. This means that
        !            42: you easily can register a callback for <EM>all</EM> progress reports.
2.15      frystyk    43: 
2.32    ! frystyk    44: <PRE>
        !            45: typedef enum _HTAlertOpcode {
        !            46:     HT_PROG_DNS                = 0x1,          /* Doing DNS resolution */
        !            47:     HT_PROG_CONNECT    = 0x2,          /* Connecting Active */
        !            48:     HT_PROG_ACCEPT     = 0x4,          /* Connecting Passive */
        !            49:     HT_PROG_READ       = 0x8,          /* Read data */
        !            50:     HT_PROG_WRITE      = 0x10,         /* Write data */
        !            51:     HT_PROG_DONE       = 0x20,         /* Request finished */
        !            52:     HT_PROG_WAIT       = 0x40,         /* Wait for socket */
        !            53:     HT_A_PROGRESS      = 0xFF,         /* Send a progress report - no reply */
        !            54: 
        !            55:     /* First word are reserved for progresss notifications */
        !            56: 
        !            57:     HT_A_MESSAGE       = 0x1&lt;&lt;8, /* Send a message - no reply */
        !            58:     HT_A_CONFIRM       = 0x2&lt;&lt;8, /* Want YES or NO back */
        !            59:     HT_A_PROMPT                = 0x4&lt;&lt;8, /* Want full dialog */
        !            60:     HT_A_SECRET                = 0x8&lt;&lt;8, /* Secret dialog (e.g. password) */
        !            61:     HT_A_USER_PW       = 0x10&lt;&lt;8 /* Atomic userid and password */
        !            62: } HTAlertOpcode;
2.15      frystyk    63: 
2.32    ! frystyk    64: typedef struct _HTAlertPar HTAlertPar;
2.8       luotonen   65: 
2.32    ! frystyk    66: typedef BOOL HTAlertCallback   (HTRequest * request, HTAlertOpcode op,
        !            67:                                int msgnum, CONST char * dfault, void * input,
        !            68:                                HTAlertPar * reply);
2.6       timbl      69: </PRE>
2.11      frystyk    70: 
2.32    ! frystyk    71: If you don't expect any return values then <CODE>reply</CODE> can be
        !            72: NULL. The return value of the callback function can be used to
        !            73: indicate confirmation on a prompt (Yes or No).
        !            74: 
        !            75: <H2>String Messages</H2>
2.11      frystyk    76: 
2.32    ! frystyk    77: This is an enumerated list of messages that can be converted into a
        !            78: string table etc.
2.11      frystyk    79: 
2.15      frystyk    80: <PRE>
2.32    ! frystyk    81: typedef enum _HTAlertMsg {
        !            82:     HT_MSG_NULL = -1,
        !            83:     HT_MSG_UID = 0,
        !            84:     HT_MSG_PW,
        !            85:     HT_MSG_FILENAME,
        !            86:     HT_MSG_ACCOUNT,
        !            87:     HT_MSG_METHOD,
        !            88:     HT_MSG_MOVED,
        !            89:     HT_MSG_RULES,
        !            90:     HT_MSG_ELEMENTS                        /* This MUST be the last element */
        !            91: } HTAlertMsg;
2.15      frystyk    92: </PRE>
                     93: 
2.32    ! frystyk    94: <H2>Public Methods</H3>
2.15      frystyk    95: 
2.32    ! frystyk    96: <H3>Enable or Disable Messages</H3>
2.6       timbl      97: 
2.32    ! frystyk    98: If you really don't want the library to prompt for anything at all
        !            99: then enable this constant. The default value is <EM>Interactive</EM>.
        !           100: 
        !           101: <PRE>
        !           102: extern void HTAlert_setInteractive     (BOOL interative);
        !           103: extern BOOL HTAlert_interactive                (void);
2.15      frystyk   104: </PRE>
                    105: 
2.32    ! frystyk   106: <H3>Add a Callback Function to a list</H3>
2.15      frystyk   107: 
2.32    ! frystyk   108: Register a call back function that is to be called when generating
        !           109: messages, dialog, prompts, progress reports etc.
2.15      frystyk   110: 
2.32    ! frystyk   111: The opcode signifies which call back function to call depending of the
        !           112: type of the message. Opcode can be any combination of the bitflags
        !           113: defined by <CODE>HTAlertOpcode</CODE>. If you register one callback
        !           114: for <CODE>HT_A_PROGRESS</CODE> then this will get called on all
        !           115: progress notifications.
2.15      frystyk   116: 
                    117: <PRE>
2.32    ! frystyk   118: extern BOOL HTAlertCall_add (HTList * list, HTAlertCallback * cbf,
        !           119:                             HTAlertOpcode opcode);
2.15      frystyk   120: </PRE>
                    121: 
2.32    ! frystyk   122: <H3>Delete a Callback function from a list</H3>
2.15      frystyk   123: 
2.32    ! frystyk   124: Unregister a call back function from a list
1.1       timbl     125: 
2.8       luotonen  126: <PRE>
2.32    ! frystyk   127: extern BOOL HTAlertCall_delete (HTList * list, HTAlertCallback * cbf);
2.15      frystyk   128: </PRE>
1.1       timbl     129: 
2.32    ! frystyk   130: <H3>Delete a list of Callback Functions</H3>
2.15      frystyk   131: 
2.32    ! frystyk   132: Unregisters all call back functions
        !           133: 
        !           134: <PRE>
        !           135: extern BOOL HTAlertCall_deleteAll (HTList * list);
        !           136: </PRE>
2.15      frystyk   137: 
2.32    ! frystyk   138: <H3>Find a Callback Function from a List</H3>
2.15      frystyk   139: 
2.32    ! frystyk   140: Finds a callback function corresponding to the opcode. If none has
        !           141: been registered then NULL is returned.
2.6       timbl     142: 
                    143: <PRE>
2.32    ! frystyk   144: extern HTAlertCallback * HTAlertCall_find(HTList * list, HTAlertOpcode opcode);
2.6       timbl     145: </PRE>
                    146: 
2.32    ! frystyk   147: <H2>Handle the Reply Structure</H2>
2.6       timbl     148: 
2.32    ! frystyk   149: Create and delete...
2.24      frystyk   150: 
                    151: <PRE>
2.32    ! frystyk   152: extern HTAlertPar * HTAlert_newReply   (void);
        !           153: extern void HTAlert_deleteReply                (HTAlertPar * old);
        !           154: </PRE>
        !           155: 
        !           156: Access the data:
        !           157: 
        !           158: <PRE>
        !           159: extern char * HTAlert_replyMessage     (HTAlertPar * me);
        !           160: extern BOOL HTAlert_setReplyMessage    (HTAlertPar * me, CONST char *message);
        !           161: 
        !           162: extern char * HTAlert_replySecret      (HTAlertPar * me);
        !           163: extern BOOL HTAlert_setReplySecret     (HTAlertPar * me, CONST char * secret);
2.6       timbl     164: 
2.32    ! frystyk   165: extern void * HTAlert_replyOutput      (HTAlertPar * me);
        !           166: extern BOOL HTAlert_setReplyOutput     (HTAlertPar * me, void * output);
2.17      frystyk   167: </PRE>
                    168: 
2.32    ! frystyk   169: <H2>Global set of Callback Functions</H2>
        !           170: 
        !           171: A list can be assigned as being global for all messages.
2.17      frystyk   172: 
2.32    ! frystyk   173: <PRE>
        !           174: extern void HTAlert_setGlobal  (HTList * list);
        !           175: extern HTList * HTAlert_global (void);
        !           176: </PRE>
        !           177: 
        !           178: You can also assign a callback directly to the global list. In this
        !           179: case you do not need to worry about creating the list - it will be
        !           180: created automatically.
2.17      frystyk   181: 
                    182: <PRE>
2.32    ! frystyk   183: extern BOOL HTAlert_add (HTAlertCallback * cbf, HTAlertOpcode opcode);
        !           184: extern HTAlertCallback * HTAlert_find (HTAlertOpcode opcode);
        !           185: </PRE>
2.6       timbl     186: 
2.32    ! frystyk   187: <PRE>
2.12      frystyk   188: #endif
                    189: </PRE>
2.32    ! frystyk   190: 
        !           191: End of declaration
2.6       timbl     192: 
2.12      frystyk   193: </BODY>
2.6       timbl     194: </HTML>

Webmaster