urbit/app/ask.hoon

82 lines
2.4 KiB
Plaintext
Raw Normal View History

::
2016-02-05 06:05:37 +03:00
:::: /hoon/ask/app
::
2016-02-18 01:57:46 +03:00
/? 310
/+ sole
[. sole]
|%
++ card
$% {$diff $sole-effect sole-effect}
==
2016-08-19 04:10:55 +03:00
++ invited ?($new $sent $ignored)
++ email @t
--
!:
2016-08-19 04:10:55 +03:00
|_ {bow/bowl adr/(map email {time invited}) sos/(map bone sole-share)}
++ peer-sole
|= path
^- (quip {bone card} +>)
~| [%not-in-whitelist src.bow]
2016-02-18 01:57:46 +03:00
?> (~(has in (sy ~zod our.bow ~talsur-todres ~)) src.bow)
:_ +>.$(sos (~(put by sos) ost.bow *sole-share))
2016-08-19 22:37:09 +03:00
=- [(effect %mor pro+[& %$ "<listening> [n,a,?]"] -)]~
=+ all=adrs
[tan+(turn all message) (turn all put-mail)]
::
2016-08-19 04:10:55 +03:00
++ adrs (sort (turn (~(tap by adr)) |=({a/email b/time c/invited} [b a c])) lor)
++ effect |=(fec/sole-effect [ost.bow %diff %sole-effect fec])
2016-08-19 04:10:55 +03:00
++ message
|= {now/time ask/@t inv/invited} ^- tank
=. now (sub now (mod now ~s1))
leaf+"ask: {<inv>} {<now>} {(trip ask)}"
::
++ put-mail |=({@ ask/@t inv/invited} =+(pax=(rash ask unix-path) [%sav pax `@t`inv]))
++ 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
2016-08-19 04:10:55 +03:00
?< (~(has by adr) ask)
:_ +>.$(adr (~(put by adr) ask now.bow %new)) :: XX electroplating
=/ new [now.bow ask %new]
=+ [mez=[(message new)]~ sav=(put-mail new)]
%+ 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 `+>.$
2016-08-19 22:37:09 +03:00
$ret [[(effect mor+help)]~ +>.$] :: 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)
2016-08-19 04:10:55 +03:00
=/ buf buf.som
=^ det som (~(transmit sole som) inv)
=. sos (~(put by sos) ost.bow som)
2016-08-19 04:10:55 +03:00
=+ mor=`(list sole-effect)`[det+det]~
=. mor
2016-08-19 22:37:09 +03:00
?: =(`*`"?" buf) (welp mor help)
?: =(`*`"a" buf) (welp mor tan+(turn adrs message) ~)
?: =(`*`"n" buf)
=; new (welp mor tan+(turn new message) ~)
(skim adrs |=({@ @ inv/invited} =(%new inv)))
mor
2016-08-19 04:10:55 +03:00
[[(effect mor+mor)]~ +>.$]
==
2016-08-19 04:10:55 +03:00
++ help
^- (list sole-effect)
=- (scan - (more (just '\0a') (stag %txt (star prn))))
"""
2016-08-19 22:37:09 +03:00
n - list new asks
a - list all asks
? - print help
2016-08-19 04:10:55 +03:00
"""
--