Solaris Common Desktop Environment: Programmer's Guide

Logging on to a Calendar


Example 10-3 Logging on to a Calendar

CSA_session_handle	cal;

logon() 
{
 	CSA_return_code		stat;
 	CSA_calendar_user	caddr
; 	CSA_flags		access;
 	CSA_extension		logon_exts[2];
 	CSA_X_COM_support	check_support[2];

  	/* Specify the calendar to logon to */
 	caddr.user_name = NULL;
 	caddr.user_type = CSA_USER_TYPE_INDIVIDUAL;
 caddr.calendar_address = "user@host";
 caddr.calendar_user_extensions = NULL;

  	/* Specify the get user access extension (CSA_X_DT_GET_USER_ACCESS_EXT)
 	 * to retrieve the user's access right with respect to the calendar.
 	 */
 	logon_exts[0].item_code		= CSA_X_DT_GET_USER_ACCESS_EXT;
 	logon_exts[0].item_data		= 0;
 logon_exts[0].item_reference	= NULL;
 	logon_exts[0].extension_flags	= NULL;

  /* Specify the CSA_X_COM_SUPPORT_EXT extension to check
 	 * whether the CSA_X_XT_APP_CONTEXT_EXT extension and the
 	 * CSA_X_UI_ID_EXT extension are supported.
 	 */
 	check_support[0].item_code	= CSA_X_XT_APP_CONTEXT_EXT;
 check_support[0].flags		= NULL;
 	check_support[1].item_code	= CSA_X_UI_ID_EXT;
 	check_support[1].flags		= NULL;
  	logon_exts[1].item_code		= CSA_X_COM_SUPPORT_EXT;
 	logon_exts[1].item_data		= 2;
 	logon_exts[1].item_reference	= (CSA_buffer)check_support;
 	logon_exts[0].extension_flags	= CSA_EXT_LAST_ELEMENT;

  	stat = csa_logon(NULL, &caddr, NULL, NULL, NULL, &cal, logon_exts);

  	if (stat == CSA_SUCCESS) {
 		access = (CSA_flags)get_access_ext.item_data;
  		if (check_support[0].flag & CSA_X_COM_SUPPORTED)
 			printf("The CSA_X_XT_APP_CONTEXT_EXT extension is supported\n");
  		if (check_support[1].flag & CSA_X_COM_SUPPORTED)
 			printf("The CSA_X_UI_ID_EXT extension is supported\n");
 	}
 }