2021-02-02 22:36:05 +03:00
|
|
|
/- pull-hook
|
2021-02-02 00:28:52 +03:00
|
|
|
/+ store=contact-store, res=resource, contact, group,
|
2021-02-03 07:52:48 +03:00
|
|
|
default-agent, dbug, push-hook, agentio, verb
|
2021-01-20 00:07:11 +03:00
|
|
|
~% %contact-push-hook-top ..part ~
|
|
|
|
|%
|
|
|
|
+$ card card:agent:gall
|
|
|
|
++ config
|
|
|
|
^- config:push-hook
|
|
|
|
:* %contact-store
|
2021-01-28 02:20:42 +03:00
|
|
|
/updates
|
2021-01-20 00:07:11 +03:00
|
|
|
update:store
|
|
|
|
%contact-update
|
2021-01-28 02:20:42 +03:00
|
|
|
%contact-pull-hook
|
2021-03-11 07:10:32 +03:00
|
|
|
0 0
|
2021-01-20 00:07:11 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ agent (push-hook:push-hook config)
|
2021-02-02 22:36:05 +03:00
|
|
|
::
|
|
|
|
+$ share [%share =ship]
|
2021-01-20 00:07:11 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
2021-02-03 07:52:48 +03:00
|
|
|
%+ verb |
|
2021-01-20 00:07:11 +03:00
|
|
|
%- (agent:push-hook config)
|
|
|
|
^- agent
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
con ~(. contact bowl)
|
2021-02-02 00:28:52 +03:00
|
|
|
grp ~(. group bowl)
|
2021-02-03 07:52:48 +03:00
|
|
|
io ~(. agentio bowl)
|
2021-01-20 00:07:11 +03:00
|
|
|
::
|
2021-02-02 22:47:53 +03:00
|
|
|
++ on-init
|
|
|
|
^- (quip card _this)
|
2021-02-09 20:30:28 +03:00
|
|
|
:_ this
|
|
|
|
:- %+ poke-our:pass:io %contact-push-hook
|
|
|
|
:- %push-hook-action
|
|
|
|
!>(`action:push-hook`[%add [our.bowl %'']])
|
|
|
|
%+ murn ~(tap in scry-groups:grp)
|
|
|
|
|= rid=res
|
|
|
|
?. =(our.bowl entity.rid) ~
|
2021-02-12 02:06:17 +03:00
|
|
|
?. (is-managed:grp rid) ~
|
2021-02-09 20:30:28 +03:00
|
|
|
`(poke-self:pass:io push-hook-action+!>([%add rid]))
|
2021-02-02 22:47:53 +03:00
|
|
|
::
|
2021-01-20 00:07:11 +03:00
|
|
|
++ on-save !>(~)
|
|
|
|
++ on-load on-load:def
|
2021-02-02 22:36:05 +03:00
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
|
|
|
?. =(mark %contact-share) (on-poke:def mark vase)
|
|
|
|
=/ =share !<(share vase)
|
|
|
|
:_ this :_ ~
|
2021-02-03 07:52:48 +03:00
|
|
|
?: =(our.bowl src.bowl)
|
2021-02-09 06:21:15 +03:00
|
|
|
?< =(ship.share our.bowl)
|
2021-02-03 07:52:48 +03:00
|
|
|
:: proxy poke
|
|
|
|
%+ poke:pass:io [ship.share dap.bowl]
|
|
|
|
contact-share+!>([%share our.bowl])
|
|
|
|
:: accept share
|
|
|
|
?> =(src.bowl ship.share)
|
|
|
|
%+ poke-our:pass:io %contact-pull-hook
|
|
|
|
pull-hook-action+!>([%add src.bowl [src.bowl %$]])
|
2021-02-02 22:36:05 +03:00
|
|
|
::
|
2021-01-20 00:07:11 +03:00
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-watch on-watch:def
|
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
::
|
2021-02-22 23:26:56 +03:00
|
|
|
++ transform-proxy-update
|
|
|
|
|= vas=vase
|
|
|
|
^- (unit vase)
|
|
|
|
:: TODO: should check if user is allowed to %add, %remove, %edit
|
|
|
|
:: contact
|
|
|
|
=/ =update:store !<(update:store vas)
|
2021-01-20 00:07:11 +03:00
|
|
|
?- -.update
|
2021-02-22 23:26:56 +03:00
|
|
|
%initial ~
|
|
|
|
%add `vas
|
|
|
|
%remove `vas
|
|
|
|
%edit `vas
|
|
|
|
%allow ~
|
|
|
|
%disallow ~
|
|
|
|
%set-public ~
|
2021-01-20 00:07:11 +03:00
|
|
|
==
|
2021-02-02 22:36:05 +03:00
|
|
|
::
|
2021-02-02 07:30:12 +03:00
|
|
|
++ resource-for-update resource-for-update:con
|
2021-02-01 23:49:14 +03:00
|
|
|
::
|
2021-01-20 00:07:11 +03:00
|
|
|
++ initial-watch
|
|
|
|
|= [=path =resource:res]
|
|
|
|
^- vase
|
2021-02-02 01:01:23 +03:00
|
|
|
|^
|
2021-02-02 08:35:29 +03:00
|
|
|
?> (is-allowed:con resource src.bowl)
|
2021-01-20 00:07:11 +03:00
|
|
|
!> ^- update:store
|
2021-02-02 01:01:23 +03:00
|
|
|
[%initial rolo %.n]
|
|
|
|
::
|
|
|
|
++ rolo
|
|
|
|
^- rolodex:store
|
|
|
|
=/ ugroup (scry-group:grp resource)
|
2021-02-13 01:13:19 +03:00
|
|
|
=/ =rolodex:store
|
|
|
|
(scry-for:con rolodex:store /all)
|
2021-02-02 01:01:23 +03:00
|
|
|
%- ~(gas by *rolodex:store)
|
2021-02-02 03:24:56 +03:00
|
|
|
?~ ugroup
|
2021-02-13 01:13:19 +03:00
|
|
|
=/ c=(unit contact:store) (~(get by rolodex) our.bowl)
|
2021-02-02 03:24:56 +03:00
|
|
|
?~ c
|
|
|
|
[our.bowl *contact:store]~
|
|
|
|
[our.bowl u.c]~
|
2021-02-02 01:01:23 +03:00
|
|
|
%+ murn ~(tap in (members:grp resource))
|
|
|
|
|= s=ship
|
|
|
|
^- (unit [ship contact:store])
|
2021-02-13 01:13:19 +03:00
|
|
|
=/ c=(unit contact:store) (~(get by rolodex) s)
|
2021-02-02 01:01:23 +03:00
|
|
|
?~(c ~ `[s u.c])
|
|
|
|
--
|
2021-01-20 00:07:11 +03:00
|
|
|
::
|
|
|
|
++ take-update
|
|
|
|
|= =vase
|
|
|
|
^- [(list card) agent]
|
|
|
|
=/ =update:store !<(update:store vase)
|
2021-02-12 02:46:36 +03:00
|
|
|
?+ -.update [~ this]
|
|
|
|
%disallow
|
|
|
|
:_ this
|
|
|
|
[%give %kick ~[resource+(en-path:res [our.bowl %''])] ~]~
|
|
|
|
::
|
|
|
|
%set-public
|
|
|
|
:_ this
|
|
|
|
?. public.update
|
|
|
|
[%give %kick ~[resource+(en-path:res [our.bowl %''])] ~]~
|
|
|
|
%+ murn ~(tap in scry-groups:grp)
|
|
|
|
|= rid=res
|
|
|
|
?: =(our.bowl entity.rid) ~
|
|
|
|
?. (is-managed:grp rid) ~
|
|
|
|
`(poke-self:pass:io contact-share+!>([%share entity.rid]))
|
|
|
|
==
|
2021-01-20 00:07:11 +03:00
|
|
|
--
|