shrub/main/app/chat/core.hook
2014-11-14 20:32:19 -05:00

364 lines
9.3 KiB
Plaintext

/- mess,user,users,zing,zong,zung
::
[sed=!>(.) .]
::
!:
=> |%
++ axle
$% [%0 pad=@p air=(map path station)]
==
++ blitz
$% [%prompt p=cord q=prom]
[%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-args $|(~ [ship ~])
++ idad ,[p=@p q=@t]
++ iron
$% [%prompt p=cord q=prom]
[%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]
++ mess :: message
$% [%do p=@t] :: act
[%exp p=@t q=tank] :: code
[%say p=@t] :: say
== ::
++ 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=(set idad)
==
--
!:
::::
::
=| 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 (poke-zung ost our.hid %mess / 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 /))
%da (since msg:(grab /) q.u.rey)
%dr (since msg:(grab /) (sub lat.hid q.u.rey))
==
%def (poke-zung ost our.hid %mess / p.u.rey)
%priv !!
%who
:_ +>.$
%^ send /out %give :+ %rush %tang :_ ~
:+ %rose [", " "" ""]
%+ turn (~(tap by ami:(grab /)))
|= 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)
::
++ 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]~
%amigos
[ost %give %rust %users (~(tap in 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=chat-args]
^- [(list move) _+>]
=^ mow +>.$ (poke-zung ost you %init ?~(arg (sein our.hid) -.arg) /)
:_ +>.$
%+ welp
:- [ost %pass /cmd-in %g %show [our.hid +.imp.hid] you /in/[-.imp.hid]]
(send /out %give %rush %prompt '& ' %text)
mow
::
++ 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 %radio ~] you %zing !>(zug)
==
::
%init
=+ ya=(grab q.zug)
?: =(sub.ya ~)
=. pad 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 *@p, air ~)
%- ^zing %+ turn (~(tap by air))
|= [pax=path sta=station]
?~ sub.sta
~
:~ [u.sub.sta %pass radi-a/pax %g %nuke [[pad /radio] our.hid]]
[u.sub.sta %pass radi-m/pax %g %nuke [[pad /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
?> ?=(?(%mean %nice) +<.sih)
[[ost %give +.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 in ami.ya) p.p.p.sih)
%out (~(del in ami.ya) 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))
%+ welp (send [pout t.pax] %give +.sih)
?. ?=(%zong -.p.sih) ~
(send /out %give %rush %tang (zong-to-tank p.p.sih) ~)
==
::
++ 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)]
::
++ 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
|= zog=zong
^- tank
:: =+ tst=(lien flags |=(a=flag ?=(%time a)))
=| tst=?
?- -.r.zog
%do
=+ mes=?:(=(0 p.r.zog) "remains quietly present" (trip p.r.zog))
:- %leaf
%+ weld
?. tst "" (timestamp p.zog)
"{<q.zog>} {mes}"
::
%exp
:~ %rose
[" " "" ""]
:- %leaf
%+ weld
?. tst "" (timestamp p.zog)
"{<q.zog>} {(trip p.r.zog)}"
q.r.zog
==
::
%say
:- %leaf
%+ weld
?. tst "" (timestamp p.zog)
"{<q.zog>}: {(trip p.r.zog)}"
==
--