#ifndef _folderP_h_
#define _folderP_h_

#include "folder.h"
#include "assert.h"

#ifndef FOLDER_DEBUG
#define FOLDER_DEBUG 0
#endif

#if (FOLDER_DEBUG == 0)
#define AlFolder_debug(str)
#define AlFolder_debug2(s1, s2)
#else
#define AlFolder_debug(str) printf("%s\n", str)
#define AlFolder_debug2(s1, s2) printf("%s %s\n", s1, s2)
#endif            /* end of  #if (FOLDER_DEBUG == 0)  */

#define AlFolder_bool_str(bool) \
          (bool == Bool_TRUE) ? "Bool_TRUE" : "Bool_FALSE"

/*************************************************************/
/*******  Definitions for Error Msgs                  ********/
/*******  ------------------------------------------  ********/
/*******    these are indexed by:                     ********/
/*******         AlFolder_get_error_code(AlFolder);   ********/
/*******    and are returned by:                      ********/
/*******         AlFolder_get_error_msg(AlFolder);    ********/
/*******    the codes are defined in "folder.h"       ********/
/*************************************************************/

const char *AlFolder_error_strings[] = {
 "Folder :: No Error. All is fine in Folder Object.",
 "Folder :: State File for this Msg contains erroneous data.",
 "Folder :: State File for this Msg contains more fields than it should.",
 "Folder :: State File for this Msg contains less fields than it should.",
 "Folder: User Property Info for the Msg contains erroneous data.",
 "Folder: User Property Info for the Msg contains more fields than it should.",
 "Folder: User Property Info for the Msg contains less fields than it should.",
 "Folder: User Property Info for this Msg is missing required 'field-count:'.",
 "Folder:: Do not have write access to the file.",
 "Folder:: Failed attempt to add a msg to a folder.",
 "Folder:: Failed attempt to remove a msg from a folder."
  };


typedef struct AlFolder_MsgPackette_struct {
  /* This object is accessed by the folder type's create functions.     */
  /* All info about the memory allocated for the currently open message */
  /* is stored in a Msg Packette, for clearity of thought and ease of   */
  /* de-allocation of memory when Msg destroy time occurs.              */
  /* ------------------------------------------------------------------ */
  /* Buffers */
  char *msg_buffer;       /* buffer Msg ob was created from, owned by folder */
  char *state_buffer;
  char *uprop_buffer;
  /* States */
  Bool no_external_state_usage; /* Bool_FALSE if external info is to be kept */
  Bool no_external_uprop_usage; /* Bool_FALSE if external info is to be kept */
  /* Msg object */
  Msg the_msg;
 } AlFolder_MsgPackette_Ob, *AlFolder_MsgPackette;

typedef struct AlFolder_Object_struct {
  char *name;
  /* Name Spaces */
  Registry fs_state_registry;    /* folder/mailer specific info about msg    */
  Registry folder_prop_registry; /* folder/mailer specific info about folder */
  /* States */
  Bool do_nested_folders;        /* the recursion flag */
  AlFolder_MsgPackette current_msg_packette;
  /* Error Info */
  int error_code;
  /* States that are purely for Data Collection */
  int num_rules_fired;
  /* Mailer/Folder Type specific functions and info */
  char *mailer_type_name;        /* "mh", "rmail", "babble", "muse1", etc.   */
  AlFolderType mailer_type;
  VOIDP data;                    /* folder type instance data, a data object */

} AlFolderObject;

#endif         /* end of ifndef _folderP_h_ :: DO NOT WRITE BELOW THIS LINE. */
