MUFbbs.gz

snippets · 6.9 KB · 2010-03-30

MUF bulletin board program (BBS v2.2p) by Tygryss, a quick-and-dirty portable version of the Crossroads BBS.

Download   « Back to the snippets list

@prog cmd-bbs
1 9999 d
1 i
(
  BBS version 2.2p                                                   
  Written by Tygryss, 11/28/90                                       
                                                                     
  The portable version of the much fuller featured BBS on the        
    upcoming MUCK Crossroads.  This version was edited in a quick    
    and dirty manner to make it independent of the 20 or so macros   
    and programs that it would normally use on Xroads.  This was     
    managed mostly by including the macros and calls as subroutines  
    but, however, some features could not be ported with it because  
    of this. [features like reply via MUFmail, and the text editor]  
    Future versions released with the list manager routines, list    
    editor, and MUFmail2.0, will re-instate these features.          
                                                                     
   [Later note:  I already have made several mods to the MUFbbs on   
     Crossroads MUCK that make it much nicer to use, like automatic  
     positioning of the current message to the first unread topic,   
     and a revamped version of the parser that allows you to use     
     'rn t' or 'rn t 2' for example.  These mods have mot been put   
     in here, but if enough people express interest, I will release  
     a new and improved MUFbbs. - 12/13/90 ]                         
                                                                     
  Installation:                                                      
        @action <bbsaction>=<object or room>                         
        @link <bbsaction> = <thisprog>                               
      then simply type '<bbsaction> help' for a helpscreen.          
      You will need to add topics to the bbs with:                   
        <bbsaction> newtopic <topicname>                             
      so that you have topics for people to post to.                 
                                                                     
  Usage:                                                             
      Using the bbs is fairly simple, with the exception of          
      restricted topics lists.  To restrict a topic, you need to     
      make a set of properties on the <bbsaction> in the format:     
        @set <bbsaction>=<restrictlistname>#:<#lines in list>        
        @set <bbsaction>=<restrictlistname>1:<restrictions>          
        @set <bbsaction>=<restrictlistname>2:<failmessage>           
        @set <bbsaction>=<restrictlistname>3:<playername>            
        @set <bbsaction>=<restrictlistname>4:<playername>            
                      .  .  .                                        
        @set <bbsaction>=<restrictlistname>n:<playername>            
      For example, if the <bbsaction> is 'rn' and the                
      <restrictlistname> is 'gamers', and you wanted only the        
      players foo bar and baz to be able to read or post to any      
      topic restricted to that list, then it would read:             
        @set rn=gamers#:5                                            
        @set rn=gamers1:+rw                                          
        @set rn=gamers2:You fail your skill roll and can't read it.  
        @set rn=gamers3:foo                                          
        @set rn=gamers4:bar                                          
        @set rn=gamers5:baz                                          
      The +rw means that only the players in the list have the       
      priveledges to read or write [post] to that topic.  The + is   
      what denotes priveledged for only those in the list.  If the   
      + had been a -, then foo, bar, and baz would be the only       
      three players who would NOT have the given priveledges.        
      The r represents reading priveledges for that topic.           
      The w represents writing [posting] priveledges.                
      Therefore, -w would exclude the listed players from posting,   
      and +w would only let the listed players post.  -rw would      
      keep certain players from being able to read or post.          
      Wizards and the owner of the database action are exempt from   
      all restrictions.  If someone tries to read a group that is    
      restricted against them, then the message in the second elem   
      of the list will be shown to them.  In this case, they would   
      see: 'You fail your skill roll and can't read it.'             
      To restrict a topic to a restrictlist, you would:              
        <bbsaction> restrict <topic#> <restrictlistname>             
      or, in this example, if we wanted to restrict topic 2 to the   
      gamers restrictlist, we would:                                 
        rn restrict 2 gamers                                         
                                                                     
      If a topic reaches the maximum number of posts, then a         
      process of autodeletion occurs, deleting the first non-        
      preserved message in that topic, to save space.  if all the    
      messages in the topic are preserved, then the second message   
      in the topic will be deleted.  The default maxposts for a      
      topic is 20, but using the command:                            
        <bbsaction> maxposts <max # posts>                           
      in a topic will let you set it to any arbitrary amount.        
                                                                     
      To prevent spamming, a player cannot post more than 30 lines   
      in a message [unless they are a wizard or the owner of the     
      <bbsaction>].  Any post over 30 lines will be auto truncated   
      to 30 lines.  Also, a player cannot post if 3 or more of the   
      last 6 posts were also posted by that player. [also with the   
      exception of wizards or the bbsaction owner.]                  
                                                                     
      That lengthy explanation over, enjoy!                          
)
  
var currtopic
var currtopicref
var currmesg
var currmesgref
  
var topic-orig
var topic-ref
var topic-nextsub
var topic-maxsubs
var topic-restrict
var topic-name
  
var mesg-author
var mesg-ref
var mesg-protect
var mesg-subject
 
: gsplit (string splitstr -- prestr postr)
    over over instr dup if
        1 - rot swap strcut
        rot strlen strcut swap pop
    else
        pop ""
    then
;
  
: fillspace
    swap strlen -
    "                                        " ( 40 spaces )
    dup strcat ( 80 spaces now )
    swap strcut pop
;
  
: initialize
    dup "#" 1 strncmp not if
        " " gsplit
        swap 1 strcut swap pop
        atoi dup 1 <
        over dbref ok? not or if
            me @ "Invalid object reference." notify
            exit
        then
        dbref trigger !
    then
   
    me @ "BBlast" trigger @
    int intostr strcat "+" strcat
    getpropstr atoi
    dup 1 < if pop 0 then currtopic !
  
    me @ "BBlastm" trigger @
    int intostr strcat "+" strcat
    getpropstr atoi
    dup 1 < if pop 0 then currmesg !
;
  
( <elem#> <list-name> <dbref> getelem )
: getelem
  rot rot swap intostr strcat getpropstr
;
  
( <list-name> <dbref> getcount )
: getcount
  swap "#" strcat getpropstr atoi
;
  
(   <count> <list-name> <dbref> setcount                             )
: setcount
  swap "#" strcat rot dup if
    intostr 0 addprop
  else
    pop remove_prop
  then
;
  
( <val> <elem#> <list-name> <dbref> putelem )
: putelem
  3 pick 2 pick 4 pick "#" strcat getpropstr atoi > if
    dup 3 pick "#" strcat 5 pick intostr 0 addprop
  then
  rot rot swap intostr strcat rot 0 addprop
;
  
(   <elem#> <list-name> <dbref> clearelem )
: clearelem
  rot rot swap intostr strcat remove_prop
;
  
  
  
( <count> <first-elem> <list-name> <dbref> getbrange )
: getbrange-loop
  2 pick 5 pick 5 pick getelem
  6 rotate 6 rotate 6 rotate 6 rotate 6 rotate
  swap 1 - swap 1 -
  dup not if exit then
  swap getbrange-loop
;
: getbrange
  4 pick 4 rotate over + 1 - swap
  dup if getbrange-loop then
  pop pop pop pop
;
  
( <count> <first-elem> <list-name> <dbref> getrange )
: getrange-loop
  2 pick 5 pick 5 pick getelem
  6 rotate 6 rotate 6 rotate 6 rotate 6 rotate
  swap 1 + swap 1 -
  dup not if exit then
  getrange-loop
;
: getrange
  4 pick 4 rotate swap
  dup if getrange-loop then
  pop pop pop pop
;
  
( <values> <count> <first-elem> <list-name> <dbref> putrange )
: putrange-loop
  5 rotate 3 pick 6 pick 6 pick putelem
  swap 1 - swap 1 -
  dup not if exit then
  putrange-loop
;
: putrange
  4 rotate 4 rotate over + 1 - swap
  dup if putrange-loop then
  pop pop pop pop
;
  
  
(   <count> <first-elem> <list-name> <dbref> clearrange )
: clearrange-loop
  2 pick 5 pick 5 pick clearelem
  swap 1 + swap 1 -
  dup not if exit then
  clearrange-loop
;
: clearrange
  4 rotate 4 rotate swap
  dup if clearrange-loop then
  pop pop pop pop
;
  
( <dest> <count> <source> <list-name> <dbref> moverange )
: moverange
  4 rotate dup not if pop pop pop pop pop exit then
  4 rotate 4 pick 4 pick getrange
  dup 4 + rotate over 4 + rotate 3 pick 4 + rotate putrange
;
  
( <count> <first-elem> <list-name> <dbref> deleterange )
: deleterange
  over over getcount dup
  6 pick - 5 pick - 1 +
  5 pick swap
  over 8 pick + 
  6 pick 6 pick moverange
  5 pick - dup 4 pick 4 pick setcount
  1 + 4 rotate pop
  4 rotate swap 4 rotate 4 rotate
  clearrange
;
  
( <values> <count> <first-elem> <list-name> <dbref> insertrange )
: insertrange
  over over getcount
  4 pick - 1 +
  5 pick 5 pick +
  swap 5 pick 5 pick 5 pick moverange
  putrange
;
  
( <dst> <cnt> <src> <src-list> <src-ref> <dst-list> <dst-ref> copyrange )
: copyrange
  6 rotate 6 rotate 6 rotate 6 rotate getrange
  dup 4 + rotate
  over 4 + rotate
  3 pick 4 + rotate
  insertrange
;
  
( <list-name> <dbref> deletelist )
: deletelist
  over over getcount
  1 4 rotate 4 rotate deleterange
;
  
( <values> <count> <first-line> edit-display )
: more  ( range 1st pos pagin? )
  4 pick 3 pick 1 - 100 * swap / intostr
  "-- More? (f/b/s) [" swap strcat
  "%] --" strcat me @ swap notify
  read 1 strcut pop
  "fbsFBS" over instr not if pop more exit then
  dup "f" stringcmp not if
      pop 1
  else dup "b" stringcmp not if
      pop over me @ "screenlength" getpropstr atoi
      2 * - dup 1 < if pop 0 then
      2 put 1
  else "s" stringcmp not if
      0
  then then then
;
  
: display-loop  ( range 1st pagin? pos -- range 1st pagin? pos )
  4 pick over - 4 + pick
  4 pick if
    4 pick intostr "   " over strlen strcut swap pop
    swap strcat ": " strcat swap strcat
    4 rotate 1 + -4 rotate
  then
  me @ swap notify
  1 + 4 pick over > not if exit then
  swap dup if   ( range 1st pos pagin? )
    me @ "screenlength" getpropstr atoi
    over = if
      pop 1 more  ( range 1st pos pagin? more? )
      not if exit then
    else
      1 +
    then
  then
  swap display-loop
;
  
: edit-display  ( range 1st paginate? -- range )
  0 3 pick if 0 display-loop pop then pop pop
;
  
  
( <count> cleanup )
: cleanup
  dup if
    1 - swap pop cleanup
  else
    pop
  then
;
  
: get-trigname
    trigger @ name dup
    ";" instr dup if
        1 - strcut
    then pop
;
  
: do_error
    "Huh?  (Type \"" get-trigname strcat
    " help\" for BBS help.)" strcat
    me @ swap notify
;
  
: in-list-loop (searchstr listname count -- listpos)
    dup 2 - 1 < if pop pop pop 0 exit then
    over over swap trigger @ getelem
    4 pick stringcmp not if pop pop pop 1 exit then
    1 - in-list-loop
;
  
: in-list? (string listname -- listpos)
    dup trigger @ getcount
    in-list-loop
;
  
: part
    dup "|" instr dup if
        strcut
    else
        pop ""
    then
;
 
: wiz-or-own?
    me @ "wizard" flag?
    me @ trigger @ owner dbcmp or
;
  
: read-restricted? (listname -- restricted?)
    wiz-or-own? if pop 0 exit then
    dup 1 swap trigger @ getelem
    dup "r" instr not if pop pop 0 exit then
    me @ name rot in-list?
    swap "-" instr not if not then
;
  
: post-restricted? (listname -- restricted?)
    wiz-or-own? if pop 0 exit then
    dup 1 swap trigger @ getelem
    dup "w" instr not if pop pop 0 exit then
    swap me @ name swap in-list?
    swap "-" instr not if not then not not
;
  
: split
    dup "|" instr dup if
        1 - strcut 1 strcut swap pop
    else
        pop ""
    then swap
;
 
: topic-list ( -- "BBtopics" trig@)
    "BBtopics" trigger @
;
  
: get-topic-count ( -- count)
    topic-list getcount
;
  
: get-topic-info (topic# -- )
    topic-list getelem
    split atoi dbref name topic-orig !
    split atoi topic-ref !
    split atoi topic-nextsub !
    split atoi topic-maxsubs !
    split topic-restrict ! topic-name !
;
  
: subject-list (topic# -- "BBm<t##>+" trig@)
    get-topic-info "BBm" topic-ref @
    intostr strcat "+" strcat
    trigger @
;
  
: get-message-info (topic# message# -- )
    swap subject-list getelem
    split atoi dbref name mesg-author !
    split atoi mesg-ref !
    split atoi mesg-protect ! mesg-subject !
;
  
: text-list (topic# message# -- "BBt<t##>-<m##>+" trig@)
    get-message-info "BBt"
    topic-ref @ intostr strcat "-" strcat
    mesg-ref @ intostr strcat "+" strcat
    trigger @
;
  
: get-message-count (topic# -- count)
    subject-list getcount
;
  
: num-unread-loop ( maxread topic# cnt lcv -- maxread topic# cnt )
    dup not if pop exit then
    dup 4 pick subject-list
    getelem
    split pop split atoi swap pop
    5 pick > if swap 1 + swap then
    1 - num-unread-loop
;
  
: get-num-unread (maxread topic# -- count)
    0 over subject-list getcount
    num-unread-loop rot rot pop pop
;
  
: list-topics-loop
    dup not if pop exit then
    over over - 1 +
    dup get-topic-info
    topic-restrict @ read-restricted? if
        pop 1 -
        list-topics-loop
        exit
    then
    topic-ref @ "BBread" trigger @
    int intostr strcat "+" strcat
    me @ getelem
    atoi over get-num-unread intostr
    dup 4 fillspace swap strcat "  " strcat
    topic-name @ strcat swap intostr dup 4 fillspace
    swap strcat ": " strcat swap strcat
    me @ swap notify
    1 -
    list-topics-loop
;
  
: list-topics ( -- )
    "BBtopics" trigger @ getcount
    dup not if
        me @ "No topics." notify
        pop exit
    then
    " " me @ swap notify
    "__#__ _New_ __Topic____________________________________________"
    me @ swap notify
    dup list-topics-loop pop
    " " me @ swap notify
    "Done." me @ swap notify
;
  
: list-messages-loop (count count -- count)
    dup not if pop exit then
    over over - 1 +
    currtopic @ over get-message-info
    mesg-author @ dup 17 fillspace strcat
    mesg-subject @ strcat swap intostr dup 3 fillspace
    swap strcat ": " strcat swap strcat
    topic-ref @ "BBread" trigger @ int intostr
    strcat "+" strcat me @ getelem
    atoi mesg-ref @ < if "*" else " " then
    swap strcat me @ swap notify
    1 -
    list-messages-loop
;
  
: list-messages (topic# -- )
    " " me @ swap notify
    dup get-topic-info
    topic-restrict @ read-restricted? if
        2 topic-restrict @ trigger @
        getelem
        dup "%" strcmp not if
            pop "Sorry, but this topic is read-restricted."
        then me @ swap notify
        "Taking you to the topics level." me @ swap notify
        me @ "BBlast" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        me @ "BBlastm" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        pop list-topics
        exit
    then
    "Topic: " topic-name @ strcat me @ swap notify
    " " me @ swap notify
    get-message-count
    dup not if
        me @ "No messages in topic." notify
        pop exit
    then
    "__#__ __Author________ "
    "__Subject_________________________________________"
    strcat me @ swap notify
    dup list-messages-loop pop
    " " me @ swap notify
    "Done." me @ swap notify
;
  
: show-message ( -- )
    " " me @ swap notify
    "Topic: " topic-name @ strcat me @ swap notify
    "Author: " mesg-author @ strcat me @ swap notify
    "Subject: " mesg-subject @ strcat me @ swap notify
    " " me @ swap notify
    currtopic @ currmesg @
    text-list over over getcount
    rot rot 1 rot rot getrange
    0 edit-display cleanup
    topic-ref @ "BBread" trigger @
    int intostr strcat "+" strcat
    me @ getelem atoi
    mesg-ref @ swap > if
        mesg-ref @ intostr
        topic-ref @ "BBread" trigger @
        int intostr strcat "+" strcat
        me @ putelem
    then
    " " me @ swap notify
    "Done." me @ swap notify
;
  
: topics-append (topicrec -- t#)
    get-topic-count 1 +
    swap over topic-list putelem
;
  
: messages-append (mesgrec -- m#)
    currtopic @ get-message-count 1 + swap
    over currtopic @ subject-list putelem
;
  
: three-of-six-loop
    over over >= if pop pop swap pop exit then
    dup 5 pick trigger @ getelem
    "|" gsplit pop atoi dbref me @ dbcmp if
        rot 1 + rot rot
    then
    1 - three-of-six-loop
;
  
: three-of-six? ( -- 1/0 )
    currmesg @ subject-list
    over swap getcount
    0 swap dup 6 - swap
    three-of-six-loop
    3 >=
;
  
: delete-message (message# -- success)
    dup currmesg !
    dup currtopic @ swap get-message-info
    mesg-author @ me @ name strcmp
    wiz-or-own? not and if
        me @ "Permission denied." notify
        0 exit
    then
    "Deleted: " mesg-subject @ strcat me @ swap notify
    dup currtopic @ swap text-list
    deletelist
    currtopic @ subject-list
    1 -4 rotate deleterange
    1
;
  
: delete-topic-loop
    dup not if pop exit then
    1 delete-message pop
    1 - delete-topic-loop
;
  
: delete-topic (topic# -- success)
    dup dup currtopic ! get-topic-info 
    wiz-or-own? not if
        me @ "Permission denied." notify
        exit
    then
    "Deleting topic: " topic-name @
    strcat me @ swap notify
    dup get-message-count
    delete-topic-loop
    1 swap topic-list
    deleterange
    "Done." me @ swap notify
;
  
: preserve-message (m# set? -- )
        swap dup currtopic @            (set? m# m# t#)
        subject-list getelem            (set? m# elem)
        part part "|" gsplit swap pop   (set? m# auth| ref| topic)
        5 rotate intostr "|" strcat     (m# "auth|" "ref|" "topic" "s|")
        swap strcat strcat strcat       (m# "auth|ref|s|topic")
        swap currtopic @ subject-list
        putelem
;
  
: getnext-unprotected (count count -- mesg#)
    dup not if pop pop 2 exit then
    over over - 1 + currtopic @ subject-list
    getelem
    split pop
    split pop
    split atoi swap pop not if
        over over - 1 +
        rot rot pop pop exit
    then
    1 - getnext-unprotected
;
  
( edit-readlines )
: readlines-loop
  read dup "." 1 strncmp if
    swap 1 + readlines-loop
  then
;
  
: edit-readlines
  0 readlines-loop
;
  
: input-message
    "You may now enter your message.  It may be multiple lines long."
    me @ swap notify
    "When you are finished entering, enter a '.' (period) on a line by itself."
    me @ swap notify
    edit-readlines pop
;
  
: clip-input
    dup 30 <= if exit then
    swap pop 1 - clip-input
;
  
: add-message (subjectname -- )
    currtopic @ topic-list
    getelem                (sub topicstr)
    part part "|" gsplit         (sub "a|" "t##|" "nm" "restofit")
    swap atoi 1 + intostr dup    (sub "a|" "t##|" "restofit" "nm+1" "nm+1")
    -5 rotate "|" strcat swap    (sub "nm+1" "a|" "t##|" "nm+1|" "restofit")
    strcat strcat strcat         (sub "nm+1" "auth|t##|nm+1|max|lst|topic")
    currtopic @ topic-list
    putelem                (sub "nm+1")
    currtopic @ get-topic-info
    dup rot me @ int intostr     ("nm+1" "nm+1" sub "me@")
    "|" strcat rot strcat        ("nm+1" sub "me@|nm+1")
    "|0|" strcat swap strcat     ("nm+1" "me@|nm+1|0|sub")
    messages-append              ("nm+1" m#)
    currmesg !
    input-message
    dup 30 >
    wiz-or-own? not and if
        "Sorry, but your post was too long.  Clipping to 30 lines."
        me @ swap notify
        clip-input
    then                         ("tn#" txt...txt cnt)
    currtopic @ currmesg @       ("tn#" txt...txt cnt t# m#)
    text-list 1 rot rot          ("tn#" txt...txt cnt 1 "BBt..." trig@)
    putrange
    currtopic @
    get-message-count
    topic-maxsubs @ > if
        currtopic @
        get-message-count
        dup getnext-unprotected
        delete-message
    then
;
  
: add-topic (topicname -- )
    trigger @ "BBnxttop"              ("topic" trig@ "BBnxttop")
    getpropstr atoi 1 + intostr       ("topic" "mt#+1")
    dup trigger @ "BBnxttop"          ("topic" "mt#+1" "mt#+1" trig@ "BBnxtop")
    rot 0 addprop dup me @            ("topic" "mt#+1" "mt#+1" me@)
    int intostr "|" strcat swap       ("topic" "mt#+1" "me@|" "mt#+1")
    strcat "|" strcat "0|20|all|"     ("topic" "mt#+1" "me@|mt#+1|" "0|20|all|")
    strcat 3 pick strcat rot swap     ("mt#+1" "topic" "me@|mt#+1|0|20|all|top")
    topics-append rot pop             ("topic" t#)
    "The first message now needs to be entered.  "
    "It should describe what the topic is all about, and what you expect "
    "it's it's contents to be." strcat strcat me @ swap notify
    currtopic ! add-message
    currmesg @ 1 preserve-message
;
  
: re-sub
    dup "Re" 2 strncmp if "Re: " swap strcat exit then
    dup "Re: " 4 strncmp not if
        ":" gsplit "^2:" swap strcat strcat exit
    then
    dup "Re^" 3 strncmp not if
        "^" gsplit ":" gsplit swap
        atoi 1 + intostr ":" strcat
        "^" swap strcat swap strcat strcat
    then
;
  
: bbs-main
    initialize
  
    dup not if pop
        currtopic @ dup not if
            pop list-topics
        else
            currmesg @ dup not if
                pop
                list-messages
            else
                1 + dup currmesg ! get-message-info
                topic-restrict @ read-restricted? if
                    2 topic-restrict @ trigger @
                    getelem
                    dup "%" strcmp not if
                        pop
                        "Topic is read-restricted.  Taking you to top level."
                    then
                    me @ swap notify
                    me @ "BBlast" trigger @
                    int intostr strcat "+" strcat
                    "0" 0 addprop
                    me @ "BBlastm" trigger @
                    int intostr strcat "+" strcat
                    "0" 0 addprop
                    exit
                then
                currmesg @
                currtopic @ get-message-count > if
                    "End of topic.  Taking you to topics level."
                    me @ swap notify
                    0 currmesg !
                    0 currtopic !
                    me @ "BBlast" trigger @
                    int intostr strcat "+" strcat
                    "0" 0 addprop
                    me @ "BBlastm" trigger @
                    int intostr strcat "+" strcat
                    "0" 0 addprop
                    list-topics
                    exit
                else
                    show-message
                then
                me @ "BBlastm" trigger @
                int intostr strcat "+" strcat
                currmesg @ intostr 0 addprop
            then
        then
        exit
    then
  
    dup "topics" stringcmp not
    over "tops" stringcmp not or
    over "t" stringcmp not or if
        pop
        me @ "BBlast" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        me @ "BBlastm" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        0 currtopic !
        0 currmesg !
        list-topics
        exit
    then
  
    dup "messages" stringcmp not
    over "mesgs" stringcmp not or
    over "m" stringcmp not or if
        pop
        currtopic @ not if
            me @ "You don't currently have a topic set." notify
            exit
        then
        me @ "BBlastm" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        0 currmesg !
        currtopic @ list-messages
        exit
    then
  
    dup atoi 0 > if
        currtopic @ not if
            atoi dup
            dup get-topic-count > if
                me @ "Improper topic reference number." notify
                pop exit
            then
            dup get-topic-info
            topic-restrict @ read-restricted? if
                2 topic-restrict @ trigger @
                getelem
                dup "%" strcmp not if
                    pop
                    "Sorry, but that topic is read-restricted."
                then me @ swap notify
                pop exit
            then
            dup currtopic !
            intostr me @ "BBlast" trigger @
            int intostr strcat "+" strcat
            rot 0 addprop
            currtopic @ list-messages
            exit
        else
            atoi dup currtopic @
            get-message-count > if
                me @ "Improper subject reference number." notify
                exit
            then
            dup currmesg !
            currtopic @ swap get-message-info
            topic-restrict @ read-restricted? if
                2 topic-restrict @ trigger @
                getelem
                dup "%" strcmp not if
                    pop
                    "Sorry, but that topic is read-restricted."
                then me @ swap notify
                exit
            then
            show-message
            me @ "BBlastm" trigger @
            int intostr strcat "+" strcat
            currmesg @ intostr 0 addprop
            exit
        then
    then
  
    dup "followup" stringcmp not if
        pop
        currtopic @ not if
            me @ "You don't currently have a topic set." notify
            exit
        then
        currtopic @ get-topic-info
        topic-restrict @ post-restricted? if
            2 topic-restrict @ trigger @
            getelem
            dup "%" strcmp not if
                pop
                "Sorry, but that topic is read-restricted."
            then me @ swap notify
            exit
        then
        wiz-or-own? not if
            three-of-six? if
                "Permission denied: You already posted 3 times in the last 6."
                me @ swap notify
                exit
            then
        then
        currmesg @ not if
            me @ "I don't know what message you want to follow up." notify
            exit
        then
        currtopic @ currmesg @
        get-message-info
        mesg-subject @ re-sub
        add-message
        exit
    then
  
    dup "help" stringcmp not
    over "h" stringcmp not or
    over "?" stringcmp not or if
        pop
        " "
        "____Command_________________  "
        " ____What it does_______________________" strcat
        get-trigname "  " strcat dup 31 fillspace strcat
        "Shows topics, subjects, or next message"  strcat
        "                                 depending on the current level."
        get-trigname " <refnum>" strcat dup 31 fillspace strcat
        "Selects a topic, or a message by number,"  strcat
        "                                 depending on the current level."
        get-trigname " top" strcat dup 31 fillspace strcat
        "Takes you directly to the topic level."  strcat
        get-trigname " mesg" strcat dup 31 fillspace strcat
        "Takes you from message to subjects level"  strcat
        get-trigname " followup" strcat dup 31 fillspace strcat
        "Follows up the current message."  strcat
        get-trigname " help" strcat dup 31 fillspace strcat
        "Shows this screen."  strcat
        get-trigname " top <topic-refnum>" strcat dup 31 fillspace strcat
        "Selects a new topic by topic number."  strcat
        get-trigname " post <subject>" strcat dup 31 fillspace strcat
        "Posts a message to the current topic."  strcat
        get-trigname " newtopic <topicname>" strcat dup 31 fillspace strcat
        "Wizard or owner command to create a new"  strcat
        "                                 topic with an intro message."
        get-trigname " preserve <msgref#>" strcat dup 31 fillspace strcat
        "preserves the message from auto-aging." strcat
        get-trigname " unpreserve <msgref#>" strcat dup 31 fillspace strcat
        "allows auto-aging of message. (default)" strcat
        get-trigname " kill <mesg-refnum>" strcat dup 31 fillspace strcat
        "Destroys a message of yours given by number."  strcat
        get-trigname " killtopic <topic-refnum>" strcat dup 31 fillspace
        strcat "Destroys a topic and all messages in it."  strcat
        "                                 This is a wiz or owner only command."
        get-trigname " restrict <top#> <list>" strcat dup 31 fillspace
        strcat "Wiz or owner command to restrict a topic." strcat
        get-trigname " maxposts <topic#> <max>" strcat dup 31 fillspace
        strcat "Wiz command to set a topic's max. posts." strcat
        21 0 edit-display cleanup
        exit
    then
  
    " " gsplit dup not if
        do_error
        exit
    then
    swap
  
    dup "top" stringcmp not
    over "topic" stringcmp not or if
        pop atoi dup 1 < if
            me @ "Improper Topic reference." notify
            pop exit
        then
        dup currtopic !
        dup get-topic-count > if
            me @ "Improper Topic reference." notify
            pop exit
        then
        dup intostr
        me @ "BBlast" trigger @
        int intostr strcat "+" strcat
        rot 0 addprop
        me @ "BBlastm" trigger @
        int intostr strcat "+" strcat
        "0" 0 addprop
        list-messages
        exit
    then
  
    dup "newtopic" stringcmp not if
        pop wiz-or-own? not if
            "Only a wizard or the owner can create a topic."
            me @ swap notify pop exit
        then
        dup strlen 55 > if
            me @ "Your topic name is more than 55 characters long." notify
            pop exit
        then
        add-topic
        exit
    then
  
    dup "post" stringcmp not if
        pop
        currtopic @ not if
            me @ "You don't currently have a topic set." notify
            pop exit
        then
        currtopic @ get-topic-info
        topic-restrict @ post-restricted? if
            2 topic-restrict @ trigger @
            getelem
            dup "%" strcmp not if
                pop
                "Sorry, but that topic is read-restricted."
            then me @ swap notify
            pop exit
        then
        wiz-or-own? not if
            three-of-six? if
                "Permission denied: You already posted 3 of the last 6 posts."
                me @ swap notify pop exit
            then
        then
        dup strlen 55 > if
            me @ "Your subject is more than 55 characters long." notify
            pop exit
        then
        add-message
        exit
    then
  
    dup "kill" stringcmp not if
        pop
        currtopic @ dup not if
            me @ "You don't currently have a topic set." notify
            exit
        then
        get-topic-info
        atoi dup 1 < if
            me @ "Improper message reference." notify
            exit
        then
        dup currtopic @
        get-message-count > if
            me @ "Improper message reference." notify
            pop exit
        then
        delete-message
        exit
    then
  
    dup "killtopic" stringcmp not if
        pop atoi dup 1 < if
            me @ "Improper topic reference." notify
            pop exit
        then
        dup get-topic-count > if
            me @ "Improper topic reference." notify
            pop exit
        then
        delete-topic
        exit
    then
  
    dup "restrict" stringcmp not if
        pop " " gsplit
        dup not if do_error pop exit then
        swap atoi dup 1 < if
            me @ "Improper topic reference." notify
            exit
        then
        dup get-topic-count > if
            me @ "Improper topic reference." notify
            pop exit
        then
        dup topic-list getelem
        part part part part "|" gsplit swap
        pop 7 rotate "|" strcat swap strcat
        strcat strcat strcat strcat swap
        topic-list putelem
        "Done." me @ swap notify
        exit
    then
  
    dup "maxposts" stringcmp not if
        pop " " gsplit
        dup atoi 1 < if
            do_error
            pop exit
        then
        swap atoi dup 1 < if
            me @ "Improper topic reference." notify
            exit
        then
        dup get-topic-count > if
            me @ "Improper topic reference." notify
            pop exit
        then
        dup topic-list getelem
        part part part "|" gsplit swap
        pop 6 rotate "|" strcat swap strcat
        strcat strcat strcat swap
        topic-list putelem
        "Done." me @ swap notify
        exit
    then
  
    dup "preserve" stringcmp not if
        pop
        currtopic @ dup not if
            me @ "You don't currently have a topic set." notify
            pop exit
        then
        get-topic-info
        atoi dup 1 < if
            me @ "Improper message reference." notify
            pop exit
        then
        dup currtopic @
        get-message-count > if
            me @ "Improper message reference." notify
            pop exit
        then
        1 preserve-message
        "Done." me @ swap notify
        exit
    then
  
    dup "unpreserve" stringcmp not if
        pop
        currtopic @ dup not if
            me @ "You don't currently have a topic set." notify
            pop exit
        then
        get-topic-info
        atoi dup 1 < if
            me @ "Improper message reference." notify
            pop exit
        then
        dup currtopic @
        get-message-count > if
            me @ "Improper message reference." notify
            pop exit
        then
        0 preserve-message
        "Done." me @ swap notify
        exit
    then
  
    do_error
;
.
c
q

Site Stats

Snippets: 1791
Codebases: 571