chat: import/export

This commit is contained in:
Isaac Visintainer 2020-11-30 13:07:51 -08:00
parent 0c0efae1e9
commit edcd29c4da
2 changed files with 70 additions and 5 deletions

View File

@ -369,6 +369,10 @@
:: ::
%chat-hook-action %chat-hook-action
(poke-chat-hook-action:cc !<(action:hook vase)) (poke-chat-hook-action:cc !<(action:hook vase))
::
%import
?> (team:title our.bol src.bol)
(poke-import:cc q.vase)
== ==
[cards this] [cards this]
:: ::
@ -417,8 +421,28 @@
== ==
:: ::
++ on-leave on-leave:def ++ on-leave on-leave:def
++ on-peek on-peek:def ++ on-peek
++ on-arvo on-arvo:def |= =path
^- (unit (unit cage))
?+ path (on-peek:def path)
[%x %export ~]
``noun+!>(state)
==
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%try-rejoin @ @ *] wire)
(on-arvo:def wire sign-arvo)
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
[(try-rejoin:cc who pax +(nack-count))]~
::
++ on-fail on-fail:def ++ on-fail on-fail:def
-- --
:: ::
@ -677,6 +701,27 @@
== ==
== ==
:: ::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-10 ;;(state-10 arc)
:_ sty
%+ turn ~(tap by synced.sty)
|= [=path =ship]
^- card
=/ watch-path=^path [%mailbox path]
?: =(our.bol ship)
=/ store-wire=wire [%store path]
[%pass store-wire %agent [our.bol %chat-store] %watch watch-path]
(try-rejoin ship watch-path 0)
::
++ try-rejoin
|= [who=@p pax=path nack-count=@ud]
^- card
=/ =wire
[%try-rejoin (scot %ud nack-count) (scot %p who) pax]
[%pass wire %agent [who %chat-hook] %watch pax]
::
++ watch-synced ++ watch-synced
|= pax=path |= pax=path
^- (list card) ^- (list card)
@ -835,6 +880,9 @@
[%pass /permissions %agent [our.bol %permission-store] %watch /updates]~ [%pass /permissions %agent [our.bol %permission-store] %watch /updates]~
:: ::
?+ wir !! ?+ wir !!
[%try-rejoin @ @ *]
$(wir t.t.t.wir)
::
[%groups ~] [~[watch-groups] state] [%groups ~] [~[watch-groups] state]
:: ::
[%store @ *] [%store @ *]
@ -909,6 +957,13 @@
?> ?=(^ chat) ?> ?=(^ chat)
(migrate-listen t.chat) (migrate-listen t.chat)
[~ state] [~ state]
::
[%try-rejoin @ *]
=/ nack-count=@ud (slav %ud i.t.wir)
=/ wakeup=@da
(add now.bol (mul ~s1 (bex (min 19 nack-count))))
:_ state
[%pass wir %arvo %b %wait wakeup]~
== ==
:: ::
++ chat-poke ++ chat-poke

View File

@ -89,9 +89,10 @@
?> (team:title our.bowl src.bowl) ?> (team:title our.bowl src.bowl)
=^ cards state =^ cards state
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%json (poke-json:cc !<(json vase)) %json (poke-json:cc !<(json vase))
%chat-action (poke-chat-action:cc !<(action:store vase)) %chat-action (poke-chat-action:cc !<(action:store vase))
%noun [~ (poke-noun:cc !<(admin-action vase))] %noun [~ (poke-noun:cc !<(admin-action vase))]
%import (poke-import:cc q.vase)
== ==
[cards this] [cards this]
:: ::
@ -139,6 +140,9 @@
?~ mailbox ?~ mailbox
~ ~
``noun+!>(config.u.mailbox) ``noun+!>(config.u.mailbox)
::
[%x %export ~]
``noun+!>(state)
== ==
:: ::
++ on-agent on-agent:def ++ on-agent on-agent:def
@ -235,6 +239,12 @@
[(weld message-moves read-moves) state] [(weld message-moves read-moves) state]
== ==
:: ::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-3 ;;(state-3 arc)
[~ sty]
::
++ handle-create ++ handle-create
|= =action:store |= =action:store
^- (quip card _state) ^- (quip card _state)