urbit/pkg/arvo/lib/chat-hook.hoon
Liam Fitzgerald 5f4fc28bc9 chat: improve namespacing of chat-* types
Improved the namespacing by dropping the app prefix on types, e.g.
chat-hook-action -> action. Compensated for shadowing by importing the
/sur files behind a face. End result is that a chat-hook-action becomes
an action:hook. Splits chat-json into lib/chat-{hook,store,view}. Uses
^? on changes files in /lib and /sur to discourage deeply nested
importing.
2020-04-28 12:01:13 +10:00

50 lines
783 B
Plaintext

/- *chat-hook
^?
|%
::
++ enjs
|%
++ update
|= upd=^update
=, enjs:format
^- json
%+ frond %chat-hook-update
%- pairs
%+ turn ~(tap by synced.upd)
|= [pax=^path shp=^ship]
^- [cord json]
[(spat pax) s+(scot %p shp)]
--
++ dejs
|%
::
++ action
|= jon=json
^- ^action
=, dejs:format
=< (parse-json jon)
|%
::
++ parse-json
%- of
:~ [%add-owned add-owned]
[%add-synced add-synced]
[%remove pa]
==
::
++ add-owned
%- ot
:~ [%path pa]
[%allow-history bo]
==
::
++ add-synced
%- ot
:~ [%ship (su ;~(pfix sig fed:ag))]
[%path pa]
[%ask-history bo]
==
--
--
--