added :ask ship request collator, |ask easter egg

This commit is contained in:
Anton Dyudin 2015-11-25 14:39:24 -08:00
parent 6550d05782
commit e82003ec38
6 changed files with 108 additions and 7 deletions

58
ape/ask.hoon Normal file
View File

@ -0,0 +1,58 @@
:: There is no love that is not an echo
::
:::: /hoon/echo/ape
::
/? 314
/+ sole
[. sole]
|%
++ card
$% [%diff %sole-effect sole-effect]
==
--
!:
|_ [bow=bowl adr=(set cord) sos=(map bone sole-share)]
++ peer-sole
|= path
^- (quip ,[bone card] +>)
~| [%not-in-whitelist src.bow]
?> (~(has in (sa (limo ~zod our.bow ~talsur-todres ~))) src.bow)
:_ +>.$(sos (~(put by sos) ost.bow *sole-share))
=- [(effect %mor pro/[& %$ "<listening>"] -)]~
=+ all=adrs
[tan/(turn all message) (turn all put-mail)]
::
++ adrs (sort (~(tap by adr)) aor)
++ effect |=(fec=sole-effect [ost.bow %diff %sole-effect fec])
++ message |=(ask=@t leaf/"ask: {(trip ask)}")
++ put-mail |=(ask=@t =+(pax=(rash ask unix-path) [%sav pax '']))
++ unix-path :: split into path of "name" and "extension"
;~ (glue dot)
(cook crip (star ;~(less dot next)))
;~(plug (cook crip (star next)) (easy ~))
==
::
++ poke-ask-mail
|= ask=@t
^- (quip ,[bone card] +>)
~| have-mail/ask
?< (~(has in adr) ask)
:_ +>.$(adr (~(put in adr) ask))
=+ [mez=[(message ask)]~ sav=(put-mail ask)]
%+ turn (prey /sole bow)
|=([ost=bone ^] (effect(ost.bow ost) %mor tan/mez sav ~))
::
++ poke-sole-action
|= act=sole-action
^- (quip ,[bone card] +>)
?- -.act
%clr `+>.$
%ret [[(effect tan/(turn adrs message))]~ +>.$] :: re-print list
%det :: reject all input
=+ som=(~(got by sos) ost.bow) :: XX this code belongs in a library
=^ inv som (~(transceive sole som) +.act)
=^ det som (~(transmit sole som) inv)
=. sos (~(put by sos) ost.bow som)
[[(effect det/det)]~ +>.$]
==
--

View File

@ -10,7 +10,8 @@
!: :: ::
=> |% :: external structures
++ house :: all state
$: %3
$: %4
egg=@u :: command count
hoc=(map bone session) :: conversations
== ::
++ session :: per conversation
@ -161,7 +162,7 @@
++ dp-sink
;~ pose
;~(plug (cold %file tar) dp-beam)
;~(plug (cold %flat pat) (most fas sym))
;~(plug (cold %flat pat) (most fas qut))
;~(plug (cold %pill dot) (most fas sym))
;~(plug (cold %http lus) (easy %post) auri:epur)
;~(plug (cold %http hep) (easy %put) auri:epur)
@ -734,9 +735,9 @@
^+ +>+>
?> ?=(~ cud)
?: ?=([%show 3] -.mad)
dy-over
he-easter:dy-over
?: =(nex num)
dy-over
he-easter:dy-over
dy-make(cud `[nex (~(got by job) nex)])
--
::
@ -761,6 +762,16 @@
%& [%& p.foy]
==
::
++ he-easter :: hint messages
^+ .
=. egg +(egg)
=- ?~(msg ..he-diff (he-diff %tan leaf/u.msg ~))
^- msg=(unit tape)
?+ (clan our.hid) ~
%pawn ?+ egg ~
5 `":: To request a planet, run |ask 'your@email.co'"
== ==
::
++ he-abet :: resolve
[(flop moz) %_(+> hoc (~(put by hoc) ost.hid +<+))]
::
@ -946,13 +957,15 @@
$% [%0 p=(map bone session-0)]
[%1 p=(map bone session-1)]
[%2 p=(map bone session-1)]
[%3 p=(map bone session)]
==
|= old=(unit ?(house hoze)) ^+ [~ ..prep]
?~ old `..prep
?- -.u.old
%3 `..prep(+<+ u.old)
%2 `..prep(+<+ [%3 (~(run by p.u.old) |=(session-1 +<(poy ~)))])
%1 `..prep(+<+ [%3 (~(run by p.u.old) |=(session-1 +<(poy ~)))])
%4 `..prep(+<+ u.old)
%3 $(u.old %*(. *house hoc p.u.old))
%2 $(u.old [%3 (~(run by p.u.old) |=(session-1 +<(poy ~)))])
%1 $(u.old [%3 (~(run by p.u.old) |=(session-1 +<(poy ~)))])
%0 =< ^$(u.old [%1 (~(run by p.u.old) .)])
|= sos=session-0 ^- session-1
[-.sos [[our.hid syd.sos ud/0] /] |3.sos]

View File

@ -103,6 +103,7 @@
++ poke-helm-reload-desk (wrap poke-reload-desk):from-helm
++ poke-helm-reset (wrap poke-reset):from-helm
++ poke-helm-send-hi (wrap poke-send-hi):from-helm
++ poke-helm-send-ask (wrap poke-send-ask):from-helm
++ poke-helm-verb (wrap poke-verb):from-helm
++ poke-helm-begin (wrap poke-begin):from-helm
++ poke-hood-sync (wrap poke-sync):from-kiln

6
gen/hood/ask.hoon Normal file
View File

@ -0,0 +1,6 @@
:- %say
|= [^ [mel=cord ~] ~]
=+ adr=(star ;~(less (mask "\"\\()[],:;<>@") prn))
=+ dom=[;~(plug dlab dot (most dot dlab))]:urlp
=+ ~|(bad-email/mel (rash mel ;~((glue pat) adr dom)))
helm-send-ask/mel

View File

@ -54,6 +54,7 @@
++ pear :: poke fruit
$% [%hood-unsync desk ship desk] ::
[%talk-command command:talk] ::
[%ask-mail cord] ::
[%helm-hi cord] ::
== ::
--
@ -88,6 +89,11 @@
%^ emit %poke /helm/hi/(scot %p her)
[[her %hood] %helm-hi ?~(mes '' (crip u.mes))]
::
++ poke-send-ask
|= mel=cord =< abet
%^ emit %poke /helm/ask/(scot %p ~doznec)
[[~doznec %ask] %ask-mail mel]
::
++ poke-hi |=(mes=@t abet:(emit %flog /di %text "< {<src>}: {(trip mes)}"))
++ coup-hi
|= [pax=path cop=(unit tang)] =< abet

17
mar/ask-mail.hoon Normal file
View File

@ -0,0 +1,17 @@
::
:::: /hoon/ask-mail/mar
::
/? 314
|_ txt=cord
::
++ grab :: convert from
|%
++ noun ,@t :: clam from %noun
++ json (cork so:jo need)
--
++ grow
|%
++ psal ;div: {(trip txt)}
++ mime [text//plain (taco txt)]
--
--