
#define MSGT_VOID        0  // invalid mail if still set
#define MSGT_SYSOP       1  // mail is for sysop's eyes only
#define MSGT_PRIVATE     2  // to go in the users private mailbox
#define MSGT_PUBLIC      3  // public mail
#define MSGT_CONFERENCE  4  // to go in the conferene's mail area
#define MSGT_INTERNET    5  // an internet mail message
#define MSGT_FIDONET     6  // a fidonet mail message

#define MSGTYPES         7  // amount of mail types..

char *MSGTypeName[]={"Invalid Type","Sysop","Private","Public","Conference","Internet","FidoNet"};

#define MSGF_NORMAL        0    // initialise to this.
#define MSGF_PRIVATE       1    // price mail (does not show up to other users when reading mail)
#define MSGF_NODELETE      2    // if set message may not be deleted (except by sysop)
#define MSGF_MUSTREAD      4    // is displayed on screen, user must confirm reading
#define MSGF_AUTODELETE    8    // message deletes itself when read
#define MSGF_RESERVED     16    // reserved for future use
#define MSGF_REMOVEFILES  32    // is set, and there are attached files, then
                                // the attached files will be deleted along
                                // with the message.
struct MailData
{
  V_SMALLNUM Type; // MSGT_#?
  V_STRING From;                 // from handle (or return internet mail address)
  V_BIGNUM FromID;               // fromid (if a HBBS handle is in From, 0 otherwise)
  V_STRING To;                   // to handle (or an internet/fido address)
  V_BIGNUM ToID;                 // only if an HBBS username. set to 0 if not
                                 // for another hbbs user (i.e. internet,fidonet ALL or EVERYBODY)
  V_STRING Subject;              // subject
  V_DATE   CreateDate;           // format DD-MMM-YYYY
  V_DATE   ExpiryDate;           // ditto..
  V_BIGNUM Flags;                // MSGF_#? (Private,AutoDelete,etc...)
  V_STRINGLIST AttachedFileList; // list of attached files (full paths ONLY in ln_Name)
  V_BIGNUM AttachedFiles;        // amount of attached files
  V_BIGNUM UserAccessLevel;      // of the user who wrote the message
  V_BIGNUM AccessLevel;          // user must have a higher or equal access to read it
  V_STRINGLIST Data;             // the actual message text
};


struct MsgNode
{
  struct Node node;    //ln_Name Contains the subject
  V_BIGNUM Number;
  char *From;
  V_BIGNUM FromID;
  char *To;
  V_BIGNUM ToID;
  V_BIGNUM Flags;
  V_SMALLNUM Type;
  V_BIGNUM ConfNum; // number of conference mail was from, if type is MSGT_CONFERENCE
  V_BOOL ReadIt;      // flag to tell us if a user has read this mail or not..
};

#define MAILDIR_PUBLIC    "HBBS:Mail/Public/"
#define MAILDIR_SYSOP     "HBBS:Mail/Sysop/"
#define MAILDIR_USER      "HBBS:Mail/Users/"

#define MAILSTATFILE      "MailStats.CFG"
/*

  Type
  From
  fromID
  To
  ToID
  Subject
  CreateDate
  ExpiryDate
  Flags
  AttachedFile_xx

*/

// *C* implent usage in mail doors and write a config program

struct UserMailConfig_s
{
  V_BOOL ShowALLInScan;            // show messages from ALL in a mailscan

  V_BIGNUM MinALLAccessLevel;      // user writing the mail to ALL must have an access level
                                   // of this or higher for the message to show up in a mailscan

  V_STRING MailSig;                // appended to every message the user writes
};

struct MailSystemConfig_s
{
  V_BOOL InternetMail;
  V_BOOL FidoNetMail;
  V_BIGNUM DefaultExpiryDays;
};

struct MailSystemConfig_s MailSystemConfig={FALSE,FALSE,30};

#define SML_ALL 1
#define SML_UNREAD 2

