home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / MSTR20R1.LZH / MSTRUCT.H
C/C++ Source or Header  |  1991-11-11  |  62KB  |  1,420 lines

  1. /*****************************************************************************
  2.                          Maximus Structure Definitions
  3.  *****************************************************************************
  4.  
  5.  Copyright 1989-1991 by Scott J. Dudley.  All rights reserved.
  6.  Portions copyright 1990 by Bit Bucket Software, Inc.  Used with permission.
  7.  
  8.  This file contains the C structures used by Maximus 2.0.  Most of the
  9.  structures were designed to be compatible with future versions, so
  10.  PLEASE write your programs to permit variable-length structures. When
  11.  we finally changed the user file size in Max 2.0, we found that a
  12.  number of poorly-written third-party programs would not work under
  13.  the new version.  (This is talking collectively, as Max SysOps.)
  14.  
  15.  However, programs which were properly written to spec worked as
  16.  advertised, with no problems encountered.  The user file, the area
  17.  file, and a few others are all VARIABLE LENGTH.  This may make things
  18.  difficult if you're coding in Pascal or BASIC, but it's a cinch under
  19.  C, and it makes things much more expandable.
  20.  
  21.  Just to make sure that everyone follows this, I may make the next
  22.  version Maximus generate a random user record size.  }:->
  23.  
  24.  This file isn't as clean as I'd like it to be; it was thrown together
  25.  in about an hour or so, scraping together the various tidbits from
  26.  all over the Max source.  I had planned to clean it up and publish
  27.  some sort of developer's kit, but I don't have time.
  28.  
  29.  The format for the Squish message base will be published in a
  30.  separate file, with a full source release of the Maximus level 0
  31.  MsgAPI layer.  I indend to make this available in a short period of
  32.  time, but no guarantees.
  33.  
  34.  Scott J. Dudley
  35.  November 11th, 1991
  36.  FidoNet 1:249/106
  37.  Internet f106.n249.z1.fidonet.org
  38.  
  39.  *****************************************************************************/
  40.  
  41.  
  42. #include <time.h>
  43.  
  44. /* Portability declarations */
  45.  
  46. #if defined(__386__) || defined(__FLAT__)
  47.   typedef unsigned      bit;
  48.  
  49.   typedef unsigned char byte;
  50.   typedef signed char   sbyte;
  51.  
  52.   typedef unsigned short word;
  53.   typedef signed short   sword;
  54.  
  55.   typedef unsigned int  dword;
  56.   typedef signed int    sdword;
  57.  
  58.   typedef unsigned short ushort;
  59.   typedef   signed short sshort;
  60.  
  61.   typedef unsigned long  ulong;
  62.   typedef   signed long  slong;
  63. #else
  64.   typedef unsigned      bit;
  65.  
  66.   typedef unsigned char byte;
  67.   typedef signed char   sbyte;
  68.  
  69.   typedef unsigned int  word;
  70.   typedef signed int    sword;
  71.  
  72.   typedef unsigned long dword;
  73.   typedef signed long   sdword;
  74.  
  75.   typedef unsigned short ushort;
  76.   typedef   signed short sshort;
  77.  
  78.   typedef unsigned long  ulong;
  79.   typedef   signed long  slong;
  80. #endif
  81.  
  82.  
  83.  
  84.  
  85. /* DOS-style bitmapped datestamp */
  86.  
  87. struct _stamp   
  88. {
  89.   struct
  90.   {
  91.     unsigned int da : 5;
  92.     unsigned int mo : 4;
  93.     unsigned int yr : 7;
  94.   } date;
  95.  
  96.   struct
  97.   {
  98.     unsigned int ss : 5;
  99.     unsigned int mm : 6;
  100.     unsigned int hh : 5;
  101.   } time;
  102. };
  103.  
  104.  
  105. struct _dos_st
  106. {
  107.   word date;
  108.   word time;
  109. };
  110.  
  111. /* Union so we can access stamp as "int" or by individual components */
  112.  
  113. union stamp_combo   
  114. {
  115.   dword ldate;
  116.   struct _stamp msg_st;
  117.   struct _dos_st dos_st;
  118. };
  119.  
  120. typedef union stamp_combo SCOMBO;
  121.  
  122.  
  123.  
  124. /* Access levels, as used in user file, PRM file, and others. */
  125.  
  126. #define  TWIT        -2 /* 0xFFFE */
  127. #define  DISGRACE    0x0000
  128. #define  LIMITED     0x0001  /**/
  129. #define  NORMAL      0x0002
  130. #define  WORTHY      0x0003  /**/
  131. #define  PRIVIL      0x0004
  132. #define  FAVORED     0x0005  /**/
  133. #define  EXTRA       0x0006
  134. #define  CLERK       0x0007  /**/
  135. #define  ASSTSYSOP   0x0008
  136. #define  SYSOP       0x000A
  137. #define  HIDDEN      0x000b
  138.  
  139.  
  140. /* Miscellaneous definitions */
  141.  
  142. #define MAX_KEYS           32
  143. #define MAX_ALEN           10   /* Max length of usr.msg[] and usr.files[]  */
  144. #define MAX_OVR            16   /* Maximum # of override privs per area     */
  145. #define NUM_MENU          256   /* Max. # of options in a menu file         */
  146. #define PATHLEN           120   /* Max. length of a path                    */
  147. #define MAX_MENUNAME  PATHLEN   /* Max. length of menuname[].               */
  148. #define MAXEXPAND          30   /* max wildcard expansion                   */
  149. #define CHAR_BITS           8   /* Number of bits in a `char' variable      */
  150. #define MAX_AREAS        1296   /* Maximum number of total areas -- obsolete*/
  151.  
  152.  
  153.  
  154. /* Enumeration `option' -- All possible values for menu.option[x].type,     *
  155.  * below.                                                                   */
  156.  
  157. typedef enum
  158. {
  159.   nothing,
  160.  
  161.   MISC_BLOCK=100, display_menu, display_file, message, file, other,
  162.                   o_press_enter, key_poke, clear_stacked, o_if,
  163.                   o_menupath, area_change, o_cls,
  164.  
  165.  
  166.   XTERN_BLOCK=200, xtern_erlvl, xtern_dos, xtern_run, xtern_chain,
  167.                    xtern_concur,
  168.  
  169.   MAIN_BLOCK=300, goodbye, statistics, o_yell, userlist, o_version,
  170.                   user_editor, leave_comment, climax,
  171.  
  172.   MSG_BLOCK=400, same_direction, read_next, read_previous,
  173.                  enter_message, msg_reply, read_nonstop,
  174.                  read_original, read_reply, msg_list, msg_scan,
  175.                  msg_inquire, msg_kill, msg_hurl, forward, msg_upload,
  176.                  xport, read_individual, msg_checkmail, msg_change,
  177.                  msg_tag, msg_browse, msg_current, msg_edit_user,
  178.                  msg_upload_qwk,
  179.  
  180.   FILE_BLOCK=500, locate, file_titles, file_type, upload, download, raw,
  181.                   file_kill, contents, file_hurl, override_path,
  182.                   newfiles, file_tag,
  183.  
  184.   /* Options generally found on the Change Setup menu */
  185.  
  186.   CHANGE_BLOCK=600, chg_city, chg_password, chg_help, chg_nulls,
  187.                     chg_width, chg_length, chg_tabs, chg_more,
  188.                     chg_video, chg_editor, chg_clear, chg_ibm,
  189.                     chg_phone, chg_realname, chg_hotkeys,
  190.                     chg_language, chg_userlist, chg_protocol,
  191.                     chg_fsr, chg_archiver,
  192.  
  193.   EDIT_BLOCK=700, edit_save, edit_abort, edit_list, edit_edit,
  194.                   edit_insert, edit_delete, edit_continue, edit_to,
  195.                   edit_from, edit_subj, edit_handling, read_diskfile,
  196.                   edit_quote,
  197.  
  198.   /* Stuff that was hacked on after the original implementation */
  199.  
  200.   CHAT_BLOCK=800, who_is_on, o_page, o_chat_cb, chat_toggle, o_chat_pvt,
  201.     
  202.   END_BLOCK,
  203.  
  204.  
  205.   /* Everything below here is RESERVED by Maximus for future uses!         *
  206.    * Also, everything ABOVE is fairly stable.  If changes have to be made, *
  207.    * the old options above will NOT be re-used.  For example, if the       *
  208.    * `edit_insert' command should become obsoleted for some reason, that   *
  209.    * slot would either get retired and do nothing, or perform the NEW      *
  210.    * edit_insert function.                                                 */
  211.  
  212.   rsvd=32766  /* This was stuck in to make sure that the `option'          *
  213.                * enumeration uses a word, instead of a byte, in case we    *
  214.                * really expand this structure sometime soon.               */
  215.  
  216. } option;
  217.  
  218.  
  219. /* An individual menu option.  There are many of these contained in one    *
  220.  * _menu file, following the _menu data header, optionally with some       *
  221.  * NULL-terminated strings between each _opt structure, for the argument.  *
  222.  * One of these for each option in *.MNU.                                  */
  223.  
  224. struct _opt
  225. {
  226. #ifdef __FLAT__
  227.   /* force enum to be 16 bits */
  228.   word type;
  229. #else
  230.   option type;  /* What this menu option does                              */
  231. #endif
  232.  
  233.   word priv;    /* Priv level required to execute this command             */
  234.   dword lock;   /* Bit-field locks for this particular menu option         */
  235.   word flag;    /* See the OFLAG_xxx contants for more info.               */
  236.   word name;    /* The menu option, as it appears to user                  */
  237.   word keypoke; /* Auto-keypoke string                                     */
  238.   word arg;     /* The argument for this menu option                       */
  239.   byte areatype;/* If this particular option can only be used if the user  *
  240.                  * is in a certain message-area type.                      */
  241.   byte fill1;   /* Reserved by Maximus for future use                      */
  242.  
  243.   byte rsvd[8]; /* Reserved for future uses */
  244. };
  245.  
  246.  
  247. /* Header of each *.MNU file */
  248.  
  249. struct _menu
  250. {
  251.   word header,      /* What to display when the user enters menu, such as  *
  252.                      * "The MESSAGE Section", "The CHG SETUP Section", etc */
  253.        num_options, /* Total number of options (struct _opt's) in menu     */
  254.        menu_length; /* Number of lines long the .?BS menu file is!         */
  255.  
  256.   sword hot_colour; /* What colour to display if a user uses hotkeys to    *
  257.                      * bypass a .?BS menu display, before displaying the   *
  258.                      * key.  -1 == display nothing.                        */
  259.  
  260.   word title;       /* Length of the title string, not counting \0.        */
  261.   word headfile;    /* Length of the header filename, not counting \0      */
  262.   word dspfile;     /* Name of file to display for menu, instead of        *
  263.                      * generating menu from .Mnu file.                     */
  264.   word flag;        /* See MFLAG_XXX, below.                               */
  265. };
  266.  
  267.  
  268.  
  269. #define MFLAG_MF_NOVICE   0x0001u /* MenuFile for these levels only */
  270. #define MFLAG_MF_REGULAR  0x0002u
  271. #define MFLAG_MF_EXPERT   0x0004u
  272. #define MFLAG_MF_HOTFLASH 0x0008u
  273.  
  274. #define MFLAG_MF_ALL      (MFLAG_MF_NOVICE | MFLAG_MF_REGULAR | \
  275.                            MFLAG_MF_EXPERT | MFLAG_MF_HOTFLASH)
  276.  
  277. #define MFLAG_HF_NOVICE   0x0010u /* HeaderFile for these levels only */
  278. #define MFLAG_HF_REGULAR  0x0020u
  279. #define MFLAG_HF_EXPERT   0x0040u
  280. #define MFLAG_HF_HOTFLASH 0x0080u
  281.  
  282. #define MFLAG_HF_ALL      (MFLAG_HF_NOVICE | MFLAG_HF_REGULAR | \
  283.                            MFLAG_HF_EXPERT | MFLAG_HF_HOTFLASH)
  284.  
  285. #define MFLAG_SILENT      0x0100u /* Silent menuheader option */
  286.  
  287.  
  288.  
  289.  
  290. /* Structure of BBSTATxx.BBS */
  291.  
  292. #define STATS_VER           1   /* Version number of the BBSTATxx.BBS file */
  293.  
  294. struct _bbs_stats
  295. {
  296.   byte    version;
  297.   dword   num_callers;
  298.   dword   quote_pos;
  299.   dword   msgs_written;
  300.   time_t  online_date;
  301.   dword   total_dl;
  302.   dword   total_ul;
  303.   sword   today_callers;
  304.   union stamp_combo date;
  305. };
  306.  
  307. /* Structure for entries in PROTOCOL.MAX */
  308.  
  309. struct _proto
  310. {
  311.   #define P_ISPROTO 0x01  /* This bit always set                            */
  312.   #define P_BATCH   0x02  /* Can handle batch transfers                     */
  313.   #define P_OPUS    0x04  /* Write an Opus-style .CTL file                  */
  314.   #define P_ERL     0x08  /* Exit with xtern_erlvl                          */
  315.   #define P_BI      0x10  /* Bidirectional transfer                         */
  316.  
  317.   word flag;
  318.  
  319.   char desc[40];
  320.   char log[PATHLEN];
  321.   char ctl[PATHLEN];
  322.   char dlcmd[PATHLEN];
  323.   char ulcmd[PATHLEN];
  324.   char dlstr[40];
  325.   char ulstr[40];
  326.   char dlkey[40];
  327.   char ulkey[40];
  328.     
  329.   word fnamword;
  330.   word descword;
  331. };
  332.  
  333.  
  334. /* Structure for IPCxx.BBS header */
  335.  
  336. struct _cstat
  337. {
  338.   word avail;
  339.  
  340.   byte username[36];
  341.   byte status[80];
  342.  
  343.   word msgs_waiting;
  344.  
  345.   dword next_msgofs;
  346.   dword new_msgofs;
  347. };
  348.  
  349.  
  350.  
  351. /* Types for _cdat.type */
  352.  
  353. #define CMSG_PAGE       0x00   /* "You're being paged by another user!"     */
  354. #define CMSG_ENQ        0x01   /* "Are you on this chat channel?"           */
  355. #define CMSG_ACK        0x02   /* "Yes, I AM on this channel!"              */
  356. #define CMSG_EOT        0x03   /* "I'm leaving this chat channel!"          */
  357. #define CMSG_CDATA      0x04   /* Text typed by used while in chat          */
  358. #define CMSG_HEY_DUDE   0x05   /* A normal messge.  Always displayed.       */
  359. #define CMSG_DISPLAY    0x06   /* Display a file to the user                */
  360.  
  361. /* Message data element within IPCxx.BBS */
  362.  
  363. struct _cdat
  364. {
  365.   word tid;
  366.   word type;
  367.   word len;
  368.  
  369.   dword rsvd1;
  370.   word  rsvd2;
  371. };
  372.  
  373.  
  374. /* Handle for saving CHAT status.  Mainly used internally, but also        *
  375.  * in RESTARxx.BBS.                                                        */
  376.  
  377. struct _css
  378. {
  379.   word avail;
  380.   byte status[80];
  381. };
  382.  
  383. /***************************************************************************
  384.                     Definitions for the .PRM file
  385.  ***************************************************************************/
  386.  
  387. #define OFS word
  388.  
  389. #define MAX_DRIVES         26   /* Maximum number of drives on system      */
  390. #define CHAR_BITS           8   /* Number of bits in a 'char'              */
  391. #define CTL_VER             9   /* Version number of BBS.PRM               */
  392.  
  393. /* This macro is ONLY used for accessing *pointers* in the `prm' structure.
  394.    This is required, due to the way Wynn has made OPUS_CTL write the strings
  395.    out (which uses a lot less memory than some other ways).  If you want
  396.    to access an INT, or a non-pointer in the structure, then you can use
  397.    a `prm.var_name'-style reference.                                       */
  398.  
  399. #define PRM(s) (offsets+(prm.s))
  400.  
  401. #define MAX_LANG           8       /* Max. number of possible languages    */
  402. #define MAX_YELL          10       /* Max number of yell slots             */
  403. #define MAX_EXTERNP       16       /* max. number of external programs     */
  404. #define MAXCLASS          12       /* number of possible priv levels       */
  405. #define ALIAS_CNT         15       /* number of matrix addresses           */
  406.  
  407.  
  408.           /** Definitions for the `prm.flags' variable **/
  409.  
  410. #define FLAG_keyboard    0x0001 /* If local mode is on by default          */
  411. #define FLAG_watchdog    0x0002 /* Use watchdog for outside commands       */
  412. #define FLAG_snoop       0x0004 /* If snoop is on by default               */
  413. #define FLAG_norname     0x0008 /* If we should disable ^aREALNAME kludge  */
  414. #define FLAG_close_sf    0x0010 /* Close all standard files for O)utside   */
  415. #define FLAG_break_clr   0x0020 /* Send a break signal to dump modem's     *
  416.                                  * internal buffer                         */
  417. #define FLAG_log_echo    0x0040 /* Log user-written echomail               */
  418. #define FLAG_no_ulist    0x0080 /* User can't press '?' to list users in   *
  419.                                  * msg.                                    */
  420. #define FLAG_no_magnet   0x0100 /* Disable the MagnEt editor               */
  421. #define FLAG_autodate    0x0200 /* Automatically search directory for      */
  422.                                 /* file size & date.                       */
  423. #define FLAG_statusline  0x0400 /* If SysOp wants a status line on screen  */
  424. #define FLAG_ask_phone   0x0800 /* If we should ask user for phone number  */
  425. #define FLAG_noyell      0x1000 /* If yell is toggled on or off by Sysop   */
  426. #define FLAG_lbaud96     0x2000 /* If we should use 9600 baud for local    *
  427.                                  * callers... (For Opus compatibility!)    */
  428. #define FLAG_alias       0x4000 /* If we're running a system which allows  *
  429.                                  * aliases or handles                      */
  430. #define FLAG_ask_name    0x8000 /* If we should ask user for their alias   *
  431.                                  * name too -- Only needed if using        *
  432.                                  * FLAG_alias.                             */
  433.  
  434. #define FLAG2_gate       0x0001 /* Gate netmail messages, use zonegate!    */
  435. #define FLAG2_has_snow   0x0002 /* Video adapter is slow CGA w/snow        */
  436. #define FLAG2_msgread    0x0004 /* If arrow keys can be used for reading   */
  437. #define FLAG2_ltimeout   0x0008 /* Local keyboard timeout                  */
  438. #define FLAG2_noshare    0x0010 /* SHARE not used -- don't lock files!     */
  439. #define FLAG2_CAPTURE    0x0020 /* Sysop chat capture automatically on     */
  440. #define FLAG2_NOCRIT     0x0040 /* Don't use internal crit.err handler     */
  441. #define FLAG2_CHECKDUPE  0x0080 /* Check for duplicate uploads             */
  442. #define FLAG2_CHECKEXT   0x0100 /* Compare extension for duplicate uploads */
  443.  
  444. #define LOG_terse       0x02
  445. #define LOG_verbose     0x04
  446. #define LOG_trace       0x06
  447.  
  448. #define MULTITASKER_none        0
  449. #define MULTITASKER_doubledos   1
  450. #define MULTITASKER_desqview    2
  451. #define MULTITASKER_topview     3
  452. #define MULTITASKER_mlink       4
  453. #define MULTITASKER_mswindows   5
  454. #define MULTITASKER_os2         6
  455. #define MULTITASKER_pcmos       7
  456.  
  457. #define VIDEO_DOS         0x00 /* Standard DOS output hooks */
  458. #define VIDEO_FOSSIL      0x01 /* FOSSIL write-character function */
  459. #define VIDEO_IBM         0x02 /* Direct screen writes */
  460. #define VIDEO_FAST        0x03 /* Semi-fast undocumented DOS call */
  461. #define VIDEO_BIOS        0x04 /* Semi-faster int 10h BIOS writes */
  462.  
  463.  
  464.  
  465. /* Special values for the character set byte */
  466.  
  467. #define CHARSET_SWEDISH   0x01
  468. #define CHARSET_CHINESE   0x02
  469.  
  470. #define XTERNEXIT       0x40      /* If external protocl has erlvl exit */
  471. #define XTERNBATCH      0x80      /* If protocol can do batch transfers */
  472.  
  473. #ifndef _ADDRESS_DEFINED
  474. #define _ADDRESS_DEFINED
  475. typedef struct _ADDRESS
  476. {
  477.   word Zone;
  478.   word Net;
  479.   word Node;
  480.   word Point;
  481. } ADDR;
  482. #endif
  483.  
  484.  
  485. struct   cl_rec
  486. {
  487.   sword    priv;
  488.   word     max_time;      /* max cume time per day         */
  489.   word     max_call;      /* max time for one call         */
  490.   word     max_dl;        /* max dl kbytes per day         */
  491.   word     ratio;         /* ul:dl ratio                   */
  492.   word     min_baud;      /* speed needed for logon        */
  493.   word     min_file_baud; /* speed needed for file xfer    */
  494. };
  495.  
  496. /* Note: To read in the *.PRM structure, first read in the m_pointers       *
  497.  * structure, which is always contained at the beginning of the file.       *
  498.  * Then, seek to the offset prm.heap_offset, and read in everything         *
  499.  * from there to EOF into heap[].  All of the 'OFS' type variables          *
  500.  * are simply offsets into the variable-length heap which started at        *
  501.  * heap_offset. To obtain a string from the .PRM heap, simply               *
  502.  * add the offset in the m_pointers structure to the address of the         *
  503.  * heap[] variable that the heap was read into.  For example, to access     *
  504.  * the string for 'system_name', you'd use '(heap+prm.system_name)'.        *
  505.  * Alternatively, you can declare a macro to do this, such as the           *
  506.  * PRM() macro shown above.  (Maximus itself uses the variable              *
  507.  * 'strings' instead of 'heap' to hold the varible-length strings,          *
  508.  * but the concept is the same.)  When using the PRM() macro to             *
  509.  * access the string for 'system_name', you'd simply write:                 *
  510.  * 'PRM(system_name)', which is a lot clearer.  Also, please note that      *
  511.  * NON-OFS variables should be accessed normally!  That means that          *
  512.  * 'task_num', 'auto_kill', can be access with 'prm.task_num',              *
  513.  * 'prm.auto_kill', etc.  The special heap manipulation is only needed      *
  514.  * for strings.                                                             */
  515.  
  516. struct m_pointers
  517. {
  518.  
  519.         /*-----------------------------------------------------------*/
  520.         /* DATA                                                      */
  521.         /*-----------------------------------------------------------*/
  522.  
  523.   byte  id;             /* Always equal to 'M'               STABLE  */
  524.   byte  version;        /* for safety                        STABLE  */
  525.   word  heap_offset;    /* OFFSET OF BEGINNING OF HEAP!      STABLE  */
  526.   byte  task_num;       /* for multi-tasking systems         STABLE  */
  527.   sword com_port;       /* Com1=0, Com2=1, etc               STABLE  */
  528.   byte  noise_ok;       /* If yell noise is currently on     STABLE  */
  529.  
  530.   /* Miscellanious system information */
  531.  
  532.   byte  video;          /* Mode for local video display              */
  533.   byte  log_mode;       /* What style of logging to use              */
  534.   word  max_baud;    /* fastest speed we can use                  */
  535.   byte  multitasker;    /* flag for DoubleDos (see below)            */
  536.   byte  nlver;          /* Which nodelist version we use (5 or 6)    */
  537.   word  min_ulist;      /* Min and max privs for the U)serlist cmd   */
  538.   word  max_ulist;      /*    "                                      */
  539.  
  540.   /* Information about errorlevels */
  541.  
  542.   byte  exit_val;       /* Erl to use after caller if none of below  */
  543.   byte  edit_exit;      /* erl to use after matrix mail written      */
  544.   byte  echo_exit;      /* ERRORLEVEL for after inbound echomail     */
  545.   byte  local_exit;     /* Errorlevel after entering local msgs      */
  546.  
  547.   /* Modem information */
  548.  
  549.   sword carrier_mask;
  550.   sword handshake_mask;
  551.  
  552.   /* Log-on information */
  553.  
  554.   sword logon_priv;     /* Access level for new users                */
  555.   word  logon_time;     /* time to give for logons                   */
  556.   word  min_baud;    /* minimum baud to get on-line               */
  557.   word  speed_graphics; /* min baud for graphics                  */
  558.  
  559.   /* Information about message areas */
  560.  
  561.   byte  auto_kill;      /* RECD PVT msgs. 0=no 1=ask 2=yes            */
  562.  
  563.   sword ctla_priv;      /* Priv to see CONTROL-A lines in messages    */
  564.   sword seenby_priv;    /* Min priv to see SEEN-BY line               */
  565.   sword pvt_priv;       /* Min priv to read pvt msgs                  */
  566.  
  567.   sword msg_ask[16];    /* Array of privs. for message attr ask's     */
  568.   sword msg_assume[16]; /* Array of privs. for message attr assume's  */
  569.   sword msg_fromfile;   /* Priv. for doing message from file          */
  570.   byte  rsvd1[4];       /* used to be high_msgarea, begin_msgarea     */
  571.   sword unlisted_priv;  /* Priv needed to send to unlisted node       */
  572.   sword unlisted_cost;  /* Charge to send to unlisted node            */
  573.  
  574.   sword mc_reply_priv;   /* Priv to reply to msg with mailchecker     */
  575.   sword mc_kill_priv;    /* Priv to kill msg with mailchecker         */
  576.  
  577.  
  578.   /* Information about file areas */
  579.  
  580.   sword date_style;     /* Used for FILES.BBS display                */
  581.   sword dlall_priv;     /* Priv. needed to DL file not in FILES.BBS  */
  582.   sword ulbbs_priv;     /* Priv. needed to UL *.BBS files            */
  583.   dword k_free;         /* The number of disk space (in K) which     *
  584.                          * must be available before we let a user    *
  585.                          * upload.                                   */
  586.   word  ul_reward;      /* Percentage reward for uploads             */
  587.   word  ratio_threshold;/* K which can DL before harass about ratio  */
  588.  
  589.   byte  rsvd2[4];       /* used to be high_filearea, begin_filearea  */
  590.  
  591.   /* Our matrix address(es) */
  592.  
  593.   ADDR address[ALIAS_CNT];
  594.  
  595.  
  596.   /*  struct _yell yell[MAX_YELL]; */  /* Yell info moved to event file */
  597.   byte rsvd3[60]; /* Reserved by Maximus for future use */
  598.  
  599.  
  600.   /* About the users */
  601.  
  602.   struct cl_rec class[MAXCLASS];
  603.  
  604.   /* Flags for external protocols */
  605.  
  606.   sword protoexit;              /* Errorlevel for protocol exit      */
  607.   char  protoflag[MAX_EXTERNP]; 
  608.  
  609.   /* General-purpose bit-flags  (See FLAGx_xxx definitions above.) */
  610.  
  611.   word  flags;
  612.   word  flags2;
  613.   word  flags3;
  614.   word  flags4;
  615.  
  616.   /* Bit field containing drive letters to save when going outside */
  617.   char  drives_to_save[(MAX_DRIVES/CHAR_BITS)+1];
  618.  
  619.   byte  fbbs_margin;      /* Margin to use for wrapping FILES.BBS comments */
  620.  
  621.   byte  rsvd999;
  622.  
  623.   word  max_ptrs;         /* Maximum size of pointers of ALL *.LTFs */
  624.   word  max_heap;         /* Maximus heap size of all *.LTFs */
  625.   byte  max_lang;         /* Current number of languages */
  626.   byte  rsvd_lang;
  627.  
  628.   word  max_glh_ptrs;
  629.   word  max_glh_len;
  630.  
  631.   word  max_syh_ptrs;
  632.   word  max_syh_len;
  633.  
  634.   byte  input_timeout;   /* # of mins until Max hangs up due to no input    */
  635.  
  636.   byte  charset;         /* Character set support - see CHARSET_XXXX, above */
  637.   word  max_pack;        /* Maximum # of msgs to pack into a .QWK packet    */
  638.   
  639.   byte  rsvd65[12];      /* Reserved by Maximus for future use              */
  640.  
  641.  
  642.  
  643.   /* --------------------------------------------------------------- */
  644.   /* -------------------------- OFFSETS ---------------------------- */
  645.   /* --------------------------------------------------------------- */
  646.  
  647.   /* About your system */
  648.  
  649.   OFS   sysop;          /* sysop's name. MUST be first offset in prm file */
  650.   OFS   system_name;    /* board's name                              */
  651.  
  652.   /* Modem commands */
  653.  
  654.   OFS   m_busy;         /* mdm cmd to take modem off hook            */
  655.  
  656.   /* Paths to various places */
  657.  
  658.   OFS   sys_path;       /* path to SYSTEM?.BBS files                 */
  659.   OFS   misc_path;      /* path to `F-key files'                     */
  660.   OFS   net_info;       /* path to NODELIST files                    */
  661.   OFS   temppath;       /* place to put temporary files              */
  662.   OFS   ipc_path;       /* path for inter-process communications     */
  663.  
  664.   /* General files needed by the system */
  665.  
  666.   OFS   user_file;      /* path/filename of User.Bbs                 */
  667.   OFS   log_name;       /* name of the log file                      */
  668.   OFS   chat_prog;      /* External chat program, if any             */
  669.   OFS   chat_fbegin;    /* File to display instead of "CHAT: begin"  */
  670.   OFS   chat_fend;      /* File to display instead of "END CHAT"     */
  671.   OFS   local_editor;   /* Command for local editor, if any          */
  672.   OFS   notfound;       /* User name not found in user file          */
  673.   OFS   junk;           /* Don't use this for anything!              */
  674.  
  675.   /* General *.?BS files needed everywhere */
  676.  
  677.   OFS   logo;           /* first file shown to a caller              */
  678.   OFS   bad_logon;      /* if user's last logon attempt was bad      */
  679.   OFS   welcome;        /* shown after logon                         */
  680.   OFS   quote;          /* For displaying "random" quotes from       */
  681.   OFS   newuser1;       /* Asks user to type in password             */
  682.   OFS   newuser2;       /* Replaces `welcome' for a new user         */
  683.   OFS   rookie;         /* Replaces `welcome' for rookies            */
  684.   OFS   application;    /* new user questionnaire                    */
  685.   OFS   byebye;         /* file displayed at logoff                  */
  686.   OFS   out_leaving;    /* Bon Voyage                                */
  687.   OFS   out_return;     /* Welcome back from O)utside                */
  688.   OFS   daylimit;       /* Sorry, you've been on too long...         */
  689.   OFS   timewarn;       /* warning about forced hangup               */
  690.   OFS   tooslow;        /* explains minimum logon baud rate          */
  691.   OFS   barricade;      /* Displayed before prompt for access code   */
  692.   OFS   shelltodos;     /* Displayed when Sysop hits Alt-J           */
  693.   OFS   backfromdos;    /* Displayed when Sysop returns from Alt-J   */
  694.   OFS   areanotexist;   /* File to display instead of "That area     *
  695.                          * doesn't exist!"                           */
  696.  
  697.   /* File-area items */
  698.  
  699.   OFS   rsvd6;          /* Reserved by Maximus for future use        */
  700.   OFS   xferbaud;       /* explains minimum file transfer baud rate  */
  701.   OFS   file_area_list; /* dump file... used instead of Dir.Bbs      */
  702.   OFS   no_space;       /* File to display if trying to UL with      *
  703.                          * less than k_free space left on drive.     */
  704.   OFS   fname_format;   /* Essay on MS-DOS filenames for U)ploads    */
  705.   OFS   ul_log;         /* Log file for uploads                      */
  706.  
  707.   OFS   file_header;    /* Format for file area's A)rea command      */
  708.   OFS   file_format;    /* Format for A)rea command entries          */
  709.   OFS   file_footer;    /* Format for footer for file.area menu      */
  710.  
  711.   OFS   proto_dump;      /* Dump file for protocol screen            */
  712.  
  713.   /* Message-area items */
  714.  
  715.   OFS   msgarea_list;   /* dump file... used instead of Dir.Bbs      */
  716.   OFS   echotoss_name;  /* Name of your echomail tosslog             */
  717.   OFS   nomail;         /* Display by mailchecker if no mail wtng.   */
  718.  
  719.   OFS   msg_header;     /* Format for msg.area's A)rea command       */
  720.   OFS   msg_format;     /* Format for A)reas command entries         */
  721.   OFS   msg_footer;     /* Format for footer for msg.area menu       */
  722.  
  723.   /* Help files:  Used to explain various things */
  724.  
  725.   OFS   hlp_editor;     /* intro to msg editor for novices.          */
  726.   OFS   hlp_replace;    /* Explain the Msg.Editor E)dit command      */
  727.   OFS   msg_inquire;    /* Explain the Msg. I)nquire command         */
  728.   OFS   hlp_locate;     /* Explain the Files L)ocate command         */
  729.   OFS   hlp_contents;   /* Explain the Files C)ontents command       */
  730.   OFS   oped_help;      /* help file for the full-screen editor      */
  731.   OFS   hlp_scan;       /* help file for S)can                       */
  732.   OFS   hlp_list;       /* help file for L)ist                       */
  733.  
  734.   /* External protocols */
  735.  
  736.   OFS   protocols[MAX_EXTERNP]; /* external file protocol programs   */
  737.   OFS   protoname[MAX_EXTERNP]; /* name of protocol, on menu         */
  738.  
  739.   /* Date/Time format strings */
  740.  
  741.   OFS   timeformat;
  742.   OFS   dateformat;
  743.  
  744.   /* Paths/filenames of the AREAS.DAT and AREAS.IDX files */
  745.  
  746.   OFS   adat_name;
  747.   OFS   aidx_name;
  748.  
  749.   /* Menu paths/names */
  750.  
  751.   OFS   menupath;        /* The default place to look for the menus */
  752.   OFS   first_menu;      /* The name of the first menu to display */
  753.   OFS   edit_menu;       /* Name of the EDIT menu */
  754.   
  755.   /* Miscellaneous */
  756.   
  757.   OFS   achg_keys;       /* Characters used to change area -/+ */
  758.   OFS   tune_file;       /* Path to TUNES.MAX */
  759.   OFS   lang_path;       /* Path to *.LTF files */
  760.   
  761.   OFS   lang_file[MAX_LANG]; /* Array of all *.LTF names */
  762.   
  763.   OFS   m_init;          /* Modem initialization string */
  764.   OFS   m_ring;          /* Command modem sends when phone ringing */
  765.   OFS   m_answer;        /* Cmd to send to modem when ring detect */
  766.   OFS   m_connect;       /* Connect string, as returned by modem */
  767.  
  768.   OFS   high_msgarea;
  769.   OFS   begin_msgarea;  /* Msg area to put new users in              */
  770.   
  771.   OFS   high_filearea;
  772.   OFS   begin_filearea; /* File area to put new users in             */
  773.   
  774.   OFS   fidouser;       /* Name of FIDOUSER.LST file to use          */
  775.   OFS   cmtarea;        /* Message area to put comments in           */
  776.  
  777.   OFS   arc_ctl;        /* Control file for archiving programs       */
  778.   OFS   olr_name;       /* OLR: Filename to use for DL packets       */
  779.   OFS   olr_dir;        /* OLR: Directory for off-line stuff         */
  780.   OFS   phone_num;
  781.   OFS   viruschk;       /* Name of batch file to call for virus check*/
  782. };
  783.  
  784.  
  785.  
  786.  
  787. /* Structure for AREA.DAT */
  788.  
  789. #ifdef NEVER
  790.  
  791. /*  NOTE:  The _area structure has a dynamic length!  To access this file, *
  792.  *         you should read the first _area structure from the file, and    *
  793.  *         check the struct_len byte.  Then, to access the file, you seek  *
  794.  *         to each new location, instead of reading straight through.      *
  795.  *                                                                         *
  796.  *         For example, to read all of the _area file into an array, you   *
  797.  *         MUST do it like this, for upward compatiblity:                  */
  798.  
  799.   {
  800.     struct _area area[NUM_AREAS];
  801.  
  802.     int x,
  803.         slen;
  804.  
  805.     if ((areafile=open(area_name,O_RDONLY | O_BINARY))==-1)
  806.       Error();
  807.  
  808.     /* Read the first record of the file, to grab the structure-length     *
  809.      * byte.                                                               */
  810.  
  811.     read(areafile,&area[0],sizeof(struct _area));
  812.     slen=area[0].struct_len;
  813.  
  814.     for (x=0;! eof(area_data);x++)
  815.     {
  816.       /* Note this lseek() call, which positions the pointer to the        *
  817.        * start of the next record, no matter how long the previous         *
  818.        * record was.                                                       */
  819.  
  820.       lseek(areafile,x*(long)struct_len,SEEK_SET);
  821.       read(areafile,&area[x],sizeof(struct _area));
  822.     }
  823.  
  824.     close(areafile);
  825.   }
  826.  
  827. #endif
  828.  
  829.  
  830. struct _override
  831. {
  832.   sword priv;   /* Override priv level */
  833.   dword lock;   /* Override lock setting */
  834.  
  835.   byte ch;      /* First letter of menu option to apply override to */
  836.   byte fill;    /* Reserved by Maximus */
  837. };
  838.  
  839.  
  840.  
  841. #define AREA_ID   0x54414441L /* "ADAT" */
  842. #define AREA_id   AREA_ID
  843.  
  844. struct _area
  845. {
  846.   long id;              /* Unique identifier for AREA.DAT structure.       *
  847.                          * Should be AREA_id, above.                       */
  848.  
  849.   word struct_len;      /* Length of _area structure -- this needs only    *
  850.                          * to be read from the first record in an area     *
  851.                          * data file, since it can be assumed to remain    *
  852.                          * the same throughout the entire file.  This is   *
  853.                          * GUARANTEED to be at offset four for this and    *
  854.                          * all future versions of this structure.          */
  855.  
  856.   word areano;          /* OBSOLETE.  Two-byte integer representation of   *
  857.                          * this area's name.  Use area.name instead.       */
  858.  
  859.   byte name[40];        /* String format of area's name.  USE THIS!        */
  860.  
  861.   /*************************************************************************/
  862.   /**                        Message Area Information                     **/
  863.   /*************************************************************************/
  864.  
  865.   word type;            /* Message base type.  MSGTYPE_SDM = *.MSG.        *
  866.                          * MSGTYPE_SQUISH = SquishMail.  (Constants are    *
  867.                          * in MSGAPI.H)                                    */
  868.  
  869.   byte msgpath[80];     /* Path to messages                                */
  870.   byte msgname[40];     /* The 'tag' of the area, for use in ECHOTOSS.LOG  */
  871.   byte msginfo[80];     /* The DIR.BBS-like description for msg section    */
  872.   byte msgbar[80];      /* Barricade file for message area                 */
  873.   byte origin[62];      /* The ORIGIN line for this area                   */
  874.  
  875.   sword msgpriv;        /* This is the priv required to access the msg     *
  876.                          * section of this area.                           */
  877.   byte fill0;           /* The lock for the message area (obsolete)        */
  878.  
  879.   byte fill1;
  880.  
  881.   sword origin_aka;     /* This is the AKA number to use on the origin     *
  882.                          * line.  See the normal SysOp documentation on    *
  883.                          * the "Origin" statement, for info on how this    *
  884.                          * number is used.                                 */
  885.  
  886.   /*************************************************************************/
  887.   /**                        File Area Information                        **/
  888.   /*************************************************************************/
  889.  
  890.  
  891.   byte filepath[80];    /* Path for downloads                              */
  892.   byte uppath[80];      /* Path for uploads                                */
  893.   byte filebar[80];     /* Barricade file for file areas                   */
  894.   byte filesbbs[80];    /* Path to FILES.BBS-like catalog for this area    */
  895.   byte fileinfo[80];    /* The DIR.BBS-like description for file section   */
  896.  
  897.   sword filepriv;       /* This is the priv required to access the file    *
  898.                          * section of this area.                           */
  899.   byte fill15;          /* The locks for the file area (obsolete)          */
  900.   byte fill2;
  901.  
  902.   /*************************************************************************/
  903.   /**                      Miscellaneous Information                      **/
  904.   /*************************************************************************/
  905.  
  906.  
  907.   byte msgmenuname[13]; /* Alternate *.MNU name to use for this msg.area   */
  908.   byte filemenuname[13];/* Alternate *.MNU name to use for this file area  */
  909.  
  910.   word attrib[MAXCLASS];/* This is an array of attributes for the          *
  911.                          * msg/file areas.  These are dependant on PRIV    *
  912.                          * level.  Once you have the CLASS number for a    *
  913.                          * particular user (via Find_Class_Number()), you  *
  914.                          * can find the attributes for that particular     *
  915.                          * priv level like this: "area.attrib[class]"      *
  916.                          * ...which will get you the attribute for that    *
  917.                          * priv level.                                     */
  918.  
  919.   /*************************************************************************/
  920.   /**                      Stuff hacked on later                          **/
  921.   /*************************************************************************/
  922.  
  923.   struct _override movr[MAX_OVR]; /* Override privs for msg/file areas */
  924.   struct _override fovr[MAX_OVR];
  925.   
  926.   dword msglock;        /* 32-bit locks for message areas                  */
  927.   dword filelock;       /* 32-bit locks for file areas                     */
  928.  
  929.   word killbyage;       /* MAXREN: max # of days to keep msgs in this area */
  930.                         /*         (use 0 for no deletion by age)          */
  931.   word killbynum;       /* MAXREN: max # of msgs to keep in area (use 0    */
  932.                         /*         for no deletion by #msgs.)              */
  933.  
  934. };
  935.  
  936.  
  937.  
  938. /* New Max 2.xx format for AREA.NDX.  The file is simply an array of        *
  939.  * these structures.                                                        */
  940.  
  941. struct _aidx
  942. {
  943.   dword offset;
  944.   byte name[MAX_ALEN];
  945. };
  946.  
  947.  
  948. /* This is the old, Max 1.02 format for AREA.IDX.  This is obsolete, but    *
  949.  * it is still written by SILT for backwards compatibility.                 */
  950.  
  951. struct _102aidx
  952. {
  953.   word  area;       /* Same format as area.areano */
  954.   dword offset;
  955.   dword rsvd;
  956. };
  957.  
  958.  
  959.  
  960. /* Structure for MTAG.BBS */
  961.  
  962. struct _tagdata
  963. {
  964.   word struct_len;
  965.   char name[36];
  966.   char areas[348];
  967. };
  968.  
  969.  
  970. /* Structure for RESTARxx.BBS */
  971.  
  972. /* NOTE: The following structure is not completely stable.  Unless         *
  973.  * rst.rst_ver is equal to RST_VER, then the ONLY items you're guaranteed  *
  974.  * to be able to read are those marked with "*STABLE*".  Those items       *
  975.  * are guaranteed to be stored at those offsets for all future versions    *
  976.  * of Maximus, regardless of the version number.  However, everything      *
  977.  * else is likely to change at a moment's notice.                          */
  978.  
  979. struct _restart
  980. {
  981.   byte rst_ver; /* Version number of restart data                 *STABLE* */
  982.  
  983.   sdword timeon;  /* Date user got on system, seconds since 1970  *STABLE* */
  984.   sdword timeoff; /* Date user must be OFF system, secs since '70 *STABLE* */
  985.   sdword restart_offset; /* Offset in .BBS file to restart at     *STABLE* */
  986.  
  987.   dword baud;             /* User's baud rate                   *STABLE*   */
  988.   dword max_time;         /* Max time, as given by '-t' param   *STABLE*   */
  989.  
  990.   sword port;             /* Current COM port, 0=COM1, 1=COM2,  *STABLE*   */
  991.  
  992.   char written_echomail;  /* 0=user HASN'T written echomail     *STABLE*   */
  993.   char written_matrix;    /* 0=user HASN'T entered matrix msg   *STABLE*   */
  994.   char local;             /* 0=NOT local                        *STABLE*   */
  995.  
  996.   struct _stamp laston;   /* Time the user was last on system   *STABLE*   */
  997.   
  998.   word steady_baud;       /* Locked baud rate of user           *STABLE*   */
  999.  
  1000.   sdword starttime;       /* Start time, for external protocol             */
  1001.   sdword timestart;       /* Time when MAX.EXE was started                 */
  1002.   sdword ultoday;         /* KB's the user has uploaded today              */
  1003.  
  1004.   union stamp_combo next_ludate;
  1005.   
  1006.   byte restart_type;      /* 1 if started via .BBS file, 0 otherwise       */
  1007.   char restart_name[PATHLEN]; /* Name of .BBS file to restart in           */
  1008.   char menuname[PATHLEN]; /* Name of current menu                          */
  1009.   char menupath[PATHLEN]; /* The current menu path                         */
  1010.   char firstname[36];     /* The user's first name                         */
  1011.   char last_onexit[PATHLEN]; /* The 'onexit' filename for current .BBS file*/
  1012.   char parm[PATHLEN];     /* Parms for external program, if any            */
  1013.   char fix_menupath[PATHLEN]; /* Readjust menu name                        */
  1014.   char last_name[MAX_MENUNAME]; /* Name of the last menu                   */
  1015.  
  1016.   char lastmenu;          /* Last ^oR menu choice                          */
  1017.   char snoop;             /* If snoop is currently on or off               */
  1018.  
  1019.   char locked;            /* If priv is locked via keyboard 'L' command    */
  1020.   char locked2;           /* If priv locked via barricade                  */
  1021.  
  1022.   char keyboard;          /* If the Sysop's keyboard is turned on          */
  1023.   char protocol_letter;   /* Letter representing current protocol choice   */
  1024.  
  1025.   char chatreq;           /* If user wanted to chat with SysOp             */
  1026.   char mn_dirty;          /* If menuname buf is dirty                      */
  1027.  
  1028.   char barricade_ok;      /* If current barricade area is OK               */
  1029.   char no_zmodem;         /* If zmodem not allowed                         */
  1030.  
  1031.   sword usr_time;         /* User's usr.time value                         */
  1032.   sword usernum;          /* User's user number                            */
  1033.   sword lockpriv;         /* If rst.locked (above), then this is real priv */
  1034.   sword lockpriv2;        /* If rst.locked2, then this is real priv        */
  1035.   sword ctltype;          /* Control-file type (for xternal protocol)      */
  1036.  
  1037.   word current_baud;      /* User's baud rate, as a mask for mdm_baud() */
  1038.  
  1039.   /* Bit flags for ECHOTOSS.LOG */
  1040.   char echo_written_in[(MAX_AREAS/CHAR_BITS)+1];
  1041.  
  1042.   struct _area area;
  1043.   struct _css css;
  1044.   
  1045.   char log_name[80];
  1046.  
  1047.   word fnames;
  1048.  
  1049.   char  filenames[MAXEXPAND][PATHLEN];
  1050.   dword filesizes[MAXEXPAND];
  1051.   word  fileflags[MAXEXPAND];
  1052.   
  1053.   char event_num;
  1054.   char rsvd;
  1055.   
  1056.   struct _tagdata tma;        /* Tagged message areas */
  1057.   sword last_protocol;
  1058.   long getoff;
  1059.   char returning[PATHLEN];
  1060. };
  1061.  
  1062. #ifndef _NODE_DEFINED
  1063.   #define _NODE_DEFINED
  1064.     
  1065.   struct _node  /* NODELIST.SYS */
  1066.   {
  1067.      sword number;        /* node number                                   */
  1068.      sword net;           /* net number                                    */
  1069.      word  cost;          /* cost of a message to this node                */
  1070.      word  rate;          /* baud rate                                     */
  1071.      byte  name[20];      /* node name                                     */
  1072.      byte  phone[40];     /* phone number                                  */
  1073.      byte  city[40];      /* city and state                                */
  1074.   };
  1075. #endif
  1076.  
  1077.  
  1078. #ifndef _NEWNODE_DEFINED
  1079.   #define _NEWNODE_DEFINED
  1080.  
  1081.   struct _newnode /* NODELIST.DAT */
  1082.   {
  1083.      word NetNumber;
  1084.      word NodeNumber;
  1085.      word Cost;                                 /* cost to user for a
  1086.                                                  * message */
  1087.      byte SystemName[34];                       /* node name */
  1088.      byte PhoneNumber[40];                      /* phone number */
  1089.      byte MiscInfo[30];                         /* city and state */
  1090.      byte Password[8];                          /* WARNING: not necessarily
  1091.                                                  * null-terminated */
  1092.      word RealCost;                             /* phone company's charge */
  1093.      word HubNode;                              /* node # of this node's hub
  1094.                                                  * or 0 if none */
  1095.      byte BaudRate;                             /* baud rate divided by 300 */
  1096.      byte ModemType;                            /* RESERVED for modem type */
  1097.      word NodeFlags;                            /* set of flags (see below) */
  1098.      word NodeFiller;
  1099.   };
  1100. #endif
  1101.  
  1102. /*------------------------------------------------------------------------*/
  1103. /* Values for the `NodeFlags' field                                       */
  1104. /*------------------------------------------------------------------------*/
  1105. #define B_hub      0x0001
  1106. #define B_host     0x0002
  1107. #define B_region   0x0004
  1108. #define B_zone     0x0008
  1109. #define B_CM       0x0010
  1110. #define B_ores1    0x0020
  1111. #define B_ores2    0x0040
  1112. #define B_ores3    0x0080
  1113. #define B_ores4    0x0100
  1114. #define B_ores5    0x0200
  1115. #define B_res1     0x0400
  1116. #define B_res2     0x0800
  1117. #define B_point    0x1000
  1118. #define B_res4     0x2000
  1119. #define B_res5     0x4000
  1120. #define B_res6     0x8000
  1121.  
  1122.  
  1123. /* Help levels */
  1124.  
  1125. #define  EXPERT      (byte)0x02  /* grizzled veteran, no menus at all       */
  1126. #define  REGULAR     (byte)0x04  /* experienced user, brief menus           */
  1127. #define  NOVICE      (byte)0x06  /* Full menus plus additional hand-holding */
  1128. #define  HOTFLASH    (byte)0x20  /* Hotkey, full-screen interface           */
  1129.  
  1130. /* Msg/file area attributes */
  1131.  
  1132. #define  SYSMAIL   0x0001 /* is a mail area                                */
  1133. #define  NOPUBLIC  0x0004 /* OPUS: Disallow public messages                */
  1134. #define  NOPRIVATE 0x0008 /* OPUS: Disallow private messages               */
  1135. #define  ANON_OK   0x0010 /* OPUS: Enable anonymous messages               */
  1136. #define  ECHO      0x0020 /* OPUS: Set=Echomail Clear=Not Echomail         */
  1137. #define  HIGHBIT   0x0040 /* MAX:  Allow high-bit chars in this area       */
  1138. #define  NREALNAME 0x0200 /* MAX:  Don't use ^aREALNAME for this area      */
  1139. #define  UREALNAME 0x0400 /* MAX:  Use usr.name instead of alias (if alsys)*/
  1140. #define  CONF      0x0800 /* MAX:  Conference-type area (no origin/sb's)   */
  1141. #define  UALIAS    0x1000 /* MAX:  Use usr.alias instead of usr.name       */
  1142.  
  1143. #define  SHARED     (CONF | ECHO)
  1144. #define  NOPVTORPUB (NOPRIVATE | NOPUBLIC)
  1145.  
  1146. /* Structure for COLOURS.MAX */
  1147.  
  1148. struct _maxcol
  1149. {
  1150.   byte menu_name;         /* yellow */
  1151.   byte menu_high;         /* yellow */
  1152.   byte menu_text;         /* gray */
  1153.   byte file_name;         /* yellow */
  1154.   byte file_size;         /* magenta */
  1155.   byte file_date;         /* green */
  1156.   byte file_desc;         /* cyan */
  1157.   byte file_find;         /* yellow */
  1158.   byte file_off;          /* red */
  1159.   byte file_new;          /* blinking green */
  1160.   byte msg_from;          /* cyan */
  1161.   byte msg_to;            /* cyan */
  1162.   byte msg_subj;          /* cyan */
  1163.   byte msg_from_txt;      /* yellow */
  1164.   byte msg_to_txt;        /* yellow */
  1165.   byte msg_subj_txt;      /* yellow */
  1166.   byte msg_date;          /* lightgreen */
  1167.   byte msg_attr;          /* lightgreen */
  1168.   byte addr_type;         /* cyan */
  1169.   byte addr_locus;        /* green */
  1170.   byte msg_text;          /* gray */
  1171.   byte msg_quote;         /* cyan */
  1172.   byte msg_kludge;        /* lightmagenta */
  1173.   byte hot_opt;           /* black on white */
  1174.   byte hot_more;          /* lightred on white */
  1175.   byte hot_clr;           /* white on white */
  1176.   byte status_bar;        /* black on white */
  1177.   byte status_cht;        /* blinking black on white */
  1178.   byte status_key;        /* blinking black on white */
  1179.   byte fsr_msgn;          /* lightred on blue */
  1180.   byte fsr_msglink;       /* yellow on blue */
  1181.   byte fsr_attr;          /* yellow on blue */
  1182.   byte fsr_msginfo;       /* yellow on blue */
  1183.   byte fsr_date;          /* white on blue */
  1184.   byte fsr_addr;          /* yellow on blue */
  1185.   byte fsr_static;        /* white on blue */
  1186.   byte fsr_border;        /* lightcyan on blue */
  1187.   byte pop_text;          /* white on blue */
  1188.   byte pop_border;        /* yellow on blue */
  1189.   byte pop_high;          /* yellow on blue */
  1190.   byte pop_list;          /* black on grey */
  1191.   byte pop_lselect;       /* grey on red */
  1192.  
  1193.   byte wfc_stat;          /* white on blue */
  1194.   byte wfc_stat_bor;      /* yellow on blue */
  1195.   byte wfc_modem;         /* gray on blue */
  1196.   byte wfc_modem_bor;     /* lgreen on blue */
  1197.   byte wfc_keys;          /* yellow on blue */
  1198.   byte wfc_keys_bor;      /* white on blue */
  1199.   byte wfc_activ;         /* white on blue */
  1200.   byte wfc_activ_bor;     /* lcyan on blue */
  1201.   byte wfc_name;          /* yellow on black */
  1202.   byte wfc_line;          /* white on black */
  1203. };
  1204.  
  1205.  
  1206.  
  1207. /* Structure for USER.BBS and LASTUSER.BBS */
  1208.  
  1209. /* NOTE:  This structure is semi-stable.  Although it is still compatible  *
  1210.  * with the old Opus 1.03 structure, don't expect it to stay that way      *
  1211.  * for long.  In a future version, Maximus will be using a dymaic-sized    *
  1212.  * user record, making it possible to make additions without breaking      *
  1213.  * preexisting software.  You can start to code for this now in your       *
  1214.  * software, as the usr.struct_len variable indicates the length of the    *
  1215.  * current user structure, divided by twenty.  This allows us to build up  *
  1216.  * a base of utilities, and be able to switch to a new format (while still *
  1217.  * not breaking anything) in the future.  Also, if usr.sruct_len==0, then  *
  1218.  * you MUST assume that the length of the structure is actually 180 bytes  *
  1219.  * long, as Opus (and Maximus v1.00 only) did not use this field.  In      *
  1220.  * other words:                                                            *
  1221.  *                                                                         *
  1222.  * len_of_struct=(usr.struct_len ? (usr.struct_len*20) : 180)              *
  1223.  *                                                                         *
  1224.  * In addition, you can assume that all user records in the user file are  *
  1225.  * the SAME size...  ie. You can just read the first user record out of    *
  1226.  * the file, and you are assured that the rest of the records in the file  *
  1227.  * area also the same size.                                                *
  1228.  *                                                                         *
  1229.  *                                                                         *
  1230.  * Example for reading in the dynamic-sized user structure:                *
  1231.  *                                                                         *
  1232.  *    {                                                                    *
  1233.  *      struct _usr users[MAX_USERS];                                      *
  1234.  *                                                                         *
  1235.  *      int x,                                                             *
  1236.  *          userfile,                                                      *
  1237.  *          s_len;                                                         *
  1238.  *                                                                         *
  1239.  *      if ((userfile=open(ufile_name,O_RDONLY | O_BINARY))==-1)           *
  1240.  *        Error();                                                         *
  1241.  *                                                                         *
  1242.  *      read(userfile,&users[0],sizeof(struct _usr));                      *
  1243.  *                                                                         *
  1244.  *      s_len=users[0].struct_len ? users[0].struct_len*20 : 180;          *
  1245.  *                                                                         *
  1246.  *      for (x=0;x < MAX_USERS;x++)                                        *
  1247.  *      {                                                                  *
  1248.  *        lseek(userfile,(long)x*(long)s_len,SEEK_SET);                    *
  1249.  *        read(userfile,&users[x],sizeof(struct _usr));                    *
  1250.  *      }                                                                  *
  1251.  *                                                                         *
  1252.  *      close(userfile);                                                   *
  1253.  *    }                                                                    *
  1254.  *                                                                         *
  1255.  * If anything is added to the user structure, it will be appended to the  *
  1256.  * END of the structure, so you can be assured that the offsets of each    *
  1257.  * individual variable will NOT change.                                    *
  1258.  *                                                                         *
  1259.  * Also, when ADDING or DELETING users, certain special operations have    *
  1260.  * to be performed, mainly those related to the lastread pointers.  When   *
  1261.  * adding a user, the procedure is fairly simple; just make sure that      *
  1262.  * usr.lastread_ptr is a unique number, different from all others in       *
  1263.  * USER.BBS.  Although Max uses a somewhat complicated algorithm to        *
  1264.  * fill gaps in the user file, most utility programs can just read through *
  1265.  * USER.BBS, and keep a running tally of the HIGHEST usr.struct_len        *
  1266.  * variable.  Once you have that, increment it by one, and stuff it into   *
  1267.  * the usr.struct_len of the user to be added.                             *
  1268.  *                                                                         *
  1269.  * When DELETING users, you must go through the process of "cleansing"     *
  1270.  * the lastread pointers for the user you deleted.  The procedure for this *
  1271.  * is simple:  For every area listed in AREAS.CTL, open the LASTREAD.BBS   *
  1272.  * file for that area, and seek to the offset...                           *
  1273.  *                                                                         *
  1274.  *    usr.lastread_ptr*(long)sizeof(int)                                   *
  1275.  *                                                                         *
  1276.  * ...and write *two* NUL bytes (ASCII 00).                                *
  1277.  *                                                                         *
  1278.  * Please note that you do NOT need to do anything special to sort the     *
  1279.  * user file...  Since the lastread offset is stored in usr.lastread_ptr,  *
  1280.  * you can sort the user file with impunity, and even use old Opus 1.03    *
  1281.  * sort utilities.                                                         */
  1282.  
  1283.  
  1284.  
  1285. /* Masks for usr.bits1, below */
  1286.  
  1287. #define BITS_HOTKEYS     0x0001 /* Hotkeys, independent of HOTFLASH level   */
  1288. #define BITS_NOTAVAIL    0x0002 /* If set, user is NOT normally available   *
  1289.                                  * for chat.                                */
  1290. #define BITS_FSR         0x0004 /* Full-screen reading in msg areas         */
  1291. #define BITS_NERD        0x0008 /* Yelling makes no noise on sysop console  */
  1292. #define BITS_NOULIST     0x0010 /* Don't display name in userlist           */
  1293. #define BITS_TABS        0x0020 /* Reserved                                 */
  1294. #define BITS_BIT6        0x0040 /* Reserved                                 */
  1295. #define BITS_BIT7        0x0080 /* Reserved                                 */
  1296. #define BITS_BIT8        0x0100 /* Used to be 'usr.msg'                     */
  1297. #define BITS_BIT9        0x0200 /* Used to be 'usr.msg'                     */
  1298. #define BITS_BITA        0x0400 /* Used to be 'usr.msg'                     */
  1299. #define BITS_BITB        0x0800 /* Used to be 'usr.msg'                     */
  1300. #define BITS_BITC        0x1000 /* Used to be 'usr.msg'                     */
  1301. #define BITS_BITD        0x2000 /* Used to be 'usr.msg'                     */
  1302. #define BITS_BITE        0x4000 /* Used to be 'usr.msg'                     */
  1303. #define BITS_BITF        0x8000 /* Used to be 'usr.msg'                     */
  1304.  
  1305.  
  1306. /* Masks for usr.bits2, below */
  1307.  
  1308. #define BITS2_BADLOGON   0x0001 /* MAX: if user's last logon attempt was bad*/
  1309. #define BITS2_IBMCHARS   0x0002 /* MAX: if user can receive high-bit chars  */
  1310. #define BITS2_RSVD1      0x0004 /* MAX: *obsolete* 1.02 avatar flag         */
  1311. #define BITS2_BORED      0x0008 /* Use the line-oriented editor             */
  1312. #define BITS2_MORE       0x0010 /* Wants the "MORE?" prompt                 */
  1313. #define BITS2_RSVD2      0x0020 /* OPUS: set=wants Ansi                     */
  1314. #define BITS2_CONFIGURED 0x0040 /* OPUS: set=used Maximus before            */
  1315. #define BITS2_CLS        0x0080 /* OPUS: set=transmit ^L, clear=ignore ^L   */
  1316. #define BITS2_BIT8       0x0100 /* used to be 'usr.keys'                    */
  1317. #define BITS2_BIT9       0x0200 /* used to be 'usr.keys'                    */
  1318. #define BITS2_BITA       0x0400 /* used to be 'usr.keys'                    */
  1319. #define BITS2_BITB       0x0800 /* used to be 'usr.keys'                    */
  1320. #define BITS2_BITC       0x1000 /* used to be 'usr.keys'                    */
  1321. #define BITS2_BITD       0x2000 /* used to be 'usr.keys'                    */
  1322. #define BITS2_BITE       0x4000 /* used to be 'usr.keys'                    */
  1323. #define BITS2_BITF       0x8000 /* used to be 'usr.keys'                    */
  1324.  
  1325.  
  1326. /* Masks for usr.delflag, below */
  1327.  
  1328. #define UFLAG_DEL   0x01
  1329. #define UFLAG_PERM  0x02
  1330.  
  1331. /* Masks for usr.xp_flag, below */
  1332.  
  1333. #define XFLAG_EXPDATE    0x0001 /* Use the xp_date to control access        */
  1334. #define XFLAG_EXPMINS    0x0002 /* Use the xp_mins number to control access */
  1335. #define XFLAG_DEMOTE     0x0004 /* Demote user to priv level in usr.xp_priv */
  1336. #define XFLAG_AXE        0x0008 /* Just hang up on user                     */
  1337.  
  1338. /* Constants for usr.video, below */
  1339.  
  1340. #define GRAPH_TTY         0x00 /* The current user's graphics setting...    */
  1341. #define GRAPH_ANSI        0x01 
  1342. #define GRAPH_AVATAR      0x02
  1343.  
  1344.  
  1345. struct   _usr
  1346.    {
  1347.       byte name[36];        /* Caller's name                                */
  1348.       byte city[36];        /* Caller's location                            */
  1349.  
  1350.       byte alias[21];       /* MAX: user's alias (handle)                   */
  1351.       byte phone[15];       /* MAX: user's phone number                     */
  1352.  
  1353.       word lastread_ptr;    /* MAX: a num which points to offset in LASTREAD*/
  1354.                             /* file -- Offset of lastread pointer will be   */
  1355.                             /* lastread_ptr*sizeof(int).                    */
  1356.  
  1357.       word timeremaining;   /* MAX: time left for current call (xtern prog) */
  1358.  
  1359.       byte pwd[16];         /* Password                                     */
  1360.       word times;           /* Number of previous calls to this system      */
  1361.       byte help;            /* Help level                                   */
  1362. /**/  byte rsvd1[2];        /* Reserved by Maximus for future use           */
  1363.       byte video;           /* user's video mode (see GRAPH_XXXX)           */
  1364.       byte nulls;           /* Number of Nulls (delays) after <cr>          */
  1365.  
  1366.       byte bits;            /* Bit flags for user (number 1)                */
  1367.  
  1368. /**/  word rsvd2;           /* Reserved by Maximus for future use           */
  1369.  
  1370.       word bits2;           /* Bit flags for user (number 2)                */
  1371.  
  1372.       sword priv;           /* Access level                                 */
  1373. /**/  byte rsvd3[19];       /* Reserved by Maximus for future use           */
  1374.       byte struct_len;      /* len of struct, divided by 20. SEE ABOVE!     */
  1375.       word time;            /* Time on-line so far today                    */
  1376.  
  1377.       word delflag;         /* Used to hold baud rate for O)utside command  */
  1378.                             /* In USER.BBS, usr.flag uses the constants     */
  1379.                             /* UFLAG_xxx, defined earlier in this file.     */
  1380.       
  1381. /**/  byte rsvd4[8];        /* Reserved by Maximus for future use           */
  1382.  
  1383.       byte width;           /* Width of the caller's screen                 */
  1384.       byte len;             /* Height of the caller's screen                */
  1385.       word credit;          /* Matrix credit, in cents                      */
  1386.       word debit;           /* Current matrix debit, in cents               */
  1387.  
  1388.       word  xp_priv;        /* Priv to demote to, when time or minutes run  */
  1389.                             /* out.                                         */
  1390.  
  1391.       union stamp_combo xp_date;  /* Bit-mapped date of when user expires.  */
  1392.                                   /* If zero, then no expiry date.          */
  1393.  
  1394.       dword xp_mins;        /* How many minutes the user has left before    *
  1395.                              * expiring.                                    */
  1396.  
  1397.       byte  xp_flag;        /* Flags for expiry.  See above XFLAG_XXX defs. */
  1398.       byte  xp_rsvd;
  1399.  
  1400.       union stamp_combo ludate;   /* Bit-mapped date of user's last call    */
  1401.  
  1402.       dword xkeys;          /* User's keys (all 32 of 'em)                  */
  1403.       byte  lang;           /* The user's current language #                */
  1404.       sbyte def_proto;      /* Default file-transfer protocol               */
  1405.  
  1406.       dword up;             /* K-bytes uploaded, all calls                  */
  1407.       dword down;           /* K-bytes downloaded, all calls                */
  1408.       dword downtoday;      /* K-bytes downloaded, today                    */
  1409.  
  1410.       byte msg[MAX_ALEN];   /* User's last msg area (string)                */
  1411.       byte files[MAX_ALEN]; /* User's last file area (string)               */
  1412.  
  1413.       byte compress;        /* Default compression program to use           */
  1414.  
  1415. /**/  byte rsvd5;
  1416.       dword extra;
  1417.    };
  1418.  
  1419.  
  1420.