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

	Copyright (c) Geoworks 1993 -- All Rights Reserved

PROJECT:	EXPO Email Application
MODULE:		
FILE:		pdafs.def

AUTHOR:		Patrick Buck, Oct 15, 1993

EXPORTED ROUTINES:

   Folder management
   -----------------
	PdaFileSysGetFolderCount	Get the # of folders
	PdaFileSysCreateFolder		Create a new folder
	PdaFileSysRenameFolder		Rename a folder
	PdaFileSysDeleteFolder		Delete a folder

   Folder access
   -------------
	PdaFileSysIndexToFolder		Get a folder's chunk given its index
	PdaFileSysFolderToIndex		Get a folder's index given its chunk
	PdaFileSysGetIncoming		Get the chunk for the Incoming folder
	PdaFileSysGetOutgoing		Get the chunk for the Outgoing folder
	PdaFileSysGetBackup		Get the chunk for the Backup folder
	PdaFileSysGetSaved		Get the chunk for the Saved folder
	PdaFileSysGetHidden		Get the chunk for the Hidden folder

   Folder internals
   ----------------
	PdaFileSysGetFolderName		Get the name of a folder
	PdaFileSysGetFolderInfo		Get information on a folder

   Message management
   ------------------
	PdaFileSysCreateMessage		Create a new message entry
	PdaFileSysMoveMessage		Move a message to another folder
	PdaFileSysDeleteMessage		Delete a message

   Message access
   --------------
	PdaFileSysIndexToMessage	Get a msg's chunk given its folder/index
	PdaFileSysMessageToIndex	Get a msg's folder/index given its chunk

   Message internals
   -----------------
	PdaFileSysGetMessageFlags	Get the flags for a message
	PdaFileSysSetMessageFlags	Set the flags for a message
	PdaFileSysGetMessageFolder	Get a message's parent folder

   Get/Set some generic message fields
   -----------------------------------
	PdaFileSysGetMessageSubject	Get a message's subject text
	PdaFileSysGetMessageFrom	Get a message's	from text
	PdaFileSysGetMessageDate	Get a message's date text
	PdaFileSysGetMessageTime	Get a message's time text
	PdaFileSysGetMessageBody	Get a message's body text

	PdaFileSysSetMessageSubject	Set a message's subject text
	PdaFileSysSetMessageFrom	Set a message's from text
	PdaFileSysSetMessageDate	Set a message's date text
	PdaFileSysSetMessageTime	Set a message's time text
	PdaFileSysSetMessageBody	Set a message's body text

   Get/Set message option fields
   -----------------------------
	PdaFileSysGetMessageOptionFlags		Get a message's option flags
	PdaFileSysSetMessageOptionFlags		Set a message's option flags

	PdaFileSysGetMessageOptionLogo		Set a message's option logo
	PdaFileSysSetMessageOptionLogo		Get a message's option logo

	PdaFileSysGetMessageOptionSignature  	Get a message's option signature
	PdaFileSysSetMessageOptionSignature  	Set a message's option signature

	PdaFileSysGetMessageOptionProjCode   	Get a message's option project code
	PdaFileSysSetMessageOptionProjCode   	Set a message's option project code

   Enclosure management
   -------------------- 
	PdaFileSysMessageCountEnclosures	Get the # of enclosures in a msg
	PdaFileSysAddMessageEnclosure		Add an enclosure to a msg
	PdaFileSysDeleteMessageEnclosure	Delete an enclosure from a msg

   Get enclosure internals
   -----------------------
	PdaFileSysGetMessageEnclosureInfo	Get general info on enclosure
	PdaFileSysGetMessageEnclosureDirectory	Get encl directory path string
	PdaFileSysGetMessageEnclosureTempName	Get encl temp file name
	PdaFileSysGetMessageEnclosureName	Get encl original name

   Address management
   ------------------
	PdaFileSysMessageCountAddresses		Get # of addr in an addr list
   	PdaFileSysCopyMessageAddress		Copy an addr between messages
	PdaFileSysAddMessageAddressName		Add an addr to an addr list
	PdaFileSysDeleteMessageAddress		Delete an address

   Set/Get address internals
   -------------------------
	PdaFileSysSetMessageAddressID		Set addr ID
	PdaFileSysSetMessageAddressDefinition	Set addr definition
	PdaFileSysGetMessageAddressID		Get an addr ID
	PdaFileSysGetMessageAddressName		Get an addr name
	PdaFileSysGetMessageAddressDefinition	Get an addr definition

   Miscellaneous
   -------------
	PdaFileSysFindMessageAddressID		Find an addr in an addr list

	PdaFileSysGetOutgoingUnheldMessage	Get the message ID for the 1st
						unheld msg in the outgoing fldr

	PdaFileSysOutgoingMessageSent		Notification that an unheld msg
						has been successfully sent.

REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	PB	10/15/93   	Initial revision


DESCRIPTION:
	This file contains definitions for the "PDA File System" library
	(bad name, should have been 'PDA Email Database' library).

	This library provides an API to store email messages and folder
	information in a single VMFile.  It will be augmented to store ink 
	and enclosures in other VMFiles that will be part of an "email
	database directory". 

	This API was designed for use by the EXPO Email application but
	my hope is that it will prove to be useful for future email projects. 
	
		
	$Id: pdafs.def,v 1.1 97/04/04 14:23:40 newdeal Exp $

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

SetDef	__PDAFS

StartLibrary	pdafs

; ============================================================================
;				Constants
; ============================================================================
NO_MESSAGE		equ	0xffff	; No unheld msg's to get from outgoing
   					;   folder.
 
NULL_TERMINATED		equ	0	; Used to indicate if some string is
   					;   null terminated.

BACKUP_FOLDER		equ	0xffff	; Default place to store sent msg's.

INTERNAL_ADDRESS	equ	0xffff	; Identifies an internal mail address
   					;  (not linked to any external source) 


; ============================================================================
;				Types
; ============================================================================

; ----------------------------------------------------------------------------
; Pda Email Database Notification Subtype
;
;   When an application calls a routine that changes something in the database
;   a notification is sent out to GCNSLT_EMAIL_DATABASE_CHANGE.
;    
;   The first value in the passed data block (see below) is of this etype and
;   it describes how the database has changed.   
; ----------------------------------------------------------------------------
PdaEmailDatabaseNotificationSubtype	etype	word, 0, 2
PEDNS_CREATE_FOLDER			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_RENAME_FOLDER			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_DELETE_FOLDER			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_CREATE_MESSAGE			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_DELETE_MESSAGE			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_FLAGS			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_SUBJECT		enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_FROM			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_DATE			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_TIME			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_BODY			enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_OPTION_FLAGS		enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_OPTION_LOGO		enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_OPTION_SIGNATURE	enum	PdaEmailDatabaseNotificationSubtype
PEDNS_SET_MESSAGE_OPTION_PROJ_CODE	enum	PdaEmailDatabaseNotificationSubtype
PEDNS_ADD_MESSAGE_ENCLOSURE		enum	PdaEmailDatabaseNotificationSubtype
PEDNS_DELETE_MESSAGE_ENCLOSURE		enum	PdaEmailDatabaseNotificationSubtype
; ** Address stuff to be done later **

; -----------------------------------------------
; Pda Email Database Notification Block Structure
;
;   Structure of the notification block sent out
;   when something in the database changes.
;   
;   See function definitions for details on
;   which fields are set for each routine.
; -----------------------------------------------
PdaEmailDatabaseNotificationBlock	struct
	PEDNB_notificationSubtype	PdaEmailDatabaseNotificationSubtype
	PEDNB_folderID			word
	PEDNB_folderIndex		word	; -1 if not in folders-list
	PEDNB_messageID			word
	PEDNB_messageIndex		word
	PEDNB_data1			word
	PEDNB_data2			word
	PEDNB_data3			word
	PEDNB_data4			word
PdaEmailDatabaseNotificationBlock	ends


; ------------------------------------------------------
; Enumerated type used to reference a particular list of 
; addresses within a message envelope
; ------------------------------------------------------
PdaFileSysMessageAddressList	etype	word, 0, 2
PFSMA_TO		enum		PdaFileSysMessageAddressList
PFSMA_CC		enum		PdaFileSysMessageAddressList
PFSMA_PRIV_TO		enum		PdaFileSysMessageAddressList
PFSMA_PRIV_CC		enum		PdaFileSysMessageAddressList

; ------------
; Folder flags
; ------------
PdaFileSysFolderFlags		record
	PFSFF_STANDARD:1   = 0	; 1 => standard folder, can't rename/delete
	:7
PdaFileSysFolderFlags		end

; -------------
; Message flags
; -------------
PdaFileSysMessageFlags		record
	PFSMF_BACKUP:1	   = 0	; 1 => message gets backed up
	:3
	PFSMF_RETURNED:1   = 0	; 1 => message could not be delivered
	PFSMF_UNREAD:1	   = 0	; 1 => unread message
	PFSMF_HELD:1	   = 0	; 1 => held message
	PFSMF_ENCLOSURES:1 = 0	; 1 => message with enclosures
PdaFileSysMessageFlags		end

; ----------------------
; Format Flags (group 1)
; ----------------------
PdaFileSysMessageOptionFlags_1	record
	PFSMOF_LANDSCAPE:1	= 0 ; 1 => Fax in 'landscape' orientation
	PFSMOF_NO_COVER:1	= 0 ; 1 => No fax cover sheet
	PFSMOF_ELECTRONIC:1	= 1 ; 1 => Send email
	PFSMOF_PAPER:1		= 0 ; 1 => Send paper mail
	PFSMOF_COD:1		= 0 ; 1 => Charge upon reading email
	PFSMOF_DELIVERED:1	= 0 ; 1 => Return delivery confirmation 
	PFSMOF_RECEIVED:1	= 0 ; 1 => Return receipt confirmation
	PFSMOF_FORMAT:2		= 0 ; PdaFileSysMessageFormat etype
	PFSMOF_NON_DELIVERY:2	= 0 ; PdaFileSysMessageService etype
	PFSMOF_SERVICE:2	= 0 ; PdaFileSysMessageDelivery etype
	:3
PdaFileSysMessageOptionFlags_1	end	; *** CHANGE TO _1 ***

; ----------------------
; Format Flags (group 2)
; ----------------------
PdaFileSysMessageOptionFlags_2	record
	:16			= 0
PdaFileSysMessageOptionFlags_2	end

; -------------------------------------------------------------------
; Etype values for PdaFileSysMessageOptionFlags_* bit field subgroups
; -------------------------------------------------------------------
PdaFileSysMessageFormat		etype	word, 0
PFSMF_FREE		enum	PdaFileSysMessageFormat
PFSMF_MEMO		enum	PdaFileSysMessageFormat
PFSMF_BUSINESS		enum	PdaFileSysMessageFormat

PdaFileSysMessageService	etype	word, 0
PFSMS_STANDARD		enum	PdaFileSysMessageService
PFSMS_NON_URGENT 	enum	PdaFileSysMessageService
PFSMS_URGENT		enum	PdaFileSysMessageService
PFSMS_PRIORITY		enum	PdaFileSysMessageService

PdaFileSysMessageDelivery	etype	word, 0
PFSMD_IGNORE		enum	PdaFileSysMessageDelivery
PFSMD_REPORT		enum	PdaFileSysMessageDelivery
PFSMD_RETURN		enum	PdaFileSysMessageDelivery

; ---------------
; Enclosure Flags
; ---------------
PdaFileSysEnclosureFlags	record
	PFSEF_REFERENCE_ONLY:1	= 0 ; 1 => file exists w/o encl structure
	:7
PdaFileSysEnclosureFlags	end

; ---------------
; Enclosure Types
; ---------------
PdaFileSysEnclosureTypes	etype	word, 0, 2



; ============================================================================
;			Exported Functions
; ============================================================================

; ---------------------------------------------------------
  global	PdaFileSysGetFolderCount:		far
; ---------------------------------------------------------
; Get the number of folders in the folders-list.
;
; 	PASS:	nothing
; 	RET:	cx = number of folders
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysCreateFolder:			far
; ---------------------------------------------------------
; Create a new folder and add it to the folders-list.
;
; 	PASS:	ds:si = fptr to folder name (asciiz text)
; 	RET:	ax = folder ID
;		cx = index of the folder in the folders-list
;		carry set if error
;	DESTR0Y	nothing
;	NOTE:	Folder flags default to NOT PFSFF_STANDARD
;
;	NOTIFICATION
;		PEDNS_CREATE_FOLDER
;		FolderID
;		FolderIndex

; ---------------------------------------------------------
  global	PdaFileSysRenameFolder:			far
; ---------------------------------------------------------
; Rename a user folder.
;
; 	PASS:	ds:si = fptr to folder name (asciiz text)
;		ax = folder ID
;		carry set if error
;	RET:	nothing
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_RENAME_FOLDER
;		FolderID
;		FolderIndex

; ---------------------------------------------------------
  global	PdaFileSysDeleteFolder:			far
; ---------------------------------------------------------
; Delete a folder and remove it from the folders-list.
;
; 	PASS:	ax = folder ID
; 	RET:	carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_DELETE_FOLDER
;		FolderID
;		FolderIndex

; ---------------------------------------------------------
  global	PdaFileSysIndexToFolder:		far
; ---------------------------------------------------------
; Get a folder's ID from its index in the folders-list.
;
; 	PASS:	cx = folder index
; 	RET:	ax = folder ID
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysFolderToIndex:		far
; ---------------------------------------------------------
; Get a folder's index given its chunk.
;
; 	PASS:	ax = folder ID
; 	RET:	cx = folder index
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------	
  global	PdaFileSysGetIncoming:			far
  global	PdaFileSysGetOutgoing:			far
  global	PdaFileSysGetBackup:			far
  global	PdaFileSysGetSaved:			far
  global	PdaFileSysGetHidden:			far
; ---------------------------------------------------------
; Get the folder ID for a particular standard mail folder.
;
; 	PASS:	nothing
; 	RET:	ax = folder ID
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetFolderName:		far
; ---------------------------------------------------------
; Get the name of a folder.
;
; 	PASS:	ax = folder ID
;		bx = hptr of text block to use (zero to allocate one)
; 	RET:	bx = hptr of filled text block
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetFolderInfo:		far
; ---------------------------------------------------------
; Get a folder's flags, message count and the number of unread
; or held messages.
;
; 	PASS:	ax = folder ID
;	 RET:	dl = PdaFileSysFolderFlags
;		cx = # of messages in the folder
;		bx = # of unread/held messages
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysCreateMessage:		far
; ---------------------------------------------------------
; Create a new message and place it in the specified folder.
;
; 	PASS:	bx = folder ID
; 	RET:	ax = message ID
;		cx = index of the message
;		carry set if error
;	DESTR0Y	nothing
;	NOTE:	Message flags default to "read" and "not held".
;
;	NOTIFICATION
;		PEDNS_CREATE_MESSAGE
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysMoveMessage:			far
; ---------------------------------------------------------
; Move a message from its current folder to the one specified.
;	
; 	PASS:	ax = message ID
;		bx = destinatin folder ID 
; 	RET:	nothing
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysDeleteMessage:		far
; ---------------------------------------------------------
; Delete a message and remove it from its folder.
;	
; 	PASS:	ax = message ID
; 	RET:	nothing
;		carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_DELETE_MESSAGE
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysIndexToMessage:		far
; ---------------------------------------------------------
; Get a message's ID from its folder and index values.
;	
; 	PASS:	bx = folder ID
;		cx = message index
; 	RET:	ax = message ID
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysMessageToIndex:		far
; ---------------------------------------------------------
; Get a msg's folder/index given its chunk.
;
; 	PASS:	ax = message ID
; 	RET:	bx = folder ID
;		cx = message index
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageFlags:		far
; ---------------------------------------------------------
; Get the flags for the specified message.
;
; 	PASS:	ax = message ID
; 	RET:	dl = PdaFileSysMessageFlags
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageFlags:		far
; ---------------------------------------------------------
; Set the flags for the specified message.
;	
; 	PASS:	ax = message ID
; 		dl = PdaFileSysMessageFlags
; 	RET:	nothing
;		carry set if error
;	SIDE:	Updates the unread/held quantity in the parent folder
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_SET_MESSAGE_FLAGS
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysGetMessageFolder:		far
; ---------------------------------------------------------
; Get the folder that the specified message resides in.
;
; 	PASS:	ax = message ID
; 	RET:	bx = folder ID
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageSubject:		far
  global	PdaFileSysGetMessageFrom:		far
  global	PdaFileSysGetMessageDate:		far
  global	PdaFileSysGetMessageTime:		far
  global	PdaFileSysGetMessageBody:		far
; ---------------------------------------------------------
; Get a particular text field from the header of a message.
;
; 	PASS:	ax = message ID
;		bx = hptr to text block to use (zero to allocate one)
; 	RET:	bx = hptr of filled text block
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageSubject:		far
  global	PdaFileSysSetMessageFrom:		far
  global	PdaFileSysSetMessageDate:		far
  global	PdaFileSysSetMessageTime:		far
  global	PdaFileSysSetMessageBody:		far
; ---------------------------------------------------------
; Set a particular text field from the header of a message.
;
;	PASS:	ax = message ID
;		ds:si = fptr to new text
;		cx = length of text in bytes or NULL_TERMINATED
; 	RET:	carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_SET_MESSAGE_ {SUBJECT,FROM,DATE,TIME,BODY}
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysGetMessageOptionFlags:	far
; ---------------------------------------------------------
; Get the message's PdaFileSysMessageOptionFlags field.
;
; 	PASS:	ax = message ID
;	RET:	cx = PdaFileSysMessageOptionFlags_1
;		dx = PdaFileSysMessageOptionFlags_2
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageOptionFlags:	far
; ---------------------------------------------------------
; Set the message's PdaFileSysMessageOptionFlags field.
;
; 	PASS:	ax = message ID
;		cx = PdaFileSysMessageOptionFlags_1
; 		dx = PdaFileSysMessageOptionFlags_2
; 	RET:	nothing
;		carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_SET_MESSAGE_OPTION_FLAGS
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysGetMessageOptionLogo:		far
; ---------------------------------------------------------
; Get a message's option logo.
;
; 	PASS:	ax = message ID
;		bx = hptr to text block to use (zero to allocate one)
; 	RET:	bx = hptr of filled text block
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageOptionLogo:		far
; ---------------------------------------------------------
; Set a message's option logo.
;
;	PASS:	ax = message ID
;		cx = length in bytes or NULL_TERMINATED
;		ds:si = fptr to new text
; 	RET:	carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_SET_MESSAGE_OPTION_LOGO
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysGetMessageOptionSignature:	far
; ---------------------------------------------------------
; Get a message's option signature.
;
; 	PASS:	ax = message ID
;		cx = length in bytes or NULL_TERMINATED
;		bx = hptr to text block to use (zero to allocate one)
; 	RET:	bx = hptr of filled text block
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageOptionSignature:	far
; ---------------------------------------------------------
; Set a message's option signature.
;
;	PASS:	ax = message ID
;		cx = length in bytes or NULL_TERMINATED
;		ds:si = fptr to new text
; 	RET:	carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageOptionProjCode:	far
; ---------------------------------------------------------
; Get a message's option project code.
;
; 	PASS:	ax = message ID
;		bx = hptr to text block to use (zero to allocate one)
; 	RET:	bx = hptr of filled text block
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysSetMessageOptionProjCode:	far
; ---------------------------------------------------------
; Set a message's option project code.
;
;	PASS:	ax = message ID
;		cx = length in bytes or NULL_TERMINATED
;		ds:si = fptr to new text
; 	RET:	carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_SET_MESSAGE_PROJ_CODE
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysMessageCountEnclosures:	far
; ---------------------------------------------------------
; Count the number of enclosures in a message.
;
; 	PASS:	ax = message ID
; 	RET:	cx = # of enclosures
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysAddMessageEnclosure:		far
; ---------------------------------------------------------
; Add an enclosure to a message.
;
; 	PASS:	ax = message ID
;		cx = PdaFileSysEnclosureTypes
;		dl = PdaFileSysEnclosureFlags
;		bx = disk handle for enclosure file
;		ON STACK
;		fptr to a directory name string
;		fptr to a temporary filename string
;		fptr to a string with the original filename
;
; 	RET:	cx = index of the created enclosure
;		carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_ADD_MESSAGE_ENCLOSURE
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysDeleteMessageEnclosure:	far
; ---------------------------------------------------------
; Delete an enclosure from a message.
;
; 	PASS:	ax = message ID
;		cx = index of enclosure to delete 
; 	RET:	carry set if error
;	DESTR0Y	nothing
;
;	NOTIFICATION
;		PEDNS_DELETE_MESSAGE_ENCLOSURE
;		FolderID
;		FolderIndex
;		MessageID
;		MessageIndex

; ---------------------------------------------------------
  global	PdaFileSysGetMessageEnclosureInfo:	far
; ---------------------------------------------------------
; Get information about an enclosure (flags, type etc)
;
;	PASS:	ax = message ID
;		cx = index of enclosure
;	RET:	bx = PdaFileSysEnclosureTypes
;		dl = PdaFileSysEnclosureFlags
;		carry set if error
;	DESTROY nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageEnclosureDirectory:	far
; ---------------------------------------------------------
; Get the directory path string to an enclosure.
;
;	PASS:	ax = message ID
;		cx = index of enclosure
;		bx = hptr to text block to use (zero to allocate one)
;	RET:	bx = hptr of filled text block 
;		dx = number of character bytes returned minus NULL
;		ax = disk handle for enclosure file
;		carry set if error
;	DESTROY nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageEnclosureTempName:	far
; ---------------------------------------------------------
; Get the temporary filename for an enclosure.
;
;	PASS:	ax = message ID
;		cx = index of enclosure
;		bx = hptr to text block to use (zero to allocate one)
;	RET:	bx = hptr of filled text block 
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTROY nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageEnclosureName:	far
; ---------------------------------------------------------
; Get the enclosure's original filename (the one that the 
; sender intended the receiver to see).
;
;	PASS:	ax = message ID
;		cx = index of enclosure
;		bx = hptr to text block to use (zero to allocate one)
;	RET:	bx = hptr of filled text block 
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTROY nothing

; ---------------------------------------------------------
  global	PdaFileSysMessageCountAddresses:	far
; ---------------------------------------------------------
; Count the number of addresses in a particular address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
; 	RET:	cx = # of addresses
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysCopyMessageAddress:		far
; ---------------------------------------------------------
; Copy an address from one message to another.
;
; WARNING: do not use to copy an address to another list in the
;          same message
;
; 	PASS:	ax = source message id
;		bx = source PdaFileSysMessageAddressList
;		cx = index of source address
;		dx = destination message id
;		bp = destination PdaFileSysMessageAddressList
;	RET:	carry set if error
;	DESTROY	nothing
;

; ---------------------------------------------------------
  global	PdaFileSysAddMessageAddressName:	far
; ---------------------------------------------------------
; Add an address to an address list.  This takes the address 
; name and inserts it into the list.  Every new address is
; given an internal 32-bit ID value and its source field
; is set to -1 (no external source).
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		cx = length in bytes or NULL_TERMINATED
;		ds:si = fptr to new name text
; 	RET:	di = index of address in address list
;		carry set if error
;	DESTR0Y	nothing


; ---------------------------------------------------------
  global	PdaFileSysDeleteMessageAddress:		far
; ---------------------------------------------------------
; Delete an address in an address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		di = index of envelope address to delete
; 	RET:	carry set if error
;	DESTR0Y	nothing


; ---------------------------------------------------------
  global	PdaFileSysSetMessageAddressID:		far
; ---------------------------------------------------------
; Add an address ID to an address list.  If the address
; source ID is INTERNAL_ADDRESS (no source), an internal
; address ID will be assigned to this entry.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		di = index of address in address list
;  		si = address source ID or INTERNAL_ADDRESS
;		bxcx = external address ID (if source = INTERNAL_ADDRESS)
;
; 	RET:    bxcx = address ID given to this entry
;  		carry set if error
;	DESTR0Y	nothing


; ---------------------------------------------------------
  global	PdaFileSysSetMessageAddressDefinition:	far
; ---------------------------------------------------------
; Add an address definition to an address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		cx = length in bytes or NULL_TERMINATED
;		ds:si = fptr to new text
;		di = index of address in address list
; 	RET:	carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageAddressID:		far
; ---------------------------------------------------------
; Get the ID for an address in an address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		di = index of address in address list
; 	RET:	si   = address source ID
;  		bxcx = address ID
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageAddressName:	far
; ---------------------------------------------------------
; Get the name for an address in an address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		di = index of address in address list
;		bx = hptr of block to use (zero to allocate one)
; 	RET:	bx = block filled
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetMessageAddressDefinition:	far
; ---------------------------------------------------------
; Get the definition for an address in an address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;		di = index of address in address list
;		bx = hptr of block to use (zero to allocate one)
; 	RET:	bx = block filled
;		dx = number of character bytes returned minus NULL
;		carry set if error
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysFindMessageAddressID:		far
; ---------------------------------------------------------
; Find out if an address ID is in a particular address list.
;
; 	PASS:	ax = message ID
;		dx = PdaFileSysMessageAddressList
;  		si   = address source ID or INTERNAL_ADDRESS
;		bxcx = address ID to find
; 	RET:	cx = index of envelope address (-1 if not found)
;		carry set if error 
;	DESTR0Y	nothing

; ---------------------------------------------------------
  global	PdaFileSysGetOutgoingUnheldMessage:	far
; ---------------------------------------------------------
; Return the message ID for the first uhneld message in the
; outgoing mail folder.
;
;	PASS:	nothing
;	RET:	ax = message ID or NO_MESSAGE
;		carry set if error 
;	DESTROY nothing

; ---------------------------------------------------------
  global	PdaFileSysOutgoingMessageSent:		far
; ---------------------------------------------------------
; Notification that an unheld msg has been successfully sent.
;
;	PASS:	ax = message ID
;	RET:	nothing
;	SIDE:	message removed from the outgoing folder

EndLibrary	pdafs




