@prog bb.muf 1 9999 d 1 i ( Bulletin-board program. This program handles multiple boards. Every board has a name, which does not necessarily bear any relation to the name of the exit by which that board is accessed. Every board exit must have a _boardname: property holding the [internal] name of the board it manipulates. _boardname: values beginning with colons are reserved for internal uses; at present, the only defined one is ":generic", which makes the exit in question a "generic" exit. Such an exit can execute only commands that do not care which board they are for; these commands are marked with [generic] in the list below. Generic exits cannot be used for board-specific actions, though board-specific exits can be used for generic actions. Permissions are grouped into three classes: read "R", add "A", and delete "D". "R" permission allows use of the new, list, and message-number commands. "A" permission allows use of the add command. "D" permission allows deleting others' messages; anyone with read permission can delete hir own messages. Wizards always have all three permissions. Every board has an owner, which is initially the person who created it; the owner, or a wizard, may transfer ownership of the board with the "chown" command. The board's owner, or a wizard, may grant/deny permissions with the "perm" command. Permissions may be granted or denied individually by player name; the special name *royal may be used to grant or deny permissions to all royals [except those who have had permissions specifically set]. Also, the special name * may be used to grant or deny permissions to all players whose permissions are not otherwise specified. ["me" can also be used to refer to the person issuing the command.] When an operation is attempted, the program checks first for a per-player grant/deny, then, if applicable, for a *royal grant/deny, then for global permissions. The first grant or denial found stops the search. Note that the owner of a board is not automatically granted any permissions; all that being the owner of a board gives is the right to use the chown and perm commands. Every board has a holder object, created for the purpose, whose dbref is kept in a property _holder-: on the program. Everything about a board is kept in properties on the holder. The holder object must have a marker property _board: with this program's dbref in it, and must be owned by a wizard or the same player who owns the program. [These objects are normally created and recycled automatically by this program.] The number of messages is kept in _nm:. Messages are identified internally with serial numbers; the next serial number is kept in _ser:. The only link between message numbers as seen by users and their serial numbers is a property _mN-ser: that holds message N's serial number. A message with serial number S has its Subject: in _sS-h-s:, Author: in _sS-h-a:, Date: in _sS-h-d: [systime, in text form], Expires: in _sS-h-e: [also in systime text form]. Text line M is kept in _sS-tM-:. A MUF array holding all live serial numbers with their expiration times, in order by expiration time, is kept in a property named " _elist"; it is recomputed if the property doesn't exist. Per-player permissions are kept on the player in question, in @bb-perm--: props, whose value is "a" or "d" for allow or deny, respectively. *royal and * permissions are kept on the holder object in similar @bb-perm--: properties. Commands: [no command] Prints basic usage info. ? help ? help Prints help; if a command is given, prints help on that. check Checks whether anything has been posted since last read; if so, prints a message; if not, prints nothing. acheck [generic] Does a "check" for each board you have ever read, except that output is a one-line summary, not one line for each board with new messages. new Prints a one-line summary of each message posted since last read. list Prints a one-line summary of all messages, new or not; a "continue?" prompt is printed each 12 lines. ## [a message number] Prints that message. del ## Deletes the specified message [or gives an error message if not allowed]. add Adds a new message. Prompts for subject and expiration time, then accepts message lines, finally posting the message. chown Transfers ownership of the board to . perm allow perm deny perm unspec Grant or deny the listed for the specified . can be * or *royal, as described above. "unspec" makes the specified permissions unspecified for the given ; it cannot be used with * as the . perm ? Prints out the permissions has for the board, plus a breakdown of how they are determined. [ can be * or *royal to inquire how those permissions are set.] newboard [generic] Creates a new board with internal name . The is the initial set of allowed actions for *; the board is created as if a "perm * allow" command had been given with the and a "perm * deny" command had been given for perms not listed. Example: a new board for general use might be set up as follows, if the program's dbref is #1234, and assuming nothing is set up already: @action board=me @link board=#1234 @set board=_boardname: :generic board newboard generic RA @action board;bulletin board;bbs=here @link bbs=#1234 @set bbs=_boardname:generic bbs perm allow *royal d bbs perm allow me d bbs perm deny troublemaker rad At this point, people in the room can use "bbs" [or any of the other aliases given in the @action command] to access the board. Everyone has read and add access. Royals are also granted delete access, as is the person issuing the commands; the person "troublemaker" is denied all access to the board. ) : say me @ swap notify ; : strip-leading (s -- s') begin dup " " 1 strncmp not while 1 -1 substr loop ; : split-first-word (s -- srest sfirst) dup " " instr dup if 1 - strcut strip-leading else "" then swap ; : do-acheck lock-global-r XXX ; : main dup not if pop do-usage exit then split-first-word dup "?" stringcmp over "help" stringcmp and not if pop do-help exit then dup "acheck" stringcmp not if pop do-acheck exit then dup "add" stringcmp not if pop do-add exit then dup "check" stringcmp not if pop do-check exit then dup "chown" stringcmp not if pop do-chown exit then dup "del" stringcmp not if pop pop do-del exit then dup "list" stringcmp not if pop do-list exit then dup "new" stringcmp not if pop do-new exit then dup "newboard" stringcmp not if pop do-newboard exit then dup "perm" stringcmp not if pop do-perm exit then dup number? if atoi do-read-number exit then "Unrecognized command `" swap "'. Use `" command @ "' for usage help." 5 "" rimplode say ; . c q