/*------------------------------------------------------------*/
/*            Sterling Service BBS header file                */
/*                                                            */
/* Contents copyright 1990 Tom Brown, B-Ware Computer Systems */
/*                 All rights Reserved.                       */
/*                                                            */
/* This file is supplied to those who may need to work with   */
/* the raw data files from the board, particularly the        */
/* USERFILE.                                                  */
/*------------------------------------------------------------*/




#ifdef SMALL_BBS

#define UMAX 200
#define MMAX 128
#define CMAX 128
#define CMASK 127
#define MMASK 127
#define NMAX 128
#define NMASK 127

#endif

#ifdef MEDIUM_BBS

#define UMAX 700
#define MMAX 256
#define CMAX 512
#define CMASK 511
#define MMASK 255
#define NMAX 512
#define NMASK 511

#endif

#ifdef LARGE_BBS

#define UMAX 2500
#define MMAX 512
#define CMAX 1024
#define CMASK 1023
#define MMASK 511
#define NMAX 512
#define NMASK 511

#endif



/* Main userfile information */

struct UserFile {
        char  Name[UMAX][16];       /* username */
        char  Password[UMAX][11];   /* user's password */
        UBYTE Level1[UMAX];         /* user #1 security flags */
        UBYTE Level2[UMAX];         /* user #2 security flags */
        UBYTE Sysop[UMAX];          /* sysop level security flags */
        ULONG LastOn[UMAX];         /* time(NULL) seconds of last logon */
        ULONG LastInClub[UMAX][6];  /* time last in each club */
        UWORD Up[UMAX][6];          /* total number of uploads so far */
        UWORD Down[UMAX][6];        /* total number of downloads so far */
        UWORD Ratio[UMAX][6];       /* up-download ratio 0=disabled */
        UBYTE Survey[UMAX];         /* survey response */
        UBYTE Valid[UMAX];          /* non-zero if this user entry is active */
        ULONG Times[UMAX];          /* number of times he's logged on */ 
        UBYTE Club[UMAX];           /* Default club setting */
        UBYTE Lines[UMAX];          /* number of lines on his screen */
        UBYTE Wide[UMAX];           /* screen width in characters */
        ULONG TimeLeft[UMAX];       /* time user has left today */
        UBYTE City[UMAX][16];       /* what city is he from */
        UBYTE State[UMAX][4];       /* what state is he from */
        UBYTE Area[UMAX][4];        /* his telephone area code */
        UBYTE Phone[UMAX][8];       /* his actual telephone number */
        UBYTE Novice[UMAX];         /* Novice Menu flags */
        UBYTE DownP[UMAX];          /* Default download protocol (future exp)*/
        UBYTE UpP[UMAX];            /* default upload protocol (future exp)*/
        UBYTE Pad1[UMAX];
        UBYTE Menu[UMAX];           /* which menu does he want */
        ULONG Messages[UMAX][6];    /* number of messages written */
        UBYTE ComType[UMAX];        /* computer type */
        UBYTE TimeAllowed[UMAX];    /* allowed seconds on line */
        ULONG FullOn[UMAX];         /* when was he last on FULL */
        ULONG Pad3[UMAX];
        
};

#define DLOAD1 (1<<0)
#define DLOAD2 (1<<1)
#define DLOAD3 (1<<2)
#define DLOAD4 (1<<3)
#define DLOAD5 (1<<4)
#define DLOAD6 (1<<5)
#define SHOPPER (1<<6)
#define WRITER (1<<7)

#define RELOGFLAG (1<<0)
#define NEWSMAN (1<<1)
#define ACCESS_PURPLE (1<<2)
#define ACCESS_BLUE (1<<3)
#define ACCESS_GREEN  (1<<4)
#define ACCESS_YELLOW (1<<5)
#define ACCESS_ORANGE (1<<6)
#define ACCESS_RED (1<<7)

#define SYSOP1 (1<<0)
#define SYSOP2 (1<<1)
#define SYSOP3 (1<<2)
#define SYSOP4 (1<<3)
#define SYSOP5 (1<<4)
#define SYSOP6 (1<<5)
#define MANAGER (1<<6)
#define USERFLAG (1<<7)

 /*   UserLevel = The Bits in the user's color key access (Level 2 )
      These flags are used in messages, file transfers, and for
      access to clubs, message area and file transfer area
                        
                        Bit 0   =   RELOGFLAG   can re-log on without signoff
                        Bit 1   =   NEWSMAN     can write a bulletin
                        Bit 2   =   ACCESS_PURPLE
                        Bit 3   =   ACCESS_BLUE 
                        Bit 4   =   ACCESS_GREEN 
                        Bit 5   =   ACCESS_YELLOW
                        Bit 6   =   ACCESS_ORANGE
                        Bit 7   =   ACCESS_RED
                        
      UserLevel = The Bits in the user's Read/Write access (Level 1 )
                        
                        Bit 0   =   DLOAD1      can he download in Club 1
                        Bit 1   =   DLOAD2      can he download in Club 2
                        Bit 2   =   DLOAD3      can he download in Club 3
                        Bit 3   =   DLOAD4      can he download in Club 4
                        Bit 4   =   DLOAD5      can he download in Club 5
                        Bit 5   =   DLOAD6      can he download in Club 6
                        Bit 6   =   SHOPPER     can he enter the mall
                        Bit 7   =   WRITER      can he write messages anywhere 
 
                        
      SysopLevel = The bits in the user's sysop access level

                        Bit 0   =  SYSOP1       sysop of Club 1
                        Bit 1   =  SYSOP2       sysop of Club 2
                        Bit 2   =  SYSOP3       sysop of Club 3
                        Bit 3   =  SYSOP4       sysop of Club 4
                        Bit 4   =  SYSOP5       sysop of Club 5
                        Bit 5   =  SYSOP6       sysop of Club 6
                        Bit 6   =  MANAGER      has controlling access of MALL
                        Bit 7   =  USERFLAG     control userfile (supervisor)


*/



/* Electronic Mail */

struct MailHeader  {
        ULONG Date[MMAX];           /* seconds = time(NULL) */
        UWORD From[MMAX];           /* user # this is from */
        UWORD To[MMAX];             /* user # this is to */
        UBYTE Sub[MMAX][30];        /* subject */
        UBYTE Attached[MMAX];       /* is a file xfer attached? */
        UBYTE Received[MMAX];       /* was this received? */
        ULONG Low;                  /* low mail number */
        ULONG Hi;                   /* high mail number */
};

/* Bulletins */

struct BullHeader {
        char  List[MMAX][80];       /* one-line description */
        UWORD Club[MMAX];           /* club # -- note size */
        ULONG Date[MMAX];           /* seconds = time(NULL) */
        UWORD From[MMAX];           /* user number who wrote it */
        UWORD Times[MMAX];          /* number of times read */
};
   


/* Messages and File Transfers */

struct ClubHeader   {

        UBYTE ClubNumber;           /* club number for load/save */
        char  NoteList[NMAX][80];   /* one-line description */
        UBYTE NoteSect[NMAX];       /* club section number */
        UBYTE NoteSecure[NMAX];     /* color locks (future use) */
        long  NoteNumber[NMAX];     /* actual message number */
        long  NoteDate[NMAX];       /* seconds = time(NULL) */
        UWORD NoteFrom[NMAX];       /* user number of writer */
        UWORD NoteTo[NMAX];         /* user # to -- if 0 then to all */
        UWORD NoteTimes[NMAX];      /* number of times read */
        UBYTE NoteReceived[NMAX];   /* flag if note was received */
        UWORD NoteThread[NMAX];     /* number of the message thread */
        
        
        char  XferList[CMAX][80];   /* one-line description */
        UBYTE XferSect[CMAX];       /* section number */
        UBYTE XferOk[CMAX];         /* can users see this? */
        long  XferDate[CMAX];       /* seconds =  time(NULL) */
        UWORD XferFrom[CMAX];       /* user number */
        UBYTE XferFlag[CMAX];       /* color locks */
        UWORD XferTimes[CMAX];      /* times read */
        UWORD XferWhere[CMAX];      /* which drive path to use */
        ULONG Low;                  /* low message number */
        ULONG Hi;                   /* high message number */
        UWORD HiThread;             /* high thread number */
        
};        

