/******************************************************************************/
/*
                                  compose.h
*/
/******************************************************************************/

#ifndef INCLUDE_COMPOSE_H
#define INCLUDE_COMPOSE_H

#define BOOL int
#define TRUE 1
#define FALSE 0

#define COMPOSE_EDITOR_PLAIN 1
#define COMPOSE_EDITOR_HTML  2

/* forward references */
typedef struct STRUCT_REQUEST_DATA REQUEST_DATA;
typedef struct STRUCT_MIME_DATA MIME_DATA;

typedef struct STRUCT_COMPOSE_DATA
{
   /* this storage is used from request-to-request */

   BOOL  /* message has already been sent at least once */
         AlreadySent,
         /* the confirm-before-send checkbox is */
         ConfirmBeforeSend,
         /* the [SELF] has already been placed into the CC or BCC */
         CopiedSelf,
         /* looks like RFC addressing (if the TO or CC fields contain a '@') */
         LooksLikeRfc,
         /* was initiated using the message page [forward] button */
         MsgForward,
         /* was initiated using the message page [reply..] button */
         MsgReply,
         /* a CC address has been provided (or requested) */
         ShowCcAddr,
         /* a BCC address has be provided (or requested) */
         ShowBccAddr,
         /* a reply-to address has be provided (or requested) */
         ShowReplyToAddr;

   int  /* the MIME content-type (plain or HTML) */
        ContentTypeIs,
        /* number of columns in edit window */
        EditCols,
        /* number of rows in edit window */
        EditRows,
        /* default plain-text, or optional HTML */
        EditorType,
        /* wrap plain-text message body at column */
        WrapAt;

   unsigned int  /* hash of current draft */
                 DraftHash,
                 /* previous draft hash */
                 PrevDraftHash;

   char  /* "RE:", "FW:" */
         *AttribPtr,
         /* list of addresses the message is to be sent BLIND to */
         *BccPtr,
         /* list of addresses the message is to be CCed to */
         *CcPtr,
         /* character set of the plain-text message */
         *CharSetPtr,
         /* list of contacts loaded from file */
         *ContactListPtr,
         /* ostensible source (sender) */
         *FromPtr,
         /* RFC in-reply-to */
         *InReplyToPtr,
         /* RFC references */
         *ReferencesPtr,
         /* explicit address to reply to */
         *ReplyToPtr,
         /* provides [SELF] in list of contacts */
         *SelfPtr,
         /* subject line */
         *SubjPtr,
         /* message body plain-text */
         *TextPtr,
         /* list of addresses the message is to be sent to */
         *ToPtr;

   char  /* */
         DraftCreated [32];

   TEXT_DATA  MimeBody,
              MimeHeader;

   /* ambit space that will be treated as PRINT_MEM (bit risky I know) */
   unsigned char  PreviewMem [12];

} COMPOSE_DATA;

/**************/
/* prototypes */
/**************/

void ComposeAttachFile (REQUEST_DATA*);
void ComposeAttachMime (REQUEST_DATA*);
char* ComposeBodyTextMassage (char*, int, char*);
BOOL ComposeCharSet (REQUEST_DATA*, int);
char* ComposeCharsetAlert (char*);
char* ComposeCharSetDir (char*);
char* ComposeCheckForSelf (REQUEST_DATA*, char*);
void ComposeCopySelf (REQUEST_DATA*);
void ComposeForwardAttachList (REQUEST_DATA*);
void ComposeReplyAttachList (REQUEST_DATA*);
BOOL ComposeMime (REQUEST_DATA*);
void ComposePage (REQUEST_DATA*);
BOOL ComposePageRequest (REQUEST_DATA*);
char* ComposePreviewMessage (REQUEST_DATA*);
char* ComposeRfcDate ();
char* ComposeSetCharSet (REQUEST_DATA*);
char* ComposeSelfAddress (REQUEST_DATA*);
void ComposeSendMessage (REQUEST_DATA*);
void ComposeSendClose (REQUEST_DATA*);
void ComposeSignature (REQUEST_DATA*, int);
void ComposeSigFileLoad (REQUEST_DATA*, char*);
int ComposeStripNonPrint (char*);

#endif /* INCLUDE_COMPOSE_H */

/******************************************************************************/

