2019-10-03 02:30:07 +03:00
|
|
|
:: chat-cli: cli chat client using chat-store and friends
|
|
|
|
::
|
|
|
|
:: pulls all known messages into a single stream.
|
|
|
|
:: type ;help for usage instructions.
|
|
|
|
::
|
2019-10-04 23:38:22 +03:00
|
|
|
:: note that while the chat-store only cares about paths,
|
|
|
|
:: we mostly deal with [ship path] (aka target) here.
|
|
|
|
:: when sending messages (through the chat hook),
|
|
|
|
:: we concat the ship onto the head of the path,
|
|
|
|
:: and trust it to take care of the rest.
|
|
|
|
::
|
2020-12-04 21:49:21 +03:00
|
|
|
/- *resource, post, store=chat-store
|
|
|
|
/+ shoe, default-agent, verb, dbug, graph=graph-store, libgraph=graph
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
|
|
|
|%
|
2020-05-24 17:38:09 +03:00
|
|
|
+$ card card:shoe
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
2020-03-11 02:42:04 +03:00
|
|
|
+$ versioned-state
|
2020-11-23 03:30:32 +03:00
|
|
|
$% state-3
|
|
|
|
state-2
|
2020-05-15 02:46:18 +03:00
|
|
|
state-1
|
2020-03-11 02:40:21 +03:00
|
|
|
state-0
|
|
|
|
==
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
+$ state-3
|
|
|
|
$: %3
|
|
|
|
::TODO support multiple sessions
|
2020-11-23 18:02:11 +03:00
|
|
|
sessions=(map sole-id session) :: sole sessions
|
2020-11-23 03:30:32 +03:00
|
|
|
bound=(map resource glyph) :: bound resource glyphs
|
|
|
|
binds=(jug glyph resource) :: resource glyph lookup
|
|
|
|
settings=(set term) :: frontend flags
|
|
|
|
width=@ud :: display width
|
|
|
|
timez=(pair ? @ud) :: timezone adjustment
|
|
|
|
==
|
|
|
|
::
|
2020-11-23 18:02:11 +03:00
|
|
|
+$ sole-id @ta
|
|
|
|
+$ session
|
|
|
|
$: viewing=(set resource) :: connected graphs
|
|
|
|
history=(list uid:post) :: scrollback pointers
|
|
|
|
count=@ud :: (lent history)
|
|
|
|
audience=target :: active target
|
|
|
|
==
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
::TODO remove for breach
|
|
|
|
+$ target-2 [in-group=? =ship =path]
|
|
|
|
+$ mail [source=target-2 envelope:store]
|
2020-05-15 02:46:18 +03:00
|
|
|
+$ state-2
|
|
|
|
$: %2
|
|
|
|
grams=(list mail) :: all messages
|
2020-11-23 03:30:32 +03:00
|
|
|
known=(set [target-2 serial:store]) :: known message lookup
|
2020-05-15 02:46:18 +03:00
|
|
|
count=@ud :: (lent grams)
|
2020-11-23 03:30:32 +03:00
|
|
|
bound=(map target-2 glyph) :: bound circle glyphs
|
|
|
|
binds=(jug glyph target-2) :: circle glyph lookup
|
|
|
|
audience=(set target-2) :: active targets
|
2020-05-15 02:46:18 +03:00
|
|
|
settings=(set term) :: frontend flags
|
|
|
|
width=@ud :: display width
|
|
|
|
timez=(pair ? @ud) :: timezone adjustment
|
|
|
|
==
|
|
|
|
::
|
2020-03-11 02:40:21 +03:00
|
|
|
+$ state-1
|
|
|
|
$: %1
|
|
|
|
grams=(list mail) :: all messages
|
2020-11-23 03:30:32 +03:00
|
|
|
known=(set [target-2 serial:store]) :: known message lookup
|
2019-10-03 02:30:07 +03:00
|
|
|
count=@ud :: (lent grams)
|
2020-11-23 03:30:32 +03:00
|
|
|
bound=(map target-2 glyph) :: bound circle glyphs
|
|
|
|
binds=(jug glyph target-2) :: circle glyph lookup
|
|
|
|
audience=(set target-2) :: active targets
|
2019-10-03 02:30:07 +03:00
|
|
|
settings=(set term) :: frontend flags
|
|
|
|
width=@ud :: display width
|
|
|
|
timez=(pair ? @ud) :: timezone adjustment
|
2020-11-23 03:30:32 +03:00
|
|
|
cli=state=sole-share:shoe :: console state
|
2019-11-09 06:32:21 +03:00
|
|
|
eny=@uvJ :: entropy
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
|
|
|
::
|
2020-03-11 02:40:21 +03:00
|
|
|
+$ state-0
|
2020-04-25 06:51:28 +03:00
|
|
|
$: grams=(list [[=ship =path] envelope:store]) :: all messages
|
2020-10-22 20:17:15 +03:00
|
|
|
known=(set [[=ship =path] serial:store]) :: known message lookup
|
2020-03-11 02:40:21 +03:00
|
|
|
count=@ud :: (lent grams)
|
|
|
|
bound=(map [=ship =path] glyph) :: bound circle glyphs
|
|
|
|
binds=(jug glyph [=ship =path]) :: circle glyph lookup
|
|
|
|
audience=(set [=ship =path]) :: active targets
|
|
|
|
settings=(set term) :: frontend flags
|
|
|
|
width=@ud :: display width
|
|
|
|
timez=(pair ? @ud) :: timezone adjustment
|
2020-11-23 03:30:32 +03:00
|
|
|
cli=state=sole-share:shoe :: console state
|
2020-03-11 02:40:21 +03:00
|
|
|
eny=@uvJ :: entropy
|
|
|
|
==
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
+$ target resource
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-04 23:38:22 +03:00
|
|
|
+$ glyph char
|
2020-03-11 02:40:21 +03:00
|
|
|
++ glyphs "!@#$%^&()-=_+[]\{}'\\:\",.<>?"
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
+$ command
|
2020-11-23 03:30:32 +03:00
|
|
|
$% [%target target] :: set messaging target
|
|
|
|
[%say content:post] :: send message
|
2019-10-03 02:30:07 +03:00
|
|
|
[%eval cord hoon] :: send #-message
|
2020-11-23 03:30:32 +03:00
|
|
|
:: ::
|
|
|
|
[%view $?(~ target)] :: notice chat
|
|
|
|
[%flee target] :: ignore chat
|
|
|
|
:: ::
|
2019-10-04 23:38:22 +03:00
|
|
|
[%bind glyph target] :: bind glyph
|
2019-10-11 00:40:08 +03:00
|
|
|
[%unbind glyph (unit target)] :: unbind glyph
|
2019-10-04 23:38:22 +03:00
|
|
|
[%what (unit $@(char target))] :: glyph lookup
|
2020-11-23 03:30:32 +03:00
|
|
|
:: ::
|
2019-10-04 23:38:22 +03:00
|
|
|
[%settings ~] :: show active settings
|
|
|
|
[%set term] :: set settings flag
|
|
|
|
[%unset term] :: unset settings flag
|
|
|
|
[%width @ud] :: adjust display width
|
|
|
|
[%timezone ? @ud] :: adjust time printing
|
2020-11-23 03:30:32 +03:00
|
|
|
:: ::
|
2019-10-07 17:02:03 +03:00
|
|
|
[%select $@(rel=@ud [zeros=@u abs=@ud])] :: rel/abs msg selection
|
2019-10-04 23:38:22 +03:00
|
|
|
[%chats ~] :: list available chats
|
2019-10-03 02:30:07 +03:00
|
|
|
[%help ~] :: print usage info
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
--
|
2020-11-23 03:30:32 +03:00
|
|
|
=| state-3
|
2020-03-11 02:42:04 +03:00
|
|
|
=* state -
|
2020-01-21 23:36:03 +03:00
|
|
|
::
|
|
|
|
%- agent:dbug
|
|
|
|
%+ verb |
|
2020-05-24 17:38:09 +03:00
|
|
|
%- (agent:shoe command)
|
|
|
|
^- (shoe:shoe command)
|
2019-11-09 06:32:21 +03:00
|
|
|
=<
|
2019-11-19 07:36:21 +03:00
|
|
|
|_ =bowl:gall
|
2019-11-09 06:32:21 +03:00
|
|
|
+* this .
|
|
|
|
talk-core +>
|
2020-05-15 15:13:38 +03:00
|
|
|
tc ~(. talk-core bowl)
|
2019-11-09 06:32:21 +03:00
|
|
|
def ~(. (default-agent this %|) bowl)
|
2020-05-24 17:38:09 +03:00
|
|
|
des ~(. (default:shoe this command) bowl)
|
2019-11-09 06:32:21 +03:00
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
^- (quip card _this)
|
2020-03-11 02:42:04 +03:00
|
|
|
=^ cards state (prep:tc ~)
|
2020-03-11 02:40:21 +03:00
|
|
|
[cards this]
|
2019-11-09 06:32:21 +03:00
|
|
|
::
|
2020-03-11 02:42:04 +03:00
|
|
|
++ on-save !>(state)
|
2019-11-09 06:32:21 +03:00
|
|
|
::
|
|
|
|
++ on-load
|
|
|
|
|= old-state=vase
|
|
|
|
^- (quip card _this)
|
2020-03-11 02:42:04 +03:00
|
|
|
=/ old !<(versioned-state old-state)
|
|
|
|
=^ cards state (prep:tc `old)
|
2019-11-09 06:32:21 +03:00
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
2020-03-11 02:42:04 +03:00
|
|
|
=^ cards state
|
2019-11-09 06:32:21 +03:00
|
|
|
?+ mark (on-poke:def mark vase)
|
2019-12-21 14:58:22 +03:00
|
|
|
%noun (poke-noun:tc !<(* vase))
|
2019-11-09 06:32:21 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-agent
|
2019-11-19 07:36:21 +03:00
|
|
|
|= [=wire =sign:agent:gall]
|
2019-11-09 06:32:21 +03:00
|
|
|
^- (quip card _this)
|
2020-03-11 02:42:04 +03:00
|
|
|
=^ cards state
|
2019-11-09 06:32:21 +03:00
|
|
|
?- -.sign
|
2020-03-11 23:52:04 +03:00
|
|
|
%poke-ack [- state]:(on-agent:def wire sign)
|
|
|
|
%watch-ack [- state]:(on-agent:def wire sign)
|
|
|
|
::
|
|
|
|
%kick
|
|
|
|
:_ state
|
|
|
|
?+ wire ~
|
2020-11-23 03:30:32 +03:00
|
|
|
[%graph-store ~] ~[connect:tc]
|
2020-03-11 23:52:04 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-09 06:32:21 +03:00
|
|
|
%fact
|
2020-11-23 03:30:32 +03:00
|
|
|
?+ p.cage.sign ~|([dap.bowl %bad-sub-mark wire p.cage.sign] !!)
|
2021-04-14 23:49:54 +03:00
|
|
|
%graph-update-2
|
2020-11-23 03:30:32 +03:00
|
|
|
%- on-graph-update:tc
|
|
|
|
!<(update:graph q.cage.sign)
|
2019-11-09 06:32:21 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
2020-05-24 17:38:09 +03:00
|
|
|
++ on-watch on-watch:def
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
2019-11-09 06:32:21 +03:00
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
|
|
|
++ command-parser
|
2020-11-23 18:02:11 +03:00
|
|
|
|= =sole-id
|
|
|
|
parser:(make:sh:tc sole-id)
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
|
|
|
++ tab-list
|
2020-11-23 18:02:11 +03:00
|
|
|
|= =sole-id
|
2020-05-24 17:38:09 +03:00
|
|
|
tab-list:sh:tc
|
|
|
|
::
|
|
|
|
++ on-command
|
2020-11-23 18:02:11 +03:00
|
|
|
|= [=sole-id =command]
|
2020-05-24 17:38:09 +03:00
|
|
|
=^ cards state
|
2020-11-23 18:02:11 +03:00
|
|
|
(work:(make:sh:tc sole-id) command)
|
2020-05-24 17:38:09 +03:00
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-connect
|
2020-11-23 18:02:11 +03:00
|
|
|
|= =sole-id
|
2020-05-24 17:38:09 +03:00
|
|
|
^- (quip card _this)
|
2020-11-23 18:02:11 +03:00
|
|
|
[[prompt:(make:sh-out:tc sole-id)]~ this]
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
|
|
|
++ can-connect can-connect:des
|
|
|
|
++ on-disconnect on-disconnect:des
|
2019-11-09 06:32:21 +03:00
|
|
|
--
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-11-19 07:36:21 +03:00
|
|
|
|_ =bowl:gall
|
2020-11-23 03:30:32 +03:00
|
|
|
+* libgraph ~(. ^libgraph bowl)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +prep: setup & state adapter
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
|
|
|
++ prep
|
2020-03-11 02:42:04 +03:00
|
|
|
|= old=(unit versioned-state)
|
|
|
|
^- (quip card _state)
|
2020-03-11 02:40:21 +03:00
|
|
|
?~ old
|
2020-12-04 06:04:48 +03:00
|
|
|
[~[connect] state(width 80)]
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
2020-05-15 02:46:18 +03:00
|
|
|
=? u.old ?=(?(~ ^) -.u.old)
|
|
|
|
^- state-1
|
2020-03-11 02:40:21 +03:00
|
|
|
:- %1
|
|
|
|
%= u.old
|
|
|
|
grams ~ ::NOTE this only impacts historic message lookup in chat-cli
|
|
|
|
::
|
|
|
|
known
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (set [target-2 serial:store])
|
2020-03-11 02:40:21 +03:00
|
|
|
%- ~(run in known.u.old)
|
2020-10-22 20:17:15 +03:00
|
|
|
|= [t=[ship path] s=serial:store]
|
2020-11-23 03:30:32 +03:00
|
|
|
[`target-2`[| t] s]
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
|
|
|
bound
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (map target-2 glyph)
|
|
|
|
%- ~(gas by *(map target-2 glyph))
|
2020-03-11 02:40:21 +03:00
|
|
|
%+ turn ~(tap by bound.u.old)
|
|
|
|
|= [t=[ship path] g=glyph]
|
2020-11-23 03:30:32 +03:00
|
|
|
[`target-2`[| t] g]
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
|
|
|
binds
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (jug glyph target-2)
|
2020-03-11 02:40:21 +03:00
|
|
|
%- ~(run by binds.u.old)
|
|
|
|
|= s=(set [ship path])
|
|
|
|
%- ~(run in s)
|
|
|
|
|= t=[ship path]
|
2020-11-23 03:30:32 +03:00
|
|
|
`target-2`[| t]
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
|
|
|
audience
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (set target-2)
|
2020-03-11 02:40:21 +03:00
|
|
|
%- ~(run in audience.u.old)
|
|
|
|
|= t=[ship path]
|
2020-11-23 03:30:32 +03:00
|
|
|
`target-2`[| t]
|
2019-10-08 22:59:25 +03:00
|
|
|
==
|
2020-05-15 02:46:18 +03:00
|
|
|
::
|
|
|
|
=? u.old ?=(%1 -.u.old)
|
|
|
|
^- state-2
|
|
|
|
=, u.old
|
|
|
|
:* %2
|
|
|
|
grams known count
|
|
|
|
bound binds audience
|
|
|
|
settings width timez
|
|
|
|
==
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
=^ cards u.old
|
|
|
|
?. ?=(%2 -.u.old) [~ u.old]
|
|
|
|
:- :~ [%pass /chat-store %agent [our-self %chat-store] %leave ~]
|
|
|
|
[%pass /invites %agent [our.bowl %invite-store] %leave ~]
|
|
|
|
==
|
|
|
|
^- state-3
|
|
|
|
:- %3
|
2020-11-23 18:02:11 +03:00
|
|
|
:* %+ ~(put in *(map sole-id session))
|
|
|
|
(cat 3 'drum_' (scot %p our.bowl))
|
|
|
|
:* ~ ~ 0
|
2020-11-23 03:30:32 +03:00
|
|
|
::
|
|
|
|
?~ audience.u.old *target
|
|
|
|
[ship ?~(path %$ i.path)]:n.audience.u.old
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%- ~(gas by *(map resource glyph))
|
|
|
|
%+ turn ~(tap in bound.u.old)
|
|
|
|
|= [t=target-2 g=glyph]
|
|
|
|
[[ship.t ?~(path.t %$ i.path.t)] g]
|
|
|
|
::
|
|
|
|
^- (jug glyph resource)
|
|
|
|
%- ~(run by binds.u.old)
|
|
|
|
|= s=(set target-2)
|
|
|
|
%- ~(run in s)
|
|
|
|
|= t=target-2
|
|
|
|
[ship.t ?~(path.t %$ i.path.t)]
|
|
|
|
::
|
|
|
|
settings.u.old
|
|
|
|
width.u.old
|
|
|
|
timez.u.old
|
|
|
|
==
|
|
|
|
::
|
|
|
|
?> ?=(%3 -.u.old)
|
|
|
|
:_ u.old
|
2020-12-11 04:04:10 +03:00
|
|
|
%+ welp
|
|
|
|
cards
|
2020-11-23 03:30:32 +03:00
|
|
|
?: %- ~(has by wex.bowl)
|
|
|
|
[/graph-store our-self %graph-store]
|
|
|
|
~
|
|
|
|
~[connect]
|
|
|
|
:: +connect: connect to the graph-store
|
2019-10-07 21:46:35 +03:00
|
|
|
::
|
|
|
|
++ connect
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2020-11-23 03:30:32 +03:00
|
|
|
[%pass /graph-store %agent [our-self %graph-store] %watch /updates]
|
2020-03-11 23:52:04 +03:00
|
|
|
::
|
2020-05-15 16:44:11 +03:00
|
|
|
::TODO better moon support. (name:title our.bowl)
|
|
|
|
++ our-self our.bowl
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-11-23 18:02:11 +03:00
|
|
|
++ get-session
|
|
|
|
|= =sole-id
|
|
|
|
^- session
|
|
|
|
(~(gut by sessions) sole-id %*(. *session audience [our-self %$]))
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +tor: term ordering for targets
|
|
|
|
::
|
|
|
|
++ tor
|
|
|
|
|= [[* a=term] [* b=term]]
|
|
|
|
(aor a b)
|
|
|
|
:: +ior: index ordering for nodes
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ ior
|
|
|
|
|= [[a=index:post *] [b=index:post *]]
|
|
|
|
(aor a b)
|
|
|
|
:: +safe-get-graph: virtualized +get-graph
|
|
|
|
::
|
|
|
|
++ safe-get-graph
|
|
|
|
|= =resource
|
|
|
|
^- (unit update:graph)
|
|
|
|
=/ res=(each update:graph tang)
|
|
|
|
::TODO doesn't actually contain the crash?
|
|
|
|
%- mule |.
|
|
|
|
(get-graph:libgraph resource)
|
|
|
|
?- -.res
|
|
|
|
%& `p.res
|
|
|
|
%| ~
|
|
|
|
==
|
|
|
|
:: +is-chat-graph: check whether graph contains chat-style data
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ is-chat-graph
|
|
|
|
|= =resource
|
|
|
|
^- ?
|
|
|
|
=/ update=(unit update:graph)
|
|
|
|
(safe-get-graph resource)
|
|
|
|
?~ update |
|
|
|
|
?> ?=(%add-graph -.q.u.update)
|
|
|
|
=(`%graph-validator-chat mark.q.u.update)
|
2019-10-07 21:46:35 +03:00
|
|
|
:: +poke-noun: debug helpers
|
|
|
|
::
|
|
|
|
++ poke-noun
|
|
|
|
|= a=*
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-07 21:46:35 +03:00
|
|
|
?: ?=(%connect a)
|
2020-03-11 02:42:04 +03:00
|
|
|
[[connect ~] state]
|
|
|
|
[~ state]
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +handle-graph-update: get new mailboxes & messages
|
2020-03-11 23:52:04 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ on-graph-update
|
|
|
|
|= upd=update:graph
|
2020-03-11 23:52:04 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 18:02:11 +03:00
|
|
|
?. ?=(?(%remove-graph %add-nodes) -.q.upd)
|
|
|
|
[~ state]
|
|
|
|
=/ sez=(list [=sole-id =session])
|
|
|
|
~(tap by sessions)
|
|
|
|
=| cards=(list card)
|
2020-11-23 03:30:32 +03:00
|
|
|
|-
|
2020-11-23 18:02:11 +03:00
|
|
|
?~ sez [cards state]
|
|
|
|
=^ caz session.i.sez
|
|
|
|
?- -.q.upd
|
|
|
|
%remove-graph (~(notice-remove se i.sez) +.q.upd)
|
|
|
|
::
|
|
|
|
%add-nodes
|
2020-12-04 06:05:38 +03:00
|
|
|
?. (~(has in viewing.session.i.sez) resource.q.upd)
|
|
|
|
[~ session.i.sez]
|
2020-11-23 18:02:11 +03:00
|
|
|
%+ ~(read-posts se i.sez)
|
|
|
|
resource.q.upd
|
|
|
|
(sort ~(tap by nodes.q.upd) ior)
|
|
|
|
==
|
|
|
|
=. sessions (~(put by sessions) i.sez)
|
|
|
|
$(sez t.sez, cards (weld cards caz))
|
|
|
|
:: +se: session event handling
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-11-23 18:02:11 +03:00
|
|
|
++ se
|
|
|
|
|_ [=sole-id =session]
|
|
|
|
+* sh-out ~(. ^sh-out sole-id session)
|
|
|
|
::
|
|
|
|
++ read-posts
|
|
|
|
|= [=target nodes=(list [=index:post =node:graph])]
|
|
|
|
^- (quip card _session)
|
|
|
|
=^ cards nodes
|
|
|
|
^- (quip card _nodes)
|
|
|
|
=+ count=(lent nodes)
|
|
|
|
?. (gth count 10) [~ nodes]
|
|
|
|
:_ (swag [(sub count 10) 10] nodes)
|
|
|
|
[(print:sh-out "skipping {(scow %ud (sub count 10))} messages...")]~
|
|
|
|
|-
|
|
|
|
?~ nodes [cards session]
|
|
|
|
=^ caz session
|
|
|
|
(read-post target [index post.node]:i.nodes)
|
|
|
|
$(cards (weld cards caz), nodes t.nodes)
|
|
|
|
::
|
|
|
|
:: +read-post: add envelope to state and show it to user
|
|
|
|
::
|
|
|
|
++ read-post
|
2021-04-14 00:18:05 +03:00
|
|
|
|= [=target =index:post =maybe-post:graph]
|
2020-11-23 18:02:11 +03:00
|
|
|
^- (quip card _session)
|
2021-04-14 00:18:05 +03:00
|
|
|
?- -.maybe-post
|
|
|
|
%| [~ session]
|
|
|
|
%&
|
|
|
|
:- (show-post:sh-out target p.maybe-post)
|
|
|
|
%_ session
|
|
|
|
history [[target index] history.session]
|
|
|
|
count +(count.session)
|
|
|
|
==
|
2020-11-23 18:02:11 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ notice-remove
|
|
|
|
|= =target
|
|
|
|
^- (quip card _session)
|
|
|
|
?. (~(has in viewing.session) target)
|
|
|
|
[~ session]
|
|
|
|
:- [(show-delete:sh-out target) ~]
|
|
|
|
session(viewing (~(del in viewing.session) target))
|
|
|
|
--
|
2019-10-07 17:02:03 +03:00
|
|
|
::
|
2019-10-10 23:38:18 +03:00
|
|
|
:: +bind-default-glyph: bind to default, or random available
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ bind-default-glyph
|
|
|
|
|= =target
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-10 23:38:18 +03:00
|
|
|
=; =glyph (bind-glyph glyph target)
|
|
|
|
|^ =/ g=glyph (choose glyphs)
|
|
|
|
?. (~(has by binds) g) g
|
|
|
|
=/ available=(list glyph)
|
|
|
|
%~ tap in
|
|
|
|
(~(dif in `(set glyph)`(sy glyphs)) ~(key by binds))
|
|
|
|
?~ available g
|
|
|
|
(choose available)
|
|
|
|
++ choose
|
|
|
|
|= =(list glyph)
|
|
|
|
=; i=@ud (snag i list)
|
|
|
|
(mod (mug target) (lent list))
|
|
|
|
--
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +bind-glyph: add binding for glyph
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ bind-glyph
|
|
|
|
|= [=glyph =target]
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-04 23:38:22 +03:00
|
|
|
::TODO should send these to settings store eventually
|
2019-10-11 00:49:20 +03:00
|
|
|
:: if the target was already bound to another glyph, un-bind that
|
|
|
|
::
|
|
|
|
=? binds (~(has by bound) target)
|
|
|
|
(~(del ju binds) (~(got by bound) target) target)
|
2019-10-04 23:38:22 +03:00
|
|
|
=. bound (~(put by bound) target glyph)
|
|
|
|
=. binds (~(put ju binds) glyph target)
|
2020-03-11 02:42:04 +03:00
|
|
|
[(show-glyph:sh-out glyph `target) state]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +unbind-glyph: remove all binding for glyph
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ unbind-glyph
|
2019-10-11 00:40:08 +03:00
|
|
|
|= [=glyph targ=(unit target)]
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-11 00:40:08 +03:00
|
|
|
?^ targ
|
|
|
|
=. binds (~(del ju binds) glyph u.targ)
|
|
|
|
=. bound (~(del by bound) u.targ)
|
2020-03-11 02:42:04 +03:00
|
|
|
[(show-glyph:sh-out glyph ~) state]
|
2019-10-04 23:38:22 +03:00
|
|
|
=/ ole=(set target)
|
|
|
|
(~(get ju binds) glyph)
|
|
|
|
=. binds (~(del by binds) glyph)
|
|
|
|
=. bound
|
|
|
|
|-
|
|
|
|
?~ ole bound
|
|
|
|
=. bound $(ole l.ole)
|
|
|
|
=. bound $(ole r.ole)
|
|
|
|
(~(del by bound) n.ole)
|
2020-03-11 02:42:04 +03:00
|
|
|
[(show-glyph:sh-out glyph ~) state]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +decode-glyph: find the target that matches a glyph, if any
|
|
|
|
::
|
|
|
|
++ decode-glyph
|
2020-11-23 18:02:11 +03:00
|
|
|
|= [=session =glyph]
|
2019-10-07 17:02:03 +03:00
|
|
|
^- (unit target)
|
|
|
|
=+ lax=(~(get ju binds) glyph)
|
2020-11-23 03:30:32 +03:00
|
|
|
:: no target
|
2019-10-07 17:02:03 +03:00
|
|
|
?: =(~ lax) ~
|
2019-10-10 23:39:41 +03:00
|
|
|
%- some
|
2020-11-23 03:30:32 +03:00
|
|
|
:: single target
|
|
|
|
?: ?=([* ~ ~] lax) n.lax
|
|
|
|
:: in case of multiple matches, pick one we're viewing
|
2020-11-23 18:02:11 +03:00
|
|
|
=. lax (~(uni in lax) viewing.session)
|
2019-10-10 23:39:41 +03:00
|
|
|
?: ?=([* ~ ~] lax) n.lax
|
|
|
|
:: in case of multiple audiences, pick the most recently active one
|
|
|
|
|- ^- target
|
2020-11-23 18:02:11 +03:00
|
|
|
?~ history.session -:~(tap in lax)
|
|
|
|
=* resource resource.i.history.session
|
2020-11-23 03:30:32 +03:00
|
|
|
?: (~(has in lax) resource)
|
|
|
|
resource
|
2020-11-23 18:02:11 +03:00
|
|
|
$(history.session t.history.session)
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-05-24 17:38:09 +03:00
|
|
|
:: +sh: shoe handling
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-05-24 17:38:09 +03:00
|
|
|
++ sh
|
2020-11-23 18:02:11 +03:00
|
|
|
|_ [=sole-id session]
|
|
|
|
+* session +<+
|
|
|
|
sh-out ~(. ^sh-out sole-id session)
|
|
|
|
put-ses state(sessions (~(put by sessions) sole-id session))
|
|
|
|
::
|
|
|
|
++ make
|
|
|
|
|= =^sole-id
|
|
|
|
%_ ..make
|
|
|
|
sole-id sole-id
|
|
|
|
+<+ (get-session sole-id)
|
|
|
|
==
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +read: command parser
|
|
|
|
::
|
|
|
|
:: parses the command line buffer.
|
|
|
|
:: produces commands which can be executed by +work.
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-05-24 17:38:09 +03:00
|
|
|
++ parser
|
2019-10-07 17:02:03 +03:00
|
|
|
|^
|
2020-06-06 19:58:57 +03:00
|
|
|
%+ stag |
|
2019-10-07 17:02:03 +03:00
|
|
|
%+ knee *command |. ~+
|
|
|
|
=- ;~(pose ;~(pfix mic -) message)
|
|
|
|
;~ pose
|
2020-11-23 03:30:32 +03:00
|
|
|
(stag %target targ)
|
2019-10-07 17:02:03 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
;~((glue ace) (tag %view) targ)
|
|
|
|
;~((glue ace) (tag %flee) targ)
|
|
|
|
;~(plug (tag %view) (easy ~))
|
2019-10-07 17:02:03 +03:00
|
|
|
::
|
|
|
|
;~((glue ace) (tag %bind) glyph targ)
|
2019-10-11 00:40:08 +03:00
|
|
|
;~((glue ace) (tag %unbind) ;~(plug glyph (punt ;~(pfix ace targ))))
|
2019-10-07 17:02:03 +03:00
|
|
|
;~(plug (perk %what ~) (punt ;~(pfix ace ;~(pose glyph targ))))
|
|
|
|
::
|
|
|
|
;~(plug (tag %settings) (easy ~))
|
|
|
|
;~((glue ace) (tag %set) flag)
|
|
|
|
;~((glue ace) (tag %unset) flag)
|
|
|
|
;~(plug (cold %width (jest 'set width ')) dem:ag)
|
2020-03-11 02:40:21 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
;~ plug
|
|
|
|
(cold %timezone (jest 'set timezone '))
|
|
|
|
;~ pose
|
|
|
|
(cold %| (just '-'))
|
|
|
|
(cold %& (just '+'))
|
|
|
|
==
|
|
|
|
%+ sear
|
|
|
|
|= a=@ud
|
|
|
|
^- (unit @ud)
|
|
|
|
?:(&((gte a 0) (lte a 14)) `a ~)
|
|
|
|
dem:ag
|
|
|
|
==
|
|
|
|
::
|
|
|
|
;~(plug (tag %chats) (easy ~))
|
|
|
|
;~(plug (tag %help) (easy ~))
|
|
|
|
::
|
|
|
|
(stag %select nump)
|
|
|
|
==
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
::TODO
|
|
|
|
:: ++ cmd
|
|
|
|
:: |* [cmd=term req=(list rule) opt=(list rule)]
|
|
|
|
:: |^ ;~ plug
|
|
|
|
:: (tag cmd)
|
|
|
|
:: ::
|
|
|
|
:: ::TODO this feels slightly too dumb
|
|
|
|
:: ?~ req
|
|
|
|
:: ?~ opt (easy ~)
|
|
|
|
:: (opt-rules opt)
|
|
|
|
:: ?~ opt (req-rules req)
|
|
|
|
:: ;~(plug (req-rules req) (opt-rules opt)) ::TODO rest-loop
|
|
|
|
:: ==
|
|
|
|
:: ++ req-rules
|
|
|
|
:: |* req=(lest rule)
|
|
|
|
:: =- ;~(pfix ace -)
|
|
|
|
:: ?~ t.req i.req
|
|
|
|
:: ;~(plug i.req $(req t.req))
|
|
|
|
:: ++ opt-rules
|
|
|
|
:: |* opt=(lest rule)
|
|
|
|
:: =- (punt ;~(pfix ace -))
|
|
|
|
:: ?~ t.opt ;~(pfix ace i.opt)
|
|
|
|
:: ;~(pfix ace ;~(plug i.opt $(opt t.opt)))
|
|
|
|
:: --
|
|
|
|
::
|
2020-11-15 08:08:52 +03:00
|
|
|
++ group ;~((glue fas) ship sym)
|
2019-10-07 17:02:03 +03:00
|
|
|
++ tag |*(a=@tas (cold a (jest a))) ::TODO into stdlib
|
|
|
|
++ ship ;~(pfix sig fed:ag)
|
2020-11-23 03:30:32 +03:00
|
|
|
++ name ;~(pfix fas urs:ab)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +tarl: local target, as /path
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ tarl (stag our-self name)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +targ: any target, as tarl, tarp, ~ship/path or glyph
|
|
|
|
::
|
|
|
|
++ targ
|
2019-10-03 02:30:07 +03:00
|
|
|
;~ pose
|
2020-11-23 03:30:32 +03:00
|
|
|
tarl
|
|
|
|
;~(plug ship name)
|
2020-11-23 18:02:11 +03:00
|
|
|
(sear (cury decode-glyph session) glyph)
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +tars: set of comma-separated targs
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ tars
|
2019-10-03 02:30:07 +03:00
|
|
|
%+ cook ~(gas in *(set target))
|
|
|
|
(most ;~(plug com (star ace)) targ)
|
2019-10-08 20:26:30 +03:00
|
|
|
:: +ships: set of comma-separated ships
|
|
|
|
::
|
|
|
|
++ ships
|
|
|
|
%+ cook ~(gas in *(set ^ship))
|
|
|
|
(most ;~(plug com (star ace)) ship)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +glyph: shorthand character
|
|
|
|
::
|
|
|
|
++ glyph (mask glyphs)
|
|
|
|
:: +flag: valid flag
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ flag
|
|
|
|
%- perk :~
|
|
|
|
%notify
|
|
|
|
%showtime
|
|
|
|
==
|
|
|
|
:: +nump: message number reference
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ nump
|
2019-10-03 02:30:07 +03:00
|
|
|
;~ pose
|
|
|
|
;~(pfix hep dem:ag)
|
|
|
|
;~ plug
|
|
|
|
(cook lent (plus (just '0')))
|
|
|
|
;~(pose dem:ag (easy 0))
|
|
|
|
==
|
|
|
|
(stag 0 dem:ag)
|
2019-10-07 17:02:03 +03:00
|
|
|
(cook lent (star mic))
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-08 20:54:26 +03:00
|
|
|
:: +message: all messages
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ message
|
2019-10-03 02:30:07 +03:00
|
|
|
;~ pose
|
|
|
|
;~(plug (cold %eval hax) expr)
|
2020-11-23 03:30:32 +03:00
|
|
|
(stag %say content)
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +content: simple messages
|
|
|
|
::TODO mentions
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ content
|
2019-10-03 02:30:07 +03:00
|
|
|
;~ pose
|
2019-10-07 21:45:58 +03:00
|
|
|
(stag %url turl)
|
2019-10-23 21:40:58 +03:00
|
|
|
(stag %text ;~(less mic hax text))
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-07 21:45:58 +03:00
|
|
|
:: +turl: url parser
|
|
|
|
::
|
|
|
|
++ turl
|
|
|
|
=- (sear - text)
|
|
|
|
|= t=cord
|
|
|
|
^- (unit cord)
|
|
|
|
?~((rush t aurf:de-purl:html) ~ `t)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +text: text message body
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ text
|
2019-10-03 02:30:07 +03:00
|
|
|
%+ cook crip
|
2020-05-15 16:49:31 +03:00
|
|
|
(plus next)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +expr: parse expression into [cord hoon]
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ expr
|
|
|
|
|= tub=nail
|
|
|
|
%. tub
|
|
|
|
%+ stag (crip q.tub)
|
|
|
|
wide:(vang & [&1:% &2:% (scot %da now.bowl) |3:%])
|
2019-10-03 02:30:07 +03:00
|
|
|
--
|
2020-05-24 17:38:09 +03:00
|
|
|
:: +tab-list: command descriptions
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-05-24 17:38:09 +03:00
|
|
|
++ tab-list
|
|
|
|
^- (list [@t tank])
|
|
|
|
:~
|
2020-11-23 03:30:32 +03:00
|
|
|
[';view' leaf+";view ~ship/chat-name (glyph)"]
|
|
|
|
[';flee' leaf+";flee ~ship/chat-name"]
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
2020-07-09 19:46:25 +03:00
|
|
|
[';bind' leaf+";bind [glyph] ~ship/chat-name"]
|
|
|
|
[';unbind' leaf+";unbind [glyph]"]
|
|
|
|
[';what' leaf+";what (~ship/chat-name) (glyph)"]
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
2020-07-09 19:46:25 +03:00
|
|
|
[';settings' leaf+";settings"]
|
|
|
|
[';set' leaf+";set key (value)"]
|
|
|
|
[';unset' leaf+";unset key"]
|
2020-05-24 17:38:09 +03:00
|
|
|
::
|
2020-07-09 19:46:25 +03:00
|
|
|
[';chats' leaf+";chats"]
|
|
|
|
[';help' leaf+";help"]
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +work: run user command
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
|
|
|
++ work
|
|
|
|
|= job=command
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-07 17:02:03 +03:00
|
|
|
|^ ?- -.job
|
|
|
|
%target (set-target +.job)
|
|
|
|
%say (say +.job)
|
|
|
|
%eval (eval +.job)
|
2019-10-08 20:26:30 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
%view (view +.job)
|
|
|
|
%flee (flee +.job)
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
%bind (bind-glyph +.job)
|
|
|
|
%unbind (unbind-glyph +.job)
|
|
|
|
%what (lookup-glyph +.job)
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-04 23:38:22 +03:00
|
|
|
%settings show-settings
|
2019-10-07 17:02:03 +03:00
|
|
|
%set (set-setting +.job)
|
|
|
|
%unset (unset-setting +.job)
|
|
|
|
%width (set-width +.job)
|
2019-10-04 23:38:22 +03:00
|
|
|
%timezone (set-timezone +.job)
|
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
%select (select +.job)
|
|
|
|
%chats chats
|
|
|
|
%help help
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-11-09 06:32:21 +03:00
|
|
|
:: +act: build action card
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
|
|
|
++ act
|
2019-11-09 06:32:21 +03:00
|
|
|
|= [what=term app=term =cage]
|
|
|
|
^- card
|
|
|
|
:* %pass
|
2019-10-03 02:30:07 +03:00
|
|
|
/cli-command/[what]
|
2019-11-09 06:32:21 +03:00
|
|
|
%agent
|
2019-10-04 23:38:22 +03:00
|
|
|
[our-self app]
|
2019-11-09 06:32:21 +03:00
|
|
|
%poke
|
|
|
|
cage
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +set-target: set audience, update prompt
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-04 23:38:22 +03:00
|
|
|
++ set-target
|
2020-11-23 03:30:32 +03:00
|
|
|
|= =target
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 03:30:32 +03:00
|
|
|
=. audience target
|
2020-11-23 18:02:11 +03:00
|
|
|
[[prompt:sh-out ~] put-ses]
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +view: start printing messages from a resource
|
2019-10-08 20:26:30 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ view
|
|
|
|
|= target=$?(~ target)
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 03:30:32 +03:00
|
|
|
:: without argument, print all we're viewing
|
2019-10-09 01:06:39 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
?~ target
|
|
|
|
[[(show-chats:sh-out ~(tap in viewing))]~ state]
|
|
|
|
:: only view existing chat-type graphs
|
|
|
|
::
|
|
|
|
?. (is-chat-graph target)
|
2020-11-23 18:02:11 +03:00
|
|
|
[[(note:sh-out "no such chat")]~ put-ses]
|
2021-04-24 22:03:48 +03:00
|
|
|
=. audience target
|
|
|
|
=. viewing (~(put in viewing) target)
|
2020-11-23 03:30:32 +03:00
|
|
|
=^ cards state
|
|
|
|
?: (~(has by bound) target)
|
|
|
|
[~ state]
|
|
|
|
(bind-default-glyph target)
|
2020-11-23 18:02:11 +03:00
|
|
|
[[prompt:sh-out cards] put-ses]
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +flee: stop printing messages from a resource
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ flee
|
2019-10-04 23:38:22 +03:00
|
|
|
|= =target
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 18:02:11 +03:00
|
|
|
=. viewing (~(del in viewing) target)
|
|
|
|
[~ put-ses]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +say: send messages
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2019-10-03 02:30:07 +03:00
|
|
|
++ say
|
2020-11-23 03:30:32 +03:00
|
|
|
|= msg=content:post
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2020-10-22 20:17:15 +03:00
|
|
|
=/ =serial:store (shaf %msg-uid eny.bowl)
|
2020-05-15 15:13:38 +03:00
|
|
|
:_ state
|
2020-11-23 03:30:32 +03:00
|
|
|
:_ ~
|
|
|
|
::TODO move creation into lib?
|
|
|
|
%^ act %out-message
|
|
|
|
%graph-push-hook
|
2021-04-14 00:18:05 +03:00
|
|
|
:- %graph-update-2
|
2020-11-23 03:30:32 +03:00
|
|
|
!> ^- update:graph
|
2021-03-18 04:50:14 +03:00
|
|
|
:- now.bowl
|
2020-11-23 03:30:32 +03:00
|
|
|
:+ %add-nodes audience
|
|
|
|
%- ~(put by *(map index:post node:graph))
|
|
|
|
:- ~[now.bowl]
|
|
|
|
:_ *internal-graph:graph
|
2021-04-14 00:18:05 +03:00
|
|
|
^- maybe-post:graph
|
|
|
|
[%& `post:post`[our-self ~[now.bowl] now.bowl [msg]~ ~ ~]]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +eval: run hoon, send code and result as message
|
|
|
|
::
|
|
|
|
:: this double-virtualizes and clams to disable .^ for security reasons
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-04 23:38:22 +03:00
|
|
|
++ eval
|
|
|
|
|= [txt=cord exe=hoon]
|
2020-11-23 03:30:32 +03:00
|
|
|
~& %eval-tmp-disabled
|
|
|
|
[~ state]
|
|
|
|
::TODO why -find.eval??
|
|
|
|
:: (say %code txt (eval:store bowl exe))
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +lookup-glyph: print glyph info for all, glyph or target
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ lookup-glyph
|
|
|
|
|= qur=(unit $@(glyph target))
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
=- [[- ~] state]
|
2019-10-04 23:38:22 +03:00
|
|
|
?^ qur
|
|
|
|
?^ u.qur
|
|
|
|
=+ gyf=(~(get by bound) u.qur)
|
2019-10-07 17:02:03 +03:00
|
|
|
(print:sh-out ?~(gyf "none" [u.gyf]~))
|
2019-10-04 23:38:22 +03:00
|
|
|
=+ pan=~(tap in (~(get ju binds) `@t`u.qur))
|
2019-10-07 17:02:03 +03:00
|
|
|
?: =(~ pan) (print:sh-out "~")
|
|
|
|
=< (effect:sh-out %mor (turn pan .))
|
|
|
|
|=(t=target [%txt ~(phat tr t)])
|
|
|
|
%- print-more:sh-out
|
2019-10-04 23:38:22 +03:00
|
|
|
%- ~(rep by binds)
|
|
|
|
|= $: [=glyph tars=(set target)]
|
2019-10-07 17:02:03 +03:00
|
|
|
lis=(list tape)
|
2019-10-04 23:38:22 +03:00
|
|
|
==
|
|
|
|
%+ weld lis
|
2019-10-07 17:02:03 +03:00
|
|
|
^- (list tape)
|
2019-10-04 23:38:22 +03:00
|
|
|
%- ~(rep in tars)
|
2019-10-07 17:02:03 +03:00
|
|
|
|= [t=target l=(list tape)]
|
2019-10-04 23:38:22 +03:00
|
|
|
%+ weld l
|
2019-10-07 17:02:03 +03:00
|
|
|
^- (list tape)
|
|
|
|
[glyph ' ' ~(phat tr t)]~
|
|
|
|
:: +show-settings: print enabled flags, timezone and width settings
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ show-settings
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
:_ state
|
2019-10-07 17:02:03 +03:00
|
|
|
:~ %- print:sh-out
|
2019-10-04 23:38:22 +03:00
|
|
|
%- zing
|
|
|
|
^- (list tape)
|
|
|
|
:- "flags: "
|
2020-11-23 03:30:32 +03:00
|
|
|
%+ join ", "
|
2019-10-04 23:38:22 +03:00
|
|
|
(turn `(list @t)`~(tap in settings) trip)
|
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
%- print:sh-out
|
2019-10-04 23:38:22 +03:00
|
|
|
%+ weld "timezone: "
|
|
|
|
^- tape
|
|
|
|
:- ?:(p.timez '+' '-')
|
|
|
|
(scow %ud q.timez)
|
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
(print:sh-out "width: {(scow %ud width)}")
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +set-setting: enable settings flag
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ set-setting
|
|
|
|
|= =term
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
[~ state(settings (~(put in settings) term))]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +unset-setting: disable settings flag
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ unset-setting
|
|
|
|
|= =term
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
[~ state(settings (~(del in settings) term))]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +set-width: configure cli printing width
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ set-width
|
|
|
|
|= w=@ud
|
2020-05-15 15:44:34 +03:00
|
|
|
[~ state(width (max 40 w))]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +set-timezone: configure timestamp printing adjustment
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ set-timezone
|
|
|
|
|= tz=[? @ud]
|
2020-03-11 02:42:04 +03:00
|
|
|
[~ state(timez tz)]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +select: expand message from number reference
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ select
|
2019-10-07 17:02:03 +03:00
|
|
|
::NOTE rel is the nth most recent message,
|
|
|
|
:: abs is the last message whose numbers ends in n
|
|
|
|
:: (with leading zeros used for precision)
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
|= num=$@(rel=@ud [zeros=@u abs=@ud])
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2019-10-04 23:38:22 +03:00
|
|
|
|^ ?@ num
|
|
|
|
=+ tum=(scow %s (new:si | +(num)))
|
2019-10-07 17:02:03 +03:00
|
|
|
?: (gte rel.num count)
|
2019-10-04 23:38:22 +03:00
|
|
|
%- just-print
|
|
|
|
"{tum}: no such telegram"
|
2019-10-07 17:02:03 +03:00
|
|
|
(activate tum rel.num)
|
|
|
|
?. (gte abs.num count)
|
2019-10-04 23:38:22 +03:00
|
|
|
?: =(count 0)
|
|
|
|
(just-print "0: no messages")
|
2019-10-07 17:02:03 +03:00
|
|
|
=+ msg=(index (dec count) num)
|
2019-10-04 23:38:22 +03:00
|
|
|
(activate (scow %ud msg) (sub count +(msg)))
|
|
|
|
%- just-print
|
2019-10-07 17:02:03 +03:00
|
|
|
"…{(reap zeros.num '0')}{(scow %ud abs.num)}: no such telegram"
|
2019-11-09 06:32:21 +03:00
|
|
|
:: +just-print: full [cards state] output with a single print card
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ just-print
|
|
|
|
|= txt=tape
|
2020-03-11 02:42:04 +03:00
|
|
|
[[(print:sh-out txt) ~] state]
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +index: get message index from absolute reference
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ index
|
2019-10-04 23:38:22 +03:00
|
|
|
|= [max=@ud nul=@u fin=@ud]
|
|
|
|
^- @ud
|
|
|
|
=+ dog=|-(?:(=(0 fin) 1 (mul 10 $(fin (div fin 10)))))
|
|
|
|
=. dog (mul dog (pow 10 nul))
|
|
|
|
=- ?:((lte - max) - (sub - dog))
|
|
|
|
(add fin (sub max (mod max dog)))
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +activate: echo message selector and print details
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ activate
|
|
|
|
|= [number=tape index=@ud]
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 03:30:32 +03:00
|
|
|
::NOTE graph store allows node deletion, so can this crash?
|
|
|
|
=/ =uid:post (snag index history)
|
|
|
|
=/ =node:graph (got-node:libgraph uid)
|
2020-11-23 18:02:11 +03:00
|
|
|
=. audience resource.uid
|
2021-04-17 00:54:30 +03:00
|
|
|
?: ?=(%| -.post.node)
|
|
|
|
[~ state]
|
2020-11-23 18:02:11 +03:00
|
|
|
:_ put-ses
|
2019-11-09 06:32:21 +03:00
|
|
|
^- (list card)
|
2019-10-07 17:02:03 +03:00
|
|
|
:~ (print:sh-out ['?' ' ' number])
|
2021-04-17 00:54:30 +03:00
|
|
|
(effect:sh-out ~(render-activate mr resource.uid p.post.node))
|
2019-10-07 17:02:03 +03:00
|
|
|
prompt:sh-out
|
2019-10-04 23:38:22 +03:00
|
|
|
==
|
|
|
|
--
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +chats: display list of joined chats
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ chats
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
|
|
|
:_ state
|
2019-10-04 23:38:22 +03:00
|
|
|
:_ ~
|
2020-11-23 03:30:32 +03:00
|
|
|
%- show-chats:sh-out
|
|
|
|
(skim ~(tap in get-keys:libgraph) is-chat-graph)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +help: print (link to) usage instructions
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ help
|
2020-03-11 02:42:04 +03:00
|
|
|
^- (quip card _state)
|
2020-11-23 03:30:32 +03:00
|
|
|
:_ state
|
|
|
|
=- (turn - print:sh-out)
|
2021-06-12 00:23:05 +03:00
|
|
|
:~ ";view ~host/chat to print messages for a chat you've already joined."
|
2020-11-23 03:30:32 +03:00
|
|
|
";flee ~host/chat to stop printing messages for a chat."
|
|
|
|
"For more details:"
|
|
|
|
"https://urbit.org/using/operations/using-your-ship/#messaging"
|
|
|
|
==
|
2019-10-03 02:30:07 +03:00
|
|
|
--
|
2019-10-07 17:02:03 +03:00
|
|
|
--
|
|
|
|
::
|
2020-05-15 02:46:18 +03:00
|
|
|
:: +sh-out: ouput to session
|
2019-10-07 17:02:03 +03:00
|
|
|
::
|
|
|
|
++ sh-out
|
2020-11-23 18:02:11 +03:00
|
|
|
|_ [=sole-id session]
|
|
|
|
++ make
|
|
|
|
|= =^sole-id
|
|
|
|
%_ ..make
|
|
|
|
sole-id sole-id
|
|
|
|
+<+ (get-session sole-id)
|
|
|
|
==
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +effex: emit shoe effect card
|
|
|
|
::
|
|
|
|
++ effex
|
|
|
|
|= effect=shoe-effect:shoe
|
|
|
|
^- card
|
2020-11-23 18:02:11 +03:00
|
|
|
[%shoe ~[sole-id] effect]
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +effect: emit console effect card
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ effect
|
2020-11-23 03:30:32 +03:00
|
|
|
|= effect=sole-effect:shoe
|
2019-12-05 01:40:41 +03:00
|
|
|
^- card
|
2020-11-23 03:30:32 +03:00
|
|
|
(effex %sole effect)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +print: puts some text into the cli as-is
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ print
|
|
|
|
|= txt=tape
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-07 17:02:03 +03:00
|
|
|
(effect %txt txt)
|
|
|
|
:: +print-more: puts lines of text into the cli
|
|
|
|
::
|
|
|
|
++ print-more
|
|
|
|
|= txs=(list tape)
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-03 02:30:07 +03:00
|
|
|
%+ effect %mor
|
2019-10-07 17:02:03 +03:00
|
|
|
(turn txs |=(t=tape [%txt t]))
|
|
|
|
:: +note: prints left-padded ---| txt
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ note
|
|
|
|
|= txt=tape
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-07 17:02:03 +03:00
|
|
|
=+ lis=(simple-wrap txt (sub width 16))
|
|
|
|
%- print-more
|
|
|
|
=+ ?:((gth (lent lis) 0) (snag 0 lis) "")
|
|
|
|
:- (runt [14 '-'] '|' ' ' -)
|
|
|
|
%+ turn (slag 1 lis)
|
|
|
|
|=(a=tape (runt [14 ' '] '|' ' ' a))
|
|
|
|
:: +prompt: update prompt to display current audience
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ prompt
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-07 17:02:03 +03:00
|
|
|
%+ effect %pro
|
|
|
|
:+ & %talk-line
|
2020-11-23 03:30:32 +03:00
|
|
|
=+ ~(show tr audience)
|
|
|
|
?:(=(1 (lent -)) "{-} " "[{-}] ")
|
|
|
|
:: +show-post: print incoming message
|
2019-10-07 17:02:03 +03:00
|
|
|
::
|
|
|
|
:: every five messages, prints the message number also.
|
|
|
|
:: if the message mentions the user's (shortened) ship name,
|
|
|
|
:: and the %notify flag is set, emit a bell.
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ show-post
|
|
|
|
|= [=target =post:post]
|
2019-11-09 06:32:21 +03:00
|
|
|
^- (list card)
|
2019-10-03 02:30:07 +03:00
|
|
|
%+ weld
|
2019-11-09 06:32:21 +03:00
|
|
|
^- (list card)
|
2019-10-03 02:30:07 +03:00
|
|
|
?. =(0 (mod count 5)) ~
|
|
|
|
:_ ~
|
|
|
|
=+ num=(scow %ud count)
|
2019-10-04 23:38:22 +03:00
|
|
|
%- print
|
2019-10-03 02:30:07 +03:00
|
|
|
(runt [(sub 13 (lent num)) '-'] "[{num}]")
|
2020-11-23 03:30:32 +03:00
|
|
|
^- (list card)
|
|
|
|
:- (effex ~(render-inline mr target post))
|
|
|
|
=; mentioned=?
|
|
|
|
?. mentioned ~
|
|
|
|
[(effect %bel ~)]~
|
|
|
|
%+ lien contents.post
|
|
|
|
(cury test %mention our.bowl)
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +show-create: print mailbox creation notification
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ show-create
|
|
|
|
|= =target
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-07 17:02:03 +03:00
|
|
|
(note "new: {~(phat tr target)}")
|
|
|
|
:: +show-delete: print mailbox deletion notification
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ show-delete
|
|
|
|
|= =target
|
2019-11-09 06:32:21 +03:00
|
|
|
^- card
|
2019-10-07 17:02:03 +03:00
|
|
|
(note "del: {~(phat tr target)}")
|
|
|
|
:: +show-glyph: print glyph un/bind notification
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
|
|
|
++ show-glyph
|
|
|
|
|= [=glyph target=(unit target)]
|
2019-11-09 06:32:21 +03:00
|
|
|
^- (list card)
|
2019-10-08 17:15:19 +03:00
|
|
|
:_ [prompt ~]
|
2019-10-04 23:38:22 +03:00
|
|
|
%- note
|
2019-10-08 17:15:19 +03:00
|
|
|
%+ weld "set: {[glyph ~]} "
|
2019-10-11 00:40:08 +03:00
|
|
|
?~ target "unbound"
|
2019-10-07 17:02:03 +03:00
|
|
|
~(phat tr u.target)
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +show-chats: print list of targets
|
2020-03-11 23:52:04 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
++ show-chats
|
|
|
|
|= chats=(list target)
|
2020-03-11 23:52:04 +03:00
|
|
|
^- card
|
2020-11-23 18:02:11 +03:00
|
|
|
%- print-more
|
2020-11-23 03:30:32 +03:00
|
|
|
%+ turn (sort chats tor)
|
|
|
|
|= resource
|
|
|
|
"{(nome:mr entity)}/{(trip name)}"
|
2019-10-03 02:30:07 +03:00
|
|
|
--
|
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
:: +tr: render targets (resource identifiers)
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ tr
|
2020-11-23 03:30:32 +03:00
|
|
|
|_ tr=target
|
|
|
|
:: +full: render target fully, always (as ~ship/path)
|
2019-11-13 02:09:18 +03:00
|
|
|
::
|
|
|
|
++ full
|
|
|
|
^- tape
|
2020-11-23 03:30:32 +03:00
|
|
|
"{(scow %p entity.tr)}/{(trip name.tr)}"
|
2019-11-13 02:09:18 +03:00
|
|
|
:: +phat: render target with local shorthand
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
:: renders as ~ship/path.
|
|
|
|
:: for local mailboxes, renders just /path.
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ phat
|
2019-10-03 02:30:07 +03:00
|
|
|
^- tape
|
2020-03-11 02:40:21 +03:00
|
|
|
%+ weld
|
2020-11-23 03:30:32 +03:00
|
|
|
?: =(our-self entity.tr) ~
|
|
|
|
(scow %p entity.tr)
|
|
|
|
"/{(trip name.tr)}"
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +show: render as tape, as glyph if we can
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ show
|
2019-10-03 02:30:07 +03:00
|
|
|
^- tape
|
2020-11-23 03:30:32 +03:00
|
|
|
=+ cha=(~(get by bound) tr)
|
|
|
|
?~(cha phat [u.cha ~])
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +glyph: tape for glyph of target, defaulting to *
|
2019-10-04 23:38:22 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ glyph
|
2019-10-04 23:38:22 +03:00
|
|
|
^- tape
|
2020-11-23 03:30:32 +03:00
|
|
|
[(~(gut by bound) tr '*') ~]
|
2019-10-03 02:30:07 +03:00
|
|
|
--
|
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +mr: render messages
|
|
|
|
::
|
|
|
|
++ mr
|
|
|
|
|_ $: source=target
|
2020-11-23 03:30:32 +03:00
|
|
|
post:post
|
2019-10-03 02:30:07 +03:00
|
|
|
==
|
2020-11-23 03:30:32 +03:00
|
|
|
+* showtime (~(has in settings) %showtime)
|
|
|
|
notify (~(has in settings) %notify)
|
|
|
|
::
|
|
|
|
++ content-width
|
|
|
|
:: termwidth, minus author, timestamp, and padding
|
|
|
|
%+ sub width
|
|
|
|
%+ add 15
|
|
|
|
?:(showtime 11 0)
|
|
|
|
::
|
|
|
|
++ render-inline
|
|
|
|
^- shoe-effect:shoe
|
|
|
|
:+ %row
|
|
|
|
:- 15
|
|
|
|
?. showtime
|
|
|
|
~[(sub width 16)]
|
|
|
|
~[(sub width 26) 9]
|
|
|
|
:+ t+(crip (weld (nome author) ~(glyph tr source)))
|
|
|
|
t+(crip line)
|
|
|
|
?. showtime ~
|
|
|
|
:_ ~
|
|
|
|
:- %t
|
|
|
|
=. time-sent
|
|
|
|
%- ?:(p.timez add sub)
|
|
|
|
[time-sent (mul q.timez ~h1)]
|
|
|
|
=+ dat=(yore time-sent)
|
|
|
|
=* t (d-co:co 2)
|
|
|
|
=, t.dat
|
|
|
|
%- crip
|
|
|
|
:(weld "~" (t h) "." (t m) "." (t s))
|
|
|
|
::
|
|
|
|
++ line
|
|
|
|
^- tape
|
|
|
|
%- zing
|
|
|
|
%+ join "\0a"
|
2020-12-04 06:05:20 +03:00
|
|
|
%- turn
|
|
|
|
:_ |=(ls=(list tape) `tape`(zing (join " " ls)))
|
|
|
|
%+ roll contents
|
|
|
|
|= [=content:post out=(list (list tape))]
|
2020-11-23 03:30:32 +03:00
|
|
|
?- -.content
|
2020-12-04 06:05:20 +03:00
|
|
|
%text (append-inline out (trip text.content))
|
|
|
|
%mention (append-inline out (scow %p ship.content))
|
|
|
|
%reference (append-inline out "^")
|
2020-11-23 03:30:32 +03:00
|
|
|
::
|
|
|
|
%code
|
2020-12-04 06:05:20 +03:00
|
|
|
%+ snoc out
|
|
|
|
^- (list tape)
|
|
|
|
:- (trip expression.content)
|
2020-11-23 03:30:32 +03:00
|
|
|
?: =(~ output.content) ~
|
2020-12-04 06:05:20 +03:00
|
|
|
:- "\0a"
|
|
|
|
~(ram re (snag 0 output.content))^~
|
2020-11-23 03:30:32 +03:00
|
|
|
::
|
|
|
|
%url
|
2020-12-04 06:05:20 +03:00
|
|
|
%+ append-inline out
|
2020-11-23 03:30:32 +03:00
|
|
|
=+ wyd=content-width
|
|
|
|
=+ ful=(trip url.content)
|
|
|
|
:: if the full url fits, just render it.
|
|
|
|
?: (gte wyd (lent ful)) ful
|
|
|
|
:: if it doesn't, prefix with _ and truncate domain with ellipses
|
|
|
|
=. wyd (sub wyd 2)
|
|
|
|
:- '_'
|
|
|
|
=- (weld - "_")
|
|
|
|
=+ prl=(rust ful aurf:de-purl:html)
|
|
|
|
?~ prl (scag wyd ful)
|
|
|
|
=+ hok=r.p.p.u.prl
|
|
|
|
=; domain=tape
|
|
|
|
%+ swag
|
|
|
|
[(sub (max wyd (lent domain)) wyd) wyd]
|
|
|
|
domain
|
|
|
|
?. ?=(%& -.hok)
|
|
|
|
+:(scow %if p.hok)
|
|
|
|
%+ reel p.hok
|
|
|
|
|= [a=knot b=tape]
|
|
|
|
?~ b (trip a)
|
|
|
|
(welp b '.' (trip a))
|
|
|
|
==
|
2020-12-04 06:05:20 +03:00
|
|
|
::
|
|
|
|
++ append-newline
|
|
|
|
|= [content=(list (list tape)) newline=tape]
|
|
|
|
^- (list (list tape))
|
|
|
|
(snoc content ~[newline])
|
|
|
|
::
|
|
|
|
++ append-inline
|
|
|
|
|= [content=(list (list tape)) inline=tape]
|
|
|
|
^- (list (list tape))
|
|
|
|
?: =(~ content)
|
|
|
|
~[~[inline]]
|
|
|
|
=/ last
|
|
|
|
(dec (lent content))
|
|
|
|
=/ old=(list tape)
|
|
|
|
(snag last content)
|
|
|
|
=/ new=(list tape)
|
|
|
|
(snoc old inline)
|
|
|
|
(snap content last new)
|
|
|
|
|
2019-10-07 17:02:03 +03:00
|
|
|
:: +activate: produce sole-effect for printing message details
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ render-activate
|
2020-11-23 03:30:32 +03:00
|
|
|
^- sole-effect:shoe
|
2019-10-07 17:02:03 +03:00
|
|
|
~[%mor [%tan meta] body]
|
|
|
|
:: +meta: render message metadata (serial, timestamp, author, target)
|
|
|
|
::
|
|
|
|
++ meta
|
|
|
|
^- tang
|
2020-11-23 03:30:32 +03:00
|
|
|
=+ hed=leaf+"{(scow %uv (fall hash 0))} at {(scow %da time-sent)}"
|
2019-10-07 17:02:03 +03:00
|
|
|
=/ src=tape ~(phat tr source)
|
|
|
|
[%rose [" " ~ ~] [hed >author< [%rose [", " "to " ~] [leaf+src]~] ~]]~
|
|
|
|
:: +body: long-form render of message contents
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ body
|
2020-11-23 03:30:32 +03:00
|
|
|
|- ^- sole-effect:shoe
|
|
|
|
:- %mor
|
|
|
|
%+ turn contents
|
|
|
|
|= =content:post
|
|
|
|
^- sole-effect:shoe
|
|
|
|
?- -.content
|
|
|
|
%text txt+(trip text.content)
|
|
|
|
%url url+url.content
|
2021-03-18 04:50:14 +03:00
|
|
|
::
|
|
|
|
%reference
|
|
|
|
?- -.reference.content
|
|
|
|
%graph
|
|
|
|
txt+"[reference to msg in {~(phat tr resource.uid.reference.content)}]"
|
2021-09-18 02:25:32 +03:00
|
|
|
::
|
2021-03-18 04:50:14 +03:00
|
|
|
%group
|
|
|
|
txt+"[reference to msg in {~(phat tr group.reference.content)}]"
|
2021-09-18 02:25:32 +03:00
|
|
|
::
|
|
|
|
%app
|
|
|
|
=, reference.content
|
2021-09-21 04:34:23 +03:00
|
|
|
txt+"[reference to app: {(scow %p ship)}/{(trip desk)}{(spud path)}]"
|
2021-03-18 04:50:14 +03:00
|
|
|
==
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2020-11-23 03:30:32 +03:00
|
|
|
%mention
|
|
|
|
?. =(ship.content our-self) txt+(scow %p ship.content)
|
|
|
|
:- %mor
|
|
|
|
:- klr+[[`%br ~ ~]^(scow %p ship.content)]~ ::TODO inline
|
|
|
|
?.(notify ~ [%bel ~]~)
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
%code
|
2020-11-23 03:30:32 +03:00
|
|
|
:- %txt
|
|
|
|
%+ weld (trip expression.content)
|
|
|
|
?: =(~ output.content) ~
|
|
|
|
:- '\0a'
|
|
|
|
~(ram re (snag 0 output.content))
|
2019-10-07 17:02:03 +03:00
|
|
|
==
|
|
|
|
:: +nome: prints a ship name in 14 characters, left-padding with spaces
|
2019-10-03 02:30:07 +03:00
|
|
|
::
|
2019-10-07 17:02:03 +03:00
|
|
|
++ nome
|
|
|
|
|= =ship
|
2019-10-03 02:30:07 +03:00
|
|
|
^- tape
|
2019-10-07 17:02:03 +03:00
|
|
|
=+ raw=(cite:title ship)
|
|
|
|
(runt [(sub 14 (lent raw)) ' '] raw)
|
2019-10-03 02:30:07 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
++ simple-wrap
|
2019-10-07 17:02:03 +03:00
|
|
|
|= [txt=tape wid=@ud]
|
2019-10-03 02:30:07 +03:00
|
|
|
^- (list tape)
|
|
|
|
?~ txt ~
|
2019-12-18 03:48:08 +03:00
|
|
|
=/ [end=@ud nex=?]
|
2020-05-15 15:10:07 +03:00
|
|
|
=+ ret=(find "\0a" (scag +(wid) `tape`txt))
|
|
|
|
?^ ret [u.ret &]
|
2019-10-07 17:02:03 +03:00
|
|
|
?: (lte (lent txt) wid) [(lent txt) &]
|
|
|
|
=+ ace=(find " " (flop (scag +(wid) `tape`txt)))
|
|
|
|
?~ ace [wid |]
|
|
|
|
[(sub wid u.ace) &]
|
2019-10-03 02:30:07 +03:00
|
|
|
:- (tufa (scag end `(list @)`txt))
|
|
|
|
$(txt (slag ?:(nex +(end) end) `tape`txt))
|
2020-03-11 01:31:18 +03:00
|
|
|
::
|
|
|
|
::NOTE anything that uses this breaks moons support, because moons don't sync
|
|
|
|
:: full app state rn
|
|
|
|
++ scry-for
|
|
|
|
|* [=mold app=term =path]
|
|
|
|
.^ mold
|
|
|
|
%gx
|
|
|
|
(scot %p our.bowl)
|
|
|
|
app
|
|
|
|
(scot %da now.bowl)
|
|
|
|
(snoc `^path`path %noun)
|
|
|
|
==
|
2019-10-09 00:00:46 +03:00
|
|
|
--
|