shrub/main/app/chat/core.hook
2014-11-19 21:30:15 -05:00

479 lines
12 KiB
Plaintext

/- mess,user,users,zing,zong,zung
::
[sed=!>(.) .]
::
!:
=> |%
++ axle
$: %0
air=(map path station)
pom=(unit ship)
sen=(qeu mess)
$= fal
$: eth=?
qit=?
let=?
sat=path
pad=ship
==
==
++ blitz
$% [%prompt p=cord q=prom r=cord]
[%tang p=(list tank)]
[%txt p=cord]
[%zong p=zong]
[%user p=user]
==
++ chat :: user action
$% [%all p=mess] :: say
[%back p=?(%da %dr %ud) q=@] :: backlog
[%def p=mess] :: use current prompt
[%how ~] :: help
[%priv p=@p q=mess] :: private
[%who ~] :: who
== ::
++ chat-arg
$? %monitor %quiet %noob %leet %time
[%s p=path]
[%tower p=ship]
==
++ idad ,[p=@p q=@t]
++ iron
$% [%prompt p=cord q=prom r=cord]
[%txt p=cord]
[%zongs p=(list zong)]
[%users p=users]
[%hymn p=manx] :: HTML format
[%json p=json] :: JSON format
==
++ gift
$% [%mean ares]
[%nice ~]
[%rush blitz]
[%rust iron]
==
++ hapt ,[p=ship q=path]
++ move ,[p=bone q=(mold note gift)]
++ note
$? $: %g
$% [%mess p=hapt q=ship r=cage]
[%nuke p=hapt q=ship]
[%show p=hapt q=ship r=path]
== == ==
++ sign
$? $: %g
$% [%mean p=ares]
[%nice ~]
$: %rush
$= p
$% [%txt p=cord]
[%user p=user]
[%zong p=zong]
== ==
$: %rust
$= p
$% [%txt p=cord]
[%users p=users]
[%zongs p=(list zong)]
== ==
== == ==
++ station
$: msg=(list zong)
sub=(unit bone)
ami=(map ,@p ,@t)
==
--
!:
::::
::
=| lat=@da
|%
++ chat
=<
%+ cook |=(a=^chat a)
;~ pose
(cold [%how ~] wut)
(cold [%who ~] tis)
(stag %back dat)
(stag %priv ;~(plug ;~(pfix sig fed:ag) ;~(pfix ace mess)))
(stag %all ;~(pfix pam mess))
(stag %def mess)
==
|%
++ dat
%+ sear
|= p=coin
?. ?=([%$ ?(%da %dr %ud) @] p) ~
(some +.p)
;~(pfix bas bas (star ace) nuck:so)
::
++ expn
%- sear
:_ text
|= a=@t
^- (unit ,[p=@t q=tank])
=+ hun=(rush a wide:(vang | &1:% &2:% (scot %da lat) |3:%))
?~ hun ~
?~(a ~ [~ a (sell (slap sed u.hun))])
::
++ mess
%+ cook |=(a=^mess a)
;~ pose
(stag %do ;~(pfix pat text))
(stag %exp ;~(pfix hax expn))
(stag %do (full (easy '')))
(stag %say text)
==
::
++ text (boss 256 (star prn))
--
--
!:
::::
::
|_ [hid=hide axle]
++ exec-cmd
|= [ost=bone txt=cord]
^- [(list move) _+>]
?: =(0 txt) [~ +>.$]
=+ rey=(rush txt chat(lat lat.hid))
?~ rey
[(send /out %give %rush %tang [%leaf "invalid input"] ~) +>.$]
|-
?- -.u.rey
%all =+ ^= mof
?~ pom ~
(send /out %give %rush %prompt '& ' %text '')
=^ mow +>.^$
(poke-zung(pom ~) ost our.hid %mess sat.fal p.u.rey)
[(welp mof mow) +>.^$(sen (~(put to sen) p.u.rey))]
%back
:_ +>.^$
%^ send /out %give :+ %rush %tang
%- turn :_ |=(a=zong (zong-to-tank | a))
?- p.u.rey
%ud (scag q.u.rey msg:(grab sat.fal))
%da (since msg:(grab sat.fal) q.u.rey)
%dr (since msg:(grab sat.fal) (sub lat.hid q.u.rey))
==
%def $(u.rey ?~(pom [%all p.u.rey] [%priv u.pom p.u.rey]))
%priv
:_ +>.^$(pom `p.u.rey)
:- :* ost %pass /priv %g
%mess [p.u.rey %chat ~] our.hid %mess !>(q.u.rey)
==
?: =(pom [~ p.u.rey]) ~
(send /out %give %rush %prompt (cat 3 (scot %p p.u.rey) ' ') %text '')
%who
:_ +>.^$
%^ send /out %give :+ %rush %tang :_ ~
:+ %rose [", " "" ""]
%+ turn (~(tap by ami:(grab sat.fal)))
|= a=idad
:- %leaf
%- trip %^ cat 3 %^ cat 3 (scot %p p.a) ' ' q.a
%how
:_ +>.^$
%^ send /out %give :+ %rush %tang
%- flop
%- turn :_ |=(a=@t [%leaf (trip a)])
%- lore
%- (hard ,@t)
.^(/cx/(scot %p our.hid)/main/(scot %da lat.hid)/pub/src/doc/chat/help/txt)
==
::
++ grab
|= sta=path
(fall (~(get by air) sta) *station)
::
++ iden
|= her=ship
^- tape
?: let.fal (scow %p her)
=+ ide=(trip (fall (~(get by ami:(grab sat.fal)) her) ''))
%+ welp (scow %p her)
?~ ide ""
[' ' ide]
::
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>.$
?: ?=(~ pax)
[ost %give %rust %hymn page]~
=+ ya=(grab t.pax)
?+ i.pax !!
%out
[ost %give %rust %prompt '& ' %text '']~
%private
~
%amigos
[ost %give %rust %users (~(tap by ami.ya))]~
%mensajes
[ost %give %rust %zongs msg.ya]~
==
++ page
^- manx
;html
;head
;title: Radio
;script(type "text/javascript", src "//use.typekit.net/fkv0sjk.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js");
;script:'''
try{Typekit.load();}catch(e){}
'''
;link(rel "stylesheet", type "text/css", href "/gen/main/pub/src/chat/main.css");
==
;body
;div#c;
;script(type "text/javascript", src "/gen/main/lib/urb.js");
;script(type "text/javascript", src "/gen/main/pub/src/chat/main.js");
==
==
::
++ poke-chat-args
|= [ost=bone you=ship arg=(list chat-arg)]
^- [(list move) _+>]
=. fal (process-args arg)
=^ mow +>.$ (poke-zung ost you %init pad.fal sat.fal)
:_ +>.$
%+ welp
:+ [ost %pass /cmd-in %g %show [our.hid +.imp.hid] you /in/[-.imp.hid]]
[ost %pass /private %g %show [our.hid /chat] you /private]
(send /out %give %rush %prompt '& ' %text '')
mow
::
++ poke-mess
|= [ost=bone you=ship mes=mess]
^- [(list move) _+>]
[[[ost %give %nice ~] (spam & %mess lat.hid you mes)] +>.$]
::
++ poke-zung :: nice should be moved out
|= [ost=bone you=ship zug=zung]
^- [(list move) _+>]
?. =(you our.hid)
[[ost %give %mean ~ %no-sos-mi-amigo ~]~ +>.$]
?- -.zug
%mess
:: ~& [%send-mess zug]
:_ +>.$ :_ ~
:* ost %pass /mesg %g
%mess [pad.fal %radio ~] you %zing !>(zug)
==
::
%init
=+ ya=(grab q.zug)
?: =(sub.ya ~)
=. pad.fal p.zug
=. sub.ya `ost
=. air (~(put by air) q.zug ya)
:_ +>.$
:~
:* ost %pass radi-m/q.zug %g
%show [[p.zug /radio] you mensajes/q.zug]
==
:* ost %pass radi-a/q.zug %g
%show [[p.zug /radio] you amigos/q.zug]
==
==
[[ost %give %nice ~]~ +>.$]
==
::
++ pull
|= ost=bone
^- [(list move) _+>]
?: ?=([* ~ ~] sup.hid)
:_ +>.$(pad.fal *@p, air ~)
%- ^zing %+ turn (~(tap by air))
|= [pax=path sta=station]
?~ sub.sta
~
:~ [u.sub.sta %pass radi-a/pax %g %nuke [[pad.fal /radio] our.hid]]
[u.sub.sta %pass radi-m/pax %g %nuke [[pad.fal /radio] our.hid]]
==
[~ +>.$]
::
++ pour
|= [ost=bone pax=path sih=*]
^- [(list move) _+>]
:: ~& sih=sih
=+ sih=((hard sign) sih)
?~ pax ~& %chat-pour-strange-path !!
:: ~& [%pour-mess pax]
?+ i.pax ~& %chat-pour-strange-path !!
%cmd-in
?- +<.sih
%nice [~ +>.$]
%mean [(send /out %give +.sih) +>.$]
?(%rush %rust)
?> ?=(%txt -.p.sih)
(exec-cmd ost p.p.sih)
==
::
?(%mesg %priv)
?> ?=(?(%mean %nice) +<.sih)
[[ost %give +.sih]~ +>.$]
::
%private
?: ?=(?(%nice %mean) +<.sih)
[~ +>.$]
?> ?=(%rush +<.sih)
?> ?=(%zong -.p.sih)
:_ +>.$
(send /out %give %rush %tang (zong-to-tank & p.p.sih) ~)
::
?(%radi-a %radi-m)
?: ?=(?(%nice %mean) +<.sih)
:_ +>.$
?: ?=(%radi-a i.pax) ~
[ost %give +.sih]~
=+ ya=(grab t.pax)
=. ya
?- i.pax
%radi-a
%_ ya
ami
^- (set idad)
?- +<.sih
%rust ?>(?=(%users -.p.sih) (sa p.p.sih))
%rush
?> ?=(%user -.p.sih)
?- -.p.p.sih
%in (~(put by ami.ya) p.p.p.sih)
%out (~(del by ami.ya) p.p.p.p.sih)
==
==
==
%radi-m
%_ ya
msg
^- (list zong)
?- +<.sih
%rush ?>(?=(%zong -.p.sih) [p.p.sih msg.ya])
%rust ?>(?=(%zongs -.p.sih) p.p.sih)
==
==
==
=+ ^= pout ?:(=(i.pax %radi-a) %amigos %mensajes)
=. air (~(put by air) t.pax ya)
=+ mow=(send [pout t.pax] %give +.sih)
=< [mow +>.$]
:: XX yes, I just used an inline comment
:: XX and multiple XX's. why? because
:: XX tmi is incredibly lame.
^+ .
?: =(%zong -.p.sih)
=+ zog=((hard zong) p.p.sih)
?: &(=(our.hid q.zog) =(`r.zog ~(top to sen)))
%_(+ sen ^+(sen ~(nap to sen)))
%_ +
mow
(welp mow (send /out %give %rush %tang (zong-to-tank | zog) ~))
==
?: =(%zongs -.p.sih)
=+ zos=((hard (list zong)) p.p.sih)
=< +
|- ^+ +.$
?: =(~ zos) +.$ :: XX tm freakin i
=+ zoy=((hard zong) -.zos)
=. +.$ $(zos +.zos)
?: &(=(our.hid &3.zoy) =(`&4.zoy ~(top to sen)))
%_(+.$ sen `(qeu mess)`~(nap to sen))
%_ +.$
mow
(welp mow (send /out %give %rush %tang (zong-to-tank | zoy) ~))
==
?: =(%user -.p.sih)
=+ use=((hard user) p.p.sih)
%_ +
mow
?: let.fal ~
=- (send /out %give %rush %tang [%leaf -] ~)
%+ weld
?: eth.fal "" (timestamp lat.hid)
%+ weld "{(iden p.p.use)} "
?- -.use
%in "comes on the air"
%out "signs off"
==
==
. :: XX users?
==
::
++ process-args
|= arg=(list chat-arg)
^- [? ? ? path ship]
%+ roll arg
|= [a=chat-arg b=[? ? ? path ship]]
?- a
%time b(&1 |)
%monitor b(&2 |)
%quiet b(&2 &)
%noob b(&3 |)
%leet b(&3 &)
[%s *] b(&4 p.a)
[%tower *] b(|4 p.a)
==
::
++ send
|= [pax=path msg=(mold note gift)]
^- (list move)
:: ~& [%send pus.hid]
%+ turn (~(tap in (~(get ju pus.hid) pax)))
|=(ost=bone [ost msg])
::
++ since
|= [ya=msg=(list zong) tim=@da]
|- ^- (list zong)
?: |(?=(~ msg.ya) (lth p.i.msg.ya tim)) ~
[i.msg.ya $(msg.ya t.msg.ya)]
::
++ spam
|= [pri=? zog=zong]
^- (list move)
%+ welp
(send /private %give %rush %zong zog)
%+ welp
(send /out %give %rush %tang (zong-to-tank pri zog) ~)
%+ murn (~(tap by sup.hid))
|= [ost=bone her=ship pax=path]
?~ pax ~
?. ?=(%mensajes i.pax) ~
(some [ost %give %rush %zong zog])
::
++ timestamp
|= t=@da
=+ da=(yell t)
"{?:((gth 10 h.da) "0" "")}{(scow %ud h.da)}:".
"{?:((gth 10 m.da) "0" "")}{(scow %ud m.da)} "
::
++ zong-to-tank
|= [pri=? zog=zong]
^- tank
=+ pre=?.(pri "" "(private) ")
?- -.r.zog
%do
=+ mes=?:(=(0 p.r.zog) "remains quietly present" (trip p.r.zog))
:- %leaf
%+ weld
?: eth.fal "" (timestamp p.zog)
"{pre}{(iden q.zog)} {mes}"
::
%exp
:~ %rose
[" " "" ""]
:- %leaf
%+ weld
?: eth.fal "" (timestamp p.zog)
"{pre}{(iden q.zog)} {(trip p.r.zog)}"
q.r.zog
==
::
%say
:- %leaf
%+ weld
?: eth.fal "" (timestamp p.zog)
"{pre}{(iden q.zog)}: {(trip p.r.zog)}"
==
--