Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.89 KB | None | 0 0
  1. @switch/inline isdbref(u(bbs))=0,{@tel create(Bulletin Board System <BBS>)=config(master_room)}
  2. &bbs u(coi)=locate(config(master_room),Bulletin Board System <BBS>,TXxi)
  3. @parent u(bbs)=u(coi)
  4. @set u(bbs)=WIZARD !NO_COMMAND
  5.  
  6. @switch/inline isdbref(u(bbs))=1,{@switch/inline isdbref(u(bbs-db))=0,{@tel create(BBS Database <BBS-DB>)=u(bbs)}}
  7. &bbs-db u(coi)=locate(u(bbs),BBS Database <BBS-DB>,TXxi)
  8. @parent u(bbs-db)=u(coi)
  9. @set u(bbs-db)=WIZARD
  10. @trigger u(ccs)/INC`MVTREE=u(bbs),BB,u(bbs-db),BB
  11. @mvattr u(bbs)/GROUPS=u(bbs-db)/GROUPS
  12. @dolist lthings(u(bbs))=@tel %i0=u(bbs-db)
  13.  
  14. &RFN`MSGHEAD u(bbs)=msghead(%0)
  15. &RFN`HEADER u(bbs)=header(%0,,BBS`BORDER,BBS`BORDERDOT,BBS`BORDERTEXT)
  16. &RFN`SUBHEADER u(bbs)=subheader(%0,,BBS`BORDER,BBS`BORDERDOT,BBS`BORDERTEXT)
  17. &RFN`SEPARATOR u(bbs)=separator(%0,,BBS`BORDER,BBS`BORDERDOT,BBS`BORDERTEXT)
  18.  
  19. &CMD`BB u(bbs)=$^(?s)(?\:\+)?(bb|gb)(\S+)(?\: +(.+?))?(?\:/(.+?)?)?(?\:=(.*))?$:@include u(bbs)/INC`INIT`%1;@include u(ccs)/INC`PARTIAL=%2,setunion(setunion(v(VAR`BB`PLAYCOMMS),if(setr(isadmin,switch(%1,bb,isadmin(%#),gb,u(u(gso)/FUN`GRPPERM,%:,%q<gid1>,GBADMIN))),v(VAR`BB`ADMINCOMMS)),|,|),if(hasflag(%#,WIZARD),v(VAR`BB`WIZCOMMS)),|,|),|,setr(ann,ucstr(%1S)),command,command;@include u(bbs)/INC`[strfirstof(%q<command>,WRITE)]=ucstr(%1),%3,%4,%5
  20. @set u(bbs)/CMD`BB=regexp
  21.  
  22. &CMD`BBWRITE u(bbs)=$^(?s)\+(bb|gb)(?\: +(.*))?$:th setq(ann,ucstr(%1S));@include u(bbs)/INC`INIT`%1;@include u(bbs)/INC`WRITE=ucstr(%1),%2
  23. @set u(bbs)/CMD`BBWRITE=regexp
  24.  
  25. &VAR`BB`PLAYCOMMS u(bbs)=READ|POST|REMOVE|MOVE|SCAN|NEXT|EDIT|WRITE|JOIN|LEAVE|LIST|PROOF|TOSS|CATCHUP|SEARCH|NEW|TIMEOUT|ALL|CHECK|COMMENT
  26. &VAR`BB`ADMINCOMMS u(bbs)=NEWGROUP|CLEARGROUP|CONFIG|TIMEOUT|LOCK|UNLOCK|ORDER|RENAME
  27. &VAR`BB`WIZCOMMS u(bbs)=IMPORT|CONVERT|TRANSFER
  28.  
  29. &INC`INIT`GB u(bbs)=@assert isdbref(u(gso))=@nspemit %#=msghead(GBS) ERROR: The Group System is not installed!;@include u(gso)/INC`CODE`VALGROUP=switch(%2,rea*,strfirstof(%5,getstat(%#/D`GROUP,Group),0),sca*,strfirstof(%3,getstat(%#/D`GROUP,Group),0),strfirstof(getstat(%#/D`GROUP,Group),0)),1;th setstat(%#/D`GROUP,Group,%q<gid1>)
  30.  
  31. &FUN`VALIDGROUPS`BB u(bbs)=filterbool(#lambda/u(FUN`CAN%1`BB,%0,\%0,%2),u(FUN`LISTGROUPS`BB))
  32. &FUN`BBADMIN`BB u(bbs)=cor(hasflag(%0,WIZARD),if(strmatch(lock(%1/Admin),*UNLOCKED*),0,elock(%1/Admin,%0)))
  33. &FUN`CANREAD`BB u(bbs)=cand(cor(elock(%1/Read,%0),u(FUN`BBADMIN`BB,%0,%1)),cor(%2,not(default(%0/D`BB`%1`OMIT,0))))
  34. &FUN`CANWRITE`BB u(bbs)=cand(cor(elock(%1/Write,%0),u(FUN`BBADMIN`BB,%0,%1)),cor(%2,not(default(%0/D`BB`%1`OMIT,0))))
  35.  
  36. &FUN`VALIDGROUPS`GB u(bbs)=filterbool(#lambda/u(FUN`CAN%1`GB,%0,\%0,%2,strfirstof(%3,%q<gid1>)),u(FUN`LISTGROUPS`GB,strfirstof(%3,%q<gid1>)))
  37. &FUN`BBADMIN`GB u(bbs)=u(u(gso)/FUN`GRPPERM,objid(%0),%1,MODERATE,GROUP)
  38. &FUN`CANREAD`GB u(bbs)=cand(cor(u(FUN`BBADMIN`GB,%0,%3),if(strlen(get(u(bbs-db)/BB`%1`GREAD)),lte(u(u(gso)/FUN`GETRANK,%3,objid(%0)),get(u(bbs-db)/BB`%1`GREAD)),1)),cor(%2,not(default(%0/D`BB`%1`OMIT,0))))
  39. &FUN`CANWRITE`GB u(bbs)=cand(cor(u(FUN`BBADMIN`GB,%0,%3),if(strlen(get(u(bbs-db)/BB`%1`GWRITE)),lte(u(u(gso)/FUN`GETRANK,%3,objid(%0)),get(u(bbs-db)/BB`%1`GWRITE)),1)),cor(%2,not(default(%0/D`BB`%1`OMIT,0))))
  40.  
  41. &INC`CHECK u(bbs)=@switch/inline t(default(%#/D`BB`CHECK,1))=1,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You will no longer +bbscan on connect!;&D`BB`CHECK %#=0},0,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You will now +bbscan on connect!;&D`BB`CHECK %#=1}
  42.  
  43. &PLAYER`CONNECT`CHECK u(bbs)=@assert t(default(%0/D`BB`CHECK,1));@force/inplace %0=+bbscan
  44.  
  45. &FUN`LISTGROUPS`BB u(bbs)=filterbool(#lambda/isdbref(\%0),get(u(bbs-db)/groups))
  46. &FUN`LISTGROUPS`GB u(bbs)=filterbool(#lambda/isdbref(\%0),get(%q<gid1>/BOARDS))
  47.  
  48. &INC`CHECK`FINDBB u(bbs)=@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You must enter a board to use!;@switch/inline %8=1,{th setq(bbnum,match(setr(listgroups,u(FUN`LISTGROUPS`%0)),setr(bb,namegrab(setr(valgroups,%q<listgroups>),if(valnum(%1),elements(%q<listgroups>,%1),%1)))))},{th setq(bbnum,match(setr(listgroups,u(FUN`LISTGROUPS`%0)),setr(bb,namegrab(setr(valgroups,u(FUN`VALIDGROUPS`%0,%#,%2,%3)),if(valnum(%1),elements(%q<listgroups>,%1),%1)))))};@assert isdbref(%q<bb>)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You are not a [ucstr(%2)] member of that board.
  49.  
  50. &INC`CHECK`FINDPOST u(bbs)=@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No post entered!;@assert valnum(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Posts must be addressed by their post #s!;@assert strlen(setr(post,elements(u(FUN`LISTPOSTS,%2),setr(postnum,%1))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Post not found.
  51.  
  52. &FUN`LISTPOSTS u(bbs)=sortkey(#lambda/baseconv(\%0,36,10),lattr(%0/*))
  53.  
  54. &FUN`MESSLIST u(bbs)=setunion(iter(%2,switch(1,valnum(%i0),%i0,regmatchi(%i0,^\\d+-\\d+$),setq(num1,abs(before(%i0,-)),num2,abs(after(%i0,-)))[setq(ord,sort(%q<num1> %q<num2>))][lnum(first(%q<ord>),last(%q<ord>))],strmatch(%i0,u),iter(setunion(setdiff(lattr(%1/*),get(%0/D`BB`%1`READ)),filterbool(#lambda/strmatch(u(FUN`MSGFLAG,%0,%1,\%0),C),lattr(%1/*))),match(u(FUN`LISTPOSTS,%1),%i0)),0),\,,%B),,%B,n)
  55.  
  56. &FUN`CONFIG u(bbs)=if(cand(strlen(%0),isdbref(%0)),u(FUN`CONFIG`BB`%1,%0),if(strlen(%0),u(FUN`CONFIG`GLOBAL`%0)))
  57.  
  58. &FUN`CONFIG`GLOBAL`AUTOTIMEOUT u(bbs)=default(u(bbs-db)/BB`AUTOTIMEOUT,0)
  59. &FUN`CONFIG`GLOBAL`TIMEOUT u(bbs)=default(u(bbs-db)/BB`TIMEOUT,mul(60,60,24,30))
  60. &FUN`CONFIG`GLOBAL`INTERVAL u(bbs)=default(u(bbs-db)/BB`INTERVAL,mul(60,60,24))
  61. &FUN`CONFIG`BB`TIMEOUT u(bbs)=strfirstof(get(u(bbs-db)/BB`%0`TIMEOUT),u(FUN`CONFIG,timeout))
  62. &FUN`CONFIG`BB`ANONYMOUS u(bbs)=t(strlen(get(u(bbs-db)/BB`%0`ANONYMOUS)))
  63.  
  64. &INC`POST u(bbs)=@include u(ccs)/INC`JAILCHECK;@switch/inline strlen(%1)=0,{@assert hasattr(%#/D`%0`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have a post in progress.;th setq(gid1,get(%#/D`%0`NEW`GID));@include u(bbs)/INC`POST`MAKEMESS=%#,get(%#/D`%0`NEW`BBNUM),get(%#/D`%0`NEW`BB),left(get(%#/D`%0`NEW`TITLE),34),get(%#/D`%0`NEW`TEXT),get(%#/D`%0`NEW`TYPE);@wipe %#/D`%0`NEW},{@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE,,,,,,%4;@assert strlen(%2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Title field empty!;@break cor(strmatch(%2,*%r*),strmatch(%2,*%t*))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Titles may not contain linebreaks or indents.;@switch/inline strlen(%3)=0,{@include u(bbs)/INC`POST`BEGIN},{@include u(bbs)/INC`POST`MAKEMESS=%#,%q<bbnum>,%q<bb>,left(%2,34),%3,%0}}
  65.  
  66. &INC`POST`BEGIN u(bbs)=@break hasattr(%#/D`BB`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You already have a post in progress. use +[lcstr(%0)] <text> to add to it, +[lcstr(%0)]proof to view it, or +[lcstr(%0)]post to post it. Alternatively, +[lcstr(%0)]toss to trash it.;&D`%0`NEW`BBNUM %#=%q<bbnum>;&D`%0`NEW`BB %#=%q<bb>;&D`%0`NEW`TITLE %#=%2;&D`%0`NEW`TYPE %#=%0;&D`%0`NEW`GID %#=%q<gid1>;@nspemit %#=You start your posting to Board #%q<bbnum> ([name(%q<bb>)])%RYou can now compose the body of the post by using '+[lcstr(%0)]write <text>'%Ror '+[lcstr(%0)] <text>'. When you are finished, type '+[lcstr(%0)]post' to send it. See '+help bbs' for help!
  67.  
  68. &INC`ALTWRITE u(bbs)=@include u(bbs)/INC`WRITE=%0,%1
  69.  
  70. &INC`WRITE u(bbs)=@assert hasattr(%#/D`%0`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have a post in progress.;@break eq(strlen(get(%#/D`%0`NEW`TEXT)),setr(max,strlen(lnum(1,9999))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Your post has already reached %q<max> characters - all that will fit. You may not add more text.;@assert strlen(setr(entry,%1[if(strlen(%2),/%2)][if(strlen(%3),=%3)]))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Nothing entered to write. Use +[lcstr(%0)]proof to see what you've written!;&D`%0`NEW`TEXT %#=trim(cat(trim(get(%#/D`%0`NEW`TEXT)),trim(%q<entry>)));@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Text added to bbpost. Your post has reached [strlen(get(%#/D`%0`NEW`TEXT))] of [strlen(lnum(1,9999))] max characters!
  71.  
  72. &INC`TOSS u(bbs)=@assert hasattr(%#/D`%0`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have a post in progress.;@wipe %#/D`%0`NEW;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Post discarded.
  73.  
  74. &INC`PROOF u(bbs)=@assert hasattr(%#/D`%0`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have a post in progress.;@nspemit %#=u(RFN`HEADER,name(get(%#/D`%0`NEW`BB)) - [get(%#/D`%0`NEW`TITLE)]);@nspemit %#=get(%#/D`%0`NEW`TEXT);@nspemit %#=u(RFN`HEADER,Length: [strlen(get(%#/D`%0`NEW`TEXT))] Characters)
  75.  
  76. &INC`POST`MAKEMESS u(bbs)=th setq(next,baseconv(default(u(bbs-db)/BB`%2`NEXT,1),10,36));&BB`%2`NEXT u(bbs-db)=add(default(u(bbs-db)/BB`%2`NEXT,1),1);&%q<next> %2=%4;&%q<next>`BY %2=name(%0);&%q<next>`BYDB %2=objid(%0);&%q<next>`ON %2=secs();&%q<next>`HDR %2=%3;@switch/inline u(FUN`CONFIG,%2,TIMEOUT)=0,{&%q<next>`TIMEOUT %2=mul(60,60,24,30);&%q<next>`NOTIMEOUT %2=1},{&%q<next>`TIMEOUT %2=firstof(u(FUN`CONFIG,%2,TIMEOUT),0)};@switch/inline %5=BB,{@include u(bbs)/INC`ALERT=%5,%1,%2,{(New [ucstr(%5)] Message ([pueblize(setr(messnum,%1/[words(lattr(%2/*))]),+[lcstr(%5)]read %q<messnum>)]) posted to '[name(%2)]' by [if(get(u(bbs-db)/BB`%2`ANONYMOUS),default(u(bbs-db)/BB`%2`ANONYMOUS,Anonymous),%n)]: %3)}},GB,{@include u(bbs)/INC`ALERT=%5,%1,%2,{ansi(hc,<GROUP BB>) New message posted on '[pueblize(%q<gname1>,+group %q<gname1>)]' '[name(%2)]' Board ([pueblize(setr(messnum,%1/[words(lattr(%2/*))]),+[lcstr(%5)]read %q<messnum>=%q<gid1>)]) by [if(get(u(bbs-db)/BB`%2`ANONYMOUS),default(u(bbs-db)/BB`%2`ANONYMOUS,Anonymous),%n)]: %3}};&D`BB`%q<bb>`READ %#=setunion(get(%#/D`BB`%q<bb>`READ),%q<next>);&D`BB`LASTPOST %#=%q<bb> %q<next>
  77.  
  78. &INC`ALERT u(bbs)=@switch/inline %0=BB,{th setq(members,filterbool(#lambda/u(FUN`CANREAD`BB,\%0,%2,,),setunion(lwho(),)))},GB,{th setq(members,filterbool(#lambda/cand(isgroupmember(\%0,%q<gid1>),u(FUN`CANREAD`GB,\%0,%2,,%q<gid1>)),setunion(lwho(),)))};@nspemit/list %q<members>=%3
  79. @@ %0 - Mode, GB or BB. %1 - Board number. %2 - Board DBREF. %3 - Message.
  80.  
  81. &INC`NEWGROUP u(bbs)=@assert strlen(%1%2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No name entered for the new board!;@assert valid(name,%1%2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: That is not a suitable name for a board.;@break gte(strlen(%1%2),29)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Board names must be 29 characters long or less.;@break isdbref(locate(switch(%0,BB,u(bbs-db),GB,%q<gid1>),trim(%1%2),TXxi))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: A board already has that name.;@tel setr(bb,create(trim(%1%2)))=switch(%0,BB,u(bbs-db),GB,%q<gid1>);@power %q<bb>=many_attribs;@switch/inline %0=BB,{&groups u(bbs-db)=trim(cat(get(u(bbs-db)/groups),%q<bb>))},GB,{&BOARDS %q<gid1>=trim(cat(get(%q<gid1>/BOARDS),%q<bb>))};@set %q<bb>=SAFE;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Board '[trim(%1%2)]' created!;th setq(bbnum,match(u(FUN`LISTGROUPS`%0),%q<bb>))
  82.  
  83. &INC`CLEARGROUP u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(ccs)/INC`VERIFY={[ansi(hr,WARNING:)] Deleting %q<ann> Board %q<bbnum> will also delete all messages. This cannot be undone! Please enter the same command again within 10 seconds to verify.},CLEARGROUP %0 %1,%q<ann>;@set %q<bb>=!SAFE;@nuke %q<bb>;@nuke %q<bb>;@wipe u(bbs-db)/BB`%q<bb>;@switch/inline %0=BB,{&groups u(bbs-db)=ldelete(get(u(bbs-db)/groups),%q<bbnum>)},GB,{&BOARDS %q<gid1>=ldelete(get(%q<gid1>/`BOARDS),%q<bbnum>)}
  84.  
  85. &INC`REMOVE u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@assert strlen(%2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No posts entered to remove.;th setq(listposts,u(FUN`LISTPOSTS,%q<bb>));@assert words(setr(processed,filterbool(#lambda/if(strlen(setr(post,elements(%q<listposts>,\%0))),cor(%q<isadmin>,strmatch(get(%q<bb>/\%q<post>`BYDB),%:))),setr(orig,u(FUN`MESSLIST,%#,%q<bb>,before(%2,/))))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No posts to remove.;@switch/inline gt(words(setr(cannot,setdiff(%q<processed>,%q<orig>,%b,n))),0)=1,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Could not remove posts: [itemize(%q<cannot>,%b,and,\,)]};@break cand(gt(words(%q<processed>),1),strlen(after(%2,/)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Cannot remove comments from more than one post!;@switch/inline t(strlen(after(%2,/)))=1,{@include u(bbs)/INC`REMOVE`COMMENT},{@dolist %q<processed>={@wipe %q<bb>/[elements(%q<listposts>,%i0)];@nspemit %#=Message %i0 removed from group #%q<bbnum> ([name(%q<bb>)]).}}
  86.  
  87. &INC`REMOVE`COMMENT u(bbs)=@assert valnum(after(%2,/))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Comments must be addressed by their comment number!;@assert strlen(setr(comm,elements(sortkey(#lambda/last(\%0,`),lattr(%q<bb>/[elements(%q<listposts>,%q<processed>)]`COMM`*)),after(%2,/))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Comment not found.;@assert cor(%q<isadmin>,strmatch(get(%q<bb>/%q<comm>`BYDB),%:))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have permission to remove that comment.;@wipe %q<bb>/%q<comm>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Comment removed!
  88.  
  89. &INC`READ u(bbs)=@switch/inline strlen(%1%2)=0,{@include u(bbs)/INC`READ`LISTGROUPS},{@switch/inline cand(strlen(%1),strlen(%2))=1,{@include u(bbs)/INC`READ`CHECKPOST},{@switch/inline gt(strlen(%1),0)=1,{@include u(bbs)/INC`READ`LISTMESS},{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: How the hell did we get here?}}}
  90.  
  91. &FUN`NAME u(bbs)=switch(%0,BB,mudname() BBS%B[if(isdbref(%1),-%b[name(%1)],Boards)],GB,name(%2) GBS%B[if(isdbref(%1),-%b[name(%1)],Boards)])
  92.  
  93. &INC`ALL u(bbs)=@assert words(setr(allunread,filterbool(#lambda/strlen(setdiff(lattr(\%0/*),get(%#/D`BB`\%0`READ))),u(FUN`VALIDGROUPS`%0,%#,READ))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) There are no Unread messages on the %q<ann>!;@dolist %q<allunread>={@switch/inline %0=BB,{@force/inplace %#=+bbread %i0/u},GB,{@force/inplace %#=+gbread %i0/u}}
  94.  
  95. &INC`READ`LISTGROUPS u(bbs)=@switch/inline %0=BB,{th setq(allgroups,get(u(bbs-db)/groups),groups,u(FUN`VALIDGROUPS`BB,%#,READ))},GB,{th setq(allgroups,get(%q<gid1>/BOARDS),groups,u(FUN`VALIDGROUPS`GB,%#,READ))};@nspemit %#=u(RFN`HEADER,u(fun`name,%0,%q<bb>,%q<gid1>));@nspemit %#=[space(7)]Group Name[space(20)]Last Post[space(6)]# of messages;@nspemit %#=u(RFN`SEPARATOR);@dolist %q<groups>={@nspemit %#=rjust(pueblize(ansi(custcolor(%#,BBS`BOARDNUM),match(%q<allgroups>,%i0)),+[lcstr(%0)]read [match(%q<allgroups>,%i0)]),2)[center(ansi(custcolor(%#,BBS`BOARDSTATUS),switch(switch(%0,BB,[if(strmatch(lock(%i0/READ),*UNLOCKED*),1,0)]:[if(strmatch(lock(%i0/WRITE),*UNLOCKED*),1,0)]:[u(FUN`CANWRITE`%0,%#,%i0)],GB,[not(hasattr(u(bbs-db)/BB`%i0`GREAD))]:[not(hasattr(u(bbs-db)/BB`%i0`GWRITE))]:[u(FUN`CANWRITE`%0,%#,%i0,,%q<gid1>)]),1:1:1,,1:*:1,{(-)},1:*:0,-,*)),5)][ljust(pueblize(ansi(custcolor(%#,BBS`BOARDNAME),name(%i0)),+[lcstr(%0)]read [match(%q<allgroups>,%i0)]),30)][ljust(ansi(custcolor(%#,BBS`LASTPOST),if(setr(time,strfirstof(get(%i0/[setr(last,last(u(FUN`LISTPOSTS,%i0)))]`EDITED),get(%i0/%q<last>`ON))),timefmt($b $d $Y,%q<time>),None)),20)][rjust(ansi(custcolor(%#,BBS`NUMMESS),nattr(%i0/*)),3)]%b[ljust(ansi(custcolor(%#,BBS`NUMMESS),if(words(setdiff(lattr(%i0/*),get(%#/D`BB`%i0`READ))),U)),2)];@switch/inline eq(inum(0),words(%q<groups>))=1,{@nspemit %#=u(RFN`SEPARATOR)%r'*' = restricted[space(5)]'-' = read only[space(5)]'\(-\)' = read only\, but you can write%r[u(RFN`HEADER)]}};@switch/inline words(%q<groups>)=0,{@nspemit %#=u(RFN`SEPARATOR,)%r'*' = restricted[space(5)]'-' = read only[space(5)]'\(-\)' = read only\, but you can write%r[u(RFN`HEADER)]}
  96.  
  97. &INC`READ`LISTMESS u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,READ;@nspemit %#=u(RFN`HEADER,u(fun`name,%0,%q<bb>,%q<gid1>));@nspemit %#=space(8)Message[space(28)]Posted[space(8)]By;@nspemit %#=u(RFN`SEPARATOR);@dolist setr(posts,u(FUN`LISTPOSTS,%q<bb>))={@nspemit %#=ljust(pueblize(ansi(custcolor(%#,BBS`POSTNUM),%q<bbnum>/[match(%q<posts>,%i0)]),+[lcstr(%0)]read %q<bbnum>/[match(%q<posts>,%i0)]),6)[ljust(u(u(bbs)/FUN`MSGFLAG,%#,%q<bb>,%i0),2)][ljust(ansi(custcolor(%#,BBS`POSTTITLE),get(%q<bb>/%i0`HDR)),35)][ljust(ansi(custcolor(%#,BBS`POSTDATE),timefmt($b $d $Y,lmath(max,firstof(get(%q<bb>/%i0`EDITED),get(%q<bb>/%i0`ON))))),14)][left(ansi(custcolor(%#,BBS`POSTAUTHOR),if(get(u(bbs-db)/BB`%q<bb>`ANONYMOUS),if(%q<isadmin>,([ansi(hx,get(%q<bb>/%i0`BY))]),default(u(bbs-db)/BB`%q<bb>`ANONYMOUS,Anonymous)),get(%q<bb>/%i0`BY))),21)];@switch/inline eq(inum(0),words(%q<posts>))=1,{@nspemit %#=u(RFN`HEADER,)}}
  98.  
  99. &FUN`MSGFLAG u(bbs)=if(match(get(%0/D`BB`%1`READ),%2),,U)
  100.  
  101. &INC`READ`CHECKPOST u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,READ;@assert strlen(%2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No posts entered to check.;th setq(listposts,u(FUN`LISTPOSTS,%q<bb>));@assert words(setr(processed,filterbool(#lambda/strlen(elements(%q<listposts>,\%0)),u(FUN`MESSLIST,%#,%q<bb>,%2))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Posts not found.;@dolist %q<processed>=@include u(bbs)/INC`READ`SHOWPOST=%0,%i0,%q<bb>
  102.  
  103. &FUN`GETTIMEOUT u(bbs)=if(default(%0/%1`NOTIMEOUT,0),X,get(%0/%1`TIMEOUT))
  104. @@ %0 - bbs, %1 - post
  105.  
  106. &INC`READ`SHOWPOST u(bbs)=@include u(bbs)/INC`CHECK`FINDPOST=%0,%1,%2;@nspemit %#=u(RFN`HEADER,u(fun`name,%0,%2,%q<gid1>));@nspemit %#=ljust(Message: [ansi(custcolor(%#,BBS`POSTNUM),%q<bbnum>/%q<postnum>)] [ansi(custcolor(%#,BBS`POSTTIMEOUT),\([if(not(u(FUN`CONFIG,autotimeout)),No System Timeout,switch(setr(showtimeout,u(FUN`GETTIMEOUT,%q<bb>,%q<post>)),X,No Timeout,>0,timestring(%q<showtimeout>),Timed Out!))]\))],35)Posted[space(8)]Author%r[ljust(ansi(custcolor(%#,BBS`POSTTITLE),get(%2/%q<post>`HDR)),35)][ljust(ansi(custcolor(%#,BBS`POSTDATE),timefmt($b $d $Y,lmath(max,firstof(get(%2/%q<post>`EDITED),get(%2/%q<post>`ON))))),14)][left(ansi(custcolor(%#,BBS`POSTAUTHOR),if(get(u(bbs-db)/BB`%q<bb>`ANONYMOUS),if(%q<isadmin>,([ansi(hx,get(%q<bb>/%q<post>`BY))]),default(u(bbs-db)/BB`%q<bb>`ANONYMOUS,Anonymous)),get(%q<bb>/%q<post>`BY))),21)]%R[u(RFN`SEPARATOR)];@nspemit %#=get(%q<bb>/%q<post>);@switch/inline t(nattr(%q<bb>/%q<post>`COMM`*))=1,{@include u(bbs)/INC`READ`SHOWCOMMS},0,{@nspemit %#=u(RFN`HEADER)};th setq(oldids,setdiff(get(%#/D`BB`%2`READ),lattr(%2/*)));&D`BB`%2`READ %#=setunion(setdiff(get(%#/D`BB`%2`READ),%q<oldids>),%q<post>)
  107.  
  108. &INC`READ`SHOWCOMMS u(bbs)=@dolist setr(allcomms,sortkey(#lambda/last(\%0,`),lattr(%q<bb>/%q<post>`COMM`*)))={@nspemit %#=u(RFN`SEPARATOR,Comment [inum(0)] - Added [ansi(custcolor(%#,BBS`POSTDATE),timefmt($b $d $Y,get(%q<bb>/%i0`ON)))]);@nspemit %#=ansi(h,get(%q<bb>/%i0`BY)) Commented:;@nspemit %#=get(%q<bb>/%i0);@switch/inline eq(inum(0),words(%q<allcomms>))=1,{@nspemit %#=u(RFN`HEADER)}}
  109.  
  110. &INC`COMMENT u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(bbs)/INC`CHECK`FINDPOST=%0,%2,%q<bb>;@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Comment contents empty!;&[setr(attr,%q<post>`COMM`[nextslot(%q<bb>,%q<post>`COMM)])] %q<bb>=%3;&%q<attr>`BY %q<bb>=%n;&%q<attr>`BYDB %q<bb>=%:;&%q<attr>`ON %q<bb>=secs();&%q<post>`EDITED %q<bb>=secs();@switch/inline strmatch(get(u(job)/vb),%#)=0,{@include u(bbs)/INC`ALERT=%0,%q<bbnum>,%q<bb>,{(New Comment added to [ucstr(%0)][if(strmatch(%0,GB),%b\([name(%q<gid1>)]\))] Message ([pueblize(setr(messnum,%q<bbnum>/%q<postnum>),+[lcstr(%0)]read %q<messnum>[if(strmatch(%0,GB),=%q<gid1>)])]) '[get(%q<bb>/%q<post>`HDR)]' on '[name(%q<bb>)]' by %n)}}
  111.  
  112. &INC`NEXT u(bbs)=th iter(u(FUN`VALIDGROUPS`%0,%#,READ),iter(setr(listposts,u(u(bbs)/FUN`LISTPOSTS,%i0)),if(match(U C,u(u(bbs)/FUN`MSGFLAG,%#,%i1,%i0)),setq(msg,%i0,bb,%i1)[ibreak(2)])));@assert isdbref(%q<bb>)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) There are no unread postings on the %q<ann>.;th setq(bbnum,match(u(FUN`LISTGROUPS`%0),%q<bb>));@include u(bbs)/INC`READ`SHOWPOST=%0,match(%q<listposts>,%q<msg>),%q<bb>
  113.  
  114. &INC`NEW u(bbs)=@include u(bbs)/INC`NEXT
  115.  
  116. &INC`EDIT u(bbs)=@include u(ccs)/INC`JAILCHECK;@switch/inline %1=TEXT,{@include u(bbs)/INC`EDIT`POST},TITLE,{@include u(bbs)/INC`EDIT`POST},{@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(bbs)/INC`CHECK`FINDPOST=%0,%2,%q<bb>;@assert cor(%q<isadmin>,isadmin(%#),strmatch(get(%q<bb>/%q<post>`BYDB),%:))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You cannot edit that post.;@assert strlen(before(%3,/))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No text entered to check for.;&%q<post> %q<bb>=edit(get(%q<bb>/%q<post>),before(%3,/),after(%3,/));&%q<post>`EDITED %q<bb>=secs();@nspemit %#=u(RFN`HEADER,)%RMessage %q<bbnum>/%q<postnum> ([name(%q<bb>)]/%q<postnum>) now reads:%R[u(RFN`SUBHEADER,)];@nspemit %#=get(%q<bb>/%q<post>);@nspemit %#=u(RFN`HEADER,)}
  117.  
  118. &INC`EDIT`POST u(bbs)=@assert hasattr(%#/D`BB`NEW)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You don't have a post in progress.;@assert strlen(before(%3,/))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No text entered to check for.;&D`BB`NEW`%1 %#=edit(get(%#/D`BB`NEW`%1),before(%3,/),after(%3,/));@nspemit %#=u(RFN`HEADER,)%RMessage now reads:%R[u(RFN`SUBHEADER,get(%#/D`BB`NEW`TITLE))];@nspemit %#=get(%#/D`BB`NEW`TEXT);@nspemit %#=u(RFN`HEADER,)
  119.  
  120. &INC`LEAVE u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,READ,1;@break default(%#/D`BB`%q<bb>`OMIT,0)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You have already left that board.;&D`BB`%q<bb>`OMIT %#=1;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You have removed yourself from the [name(%q<bb>)] board.
  121. &INC`JOIN u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,READ,1;@assert default(%#/D`BB`%q<bb>`OMIT,0)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You are already watching this board.;&D`BB`%q<bb>`OMIT %#=0;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You have joined the [name(%q<bb>)] board.
  122.  
  123. &INC`SCAN u(bbs)=@include/nobreak u(bbs)/INC`SCAN`DOSCAN;@switch %0=BB,{@include u(bbs)/INC`SCAN`GROUPSCAN}
  124.  
  125. &INC`SCAN`DOSCAN u(bbs)=@assert words(setr(groups,filterbool(#lambda/words(iter(lattr(\%0/*),u(u(bbs)/FUN`MSGFLAG,%#,\%0,\%i0))),u(FUN`VALIDGROUPS`%0,%#,READ))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) There are no unread postings on the [switch(%0,GB,%q<gname1> GBS,BBS)].;th setq(listgroups,u(FUN`LISTGROUPS`%0));@dolist %q<groups>={@switch/inline inum(0)=1,{@nspemit %#=u(RFN`HEADER,u(FUN`NAME,%0,,%q<gid1>) - Unread Postings)};th setq(posts,u(FUN`LISTPOSTS,%i0));@nspemit %#=pueblize(name(%i0) (#[setr(bbnum,match(%q<listgroups>,%i0))]),+[lcstr(%0)]read %q<bbnum>[if(strmatch(%0,GB),=%q<gid1>)]): [setr(num,words(setr(unread,filterbool(#lambda/match(U C,u(u(bbs)/FUN`MSGFLAG,%#,%i0,\%0)),%q<posts>))))] unread ([itemize(iter(%q<unread>,pueblize(setr(postnum,match(%q<posts>,%i0)),+[lcstr(%0)]read %q<bbnum>/%q<postnum>[if(strmatch(%0,GB),=%q<gid1>)])),%b,and,\,)]);&D`BBTOTAL %#=add(%q<num>,get(%#/D`BBTOTAL));@switch/inline eq(words(%q<groups>),inum(0))=1,{@nspemit %#=u(RFN`HEADER,Total Unread: [get(%#/D`BBTOTAL)]);@wipe %#/D`BBTOTAL}}
  126.  
  127. &INC`SCAN`GROUPSCAN u(bbs)=@assert strfirstof(getstat(%#/D`GROUP,ALLGB),1);@assert words(setr(allgroups,filterbool(#lambda/cand(isgroupmember(%:,\%0),strfirstof(getstat(%#/D`GROUP`\%0,GB),1)),u(u(gso)/FUN`LISTGROUPS))))=@nspemit %#=msghead(GBS) There are no unread posts on the GBS.;@dolist %q<allgroups>={th setq(gid1,%i0,gname1,name(%i0));@assert lmath(max,iter(u(FUN`VALIDGROUPS`GB,%#,READ),iter(setr(listposts,u(u(bbs)/FUN`LISTPOSTS,%i0)),if(match(U C,u(u(bbs)/FUN`MSGFLAG,%#,%i1,%i0)),1[ibreak(2)]))));@nspemit %#=msghead(GBS) Group '[pueblize(%q<gname1>,+group %q<gid1>)]' has unread posts! Type [pueblize(+gbscan %q<gname1>,+gbscan %q<gid1>)] to see which!}
  128.  
  129. &INC`LIST u(bbs)=th setq(listgroups,u(FUN`LISTGROUPS`%0));@nspemit %#=u(RFN`HEADER,u(FUN`NAME,%0,,%q<gid1>))%r[align(36 8 20 8,Available Bulletin Board Groups,Member?,Timeout,Capacity)]%r[u(RFN`SEPARATOR,)];@dolist setr(groups,u(FUN`VALIDGROUPS`%0,%#,READ,1))={@nspemit %#=align(5 31 -7 20 12,%b[ansi(custcolor(%#,BBS`BOARDNUM),match(%q<listgroups>,%i0))],ansi(custcolor(%#,BBS`BOARDNAME),name(%i0)),switch(default(%#/D`BB`%i0`OMIT,0),0,Yes,No),if(u(FUN`CONFIG,%i0,timeout),timestring(u(FUN`CONFIG,%i0,timeout)),none),rjust(nattr(%i0/*),4,0)/[switch(strlen(default(u(bbs-db)/BB`%i0`NEXT,1)),1,1800?,2,1800?,3,1800?,4,1600?,5,1300?,6,1100?,7,1000?,8,900?,9,800?,10,700?,11,600?,12,500?,13,400?)]);@switch/inline eq(inum(0),words(%q<groups>))=1,{@nspemit %#=u(RFN`SEPARATOR)%RTo join boards, type '+[lcstr(%0)]join <board number>'%RTo leave boards, type '+[lcstr(%0)]leave <board number>'%R[u(RFN`HEADER)]}}
  130.  
  131. &INC`CATCHUP u(bbs)=@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No board entered to catchup.;@switch/inline %1=ALL,{@dolist/inline u(FUN`VALIDGROUPS`%0,%#,READ)={@include u(bbs)/INC`DOCATCHUP=%i0};@nspemit %#=u(RFN`MSGHEAD,%q<ann>) All postings on all %q<ann> boards marked as read.},{@dolist/delimit , %1={@include u(bbs)/INC`CHECK`FINDBB=%0,trim(%i0),READ;@include u(bbs)/INC`DOCATCHUP=%q<bb>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) All postings on board [name(%q<bb>)] marked as read.}}
  132.  
  133. &INC`DOCATCHUP u(bbs)=&D`BB`%0`READ %#=lattr(%0/*);@dolist/inline lattr(%0/*`COMM`*)={th setstat(%0/[before(%i0,`)]`COMMREAD,%#,baseconv(secs(),10,64))}
  134.  
  135. &INC`MOVE u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(bbs)/INC`CHECK`FINDPOST=%0,%2,%q<bb>;@assert cor(%q<isadmin>,isadmin(%#),strmatch(get(%q<bb>/%q<post>`BYDB),%:))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: You cannot move that post.;@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No destination board entered.;th setq(oldbb,%q<bb>);@include u(bbs)/INC`CHECK`FINDBB=%0,%3,WRITE;@switch/inline %0=BB,{th setq(next,baseconv(default(u(bbs-db)/BB`%q<bb>`NEXT,1),10,36));&BB`%q<bb>`NEXT u(bbs-db)=add(default(u(bbs-db)/BB`%q<bb>`NEXT,1),1)},GB,{&BB`%q<bb>`NEXT u(bbs-db)=add(default(u(bbs-db)/BB`%q<bb>`NEXT,1),1)};@include u(ccs)/INC`MVTREE=%q<oldbb>,%q<post>,%q<bb>,%q<next>;@nspemit %#=Message '%q<postnum>' moved from Board '[name(%q<oldbb>)]' to Board '[name(%q<bb>)]'
  136.  
  137. &INC`CONFIG u(bbs)=@switch/inline cor(cand(strlen(%1),not(valnum(%1))),not(strlen(%1)))=1,{@include u(bbs)/INC`CONFIG`GLOBAL},{@switch/inline cand(and(strlen(%1),valnum(%1)),not(valnum(%2)),not(strlen(after(%2,/))))=1,{@include u(bbs)/INC`CONFIG`BOARD},{@include u(bbs)/INC`CONFIG`POST}}
  138.  
  139. &INC`CONFIG`GLOBAL u(bbs)=@break strmatch(%0,GB)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Global Options cannot be changed in Group mode.;@switch/inline strlen(%1)=0,{@include u(bbs)/INC`CONFIG`GLOBAL`SHOW},{@include u(ccs)/INC`PARTIAL=%1,timeout|autotimeout|interval,|,%q<ann>,parameter,parameter;@switch/inline strlen(%3)=0,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for the %q<ann> cleared.;&BB`%q<parameter> u(bbs-db)},{@include u(bbs)/INC`CONFIG`GLOBAL`%q<parameter>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for the %q<ann> set to: %3.;&BB`%q<parameter> u(bbs-db)=strfirstof(%q<entry>,%3)}}
  140.  
  141. &INC`CONFIG`GLOBAL`SHOW u(bbs)=@nspemit %#=u(RFN`HEADER,BBS - Global Settings);@nspemit %#=AUTOTIMEOUT: [u(FUN`CONFIG,autotimeout)] - [if(u(FUN`CONFIG,autotimeout),On,Off)];@nspemit %#=TIMEOUT: [u(FUN`CONFIG,timeout)] [if(u(FUN`CONFIG,timeout),- [timestring(u(FUN`CONFIG,timeout))],Off)];@nspemit %#=INTERVAL: [u(FUN`CONFIG,interval)] [if(u(FUN`CONFIG,interval),- [timestring(u(FUN`CONFIG,interval))],Unset! Dangerous!)];@nspemit %#=u(RFN`HEADER,)
  142.  
  143. &INC`CONFIG`GLOBAL`TIMEOUT u(bbs)=@assert strlen(setr(entry,stringsecs(%3)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Entry doesn't convert properly. Check [pueblize(help stringsecs,help stringsecs)] for proper format.
  144.  
  145. &INC`CONFIG`GLOBAL`INTERVAL u(bbs)=@assert setr(entry,stringsecs(%3))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Entry doesn't convert properly. Check [pueblize(help stringsecs,help stringsecs)] for proper format.
  146.  
  147. &INC`CONFIG`GLOBAL`AUTOTIMEOUT u(bbs)=@assert regmatchi(setr(entry,%3),^0|1$)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Entry must be binary truth - 0 (off) or 1 (on).
  148.  
  149. &INC`CONFIG`BOARD u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@switch/inline strlen(%2)=0,{@include u(bbs)/INC`CONFIG`BOARD`SHOW},{@include u(ccs)/INC`PARTIAL=%2,anonymous|timeout,|,%q<ann>,parameter,parameter;@switch/inline strlen(%3)=0,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for Board [name(%q<bb>)] cleared.;&BB`%q<bb>`%q<parameter> u(bbs-db)},{@include u(bbs)/INC`CONFIG`GLOBAL`%q<parameter>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for Board [name(%q<bb>)] set to: %3.;&BB`%q<bb>`%q<parameter> u(bbs-db)=strfirstof(%q<entry>,%3)}}
  150.  
  151. &INC`CONFIG`BOARD`SHOW u(bbs)=@nspemit %#=u(RFN`HEADER,%q<ann> - [name(%q<bb>)] Board Settings);@nspemit %#=TIMEOUT: [strfirstof(u(FUN`CONFIG,%q<bb>,timeout),0)] [if(u(FUN`CONFIG,%q<bb>,timeout),- [timestring(u(FUN`CONFIG,%q<bb>,timeout))])] [if(strlen(get(u(bbs-db)/BB`%q<bb>`TIMEOUT)),- Using Board Setting,- Using Global Default)];@nspemit %#=ANONYMOUS: [u(FUN`CONFIG,%q<bb>,anonymous)] [if(u(FUN`CONFIG,%q<bb>,anonymous),- [get(u(bbs-db)/BB`%q<bb>`ANONYMOUS)])];@nspemit %#=u(RFN`HEADER,)
  152.  
  153. &INC`CONFIG`BOARD`TIMEOUT u(bbs)=@assert strlen(setr(entry,stringsecs(%3)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Entry doesn't convert properly. Check [pueblize(help stringsecs,help stringsecs)] for proper format.
  154.  
  155. &INC`CONFIG`BOARD`ANONYMOUS u(bbs)=@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Anonymous entry must be a string.
  156.  
  157. &INC`CONFIG`POST u(bbs)=@switch/inline strlen(after(%2,/))=0,{@include u(bbs)/INC`CONFIG`GLOBAL`POST},{@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(bbs)/INC`CHECK`FINDPOST=%0,before(%2,/),%q<bb>;@include u(ccs)/INC`PARTIAL=after(%2,/),timeout,|,%q<ann>,parameter,parameter;@switch/inline strlen(%3)=0,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for the %q<ann> cleared.;&%q<post>`%q<parameter> %q<bb>;&%q<post>`EDITED %q<bb>=secs()},{@include u(bbs)/INC`CONFIG`GLOBAL`%q<parameter>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) %q<parameter> for Board [name(%q<bb>)]'s Post %q<postnum> set to: %3.;&%q<post>`%q<parameter> %q<bb>=strfirstof(%q<entry>,%3)};&%q<post>`EDITED %q<bb>=secs()}
  158.  
  159. &INC`CONFIG`POST`SHOW u(bbs)=@nspemit %#=u(RFN`HEADER,%q<ann> - [name(%q<bb>)] - Message %q<postnum> Settings);@nspemit %#=TIMEOUT: [strfistof(get(%q<bb>/%q<post>`TIMEOUT),0)] [if(get(%q<bb>/%q<post>`TIMEOUT),- [timestring(get(%q<bb>/%q<post>`TIMEOUT))])];@nspemit %#=u(RFN`HEADER,)
  160.  
  161. &INC`CONFIG`POST`TIMEOUT u(bbs)=@assert strlen(setr(entry,stringsecs(%3)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Entry doesn't convert properly. Check [pueblize(help stringsecs,help stringsecs)] for proper format.
  162.  
  163. &INC`TIMEOUT u(bbs)=@switch/inline strlen(%1)=0,{@include u(bbs)/INC`LIST},{@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@switch/inline t(strlen(%2))=1,{@assert words(setr(processed,filterbool(#lambda/if(strlen(setr(post,elements(u(FUN`LISTPOSTS,%q<bb>),\%0))),cor(%q<isadmin>,strmatch(get(%q<bb>/\%q<post>`BYDB),%:))),setr(orig,u(FUN`MESSLIST,%#,%q<bb>,%2)))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No posts to change timeouts.;@switch/inline gt(words(setr(cannot,setdiff(%q<processed>,%q<orig>,%b,n))),0)=1,{@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Could not change timeout for posts: [itemize(%q<cannot>,%b,and,\,)]};@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No new timeout entered!;@switch/inline %3=0,{@assert %q<isadmin>=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Only admin may set a timeout of 0.;th setq(entry,0)},{@include u(bbs)/INC`CONFIG`POST`TIMEOUT};@switch/inline %q<isadmin>=0,{@break gt(%q<entry>,u(FUN`CONFIG,%q<bb>,Timeout))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Cannot set a post's timeout greater than a board's timeout.};@dolist %q<processed>={@switch/inline %q<isadmin>=0,{@break eq(get(%q<bb>/[elements(u(FUN`LISTPOSTS,%q<bb>),%i0)]),0)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Only admin may apply timeouts to static posts.};@switch/inline %q<entry>=0,{&[elements(u(FUN`LISTPOSTS,%q<bb>),%i0)]`TIMEOUT %q<bb>=u(FUN`CONFIG,%q<bb>,Timeout);&[elements(u(FUN`LISTPOSTS,%q<bb>),%i0)]`NOTIMEOUT %q<bb>=1},{&[elements(u(FUN`LISTPOSTS,%q<bb>),%i0)]`TIMEOUT %q<bb>=%q<entry>;&[elements(u(FUN`LISTPOSTS,%q<bb>),%i0)]`NOTIMEOUT %q<bb>=0};@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Timeout for %q<bbnum>/%i0 set to: [if(%q<entry>,timestring(%q<entry>),Static)]!}},{@nspemit %#=u(RFN`HEADER,u(fun`name,%0,%q<bb>,%q<gid1>) - Timeouts)%r[space(8)]Message[space(28)]Timeout[space(9)]By;@dolist setr(posts,u(FUN`LISTPOSTS,%q<bb>))={@nspemit %#=ljust(pueblize(%q<bbnum>/[match(%q<posts>,%i0)],+[lcstr(%0)]read %q<bbnum>/[match(%q<posts>,%i0)][switch(%0,GB,=%q<gid1>)]),6)[ljust(u(u(bbs)/FUN`MSGFLAG,%#,%q<bb>,%i0),2)][ljust(get(%q<bb>/%i0`HDR),35)][ljust(switch(setr(ptime,u(FUN`GETTIMEOUT,%q<bb>,%i0)),X,No Timeout,>0,timestring(%q<ptime>),Timed Out),16)][left(if(get(u(bbs-db)/BB`%q<bb>`ANONYMOUS),if(%q<isadmin>,([ansi(hx,get(%q<bb>/%i0`BY))]),default(u(bbs-db)/BB`%q<bb>`ANONYMOUS,Anonymous)),get(%q<bb>/%i0`BY)),21)];@switch/inline eq(inum(0),words(%q<posts>))=1,{@nspemit %#=u(RFN`HEADER,Board Timeout: [switch(setr(btime,u(FUN`CONFIG,%q<bb>,timeout)),0,No Timeout,timestring(%q<btime>))])}}}}
  164.  
  165. &STARTUP u(bbs)=@trigger u(bbs)/TRG`TIMEOUT
  166.  
  167. &TRG`TIMEOUT u(bbs)=@switch/inline u(FUN`CONFIG,autotimeout)=1,{@dolist lattr(u(bbs-db)/BB`#*)={@wait inum(0)={@assert isdbref(last(%i0,`))=@wipe u(bbs-db)/%i0;@trigger u(bbs)/TRG`TIMEOUT`BOARD=last(%i0,`)}}};@wait u(FUN`CONFIG,interval)=@trigger u(bbs)/TRG`TIMEOUT
  168.  
  169. &TRG`TIMEOUT`BOARD u(bbs)=@dolist lattr(%0/*)={@switch/inline setr(timeout,u(FUN`GETTIMEOUT,%0,%i0))=X,{},>0,{&%i0`TIMEOUT %0=sub(%q<timeout>,u(FUN`CONFIG,interval))},<=0,{@wipe %0/%i0}}
  170.  
  171. &INC`LOCK u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(ccs)/INC`PARTIAL=%2,read|write,|,%q<ann>,lock,lock;@switch/inline %0=BB,{@assert cand(u(kls),u(kop))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Key System not installed, cannot continue.;@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No lock string entered. See [pueblize(+help +key)] for more information.;@include u(kls)/INC`DOLOCK=%q<bb>,user:%q<lock>,%3,%q<ann>},GB,{@assert valnum(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: %q<lock> Lock must be a number!;@break lte(%3,u(u(gso)/FUN`GETRANK,%q<gid1>,%:))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Cannot raise the %q<lock> Lock beyond your own rank.;@assert hasattrp(%q<gid1>/RANK`[setr(entry,abs(%3))])=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Cannot find that rank.;&BB`%q<bb>`G%q<lock> u(bbs-db)=%q<entry>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You set the %q<lock> Lock on Group Board [name(%q<bb>)] to: Rank %q<entry> or higher.}
  172.  
  173. &INC`UNLOCK u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(ccs)/INC`PARTIAL=%2,read|write,|,%q<ann>,lock,lock;@switch/inline %0=BB,{@unlock/user:%q<lock> %q<bb>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You release the %q<lock> Lock on [name(%q<bb>)]},GB,{@assert lte(get(u(bbs-db)/BB`%q<bb>`G%q<lock>),u(u(gso)/FUN`GETRANK,%q<gid1>,%:))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Cannot release a %q<lock> Lock that's beyond your own rank.;&BB`%q<bb>`G%q<lock> u(bbs-db);@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You release the %q<lock> Lock on [name(%q<bb>)]}
  174.  
  175. &INC`MYR`FINDBBP u(bbs)=@switch/inline isdbref(get(%#/BBPOCKET))=1,{@assert cand(hasattr(get(%#/BBPOCKET)/groups),hasattr(get(%#/BBPOCKET)/version))=@nspemit u(RGn`MSGHEAD,%q<ann>) ERROR: DBREF in BBPOCKET is not a Myrddin BBS BBpocket!;th setq(bbp,get(%#/BBPOCKET))},0,{@assert words(setr(bbp,lsearch(all,ething,\[cand(strmatch(name(##),bbpocket),hasattr(##/version),hasattr(##/groups))\])))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: BBpocket not found.;@break gt(words(%q<bbp>),1)=@nspemit %#=u(RFN`MSHEAD,%q<ann>) ERROR: Search turned up multiple bbpockets: %q<bbp>}
  176.  
  177. &INC`MYR`TRANSFER u(bbs)=@dolist setr(list,sortkey(#lambda/baseconv(\%1,36,10),get(%1/MESS_LST)))={@switch/inline %0=BB,{th setq(next,baseconv(default(u(bbs-db)/BB`%2`NEXT,1),10,36));&BB`%2`NEXT u(bbs-db)=add(default(u(bbs-db)/BB`%2`NEXT,1),1)},GB,{};th setq(head,get(%1/HDR_%i0));&%q<next> %2=get(%1/BDY_%i0);&%q<next>`BY %2=elements(%q<head>,3,|);&%q<next>`BYDB %2=objid(elements(%q<head>,4,|));&%q<next>`ON %2=convtime(elements(%q<head>,2,|));&%q<next>`HDR %2=elements(%q<head>,1,|);&%q<next>`TIMEOUT %2=if(u(FUN`CONFIG,%2,TIMEOUT),u(FUN`CONFIG,%2,TIMEOUT),0)}
  178.  
  179. &INC`IMPORT u(bbs)=@include u(bbs)/INC`MYR`FINDBBP;@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No Old Board number entered to convert from.;@assert isdbref(setr(oldbb,elements(get(%q<bbp>/groups),%1)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Old Board not found.;@include u(ccs)/INC`VERIFY={[ansi(hr,WARNING:)] This will attempt to import Old Myrddin Board %1: [name(%q<oldbb>)]. A new, unlocked board with the same name will be created and posts copied/converted. Please enter the same command again within ten seconds to verify.},%q<ann> IMPORT %1,%q<ann>;@include u(bbs)/INC`NEWGROUP=%0,name(%q<oldbb>);@trigger u(bbs)/INC`MYR`TRANSFER=%0,%q<oldbb>,%q<bb>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Conversion of [words(%q<list>)] messages (hopefully) complete!
  180.  
  181. &INC`TRANSFER u(bbs)=@include u(bbs)/INC`MYR`FINDBBP;@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No Old Board number entered to convert from.;@assert isdbref(setr(oldbb,elements(get(%q<bbp>/groups),%1)))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Old Board not found.;@include u(bbs)/INC`CHECK`FINDBB=%0,%3,WRITE;@include u(ccs)/INC`VERIFY={[ansi(hr,WARNING:)] This will attempt to transfer messages from Old Myrddin Board %1: [name(%q<oldbb>)] to New BB: [name(%q<bb>)]. Please enter the same command again within ten seconds to verify.},%q<ann> TRANSFER %q<oldbb> %q<bb>,%q<ann>;@trigger u(bbs)/INC`MYR`TRANSFER=%0,%q<oldbb>,%q<bb>;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Conversion of [words(%q<list>)] messages (hopefully) complete!
  182.  
  183. &INC`CONVERT u(bbs)=@include u(bbs)/INC`MYR`FINDBBP;@include u(ccs)/INC`VERIFY={[ansi(hr,WARNING:)] This will attempt to COMPLETELY CONVERT the old Myrddin Board to the new BB, creating boards and copying posts in order. Please be VERY SURE you want to do this by entering the same command again within ten seconds.},%q<ann> CONVERT %q<bbp>;@nspemit %#=u(RFn`MSGHEAD,%q<ann>) Okay! Beginning conversion. This will take approximately [setr(time,mul(2,words(get(%q<bbp>/groups))))] Seconds to complete.;@dolist filterbool(#lambda/isdbref(\%0),get(%q<bbp>/groups))={@wait mul(inum(0),2)={@include u(bbs)/INC`NEWGROUP=%0,name(%i0);@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Converting Board [inum(0)]: [name(%i0)]...;@trigger u(bbs)/INC`MYR`TRANSFER=%0,%i0,%q<bb>}};@wait add(%q<time>,2)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) Conversion process complete.
  184.  
  185. &INC`ORDER u(bbs)=@assert setr(num,words(setr(list,switch(%0,BB,get(u(bbs-db)/groups),GB,get(%q<gid1>/boards)))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: No boards to re-order.;@assert strlen(%1)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: New order field empty.;@assert eq(%q<num>,words(%1))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: new order field should not contain more than %q<num> numbers.;@break words(setdiff(lnum(1,%q<num>),%1))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Some numbers in that list don't match with the original.;@assert strmatch(lnum(1,%q<num>),sort(%1))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: At least one number was duplicated in the new order field.;th setq(newlist,elements(%q<list>,%1));@switch/inline %0=BB,{&groups u(bbs-db)=%q<newlist>},GB,{&boards %q<gid1>=%q<newlist>};@nspemit %#=u(RFN`MSGHEAD,%q<ann>) The board order was changed!
  186.  
  187. &INC`RENAME u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@assert strlen(%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: New name field empty.;@assert valid(name,%3)=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: Not a suitable object name. Please try something simpler - perhaps without fancy characters?;@break isdbref(locate(switch(%0,BB,u(bbs-db),GB,%q<gid1>),trim(%3),TXxi))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) ERROR: A board already has that name.;@nspemit %#=u(RFN`MSGHEAD,%q<ann>) You renamed Board [name(%q<bb>)] to: %3;@name %q<bb>=%3
  188.  
  189. &INC`SEARCH u(bbs)=@include u(bbs)/INC`CHECK`FINDBB=%0,%1,WRITE;@include u(ccs)/INC`CHECKPC=%3,1,%q<ann>;@assert words(setr(posts,iter(grepi(%q<bb>,*`BYDB,%q<t1objid>),first(%i0,`))))=@nspemit %#=u(RFN`MSGHEAD,%q<ann>) No posts by %q<t1name> on [name(%q<bb>)].;@nspemit %#=u(RFN`HEADER,BBS - [name(%q<bb>)])%r[space(8)]Message[space(28)]Posted[space(8)]By;@dolist/inline %q<posts>={@nspemit %#=ljust(pueblize(%q<bbnum>/[match(u(FUN`LISTPOSTS,%q<bb>),%i0)],+[lcstr(%0)]read %q<bbnum>/[match(u(FUN`LISTPOSTS,%q<bb>),%i0)]),6)[ljust(u(u(bbs)/FUN`MSGFLAG,%#,%q<bb>,%i0),2)][ljust(get(%q<bb>/%i0`HDR),35)][ljust(timefmt($b $d $Y,lmath(max,firstof(get(%q<bb>/%i0`EDITED),get(%q<bb>/%i0`ON)))),14)][left(if(get(u(bbs-db)/BB`%q<bb>`ANONYMOUS),if(%q<isadmin>,([ansi(hx,get(%q<bb>/%i0`BY))]),default(u(bbs-db)/BB`%q<bb>`ANONYMOUS,Anonymous)),get(%q<bb>/%i0`BY)),21)]};@nspemit %#=u(RFN`HEADER,)
  190.  
  191. th attrib_set(u(cco-db)/VAR`CATEGORIES,setunion(get(u(cco-db)/VAR`CATEGORIES),BBS,|,|))
  192. &VAR`CATEGORIES`BBS u(cco-db)=BOARDNUM|BOARDNAME|BOARDSTATUS|POSTNAME|POSTNUM|LASTPOST|NUMMESS|POSTAUTHOR|POSTDATE|POSTTITLE|POSTTIMEOUT|BORDER|BORDERDOT|BORDERTEXT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement