urbit/mar/talk/telegrams.hoon

192 lines
4.8 KiB
Plaintext
Raw Normal View History

2015-09-03 00:53:11 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/telegrams/talk/mar
2015-09-03 00:53:11 +03:00
::
2016-02-18 02:00:12 +03:00
/? 310
/- talk
2017-02-14 03:44:49 +03:00
/+ talk, map-to-json, old-zuse
2016-11-17 04:42:58 +03:00
::
=, talk
2016-12-03 03:56:54 +03:00
=, mimes:html
=, format
=, html
2017-02-14 03:02:25 +03:00
=, old-zuse
|_ gam/(list telegram)
2015-09-03 00:53:11 +03:00
::
++ grab
|%
2015-09-03 00:53:11 +03:00
++ noun (list telegram)
++ mime |=(^mime (json (rash q.q apex:de-json)))
2015-09-03 00:53:11 +03:00
++ json
2017-02-14 03:44:49 +03:00
=> [dejs talk old-zuse]
|= a/json ^- (list telegram)
2017-02-14 03:44:49 +03:00
%. a
|^ (ar (ot ship+(su fed:ag) thought+thot ~))
:: ++ of
:: |* a/(pole {@tas fist})
:: |= b/json
:: %. ((of:jo a) b)
:: %- slog
:: ?+ b ~
:: {$o *}
:: %+ murn `(list {@tas fist})`a
:: |= {c/term d/fist} ^- (unit tank)
:: =+ (~(get by p.b) c)
:: ?~ - ~
:: =+ (d u)
:: ?~ - (some >[c u]<)
:: ~
:: ==
2015-09-03 00:53:11 +03:00
::
++ as :: array as set
|* a/fist
2017-02-14 03:44:49 +03:00
(cu ~(gas in *(set _*a)) (ar a))
2015-09-03 00:53:11 +03:00
::
2015-09-15 04:03:40 +03:00
++ ke :: callbacks
|* {gar/* sef/_|.(fist)}
|= jon/json
2017-02-14 03:44:49 +03:00
^+ gar
2015-09-15 04:03:40 +03:00
=- ~! gar ~! (need -) -
((sef) jon)
2015-09-03 00:53:11 +03:00
::
++ head-rush
|* a/rule
|* {cord *}
=+ nit=(rush +<- a)
2015-09-03 00:53:11 +03:00
?~ nit ~
(some [u.nit +>->])
2015-09-03 00:53:11 +03:00
::
++ thot
2017-02-14 03:44:49 +03:00
^- $-(json thought)
2015-09-03 00:53:11 +03:00
%- ot :~
2017-02-14 03:44:49 +03:00
serial+`$-(json serial)`(ci (slat %uv) so)
audience+`$-(json audience)`audi
statement+`$-(json statement)`stam
2015-09-03 00:53:11 +03:00
==
::
2017-02-14 03:44:49 +03:00
++ audi `$-(json audience)`(op parn memb)
++ auri (op parn (ci (soft presence) so))
2017-02-14 03:44:49 +03:00
++ memb ^- $-(json (pair envelope delivery))
(ot envelope+lope delivery+(cu (hard delivery) so) ~)
++ lope (ot visible+bo sender+(mu (su parn)) ~)
2015-09-03 00:53:11 +03:00
::
++ parn
^- $-(nail (like partner))
2015-09-15 04:03:40 +03:00
%+ pick
2015-09-03 00:53:11 +03:00
;~((glue fas) ;~(pfix sig fed:ag) urs:ab)
%+ sear (soft passport)
;~((glue fas) sym urs:ab) :: XX [a-z0-9_]{1,15}
::
++ stam (ot date+di bouquet+(as (ar so)) speech+spec ~)
2015-09-15 04:03:40 +03:00
++ spec
%+ ke *speech |. ~+
%- of :~
lin+(ot say+bo txt+so ~)
url+(ot txt+(su aurf:urlp) ~)
exp+(ot txt+so ~)
app+(ot txt+so src+so ~)
fat+(ot tor+tors taf+spec ~)
ext+(ot nom+so txe+blob ~)
non+ul
mor+(ar spec)
:: inv+(ot ship+(su fed:ag) party+(su urs:ab) ~)
2015-09-15 04:03:40 +03:00
==
++ tors
%+ ke *torso |. ~+
%- of :~
name+(ot nom+so mon+tors ~)
text+(cu to-wain so)
tank+(ot dat+(cu (hard (list tank)) blob) ~)
2015-09-03 00:53:11 +03:00
==
2015-09-15 04:03:40 +03:00
::
++ blob (cu cue (su fel:ofis))
2015-09-03 00:53:11 +03:00
--
--
::
++ grow
|%
2016-12-03 03:56:54 +03:00
++ mime [/text/json (as-octs (crip (en-json json)))]
2015-09-03 00:53:11 +03:00
++ json
=> +
|^
:- %a
%+ turn gam
|= telegram
(jobe ship+(jope p) thought+(thot q) ~)
2015-09-03 00:53:11 +03:00
::
++ jove
|= {a/envelope b/delivery}
2015-09-03 00:53:11 +03:00
%- jobe :~
envelope+(jobe visible+[%b p.a] sender+?~(q.a ~ s+(parn u.q.a)) ~)
delivery+[%s b]
2015-09-03 00:53:11 +03:00
==
::
++ jope |=(a/ship (jape +:<a>)) ::[%s (crip +:(scow %p a))])
2017-02-14 03:02:25 +03:00
++ joke |=(a/tank (jape (of-wall (wash 0^80 a))))
++ jode |=(a/time (jone (div (mul (sub a ~1970.1.1) 1.000) ~s1)))
2015-09-03 00:53:11 +03:00
::
++ thot
|= thought
(jobe serial+(jape <p>) audience+(audi q) statement+(stam r) ~)
2015-09-03 00:53:11 +03:00
::
2016-02-18 02:50:03 +03:00
++ audi (map-to-json parn jove)
2015-09-03 00:53:11 +03:00
++ bouq
|= a/bouquet
a+(turn ~(tap in a) |=(b/path a+(turn b |=(c/knot s+c))))
2015-09-03 00:53:11 +03:00
::
++ parn
|= a/partner ^- cord
2015-09-03 00:53:11 +03:00
?- -.a
$& (stat p.a)
$| %- crip
2015-09-03 00:53:11 +03:00
?- -.p.a
$twitter "{(trip -.p.a)}/{(trip p.p.a)}"
2015-09-03 00:53:11 +03:00
==
==
::
++ stat
|= a/station ^- cord
2015-09-03 00:53:11 +03:00
(crip "{<p.a>}/{(trip q.a)}")
::
++ stam
|= statement
(jobe date+(jode p) bouquet+(bouq q) speech+(spec r) ~)
2015-09-03 00:53:11 +03:00
::
++ spec
|= a/speech
2015-09-03 00:53:11 +03:00
%+ joba -.a
?+ -.a ~|(stub+-.a !!)
$lin (jobe txt+[%s q.a] say+[%b p.a] ~)
$url (joba txt+(jape (earf p.a)))
$exp (joba txt+[%s p.a])
$app (jobe txt+[%s q.a] src+[%s p.a] ~)
$fat (jobe tor+(tors p.a) taf+$(a q.a) ~)
$ext (jobe nom+[%s p.a] txe+(jape (sifo (jam +.a))) ~)
$non ~
$mor :- %a
|- ^- (list json)
?~ p.a ~
[^$(a i.p.a) $(p.a t.p.a)]
:: $inv (jobe ship+(jope p.a) party+[%s q.a] ~)
2015-09-03 00:53:11 +03:00
==
::
++ tors
|= a/torso
2015-09-03 00:53:11 +03:00
%+ joba -.a
?- -.a
$text [%s (of-wain +.a)]
$tank (jobe txt+[%a (turn +.a joke)] dat+(jape (sifo (jam +.a))) ~)
$name (jobe nom+s+p.a mon+$(a q.a) ~)
2015-09-03 00:53:11 +03:00
==
::
--
--
::
2015-09-03 02:20:11 +03:00
++ grad
|%
++ form %talk-telegrams
++ diff |=((list telegram) +<)
++ pact |=((list telegram) +<)
++ join |=({(list telegram) (list telegram)} `(unit mime)`~)
2015-09-03 02:20:11 +03:00
--
2015-09-03 00:53:11 +03:00
--