home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / MAXMAILP.ZIP / MAX_U.H < prev    next >
Text File  |  1990-10-12  |  11KB  |  181 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  MAXIMUS-CBCS Source Code, Version 1.02                                 *
  4.  *  Copyright 1989, 1990 by Scott J. Dudley.  All rights reserved.         *
  5.  *                                                                         *
  6.  *  Maximus USER.BBS structure definition                                  *
  7.  *                                                                         *
  8.  *  For complete details of the licensing restrictions, please refer to    *
  9.  *  the licence agreement, which is published in its entirety in MAX.C     *
  10.  *  and LICENCE.MAX.                                                       *
  11.  *                                                                         *
  12.  *  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  13.  *  MAXIMUS-CBCS LICENSING AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF THIS *
  14.  *  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES, OR IF YOU DO NOT HAVE   *
  15.  *  THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT ONE OF THE   *
  16.  *  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO USE THIS    *
  17.  *  FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE MAXIMUS-CBCS LICENSING   *
  18.  *  AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH THE   *
  19.  *  AUTHOR.                                                                *
  20.  *                                                                         *
  21.  *  You can contact the author at one of the address listed below:         *
  22.  *                                                                         *
  23.  *  Scott Dudley           FidoNet  1:249/106                              *
  24.  *  777 Downing St.        IMEXnet  89:483/202                             *
  25.  *  Kingston, Ont.         Internet f106.n249.z1.fidonet.org               *
  26.  *  Canada - K7M 5N3       BBS      (613) 389-8315 - HST/14.4K, 24hrs      *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30.  
  31. /* NOTE:  This structure is semi-stable.  Although it is still compatible  *
  32.  * with the old Opus 1.03 structure, don't expect it to stay that way      *
  33.  * for long.  In a future version, Maximus will be using a dymaic-sized    *
  34.  * user record, making it possible to make additions without breaking      *
  35.  * preexisting software.  You can start to code for this now in your       *
  36.  * software, as the usr.struct_len variable indicates the length of the    *
  37.  * current user structure, divided by twenty.  This allows us to build up  *
  38.  * a base of utilities, and be able to switch to a new format (while still *
  39.  * not breaking anything) in the future.  Also, if usr.sruct_len==0, then  *
  40.  * you MUST assume that the length of the structure is actually 180 bytes  *
  41.  * long, as Opus (and Maximus v1.00 only) did not use this field.  In      *
  42.  * other words:                                                            *
  43.  *                                                                         *
  44.  * len_of_struct=(usr.struct_len ? (usr.struct_len*20) : 180)              *
  45.  *                                                                         *
  46.  * In addition, you can assume that all user records in the user file are  *
  47.  * the SAME size...  ie. You can just read the first user record out of    *
  48.  * the file, and you are assured that the rest of the records in the file  *
  49.  * area also the same size.                                                *
  50.  *                                                                         *
  51.  *                                                                         *
  52.  * Example for reading in the dynamic-sized user structure:                *
  53.  *                                                                         *
  54.  *    {                                                                    *
  55.  *      struct _usr users[MAX_USERS];                                      *
  56.  *                                                                         *
  57.  *      int x,                                                             *
  58.  *          userfile,                                                      *
  59.  *          s_len;                                                         *
  60.  *                                                                         *
  61.  *      if ((userfile=open(ufile_name,O_RDONLY | O_BINARY))==-1)           *
  62.  *        Error();                                                         *
  63.  *                                                                         *
  64.  *      read(userfile,&users[0],sizeof(struct _usr));                      *
  65.  *                                                                         *
  66.  *      s_len=users[0].struct_len ? users[0].struct_len*20 : 180;          *
  67.  *                                                                         *
  68.  *      for (x=0;x < MAX_USERS;x++)                                        *
  69.  *      {                                                                  *
  70.  *        lseek(userfile,(long)x*(long)s_len,SEEK_SET);                    *
  71.  *        read(userfile,&users[x],sizeof(struct _usr));                    *
  72.  *      }                                                                  *
  73.  *                                                                         *
  74.  *      close(userfile);                                                   *
  75.  *    }                                                                    *
  76.  *                                                                         *
  77.  * If anything is added to the user structure, it will be appended to the  *
  78.  * END of the structure, so you can be assured that the offsets of each    *
  79.  * individual variable will NOT change.                                    *
  80.  *                                                                         *
  81.  * Also, when ADDING or DELETING users, certain special operations have    *
  82.  * to be performed, mainly those related to the lastread pointers.  When   *
  83.  * adding a user, the procedure is fairly simple; just make sure that      *
  84.  * usr.lastread_ptr is a unique number, different from all others in       *
  85.  * USER.BBS.  Although Max uses a somewhat complicated algorithm to        *
  86.  * fill gaps in the user file, most utility programs can just read through *
  87.  * USER.BBS, and keep a running tally of the HIGHEST usr.struct_len        *
  88.  * variable.  Once you have that, increment it by one, and stuff it into   *
  89.  * the usr.struct_len of the user to be added.                             *
  90.  *                                                                         *
  91.  * When DELETING users, you must go through the process of "cleansing"     *
  92.  * the lastread pointers for the user you deleted.  The procedure for this *
  93.  * is simple:  For every area listed in AREAS.CTL, open the LASTREAD.BBS   *
  94.  * file for that area, and seek to the offset...                           *
  95.  *                                                                         *
  96.  *    usr.lastread_ptr*(long)sizeof(int)                                   *
  97.  *                                                                         *
  98.  * ...and write *two* NUL bytes (ASCII 00).                                *
  99.  *                                                                         *
  100.  * Please note that you do NOT need to do anything special to sort the     *
  101.  * user file...  Since the lastread offset is stored in usr.lastread_ptr,  *
  102.  * you can sort the user file with impunity, and even use old Opus 1.03    *
  103.  * sort utilities.                                                         */
  104.  
  105.  
  106. #define bit   unsigned
  107. #define sword signed int
  108. #define word  unsigned int
  109. #define dword long int
  110. #define byte  unsigned char
  111.  
  112. /* Bits for usr.flag, below. */
  113.  
  114. #define UFLAG_deleted   0x01
  115. #define UFLAG_permanent 0x02
  116.  
  117. /* Bits for usr.bits, below */
  118.  
  119. #define BITS_hotkeys    0x01    /* Hotkeys, independent of HOTFLASH level */
  120.  
  121.  
  122.  
  123. #define hotkeys(usr)  hot_keys(&usr)
  124.  
  125.  
  126. struct   _usr
  127.    {
  128.       byte name[36];       /* Caller's name                                 */
  129. /*>*/ byte city[36];       /* Caller's location                             */
  130.  
  131. /**/  byte realname[21];   /* MAX: user's real name                         */
  132. /**/  byte phone[15];      /* MAX: user's phone number                      */
  133. /**/
  134. /**/  word lastread_ptr;   /* MAX: a num which points to offset in LASTREAD */
  135. /**/                       /* file -- Offset of lastread pointer will be    */
  136. /**/                       /* lastread_ptr*sizeof(int).                     */
  137. /**/  word timeremaining;  /* MAX: time left for current call (xternal prog)*/
  138.       byte pwd[16];        /* Password                                      */
  139.       word times;          /* Number of previous calls to this system       */
  140.  
  141. /**/  byte help;           /* Help level                                    */
  142. /**/  byte rsvd1;
  143.  
  144. /*>*/ byte tabs;           /* 0=transmit <sp> instead of <tab>              */
  145. /**/  byte rsvd2;
  146.  
  147. /**/  byte nulls;          /* Number of Nulls (delays) after <cr>           */
  148. /**/  byte bits;           /* More bit flags for user                       */
  149.  
  150.       word msg;            /* Last message area visited                     */
  151.  
  152. /**/  bit  bad_logon: 1;   /* MAX: if user's last logon attempt was bad     */
  153. /**/  bit  ibmchars : 1;   /* MAX: if user can receive high-bit chars       */
  154. /**/  bit  avatar   : 1;   /* MAX: if user can handle AVATAR graphics       */
  155.       bit  use_lore : 1;   /* Use the line-oriented editor                  */
  156.       bit  more     : 1;   /* Wants the "MORE?" prompt                      */
  157.       bit  ansi     : 1;   /* OPUS: set=wants Ansi                          */
  158.       bit  kludge   : 1;   /* OPUS: set=used Maximus before                 */
  159.       bit  formfeed : 1;   /* OPUS: set=transmit <ff>, clear=ignore <ff>    */
  160. /**/  bit  key      : 8;   /* MAX: lock/key system                          */
  161.  
  162. /*>*/ sword priv;          /* Access level                                  */
  163.       byte ldate[19];      /* Date of previous call (AsciiZ string)         */
  164. /**/  byte struct_len;     /* MAX: len of struct, divided by 20. SEE ABOVE! */
  165.       word time;           /* Time on-line so far today                     */
  166.  
  167.       word flag;           /* Used to hold baud rate for O)utside command   */
  168.                            /* In USER.BBS, usr.flag uses the constants      */
  169.                            /* UFLAG_xxx, defined earlier in this file.      */
  170.       
  171.       word upld;           /* K-bytes uploaded, all calls                   */
  172.       word dnld;           /* K-bytes downloaded, all calls                 */
  173.       word dnldl;          /* K-bytes downloaded, today                     */
  174.       word files;          /* Last file area visited                        */
  175.       byte width;          /* Width of the caller's screen                  */
  176.       byte len;            /* Height of the caller's screen                 */
  177.       word credit;         /* Matrix credit, in cents                       */
  178.       word debit;          /* Current matrix debit, in cents                */
  179.    };
  180.  
  181.