	IFND	LIBRARIES_BBSREAD_I
LIBRARIES_BBSREAD_I	SET	1

**
**  From version: BBSRead.h 4.1 (18.06.95)
** 
**  BBSRead structures and definitions.
**
**  © Copyright 1995 Ultima Thule Software
**  All Rights Reserved.
**
**  Author: Eivind Nordseth
**
**-------------------------------------------------------------------
**
**  Assembler (.i) includes translated by Kenneth "Kenny" Nilsen
**  $VER: BBSRead.i 1.0 (17.3.97)
**
**-------------------------------------------------------------------

	IFND	EXEC_TYPES_I
	INCLUDE	"exec/types.i"
	ENDC

	IFND	EXEC_NODES_I
	INCLUDE	"exec/nodes.i"
	ENDC

	IFND	EXEC_LISTS_I
	INCLUDE	"exec/lists.i"
	ENDC

	IFND	LIBRARIES_BBSREADTAGS_I
	INCLUDE	"libraries/bbsreadtags.i"
	ENDC


BBSREADNAME		DC.B	"bbsread.library",0
BBSREADVERSION		EQU	4

ENV_BBSDATAPATH		DC.B	"THOR/BBSDataPath",0
ENV_THORPATH		DC.B	"THOR/THORPath",0
			even

**********************************************************************
*
* Global config structures and definitions
*


	STRUCTURE ArcConfigItem,0
	STRUCT	ac_node,ln_size
	UWORD	sc_pad
	APTR	ac_Name			;Name of this archiver
	APTR	ac_FindPatern		;Patern to identify this archiver
	APTR	ac_UnArcCmd		;Command to unarc an archive
	APTR	ac_ArcCmd		;Command to add to an archive
	ULONG	ac_OpenCnt		;Nr of types using this archiver. Private.
	LABEL	ac_sizeof


	STRUCTURE GlobalConfig,0
	APTR	gc_DnloadPath		;Path where downloaded files resides
	APTR	gc_UploadPath		;Path where files to upload resides
	APTR	gc_GlobalUserName	;Global user name.	(from key file)

	ULONG	gc_Buffers		;Number of buffers to use
	ULONG	gc_BufferSize		;Size of each buffer

	APTR	gc_Signature		;Global signature, could be a NULL pointer

	ULONG	gc_KeepMsg		;Messages to keep in each conference
	ULONG	gc_KeepTime		;Time (in seconds) to keep messages in conferences

	ULONG	gc_Flags

	STRUCT	gc_AvailArc,MLH_Size	;List of archivers which can be used for (un)packing.

	APTR	gc_XpkMethod		;What xpk method to use when packing

	APTR	gc_UserStreet		;User data from key file.
	APTR	gc_UserAddress
	APTR	gc_UserCountry
	APTR	gc_UserPhone		;User editable.

	APTR	gc_TmpDir		;Directory to use for temp files while packing
	APTR	gc_TagFile		;Global tag file. NULL-pointer, no tags
	
	ULONG	gc_HazeLevel1		;Seconds to keep messages marked with hazelevel 1
	ULONG	gc_HazeLevel2		;Seconds to keep messages marked with hazelevel 2
	ULONG	gc_HazeLevel3		;Seconds to keep messages marked with hazelevel 3
	
	APTR	gc_PGPCommand		;Command for pgp (Default is "(ENV:PGPPATH)pgp")
	APTR	gc_PGPSignID		;Id to use when PGP signing messages. Default is '*'.

	APTR	gc_ReplyString		;Reply string to use when a message is replied _and_ moved.

	APTR	gc_StartupScript	;Arexx script to be run each time Thor is started.
	APTR	gc_QuitScript		;Arexx script to be run each time Thor is quited.

	APTR	gc_BBSEnterScript	;Arexx script to be run each time a bbs is entered.
	APTR	gc_BBSLeaveScript	;Arexx script to be run each time a bbs is left.

	APTR	gc_ConfEnterScript	;Arexx script to be run each time a conf is entered.
	APTR	gc_ConfLeaveScript	;Arexx script to be run each time a conf is left.
	LONG	gc_QuoteChars		;String to use as quote chars in custom quote type.
					;Max length is 3. The string is NUL terminated.
	LABEL	gc_sizeof


;  GlobalConfig.gc_Flags

GCF_IGNORE_KEEPMSG	EQU	(1<<0)	;gc_KeepMsg is ignored. Messages won't
					;be counted when packing conferences
GCF_IGNORE_KEEPTIME	EQU	(1<<1)	;gc_KeepTime is ignored.	Time won't be
					;checked when packing conferences
GCF_RESET_EVENT_NR	EQU	(1<<2)	;Reset event numbers when packing events.
GCF_NO_XPK_METHOD	EQU	(1<<3)	;Don't use any xpk method
GCF_FILE_SIGNATURE	EQU	(1<<4)	;The gc_Signature field contains the path
					;and name of a file containing the signature.
GCF_AUTO_XPK_PACK	EQU	(1<<5)	;Automatically xpk pack all new messages
					;when are written to the database. NB: A xpk method must have been defined.
GCF_FORCE_PACK_REWRITE	EQU	(1<<6)	;Force a rewrite when packing conferences
GCF_COMMAND_SIGNATURE	EQU	(1<<7)	;The gc_Signature field contains the path
					;and name of a command. When the command is executed should the signature
					;contents be written to stdout. The template for the command is expected to be
					;BBSNAME/K,CONFNAME/K.
GCF_ALWAYS_REPLY_STR	EQU	(1<<8) 	;Use reply string on all replies.


**********************************************************************
*
* BBSType structures and definitions
*


	STRUCTURE EventConfigItem,0

	struct	ec_Node,mln_size
	
	ULONG	ec_Event	;Identification of this event
	ULONG	ec_NeedTags	;Pointer to TAG_END-terminated array of tags needed
				;for this event (NULL pointer -> no needed tags)
	ULONG	ec_OptTags	;Pointer to TAG_END-terminated array of optional tags
				;for this event (NULL pointer -> no optional tags)
	ULONG	ec_Reserved	;Reserved for future expansion
	LABEL	ec_SizeOf


;  Structure holding BBS-type spesific data  

	STRUCTURE TypeData,0

	APTR	td_TypeName		; Name of BBS-type
	APTR	td_MsgParser		; Command for parsing grabs
	UWORD	td_LineLength		; Max length of lines in messages
	UWORD	td_SubjectLength	; Max length of subjects
	UWORD	td_FileDescrLen		; Max length of short filedescription
	UBYTE	td_CharSet		; Charset the grab from this BBS typr uses.
					; Se bellow for definitions
	UBYTE	td_QuoteType		; Prefered quote type for this bbstype.
					; See below for definitions.
	ULONG	td_AvailScrFlags	; Mask of flags script uses
	UWORD	td_FileNameLen		; Max length of filenames allowed
	UWORD	td_pad2
	APTR	td_EventPacker		; Command for packing events
	APTR	td_EventArchiver	; Archiver to use when making packages

	STRUCT	td_AvailEvents,MLH_SIZE	; List of struct EventConfigItem
	
	ULONG	td_Flags
	APTR	td_AcceptPattern	; Pattern for accepting grabs for this bbstype
					; NULL equals #?
	APTR	td_InitMsgFile		; Command for initializing message files
	APTR	td_ExtConfig		; Command for external configuration

	LABEL	td_SIZEOF

; Charsets defined 
BRCS_ANY	EQU	0	; Any charset, can't be used in BBSTypes.
BRCS_ISO	EQU	1	; ISO Latin 1 charset.
BRCS_IBN	EQU	2	; IBM charset used in Norway. Same as IBM CodePage 865.
BRCS_SF7	EQU	3	; 7-bit charset. Sweden and Finland.
BRCS_NO7	EQU	4	; 7-bit charset. Norway.
BRCS_DE7	EQU	5	; 7-bit charset. Denmark.
BRCS_US7	EQU	6	; 7-bit charset. USA.
BRCS_UK7	EQU	7	; 7-bit charset. United Kingdom.
BRCS_IT7	EQU	8	; 7-bit charset. Italia.
BRCS_PO7	EQU	9	; 7-bit charset. Portugal.
BRCS_SP7	EQU	10	; 7-bit charset. Espania.
BRCS_GE7	EQU	11	; 7-bit charset. Germany.
BRCS_FR7	EQU	12	; 7-bit charset. France.
BRCS_IBM	EQU	13	; IBM charset. Same as IBM CodePage 437.
BRCS_IBMM	EQU	14	; IBM multinational charset. Same as IBM CodePage 850.
BRCS_APPLE	EQU	15	; Apple charset.
BRCS_NO_OF	EQU	15	; Number of charset defined.


; Charset equivalents

BRCS_ISO8859.1	EQU	BRCS_ISO

BRCS_ISO_IR002	EQU	BRCS_US7
BRCS_ISO_IR004	EQU	BRCS_UK7
BRCS_ISO_IR010	EQU	BRCS_SF7
BRCS_ISO_IR011	EQU	BRCS_SF7
BRCS_ISO_IR015	EQU	BRCS_IT7
BRCS_ISO_IR016	EQU	BRCS_PO7
BRCS_ISO_IR017	EQU	BRCS_SP7
BRCS_ISO_IR021	EQU	BRCS_GE7
BRCS_ISO_IR060	EQU	BRCS_NO7
BRCS_ISO_IR061	EQU	BRCS_NO7
BRCS_ISO_IR069	EQU	BRCS_FR7

BRCS_IBM_CP437	EQU	BRCS_IBM
BRCS_IBM_CP850	EQU	BRCS_IBMM
BRCS_IBM_CP865	EQU	BRCS_IBN


;  TypeData.td_AvailScrFlags  
SF_NEWFILES	EQU	(1<<0)		; Do newfiles scan every logon
SF_AUTOPDNL	EQU	(1<<1)		; Automaticaly download private files
SF_AUTOLOGOFF	EQU	(1<<2)		; Automaticaly logoff after all is done
SF_USECOLORS	EQU	(1<<3)		; Use colors on BBS
SF_ANSIMENUES	EQU	(1<<4)		; Use ANSI menues
SF_BULLETINS	EQU	(1<<5)		; Get new bulletins on every logon


;  TypeData.td_QuoteType, BBSData.bd_QuoteType, ConfData.cd_QuoteType  

QT_USE_SUPER	EQU	0		; In TypeData.td_QuoteType: Same as QT_DEFAULT.
					; In BBSData.bd_QuoteType:  Use quotetype defined for the BBSType.
					; In ConfData.cd_QuoteType: Use quotetype defined for the BBS.
QT_NONE     	EQU	1 		; No quoting.
QT_DEFAULT  	EQU	2 		; Default quote char. (">")
QT_DEF_SPACE	EQU	3 		; Default quote char pluss space. ("> ")
QT_CUSTOM   	EQU	4 		; Custom quote chars defined in QuoteChars field.
QT_INITIALS 	EQU	5 		; Use initials as quote chars.


; TypeData.td_Flags  
TDF_NO_NAME_CHECK	EQU	(1<<0)	; Don't check BBSData->bd_UserName/
					; ConfData->cd_Alias when adding messages
TDF_NO_ADDR_CHECK	EQU	(1<<1)	; Don't check BBSData->bd_UserAddr when
					; adding messages
TDF_SELECT_ADD_USER	EQU	(1<<2)	; BBSType supports selectable user adding.
TDF_ADD_USERS		EQU	(1<<3)	; The parser for this eventtype adds users
					; to the user database by default. Used by ConfigBBS() when creatig new BBS'es.
TDF_ABS_LINELENGTH	EQU	(1<<4)	; The line length in messages from this bbs
					; type is never longer than defined for the conf/bbs/bbsttype.
TDF_MULTIPLE_CONFS	EQU	(1<<5)	; BBSType supports "conf1,conf2,...,confn"
					; in BREV_Conference tag.
TDF_MULTIPLE_TO		EQU	(1<<6)	; BBSType supports "to1,to2,...,ton" in
					; BREV_ToName and/or BREV_ToAddr. If both BREV_ToName and BREV_ToAddr tags are
					; used must name x in BREV_ToName correspond to address x in BREV_ToAddr.
TDF_REFLOW_QUOTING	EQU	(1<<7)	; Reflow quoting should be on as default
					; when answering messages.
TDF_GLOBAL_REPLIES	EQU	(1<<8)	; BRMSG_MsgID or BRMSG_OrginalNr is globaly
					; unique and can be used when repling messages to another conference than the
					; orginal.	See BREV_RefConference tag.	
TDF_NAME_REPLIES	EQU	(1<<9)	; It is possible to reply messages to
					; another user than the author of the orginal message.
TDF_REPLY_SUBJ_PREFIX	EQU	(1<<10)	; Use "Re: " as subject prefix on replies.
TDF_EVENTS_HANDELED	EQU	(1<<11)	; The library shouldn't ask if packed
					; events should be deleted when parsing. This is handled by the event
					; packer/parser.	

TDF_SUPPORTS_ENCODE_8BIT_MAIL		EQU	(1<<12)	; Supports encoding of 8-bit
							; messages only in mail conferences.	
TDF_SUPPORTS_ENCODE_8BIT_MSGS		EQU	(1<<13)	; Supports encoding of 8-bit
							; messages in public conferences.	
TDF_SUPPORTS_MULTIPLE_ATTACHMENTS	EQU	(1<<14)	; Supports multiple attachments


;  Structure used in List returned by GetTypeList

	STRUCTURE TypeListItem,0

	STRUCT	tl_Node,LN_size		;Caller is free to use nl_Name
	WORD	tl_pad
	APTR	tl_Link			;Private!!!!!!!!
	APTR	tl_UserData		;For use by the caller; no restrictions!
	STRUCT	tl_Data,td_sizeof	;Pointer to the Type data
	LABEL	tl_sizeof


**********************************************************************
*
* BBS structures and definitions
*


;  Structure holding user modifiable BBS data  

	STRUCTURE BBSData,0

	APTR	bd_Name			; Name of BBS
	APTR	bd_GrabName		; Name of grabfile (without extension) or with wildcards
	APTR	bd_BBSType		; Type of BBS, used when splitting grabs and scripting
	APTR	bd_UserName		; The name the user is registered as
	APTR	bd_Signature		; Signature to use on this BBS, could be a NULL-pointer

	UWORD	bd_LineLength		; Max linelength in messages. Overrides TypeData if >0
	UBYTE	bd_CharSet		; Charset for the grab from this BBS uses. Overrides
					; TypeData if != BRCS_ANY
	UBYTE	bd_QuoteType		; Prefered quite type for this bbs. See above for definitions.

	ULONG	bd_ScrFlags		; Flags for script (for definitions se TypeData)
	ULONG	bd_Flags		; Flags for this BBS

	ULONG	bd_KeepMsg		; Messages to keep in each conference
	ULONG	bd_KeepTime		; Time (in seconds) to keep messages in conferences

	APTR	bd_EMailAddr		; The address the user has on the bbs
	APTR	bd_XpkMethod		; What xpk method to use when packing this bbs

	APTR	bd_UserStreet		; User data to override GlobalConfig
	APTR	bd_UserAddress		; NULL equals to value in GlobalConfig
	APTR	bd_UserCountry
	APTR	bd_UserPhone
	APTR	bd_Alias		; Alias used on this BBS. NULL-pointer, no alias
					; This alias will only be used in conferences
					; marked with CDF_ALIAS.
	APTR	bd_DnloadPath;		; Dnloadpath for this BBS. Overrides global settings
	APTR	bd_TagFile		; Tagfile to use on this BBS. NULL-pointer, use global
	APTR	bd_EventArchiver	; Archiver to use when packing the events from this BBS
					; Overrides the setting in the BBSType if non NULL.
	APTR	bd_ReplyPacket		; File name of eventual reply packet. Is expected to be
					; relative to the defined upload dir for this bbs.
	APTR	bd_UploadPath		; Upload path for this BBS. Overrides global settings
	APTR	bd_ReplyString		; Reply string to use when a message is replied _and_
					; moved. NULL means: Use global reply string.
	APTR	bd_BBSEnterScript	; Arexx script to be run each time this bbs is
					; entered. Overrides global setting.
	APTR	bd_BBSLeaveScript	; Arexx script to be run each time this bbs is left.
					; Overrides global setting.
	APTR	bd_ConfEnterScript	; Arexx script to be run each time a conference on
					; this bbs is entered. Overrides global setting.
	APTR	bd_ConfLeaveScript	; Arexx script to be run each time a conference on
					; this bbs is left. Overrides global setting.
	LONG	bd_QuoteChars		; String to use as quote chars in custom quote type.
					; Max length is 3. The string is NUL terminated.
	LABEL	bd_sizeof


;  BBSData.bd_Flags  
BDF_GLOBAL_KEEPMSG	EQU	(1<<0)	; Use global KeepMsg for this BBS
BDF_GLOBAL_KEEPTIME	EQU	(1<<1)	; Use global KeepTime for this BBS
BDF_IGNORE_KEEPMSG	EQU	(1<<2)	; bd_KeepMsg is ignored. Messages won't
					;	be counted when packing conferences
BDF_IGNORE_KEEPTIME	EQU	(1<<3)	; bd_KeepTime is ignored.	Time won't be
					; checked when packing conferences
BDF_NO_XPK_METHOD	EQU	(1<<4)	; Don't use any xpk method on this bbs

 * This flag is used to show that the events for this bbs has changed since last
 * call to MakeEventPackage(). It is maintained by the library, and should normally
 * not be set or cleard by other. A successfull call to MakeEventPackage() will
 * clear the flag.

BDF_EVENTS_CHANGED	EQU	(1<<5)
BDF_NO_SIGNATURE	EQU	(1<<6)	; Don't use signatures on this bbs
BDF_MARK_OWN_MSGS	EQU	(1<<7)	; Also mark messages from user when adding
					; messages with the WBRMSG_MarkMessage tag
BDF_NO_TAGS		EQU	(1<<8)	; Don't use tags on this bbs
BDF_ADD_USERS		EQU	(1<<9)	; The parser for this bbs should add users
					; to the database if it supports it.
BDF_FILE_SIGNATURE	EQU	(1<<10)	; The bd_Signature field contains the path
					; and name of a file containing the signature.	
BDF_AUTO_XPK_PACK	EQU	(1<<11)	; Automatically xpk pack new messages when
					; they are written to this bbs. NB: A xpk method must have been defined.
BDF_NO_AUTO_XPK_PACK	EQU	(1<<12)	; No automatically xpk packing on this bbs.
					; Overrides global flags for auto xpk packing.	
BDF_COMMAND_SIGNATURE	EQU	(1<<13)	; The bd_Signature field contains the path
					; and name of a command. When the command is executed should the signature
					; contents be written to stdout. The template for the command is expected to be
					; BBSNAME/K,CONFNAME/K.	
BDF_REFLOW_QUOTING	EQU	(1<<14)	; Reflow quoting should be on as default
					; when answering messages. This flag should only be considered when
					; bd_QuoteType is != QT_USE_SUPER.	
BDF_ALWAYS_REPLY_STR	EQU	(1<<15)	; Use reply string on all replies. This
					; flag should only be considered when bd_ReplyString is non NULL.
BDF_NO_REPLY_STR	EQU	(1<<16)	; Don't use reply strings on this bbs.
					; Overrides the setting of bd_ReplyString.
BDF_GLOBAL_REPLY_STR	EQU	(1<<17)	; Use global reply string settings.
					; Overrides all other bbs reply string settings.	
BDF_NO_BBS_ENTER_SCR	EQU	(1<<18)	; Don't use a bbs enter script on this bbs.
BDF_NO_BBS_LEAVE_SCR	EQU	(1<<19)	; Don't use a bbs leave script on this bbs.
BDF_NO_CONF_ENTER_SCR	EQU	(1<<20)	; Don't use a conference enter script on this bbs.
BDF_NO_CONF_LEAVE_SCR 	EQU	(1<<21)	; Don't use a conference leave script on this bbs.
BDF_ENCODE_8BIT_MAIL	EQU	(1<<22)	; Encode 8 bits messages in mail conferences. Only
					; appliable when the TDF_SUPPORTS_ENCODE_8BIT_MAIL flag is set for the bbstype.
BDF_ENCODE_8BIT_MSGS	EQU	(1<<23)	; Encode 8 bits messages in public conferences. Only
					; appliable when the TDF_SUPPORTS_ENCODE_8BIT_MSGS flag is set for the bbstype.

;  Structure holding BBS data maintained by the library

	STRUCTURE BBSInternal,0

	ULONG	bi_FirstEvent	; First event for this BBS
	ULONG	bi_LastEvent	; Last event for this BBS
	ULONG	bi_NumEvents	; Number of active events (not deleted or done)

	ULONG	bi_FirstUser	; First user in userfile
	ULONG	bi_LastUser	; Last user in userfile
	ULONG	bi_NumUsers	; Number of active users in userfile

	ULONG	bi_FirstKill	; First kill in killfile
	ULONG	bi_LastKill	; Number of last kill in killfile
	ULONG	bi_NumKills	; Number of active kills in killfile

	ULONG	bi_SumMarked	; Nr of marked messages on this BBS
				; This field should be regarded as a BOOL until you
				; have obtained a conference list for the bbs.
				; This field will only be updated during UpdateStruct()
	ULONG	bi_SumM2User	; Nr of marked messages on this BBS to the user
				; This field should be regarded as a BOOL until you
				; have obtained a conference list for the bbs.
				; This field will only be updated during UpdateStruct()
	LABEL	bi_sizeof


;  Structure used in List returned by GetBBSList

	STRUCTURE BBSListItem,0

	STRUCT	bl_Node,LN_SIZE		; Caller is free to use nl_Name
	WORD	bl_pad
	APTR	bl_Link			; Private!!!!!!!!
	APTR	bl_UserData		; For use by the caller; no restrictions!

	STRUCT	bl_Data,bd_sizeof	; Pointer to the BBS data
	STRUCT	bl_Internal,bi_sizeof	; Pointer to public internal data

	APTR	bl_BBSPath		; Path to the data directory for this BBS
					; Used for textfiles. Ends with a '/'
	ULONG	bl_ChangeCnt		; Private!!!!!!!!

	LABEL	bl_sizeof

**********************************************************************
*
* Conference structures and definitions
*


;  Structure holding general conference data  

	STRUCTURE ConfData,0

	APTR	cd_Name			; Name of Conference				
	ULONG	cd_KeepMsg		; Max number of messages to keep			
	ULONG	cd_KeepTime		; Oldest msg to keep (time in seconds)					
	APTR	cd_Signature		; Signature for conference, could be a NULL-pointer	
	APTR	cd_Alias		; Alias used in conference, NULL pointer, no alias		
	LONG	cd_BBSConfNr		; The internal number a conference has on the BBS			
	UWORD	cd_LineLength		; Max linelength in messages. Overrides BBSData if > 0	
	UBYTE	cd_CharSet		; Charset for the grab from this conf. Overrides			
					; BBSData if != BRCS_ANY											
	UBYTE	cd_QuoteType		; Prefered quite type for this conf. See above for 		
					; definitions.														
	ULONG	cd_Flags

	APTR	cd_XpkMethod		; What xpk method to use when packing this conference			
	APTR	cd_TagFile		; Tagfile to use in this conf. NULL-pointer, use bbs				
	APTR	cd_EMailAddr		; The Email address the user has in this conference. For use	
					; on bbses where the user is member of more than one net.		
	APTR	cd_ReplyString		; Reply string to use when a message is replied _and_			
					; moved. NULL means: Use bbs reply string. 						
	APTR	cd_ConfEnterScript	; Arexx script to be run each time this conference 	
					; is entered. Overrides bbs setting.						
	APTR	cd_ConfLeaveScript	; Arexx script to be run each time this conference 	
					; is left. Overrides bbs setting.							
	ULONG	cd_QuoteChars		; String to use as quote chars in custom quote type. 
					; Max length is 3. The string is NUL terminated.		
	UBYTE	cd_ConfNetType		; States which type of net the conference is on. To 	
					; be used on bbses of bbstypes which support serveral nettypes. Should only 	
					; be set by parser/packer for the bbstype. Se below for defines.					
	STRUCT	cd_reserved,3

	LABEL	cd_sizeof


;  ConfData.cd_Flags  

CDF_MEMBER_OF		EQU	(1<<0)	; Member of this conference
CDF_MAIL		EQU	(1<<1)	; Mail conference
CDF_READ_ONLY		EQU	(1<<2)	; Read only conference
CDF_COMPULSORY		EQU	(1<<3)	; Compulsory conference
CDF_FILE_INFO		EQU	(1<<4)	; File info conference
CDF_USER_INFO		EQU	(1<<5)	; User info conference
CDF_PRIVATE_ALLOWED	EQU	(1<<6)	; Private messages allowed
CDF_ENTER_ONLY_TO_ALL	EQU	(1<<7)	; Enter only allowed to ALL
CDF_ALIAS		EQU	(1<<8)	; Alias conference
CDF_BBS_KEEPMSG		EQU	(1<<9)	; Use BBS KeepMsg for this Conf
CDF_BBS_KEEPTIME	EQU	(1<<10)	; Use BBS KeepTime for this Conf
CDF_IGNORE_KEEPMSG	EQU	(1<<11)	; cd_KeepMsg is ignored. Messages won't
					; be counted when packing conference
CDF_IGNORE_KEEPTIME	EQU	(1<<12)	; cd_KeepTime is ignored. Time won't be
					; checked when packing conference
CDF_NO_XPK_METHOD	EQU	(1<<13)	; Don't use any xpk method on this conf
CDF_NO_SIGNATURE	EQU	(1<<14)	; Don't use any signature in this conf
CDF_NOT_ON_BBS		EQU	(1<<15)	; This conference is not on the BBS
CDF_NO_TAGS		EQU	(1<<16)	; Don't use message tags in this conf
CDF_REPLY_ONLY_TO_ALL 	EQU	(1<<17)	; Replies should be adresses to all
					; If both CDF_REPLY_ONLY_TO_ALL and CDF_ENTER_ONLY_TO_ALL flags is set are
					; all messages in the conference addressed to all.
CDF_NO_LINEWRAP_DISPLAY	EQU	(1<<18) ; Don't line wrap messages in this
					; conference when they are displayed. Should be used for conferences with
					; messages with ansi-codes. Typical conferences are conferences which are
					; used to display bulletins from the bbs.	
CDF_FILE_SIGNATURE	EQU	(1<<19)	; The cd_Signature field contains the
					; path and name of a file containing the signature.
CDF_AUTO_XPK_PACK	EQU	(1<<20)	; Automatically xpk pack new messages
					; when they are written to this conference. NB: A xpk method must have been
					; defined.	
CDF_NO_AUTO_XPK_PACK	EQU	(1<<21)	; No automatically xpk packing in this
					; conference. Overrides bbs og global flags for auto xpk packing.
CDF_MARK_OWN_MSGS	EQU	(1<<22)	; Also mark messages from user when
					; adding messages with the WBRMSG_MarkMessage tag in this conference.
CDF_COMMAND_SIGNATURE	EQU	(1<<23)	; The cd_Signature field contains the path
					; and name of a command. When the command is executed should the signature
					; contents be written to stdout. The template for the command is expected to be
					; BBSNAME/K,CONFNAME/K.	
CDF_REFLOW_QUOTING 	EQU	(1<<24)	; Reflow quoting should be on as default
					; when answering messages. This flag should only be considered when
					; cd_QuoteType is != QT_USE_SUPER.	
CDF_ALWAYS_REPLY_STR	EQU	(1<<25)	; Use reply string on all replies. This
					; flag should only be considered when cd_ReplyString is non NULL.
CDF_NO_REPLY_STR	EQU	(1<<26)	; Don't use reply strings in this conf.
					; Overrides the setting of cd_ReplyString.
CDF_BBS_REPLY_STR	EQU	(1<<27)	; Use bbs reply string settings.
					; Overrides all other conference reply string settings.
CDF_NO_CONF_ENTER_SCR	EQU	(1<<28)	; Don't use a conference enter script in this conference.
CDF_NO_CONF_LEAVE_SCR	EQU	(1<<29)	; Don't use a conference leave script on this conference.
CDF_FORCE_PACK_REWRITE	EQU	(1<<30)	; Force a rewrite next time this conference
					; is packed. If the packing succeed will the flagg be cleared.
CDF_ATTACH_FORBIDDEN	EQU	(1<<31)	; User may not attach files in this conference.


;  ConfData.cd_ConfNetType   

CDNT_NONET		EQU	0	; This conference is a local conference. This is the
					; default values for new conferences.
CDNT_FIDONET		EQU	1	; This conference is a Fido net conference.
CDNT_USENET		EQU	2	; This conference is a usenet conference.


;  Structure holding conference data maintained by the library 

	STRUCTURE ConfInternal,0

	ULONG	ci_FirstMsg		; First message in conference
	ULONG	ci_LastMsg		; Last message in conference
	ULONG	ci_NumMessages		; Number of active messages in conference
	ULONG	ci_MsgMarked		; Number of messages marked
	ULONG	ci_Marked2User		; Number of marked messages to user
	LABEL	ci_sizeof


;  Structure used in List returned by GetConfList  

	STRUCTURE ConfListItem,0

	STRUCT	cl_Node,LN_Size		; Caller is free to use nl_Name
	WORD	cl_pad
	APTR	cl_Link			; Private!!!!!!!!
	APTR	cl_UserData		; For use by the caller; no restrictions!
	STRUCT	cl_Data,cd_sizeof	; Pointer to the conference data
	STRUCT	cl_Internal,ci_sizeof	; Pointer to public internal data
	ULONG	cl_ChangeCnt		; Private!!!!!!!!
	LABEL	cl_sizeof


**********************************************************************
*
* File area structures and definitions
*


;  Structure holding general file area data  

	STRUCTURE FAreaData,0

	APTR	ad_Name;		; Name of file area
	LABEL	ad_sizeof


;  Structure holding file area data maintained by the library 

	STRUCTURE FAreaInternal,0

	ULONG	ai_FirstFile		; Number of the first file in this area
	ULONG	ai_NumFiles		; Number of files in this area
	LABEL	ai_sizeof


;  Structure used in List returned by GetFAreaList  

	STRUCTURE FAreaListItem,0

	STRUCT	al_Node,LN_SIZE		; Caller is free to use nl_Name
	WORD	al_pad
	APTR	al_Link			; Private!!!!!!!!
	APTR	al_UserData		; For use by the caller; no restrictions!
	STRUCT	al_Data,ad_sizeof	; Pointer to the file area data
	STRUCT	al_Internal,ai_sizeof	; Pointer to public internal data

	ULONG	al_ChangeCnt		; Private!!!!!!!!
	LABEL	al_sizeof


**********************************************************************
*
* Passive Conference list structures and definitions
*


	STRUCTURE PassConfListItem,0

	STRUCT	pl_Node,ln_size		; Caller is free to use nl_Name
	WORD	pl_pad
	APTR	pl_Name			; Must always be set.
	APTR	pl_Description		; NULL equals no available description
	LONG	pl_BBSConfNr		; The internal number the conf has on the bbs
	ULONG	pl_Flags		; Same as CondData.cd_Data.
	LABEL	pl_sizeof

**********************************************************************
*
* Message, event, user, kill, file flags and definitions.
*


;  Message flags (Returned by GBRMSG_Flags tag)

MDF_READ		EQU	(1<<0)	; Message is read
MDF_REPLIED		EQU	(1<<1)	; Message is replied
MDF_PRIVATE		EQU	(1<<2)	; Message is private
MDF_TO_USER		EQU	(1<<3)	; Message is to the user
MDF_FROM_USER		EQU	(1<<4)	; Message is from the user
MDF_DELETED		EQU	(1<<5)	; Message is deleted
MDF_UNRECOVERABLE	EQU	(1<<6)	; Message is can not be undeleted
MDF_KEEP		EQU	(1<<7)	; Keep message. Message will not be deleted
					; during packing of conference
MDF_TO_ALL		EQU	(1<<8)	; Message is to all (has no reciever)
MDF_XPK_TEXT		EQU	(1<<9)	; Message text is Xpk'ed (Private flag)
MDF_MARKED		EQU	(1<<10)	; Message is marked (Private flag)
MDF_URGENT		EQU	(1<<11)	; Message is urgent
MDF_IMPORTANT		EQU	(1<<12)	; Message is important
MDF_SUPERMARKED		EQU	(1<<13)	; Message will not be unmarked as long as this flag is set.

MDF_BINARY_PARTS	EQU	(1<<14)	; Message contains 1 or more BRMSG_BinaryPart tags
MDF_TEXT_PARTS		EQU	(1<<15)	; Message contains 1 or more BRMSG_TextPart tags
					; These two flags does also concern possible message parts.	

MDF_MESSAGE_PARTS	EQU	(1<<16)	; Message contains 1 or more BRMSG_MsgPart tags
MDF_CONFIDENTIAL	EQU	(1<<17)	; Message is confidential

MDF_HAZE_BIT0		EQU	(1<<24)	; Use MsgHazeLevel macro to extract haze
MDF_HAZE_BIT1		EQU	(1<<25)	; level from message flags.

;[dunno about this one  -Kenny]
;MsgHazeLevel(msgflags) ((msgflags & (MDF_HAZE_BIT0 | MDF_HAZE_BIT1)) >> 24)


;  Event flags (Returned by RBREV_Flags tag)
EDF_DELETED		EQU	(1<<0)	; Event is deleted
EDF_PACKED		EQU	(1<<1)	; Event is packed
EDF_DONE		EQU	(1<<2)	; Event is done
EDF_ERROR		EQU	(1<<3)	; Error performing this event
EDF_UNRECOVERABLE	EQU	(1<<4)	; Event can not be undeleted
EDF_FREEZE		EQU	(1<<5)	; Event is frozen. Will not be done as long as this flag is set.


;  Event types supported

EVE_ENTERMSG		EQU	0	; Enter message
EVE_REPLYMSG		EQU	1	; Reply message
EVE_JOINCONF		EQU	2	; Join conference
EVE_RESIGNCONF		EQU	3	; Resign conference
EVE_DOWNLOAD		EQU	4	; Download file
EVE_UPLOAD		EQU	5	; Upload file
EVE_CONFLIST		EQU	6	; Get conflist
EVE_CONFIGUREBBS	EQU	7	; Set correct configuration on the bbs.
EVE_SENDUSERINFO	EQU	8	; Send userinfo
EVE_GETMESSAGES		EQU	9	; Get specified messages
EVE_FORWARDMSG		EQU	EVE_GETMESSAGES	; Forward a message
EVE_GETNEWFILES		EQU	10	; Get new files listing
EVE_DOCOMMAND		EQU	11	; Command the script should do
EVE_AUTOLOGOFF		EQU	12	; Autologoff on next session
EVE_RETRACTMSG		EQU	13	; Retract message from bbs
EVE_RETRACTFILE		EQU	14	; Retract file from bbs
EVE_MAXEVENT		EQU	15


;  User flags (Returned by RBRUSR_Flags tag)
UDF_DELETED		EQU	(1<<0)	; User is deleted
UDF_UNRECOVERABLE	EQU	(1<<1)	; User can not be undeleted


;  Kill flags (Returned by RBRK_Flags tag)
KDF_DELETED		EQU	(1<<0)	; Kill is deleted
KDF_UNRECOVERABLE  	EQU	(1<<1)	; Kill can not be undeleted
KDF_MARK_KEEP		EQU	(1<<2)	; Mark message with MDF_KEEP if matched
KDF_MARK_URGENT		EQU	(1<<3)	; Mark message with MDF_URGENT if matched
KDF_MARK_IMPORTANT	EQU	(1<<4)	; Mark message with MDF_IMPORTANT if matched

KDF_MARK_HAZE_BIT0	EQU	(1<<24)	; Use KillHazeLevel macro to extract haze
KDF_MARK_HAZE_BIT1	EQU	(1<<25)	; level from kill flags.

;[dunno about this one either -Kenny]
;KillHazeLevel(killflags) ((killflags & (KDF_MARK_HAZE_BIT0 | KDF_MARK_HAZE_BIT1)) >> 24)


;  File flags (Returned by RBRF_Flags tag)
FDF_DELETED		EQU	(1<<0)	; File is deleted
FDF_UNRECOVERABLE	EQU	(1<<1)	; File is unrecoverable



**********************************************************************
*
*  Search result structures and definitions.
*


;[not sure if this one is correct -Kenny]

	STRUCTURE SearchResult,0	; Structure returned from SearchBRMessage()
	APTR	sr_NextResult		; Link to next SearchResult
	ULONG	sr_MsgsFound		; Number of messagenumbers in the buffer
	ULONG	sr_Messages		; Buffer holding the messagenumbers
					; NULL-terminated.
	LABEL	sr_sizeof


	STRUCTURE UserSuggestion,0	; Structure returned from SearchBRUser()
	STRUCT	us_Node,ln_size		; us_Node.ln_Name contains the name of the user
	ULONG	us_UserNr		; Number of user found
	LABEL	us_sizeof


	STRUCTURE FoundFile,0
	ULONG	ff_FileNr		; Number of file found
	STRUCT	ff_FArea,al_sizeof	; File area file belongs to. This is a list
					; item from the SBRF_SearchFAreaList or the
					; SBRF_SearchFArea.
	LABEL	ff_sizeof


	STRUCTURE SFileResult,0		; Structure returned by SearchBRFile()
	APTR	fr_NextResult		; Link to next SFileResult
	ULONG	fr_FilesFound		; Number of files in *this* SFileResult
	STRUCT	fr_Files,ff_sizeof	; Buffer holding FoundFile structures
	LABEL	fr_sizeof


	STRUCTURE FoundUser,0
	ULONG	fu_UserNr		; Number of user found
	ULONG	fu_FoundInTag		; In which tag the search string was found first in
	LABEL	fu_sizeof


	STRUCTURE SUserResult,0		; Structure returned by SearchBRUser()
	APTR	ur_NextResult		; Link to next SUserResult
	ULONG	ur_UsersFound		; Number of users in *this* SUserResult
	STRUCT	ur_Users,fu_sizeof	; Buffer holding FoundUser structures
	LABEL	ur_sizeof



**********************************************************************
*
*  Structure returned with data about user.
*


	STRUCTURE UserData,0		; Structure returned by BBSUserData()
	APTR	ud_Name
	APTR	ud_Street
	APTR	ud_Address
	APTR	ud_Country
 	APTR	ud_Phone		; May be NULL
	LABEL	ud_sizeof


**********************************************************************
*
*  Structures passed to callback hooks.
*

DEF_PROGRESS_UPDATES	EQU	100	; Default progress callbacks on each pass

;Prototype for the progress callback hook function should be:
;	ULONG __saveds __asm DoBRProgress(register __a0 struct Hook *hook, 
;		register __a2 struct BRProgress *progress, register __a1 APTR message);
;	No messages defined yet. The messages parameter will always be NULL;


	STRUCTURE BRProgress,0		; Structure passed as object to the different progress callback hooks

	ULONG	brp_Pass		; Some operations are done in more than one pass
	ULONG	brp_First		; First object in this pass.
	ULONG	brp_Last		; Last object in this pass.
					; brp_First may be greater than brp_Last!
	ULONG	brp_Current		; Current object.
	ULONG	brp_Actions		; How many objects so far which has been altered.
	ULONG	brp_Skip		; How manu objects done between each call to the hook. (read only)
	ULONG	brp_LastPass		; Is set to the value of brp_Pass had the last call to the hook.
	                   		; Is 0 in first call to hook
	LABEL	brp_sizeof

;pewh! -Kenny


	ENDC	; LIBRARIES_BBSREAD_I
