COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	Copyright (c) GeoWorks 1993 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		
FILE:		emailtmp.def

AUTHOR:		Eric Weber, Mar 11, 1993

	
REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	epw	3/11/93	Initial revision


DESCRIPTION:
	Temporary holding location for routines during the email
	reorganization.  Any routines in this library will eventually
	move to another library or be deleted.

	$Id: emailtmp.def,v 1.1 97/04/04 14:25:15 newdeal Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@

SetDef __EMAILTMP

StartLibrary emailtmp

;-----------------------------------------------------------------------------
; 			    Constants
;-----------------------------------------------------------------------------
include	dbase.def

;-----------------------------------------------------------------------------
; 			    Constants
;-----------------------------------------------------------------------------

VALUE_LENGTH		equ	256

GEO_MAIL_DOUBLE_BACK_SLASH	= "\\"
GEO_MAIL_DIR_PATH_NAME		= "\\MAIL"
GEO_MAIL_OUTBOX_PATH_NAME	= "\\MAIL\\MESSAGES\\OUTBOX"


EMAIL_WORK_GROUP_BUFFER_SIZE	= 64
EMAIL_MAILBOX_SIZE = PATH_BUFFER_SIZE
GEO_MAIL_FILE_SIZE = FILE_LONGNAME_BUFFER_SIZE
GEO_MAIL_FULL_PATH_SIZE	= PATH_BUFFER_SIZE+FILE_LONGNAME_BUFFER_SIZE
EMAIL_DATE_TIME_BUFFER_LENGTH	equ	20

GEO_MAIL_DATE_PARSE_STRING	= "|SW| |SD|-|SM|-|SY| |hh|:|mm|:|ss|"
GEO_MAIL_MAXIMUM_FOR_SIXTEEN_BITS = 65535

MESSAGE_FILE_MINOR_PROTOCOL = 0
MESSAGE_FILE_MAJOR_PROTOCOL = 4


;----------------------------------------------------------------------------
;		Enumerations
;----------------------------------------------------------------------------

;
; This type is used by services to differentiate whether they are
; being asked to move mail to the classifier (incoming) or from the
; classifier (outgoing).  It is passed in bp to MSG_META_NOTIFY.
;
; The classifier ignores this value.
;
EmailNotificationSubtype	etype	word, 0, 1
ENS_SCAN_INCOMING	enum	EmailNotificationSubtype
ENS_SCAN_OUTGOING	enum	EmailNotificationSubtype

;----------------------------------------------------------------------------
;		Types
;----------------------------------------------------------------------------
EmailMailboxName	type	EMAIL_MAILBOX_SIZE dup (char)
EmailFolderName		type	GEO_MAIL_FULL_PATH_SIZE dup (char)
FullLongFileName	type	GEO_MAIL_FILE_SIZE dup (char)
FullLongPathFileName	type	GEO_MAIL_FULL_PATH_SIZE dup (char)

EmailEnclosureListStruct	struct

EELS_fileName		FileLongName		; Actual file name
EELS_diskHandle		word			; Disk
EELS_relPath		EmailMailboxName	; Path relative to disk
EELS_fileSize		dword			; Size of file
EELS_token		GeodeToken		; Token of file (if Geos)
EELS_creator		GeodeToken		; File creator (if Geos)
EELS_fileType		GeosFileType		; File type (Geos, data, DOS)
EELS_tempFileName	FileLongName		; Enclosure name
EELS_sourceFileName	FileLongName		; Used when file hops

EmailEnclosureListStruct	ends

;-----------------------------------------------------------------------------
; 			    public routines
;-----------------------------------------------------------------------------

global	CheckIfFileExists:far
global	ClearBuffer:far
global	CreateTempChunkArray:far
global	DestroyTempChunkArray:far
global	EmailEnclosureListLock:far
global	EmailEnclosureListUnlock:far
global	EmailRandom:far
global	EmailSeedRandom:far
global	StrCat:far
global	StrCopy:far
global	WriteMessageBody:far
global	MsgAccess:far
global  EmailMessageFileOpen:far
global	MsgAccessSetValue:far
global	OpenTempVMFile:far
global	PutTextIntoFile:far
global	EmailHandleError:far
global	IACP_SimpleConnectAndSend:far
global	IACP_SimpleConnectAndSendToTop:far
global  GenerateRandomFileName:far
global  GenerateRandomFileNameForEnclosureFile:far
global	GenerateRandomDOSFileName:far
global	HugeArrayBinarySearch:far
global	ChunkArrayBinarySearch:far
global	CreateDBItemForDate:far
global	InitializeMsgFile:far
global	MsgAddLogEntry:far

;-----------------------------------------------------------------------------
; 			    message format
;-----------------------------------------------------------------------------

ChunkAndBlockHandle	struct
    CABH_chunk	word
    CABH_block  word
ChunkAndBlockHandle	ends    

; for huge arrays, store huge array handle,
; for DB items, store group-handle and item-handle,
; for chunk arrays (name arrays) , store VM block handle and 
;   chunk handle
;
GeosMailFormatMapBlock	struct
    GMFMB_sender		DBGroupAndItem
    GMFMB_mcbOptions		DBGroupAndItem
    GMFMB_datePosted		DBGroupAndItem
    GMFMB_mhsId			DBGroupAndItem
    GMFMB_from			DBGroupAndItem
    GMFMB_subject		DBGroupAndItem
    GMFMB_date			DBGroupAndItem
    GMFMB_messageId		DBGroupAndItem
    GMFMB_viaHost		DBGroupAndItem
    GMFMB_conversationId	DBGroupAndItem
    GMFMB_dateDelivered		DBGroupAndItem
    GMFMB_dateReceived		DBGroupAndItem
    GMFMB_reSentBy		DBGroupAndItem  ; more than one can appear
    GMFMB_expirationDate	DBGroupAndItem
    GMFMB_messageSequence	DBGroupAndItem
    GMFMB_applicationName	DBGroupAndItem    
    GMFMB_attachmentDate	DBGroupAndItem
    GMFMB_authers		DBGroupAndItem
    GMFMB_inReplyTo		DBGroupAndItem
    GMFMB_originalRecipients	DBGroupAndItem	
    GMFMB_originator		DBGroupAndItem	
    GMFMB_respondBy		DBGroupAndItem
    GMFMB_retMessage		DBGroupAndItem
    GMFMB_summary		DBGroupAndItem
    GMFMB_hopCount		DBGroupAndItem	; decimal # between 0 and 65535

    GMFMB_macFcreator		ChunkAndBlockHandle ; chunk array
    GMFMB_macFtype		ChunkAndBlockHandle ; chunk array
    GMFMB_keywords		ChunkAndBlockHandle ; chunk array

    GMFMB_attachmentEncoding	word		; huge array
    GMFMB_attachmentType	word		; huge array
    GMFMB_body			word		; vm block
    GMFMB_addressesReferredTo	word		; huge array
    GMFMB_sendTo		word		; huge array
    GMFMB_errorReport		word		; huge array
    GMFMB_to			word		; huge array
    GMFMB_copiesTo		word		; huge array
    GMFMB_bcc			word		; huge array
    GMFMB_totalTo		word		; huge array
    GMFMB_totalCopiesTo		word		; huge array
    GMFMB_replyCopiesTo		word		; huge array
    GMFMB_replyTo		word		; huge array
    GMFMB_messageEncoding 	word		; enum type
    GMFMB_formType		word		; enum type
    GMFMB_importance		word		; enum type
    GMFMB_mcb			word		; enum type
    GMFMB_mcbSize		word		; enum type 
    GMFMB_messageType		word		; enum type
    GMFMB_sensitivity		word		; enum type
    GMFMB_messageRead		word		; enum type
    GMFMB_encryption		word		; enum type
    GMFMB_mcbType		word		; 0 or 1
    GMFMB_smfVersion		word		; 64 or 70
    GMFMB_enclHugeArray		word		; huge array handle
    GMFMB_geosHeader		word		; etype
    GMFMB_otherHeaders		ChunkAndBlockHandle ; name array  (DB items)

    GMFMB_deliveryLog		DBGroupAndItem
    GMFMB_encloseOriginal	word		; 0 or 1

GeosMailFormatMapBlock	ends


GeosMailHeaderType	etype	word
    GMHT_SENDER 		enum   GeosMailHeaderType, offset GMFMB_sender
    GMHT_MCB_OPTIONS		enum   GeosMailHeaderType, offset GMFMB_mcbOptions
    GMHT_DATE_POSTED		enum   GeosMailHeaderType, offset GMFMB_datePosted
    GMHT_MHS_ID			enum   GeosMailHeaderType, offset GMFMB_mhsId
    GMHT_FROM			enum   GeosMailHeaderType, offset GMFMB_from
    GMHT_SUBJECT		enum   GeosMailHeaderType, offset GMFMB_subject
    GMHT_DATE			enum   GeosMailHeaderType, offset GMFMB_date
    GMHT_MESSAGE_ID		enum   GeosMailHeaderType, offset GMFMB_messageId
    GMHT_VIA_HOST		enum   GeosMailHeaderType, offset GMFMB_viaHost
    GMHT_CONVERSATION_ID	enum   GeosMailHeaderType, offset GMFMB_conversationId
    GMHT_DATE_DELIVERED		enum   GeosMailHeaderType, offset GMFMB_dateDelivered
    GMHT_DATE_RECEIVED		enum   GeosMailHeaderType, offset GMFMB_dateReceived
    GMHT_RE_SENT_BY		enum   GeosMailHeaderType, offset GMFMB_reSentBy
    GMHT_EXPIRATION_DATE	enum   GeosMailHeaderType, offset GMFMB_expirationDate
    GMHT_MESSAGE_SEQUENCE	enum   GeosMailHeaderType, offset GMFMB_messageSequence
    GMHT_APPLICATION_NAME	enum   GeosMailHeaderType, offset GMFMB_applicationName
    GMHT_ATTACHMENT_DATE	enum   GeosMailHeaderType, offset GMFMB_attachmentDate
    GMHT_AUTHERS		enum   GeosMailHeaderType, offset GMFMB_authers
    GMHT_IN_REPLY_TO		enum   GeosMailHeaderType, offset GMFMB_inReplyTo
    GMHT_ORIGINAL_RECIPIENTS	enum   GeosMailHeaderType, offset GMFMB_originalRecipients
    GMHT_ORIGINATOR		enum   GeosMailHeaderType, offset GMFMB_originator
    GMHT_RESPOND_BY		enum   GeosMailHeaderType, offset GMFMB_respondBy
    GMHT_RET_MESSAGE		enum   GeosMailHeaderType, offset GMFMB_retMessage
    GMHT_SUMMARY		enum   GeosMailHeaderType, offset GMFMB_summary
    GMHT_HOP_COUNT		enum   GeosMailHeaderType, offset GMFMB_hopCount
    GMHT_MAC_FCREATOR		enum   GeosMailHeaderType, offset GMFMB_macFcreator
    GMHT_MAC_FTYPE		enum   GeosMailHeaderType, offset GMFMB_macFtype
    GMHT_KEYWORDS		enum   GeosMailHeaderType, offset GMFMB_keywords
    GMHT_ATTACHMENT_ENCODING	enum   GeosMailHeaderType, offset GMFMB_attachmentEncoding
    GMHT_ATTACHMENT_TYPE	enum   GeosMailHeaderType, offset GMFMB_attachmentType
    GMHT_BODY			enum   GeosMailHeaderType, offset GMFMB_body
    GMHT_ADDRESSES_REFERRED_TO	enum   GeosMailHeaderType, offset GMFMB_addressesReferredTo
    GMHT_SEND_TO    		enum   GeosMailHeaderType, offset GMFMB_sendTo
    GMHT_ERROR_REPORT		enum   GeosMailHeaderType, offset GMFMB_errorReport
    GMHT_TO			enum   GeosMailHeaderType, offset GMFMB_to
    GMHT_COPIES_TO		enum   GeosMailHeaderType, offset GMFMB_copiesTo
    GMHT_BCC			enum   GeosMailHeaderType, offset GMFMB_bcc
    GMHT_TOTAL_TO		enum   GeosMailHeaderType, offset GMFMB_totalTo
    GMHT_TOTAL_COPIES_TO	enum   GeosMailHeaderType, offset GMFMB_totalCopiesTo
    GMHT_REPLY_COPIES_TO	enum   GeosMailHeaderType, offset GMFMB_replyCopiesTo
    GMHT_REPLY_TO		enum   GeosMailHeaderType, offset GMFMB_replyTo
    GMHT_MESSAGE_ENCODING	enum   GeosMailHeaderType, offset GMFMB_messageEncoding
    GMHT_FORM_TYPE		enum   GeosMailHeaderType, offset GMFMB_formType
    GMHT_IMPORTANCE		enum   GeosMailHeaderType, offset GMFMB_importance
    GMHT_MCB			enum   GeosMailHeaderType, offset GMFMB_mcb
    GMHT_MCB_SIZE		enum   GeosMailHeaderType, offset GMFMB_mcbSize
    GMHT_MESSAGE_TYPE		enum   GeosMailHeaderType, offset GMFMB_messageType
    GMHT_SENSITIVITY		enum   GeosMailHeaderType, offset GMFMB_sensitivity
    GMHT_MESSAGE_READ		enum   GeosMailHeaderType, offset GMFMB_messageRead
    GMHT_ENCRYPTION		enum   GeosMailHeaderType, offset GMFMB_encryption
    GMHT_MCB_TYPE		enum   GeosMailHeaderType, offset GMFMB_mcbType
    GMHT_SMF_VERSION		enum   GeosMailHeaderType, offset GMFMB_smfVersion
    GMHT_ENCL_HUGE_ARRAY	enum   GeosMailHeaderType, offset GMFMB_enclHugeArray
    GMHT_GEOS_HEADER		enum   GeosMailHeaderType, offset GMFMB_geosHeader
    GMHT_OTHER_HEADERS		enum   GeosMailHeaderType, offset GMFMB_otherHeaders
    GMHT_DELIVERY_LOG		enum   GeosMailHeaderType, offset GMFMB_deliveryLog
    GMHT_ENCLOSE_ORIGINAL	enum   GeosMailHeaderType, offset GMFMB_encloseOriginal

MessageEncoding		etype	word, 1
    MET_IBM_437		enum	MessageEncoding
    MET_IBM_850		enum	MessageEncoding
    MET_IBM_860		enum	MessageEncoding
    MET_IBM_863		enum	MessageEncoding
    MET_IBM_865		enum	MessageEncoding
    MET_IBM_256		enum	MessageEncoding
    MET_EBCDIC		enum	MessageEncoding
    MET_ISO_646		enum	MessageEncoding
    MET_ISO_6937	enum	MessageEncoding
    MET_ISO_8859	enum	MessageEncoding
    MET_CCITT_T50	enum	MessageEncoding
    MET_CCITT_T51_US	enum	MessageEncoding
    MET_CCITT_T51_UK	enum	MessageEncoding
    MET_CCITT_T61_US	enum	MessageEncoding
    MET_MAC		enum	MessageEncoding
    MET_HOLLERITH	enum	MessageEncoding
    MET_BAUDOT		enum	MessageEncoding


FormType		etype	word, 1
    FT_TELEPHONE_MESSAGE  enum	FormType


Importance		etype	word, 1
    I_HIGH		enum  	Importance
    I_NORMAL		enum  	Importance
    I_LOW		enum  	Importance

MCB			etype	word, 1
    MCB_MHS_1		enum	MCB


MailType		etype	word, 1
    MT_GEOS		enum	MailType
    MT_NON_GEOS		enum 	MailType


MessageType		etype	word, 1
    MT_100		enum	MessageType
    MT_1000		enum	MessageType
    MT_1100		enum	MessageType
    MT_1200		enum	MessageType
    MT_1210		enum	MessageType


Sensitivity		etype	word, 1
    S_NORMAL		enum	Sensitivity
    S_PRIVATE		enum	Sensitivity
    S_PERSONAL		enum	Sensitivity
    S_COMPANY_CONFIDENTIAL  enum  Sensitivity


EndLibrary emailtmp






