urbit/main/app/talk/core.hook

455 lines
11 KiB
Plaintext
Raw Normal View History

2014-12-10 23:09:01 +03:00
::
:::: /hook/core/talk/app
::
/? 314
2014-12-11 00:10:30 +03:00
/- *radio
2014-12-10 23:09:01 +03:00
::
::::
::
!:
[sed=!>(.) .]
=> |%
2014-12-12 00:32:59 +03:00
++ house
$: live=(unit span) :: looking at
parties=(map span party) :: all parties
shown=(set serial) :: messages shown
targets=(unit (set station)) :: talking to
== ::
++ party :: local party
$: count=@ud :: number shown
shape=(unit config) :: configuration
present=(map ship status) :: presence
2014-12-10 23:09:01 +03:00
== ::
++ work :: user action
$% [%all p=mess] :: say
[%back p=?(%da %dr %ud) q=@] :: backlog
2014-12-12 00:32:59 +03:00
[%def p=mess] :: default
2014-12-10 23:09:01 +03:00
[%how ~] :: help
2014-12-11 02:33:22 +03:00
[%join p=station] :: subscribe /=main to
[%host p=span] :: create /=foo
2014-12-12 03:36:56 +03:00
[%priv p=(list station) q=mess] :: private
2014-12-10 23:09:01 +03:00
[%who ~] :: who
== ::
++ iron :: terminal output
$% [%prompt p=cord q=prom r=cord] :: prompt
[%tang p=(list tank)] :: prettyprintable
[%txt p=cord] :: simple text
==
++ mess
$% [%do p=@t]
[%exp p=@t q=tank]
[%say p=@t]
==
++ gift
$% [%mean ares]
[%nice ~]
[%rush iron]
[%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]
== ==
$: %rust
$= p
$% [%txt p=cord]
[%radio-report p=report]
== ==
== == ==
--
!:
::::
::
2014-12-11 02:33:22 +03:00
=| [our=@p lat=@da]
2014-12-10 23:09:01 +03:00
|%
++ talk
=<
2014-12-11 02:33:22 +03:00
%+ cook |=(a=work a)
2014-12-10 23:09:01 +03:00
;~ pose
(cold [%how ~] wut)
(cold [%who ~] tis)
(stag %back dat)
2014-12-12 03:36:56 +03:00
(stag %priv target)
2014-12-10 23:09:01 +03:00
(stag %all ;~(pfix pam mess))
2014-12-11 02:33:22 +03:00
(comd %join stati)
(comd %host urs:ab)
2014-12-10 23:09:01 +03:00
(stag %def mess)
==
|%
2014-12-11 02:33:22 +03:00
++ peach :: either ++each branch
|* a=_[rule rule]
|= tub=nail
^- (like (each ,_(wonk (-.a)) ,_(wonk (+.a))))
%. tub
;~(pose (stag %& -.a) (stag %| +.a))
::
++ comd :: ! command
|* [a=@tas b=_rule]
%- full
;~((glue (plus ace)) ;~(pfix zap (cold a (jest a))) b)
::
::
2014-12-10 23:09:01 +03:00
++ 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])
2014-12-11 02:33:22 +03:00
=+ hun=(rush a wide:(vang | [&1:% &2:% (scot %da lat) |3:%]))
2014-12-10 23:09:01 +03:00
?~ hun ~
?~(a ~ [~ a (sell (slap sed u.hun))])
::
++ mess
2014-12-11 02:33:22 +03:00
^- $+(nail (like ^mess))
2014-12-10 23:09:01 +03:00
;~ pose
(stag %do ;~(pfix pat text))
(stag %exp ;~(pfix hax expn))
(stag %do (full (easy '')))
(stag %say text)
==
::
2014-12-12 03:36:56 +03:00
++ target
^- $+(nail (like ,[p=(list station) q=^mess]))
;~ plug
(most ;~(plug com ace) stati)
;~(pfix ace mess)
==
::
2014-12-10 23:09:01 +03:00
++ text (boss 256 (star prn))
2014-12-11 02:33:22 +03:00
++ stati
%+ peach
;~(plug ;~(pose (cold our tis) (ifix sig^fas fed:ag)) urs:ab)
%+ sear (soft partner)
2014-12-12 04:09:59 +03:00
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
2014-12-10 23:09:01 +03:00
--
--
!:
::::
::
2014-12-12 00:32:59 +03:00
|_ [hid=hide house]
2014-12-10 23:09:01 +03:00
::
2014-12-12 03:00:09 +03:00
++ destination
^- audience
=- =+ ped=(~(tap in ted) ~)
%- ~(gas by *audience)
(turn ped |=(a=station [a %pending]))
^= ted ^- (set station)
?^ targets u.targets
?~ live ~
=+ pur=(~(get by parties) u.live)
?~ pur ~
?~ shape.u.pur ~
sources.u.shape.u.pur
::
2014-12-10 23:09:01 +03:00
++ pour-shell
|= [ost=bone txt=cord]
^- [(list move) _+>]
?: =(0 txt) [~ +>.$]
2014-12-11 02:33:22 +03:00
=+ rey=(rush txt talk(lat lat.hid, our our.hid))
2014-12-10 23:09:01 +03:00
?~ rey
[(send /out %give %rush %tang [%leaf "invalid input"] ~) +>.$]
2014-12-15 23:56:03 +03:00
|- ^- [(list move) _+>.^$]
2014-12-11 02:33:22 +03:00
?+ -.u.rey !!
2014-12-12 03:36:56 +03:00
%priv $(targets `(sa p.u.rey), u.rey [%def q.u.rey])
2014-12-11 02:33:22 +03:00
%def
?> ?=(%say -.p.u.rey)
2014-12-12 00:32:59 +03:00
?~ live
~& %not-live
!!
2014-12-15 23:56:03 +03:00
=- [[(send-rodeo ost [%publish - ~]) ~] +>.^$]
2014-12-12 03:00:09 +03:00
=+ aud=destination
?~ aud
~& %no-audience
!!
2014-12-11 03:02:02 +03:00
^- thought
2014-12-12 03:00:09 +03:00
[(shaf %foo eny.hid) aud [lat.hid p.u.rey]]
::
2014-12-11 02:33:22 +03:00
%host
2014-12-15 23:56:03 +03:00
[[(send-rodeo ost [%design p.u.rey ~ `config`[~ [%| ~]]]) ~] +>.^$]
::
2014-12-11 03:02:02 +03:00
%join
2014-12-12 00:32:59 +03:00
?~ live
~& %not-live
!!
=+ par=(~(got by parties) u.live)
?~ shape.par
~& %not-configured
!!
=. sources.u.shape.par (~(put in sources.u.shape.par) p.u.rey)
2014-12-15 23:56:03 +03:00
[[(send-rodeo ost [%design u.live `u.shape.par]) ~] +>.^$]
::
%how
:_ +>.^$
%^ send /out %give :+ %rust %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)
::
%back
?~ live
~& %not-live
!!
=+ ^= sin
?- p.u.rey
%ud [%ud q.u.rey]
%da [%da q.u.rey]
%dr [%da (sub lat.hid q.u.rey)]
==
:_ +>.^$
:_ ~
:* ost %pass /fm/backlog
%g %show
[our.hid /rodeo] our.hid
/fm/[u.live]/(scot sin)/(scot %da lat.hid)
==
2014-12-10 23:09:01 +03:00
==
::
2014-12-12 00:32:59 +03:00
++ pour-attach :: attach to party
2014-12-12 01:37:45 +03:00
|= [man=span moz=(list move)]
^- (list move)
2014-12-12 00:32:59 +03:00
~& [%pour-attach man]
2014-12-12 01:37:45 +03:00
:* :* 0 %pass /fm/[man]
2014-12-12 00:32:59 +03:00
%g %show
[our.hid /rodeo] our.hid
/fm/[man]
==
(welp (send /out %give %rush %prompt prompt %text '') moz)
==
::
++ pour-detach :: detach from party
2014-12-12 01:37:45 +03:00
|= [man=span moz=(list move)]
^- (list move)
2014-12-12 00:32:59 +03:00
~& [%pour-detach man]
:_ moz
2014-12-12 01:37:45 +03:00
:* 0 %pass /fm/[man]
2014-12-12 00:32:59 +03:00
%g %nuke
[our.hid /rodeo] our.hid
==
::
++ pour-live
2014-12-12 01:37:45 +03:00
|= moz=(list move)
2014-12-12 00:32:59 +03:00
^+ [moz +>]
?~ live
?: (~(has by parties) %main)
2014-12-12 01:37:45 +03:00
=> .(live `%main)
2014-12-12 03:00:09 +03:00
~& %main-live
2014-12-12 00:32:59 +03:00
[(pour-attach %main moz) +>.$]
?~ parties
[moz +>]
2014-12-12 01:37:45 +03:00
=> .(live `p.n.parties)
2014-12-12 03:00:09 +03:00
~& [%pour-live p.n.parties]
2014-12-12 00:32:59 +03:00
[(pour-attach p.n.parties moz) +>.$]
?: (~(has by parties) u.live)
[moz +>]
2014-12-12 03:00:09 +03:00
~& %pour-detach
2014-12-12 01:37:45 +03:00
$(live ~, moz (pour-detach u.live moz))
2014-12-12 00:32:59 +03:00
::
++ pour-house
|= [ost=bone wha=(set span)]
2014-12-10 23:09:01 +03:00
^- [(list move) _+>]
2014-12-12 01:37:45 +03:00
=+ lug=`(list span)`(~(tap in wha) ~)
2014-12-12 00:32:59 +03:00
=+ yap=`(list (pair span party))`(~(tap by parties) ~)
=+ nup=(skip lug |=(a=span (~(has by parties) a)))
2014-12-12 01:37:45 +03:00
=+ pig=(skip yap |=([a=span *] (~(has in wha) a)))
2014-12-12 00:32:59 +03:00
=. parties
|- ^+ parties
?~ pig parties
$(pig t.pig, parties (~(del by parties) p.i.pig))
=. parties
|- ^+ parties
?~ nup parties
$(nup t.nup, parties (~(put by parties) i.nup *party))
%- pour-live
^- (list move)
%+ welp
2014-12-12 01:37:45 +03:00
^- (list move)
2014-12-12 00:32:59 +03:00
%- zing
%+ turn nup
|= man=span
^- (list move)
~& [%new-party man]
:~ :* 0 %pass /am/[man]
%g %show
[our.hid /rodeo] our.hid
/am/[man]
2014-12-12 01:37:45 +03:00
==
2014-12-12 00:32:59 +03:00
:* 0 %pass /xm/[man]
%g %show
[our.hid /rodeo] our.hid
/xm/[man]
==
2014-12-10 23:09:01 +03:00
==
2014-12-12 01:37:45 +03:00
^- (list move)
2014-12-12 00:32:59 +03:00
%- zing
%+ turn pig
|= [man=span *]
^- (list move)
~& [%old-party man]
:~ :* 0 %pass /am/[man]
%g %nuke
[our.hid /rodeo] our.hid
2014-12-12 01:37:45 +03:00
==
2014-12-12 00:32:59 +03:00
:* 0 %pass /xm/[man]
%g %nuke
[our.hid /rodeo] our.hid
==
==
::
++ pour-grams
|= [ost=bone man=span raq=(pair ,@ud (list telegram))]
^- [(list move) _+>]
:_ +>.$
%- zing ^- (list (list move))
%+ turn
`(list telegram)`q.raq
|= gam=telegram
=* sta r.q.gam
?+ -.q.sta !!
%say
(send /out %give %rush %txt p.q.sta)
2014-12-10 23:09:01 +03:00
==
::
2014-12-12 00:32:59 +03:00
++ pour-config
|= [ost=bone man=span cof=config]
^- [(list move) _+>]
=+ pur=(~(get by parties) man)
?~ pur
~& [%no-party man]
[~ +>.$]
2014-12-12 01:37:45 +03:00
[~ +>.$(parties (~(put by parties) man u.pur(shape `cof)))]
2014-12-12 00:32:59 +03:00
::
++ pour-group
|= [ost=bone man=span lup=(map ship status)]
^- [(list move) _+>]
=+ pur=(~(get by parties) man)
?~ pur
~& [%no-party man]
[~ +>.$]
2014-12-12 01:37:45 +03:00
[~ +>.$(parties (~(put by parties) man u.pur(present lup)))]
2014-12-12 00:32:59 +03:00
::
++ prompt
^- cord
?~ live
'waiting...'
2014-12-12 03:00:09 +03:00
?: =(%main u.live)
'& '
2014-12-12 00:32:59 +03:00
(cat 3 u.live '& ')
::
2014-12-10 23:09:01 +03:00
++ peer
|= [ost=bone you=ship pax=path]
^- [(list move) _+>]
:_ +>.$
2014-12-11 00:10:30 +03:00
?~ pax !!
2014-12-10 23:09:01 +03:00
?+ i.pax !!
2014-12-12 03:00:09 +03:00
%out [ost %give %rust %prompt prompt %text '']~
2014-12-10 23:09:01 +03:00
==
::
++ pour
|= [ost=bone pax=path sih=*]
^- [(list move) _+>]
2014-12-12 00:32:59 +03:00
=> .(sih ((hard sign) sih))
~& talk-pour/sih
2014-12-11 00:10:30 +03:00
?~ pax ~& talk-pour-strange-path/pax !!
?+ i.pax ~& talk-pour-strange-path/pax !!
2014-12-10 23:09:01 +03:00
%cmd-in
?- +<.sih
%nice [~ +>.$]
%mean [(send /out %give +.sih) +>.$]
?(%rush %rust)
?> ?=(%txt -.p.sih)
(pour-shell ost p.p.sih)
==
2014-12-11 00:10:30 +03:00
::
%command
?> ?=(?(%mean %nice) +<.sih)
[~ +>.$]
2014-12-10 23:09:01 +03:00
::
2014-12-12 00:32:59 +03:00
%server
?+ &2.sih !!
%nice [~ +>.$]
%mean ~&(%server-mean [~ +>.$])
%rust
?> ?=([%radio-report %house *] +>.sih)
(pour-house ost `(set span)`+>.+>.sih)
==
::
%am
?> ?=([@ *] t.pax)
?+ &2.sih !!
%nice [~ +>.$]
%mean ~&(%am-mean [~ +>.$])
%rust
?> ?=([%radio-report %group *] +>.sih)
(pour-group ost i.t.pax `(map ship status)`+>.+>.sih)
==
::
%xm
?> ?=([@ *] t.pax)
?+ &2.sih !!
%nice [~ +>.$]
%mean ~&(%xm-mean [~ +>.$])
%rust
2014-12-12 01:37:45 +03:00
?> ?=([%radio-report %config *] +>.sih)
2014-12-12 00:32:59 +03:00
(pour-config ost i.t.pax `config`+>.+>.sih)
==
::
%fm
?> ?=([@ *] t.pax)
?+ &2.sih !!
%nice [~ +>.$]
%mean ~&(%fm-mean [~ +>.$])
%rust
2014-12-12 01:37:45 +03:00
?> ?=([%radio-report %grams *] +>.sih)
2014-12-12 00:32:59 +03:00
(pour-grams ost i.t.pax `(pair ,@ud (list telegram))`+>.+>.sih)
2014-12-11 00:10:30 +03:00
==
2014-12-10 23:09:01 +03:00
==
::
++ poke-talk-args
|= [ost=bone you=ship arg=~]
^- [(list move) _+>]
:_ +>
2014-12-12 01:37:45 +03:00
:~ [ost %pass /cmd-in %g %show [our.hid +.imp.hid] you /in/[-.imp.hid]]
2014-12-10 23:09:01 +03:00
^- move
2014-12-12 01:37:45 +03:00
:* ost %pass /server
2014-12-11 22:03:49 +03:00
%g %show
[our.hid /rodeo] our.hid
2014-12-12 00:32:59 +03:00
/
2014-12-11 22:03:49 +03:00
==
2014-12-10 23:09:01 +03:00
==
::
++ send
|= [pax=path msg=(mold note gift)]
^- (list move)
:: ~& [%send pus.hid]
%+ turn (~(tap in (~(get ju pus.hid) pax)))
|=(ost=bone [ost msg])
2014-12-15 23:56:03 +03:00
::
++ send-rodeo
|= [ost=bone cod=command]
^- move
:* ost %pass /command
%g %mess [our.hid /rodeo] our.hid
[%radio-command !>(cod)]
==
2014-12-10 23:09:01 +03:00
--