
/*
 *	Header		SpoolWatch.h
 *	Programmer	N.d'Alterio
 *	Date		09/09/95	
 *
 *  Synopsis:	Header for SpoolWatch program
 *
 * $Id: SpoolWatch.h 2.7 1995/09/28 00:16:50 daltern Exp $
 *
 *
 */

/*========================================================================*
 			        INCLUDES
 *========================================================================*/

#include <nick/stdnick.h>
#include <dos/dos.h>
#include <dos/rdargs.h>
#include <dos/notify.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <exec/ports.h>
#include <intuition/intuition.h>
#include <intuition/gadgetclass.h>
#include <workbench/workbench.h>
#include <workbench/startup.h>
#include <devices/timer.h>
#include <graphics/gfxbase.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/icon_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/alib_protos.h>

/*========================================================================*
                              DEFINITIONS
 *========================================================================*/

#define WB_START	0
#define CLI_START	1

/*
 *   Types
 */

#define NEWS_TYPE	'N'
#define MAIL_TYPE	'T'

/*
 *   Default program values.
 */

#define MAIL_SPOOLDIR	"AmiTCP:Usr/Spool/Mail/"
#define NEWS_SPOOLDIR	"AmiTCP:Usr/Spool/News/"
#define UPD_DELAY	10
#define WIN_LEFT	0
#define WIN_TOP		0

#define SCREEN_TITLE	"SpoolWatch v2 © Nick d'Alterio 1995"

/*
 *   Max length for address or newsgroup name
 */

#define MAX_DEST_LEN	35L
#define FULLINFO_LEN	66L

/*========================================================================*
                               DATATYPES
 *========================================================================*/


struct SWArgs {

	int start;			/* flag to show if WB or CLI start  */

	int nogui;			/* Don't display GUI if TRUE (CLI)  */
	int full;			/* Give full listing (CLI)          */

	long int win_top;		/* top edge of window               */
	long int win_left;		/* left edge of window              */

	char *mail_spooldir;		/* path to mail spool directory     */
	char *news_spooldir;		/* path to news spool directory     */

	int  delay;			/* Number of second between updates */

	};

struct FullInfo {

	long int 	fi_size;	/* Article size			   */

	int		fi_days;	/* Days in queue		   */
	int		fi_hours;	/* Hours in queue		   */
	int		fi_mins;	/* Minutes in queue		   */

	char		fi_dest[MAX_DEST_LEN];	/* Destination 		   */

	struct FullInfo *fi_next;	/* Next full info structure	   */
	
	};


/*========================================================================*
                               MACROS
 *========================================================================*/

/*========================================================================*
                              PROTOTYPES
 *========================================================================*/

extern void	         FreeProgArgs( struct SWArgs * );
extern void              FreeFullInfo( struct FullInfo * );
extern void		 FreeIntuiText( struct IntuiText * );
extern void	         SpoolCLI( struct FullInfo *, struct FullInfo * );
extern void              DateDiff( struct DateStamp, struct DateStamp, int *, int *, int * );
extern void		 StopStrAt( char *, char );
extern void		 SWError( struct SWArgs *, struct Window *, char * );  
extern void              UpdateTitleStr( char *, struct FullInfo *, struct FullInfo * );
extern void		 PrintFullInfo( struct FullInfo * );
extern int               CountSpool( struct FullInfo * );
extern int	         GetDest( char *, char, char * );
extern int               HandleEvents( struct Window *, struct Gadget *, struct IntuiText *, struct SWArgs *, struct FullInfo *, struct FullInfo * );
extern int	         SpoolWindow( struct SWArgs *, struct FullInfo *, struct FullInfo * );
extern int		 MaxLinesForScreen( struct Window *, struct Gadget * );
extern struct FullInfo  *FullSpoolInfo( struct SWArgs *, char );
extern struct IntuiText *AllocIntuiText( struct IntuiText * );
extern struct IntuiText *BuildIntuiText( struct IntuiText *, struct FullInfo *, int );
extern struct SWArgs    *ProgArgsCLI( void );
extern struct SWArgs    *ProgArgsWB( char ** );

/*========================================================================*
                                  END
 *========================================================================*/
