mirror of
https://github.com/urbit/shrub.git
synced 2024-12-24 03:14:30 +03:00
62 lines
1.4 KiB
Plaintext
62 lines
1.4 KiB
Plaintext
:: invite-hook: receive invites from any source
|
|
::
|
|
/+ *invite-json
|
|
|%
|
|
+$ move [bone [%poke wire dock [%invite-action invite-action]]]
|
|
--
|
|
::
|
|
|_ [bol=bowl:gall ~]
|
|
::
|
|
++ this .
|
|
::
|
|
++ poke-json
|
|
|= =json
|
|
^- (quip move _this)
|
|
?> (team:title our.bol src.bol)
|
|
=/ act (json-to-action json)
|
|
?> ?=(%invite -.act)
|
|
:_ this
|
|
[(invite-hook-poke recipient.invite.act act)]~
|
|
::
|
|
++ poke-invite-action
|
|
|= act=invite-action
|
|
^- (quip move _this)
|
|
:_ this
|
|
?+ -.act
|
|
~
|
|
::
|
|
%invite
|
|
?: (team:title our.bol src.bol)
|
|
?> !(team:title our.bol ship.invite.act)
|
|
[(invite-hook-poke recipient.invite.act act)]~
|
|
?~ (invitatory-scry path.act) ~
|
|
?^ (invite-scry uid.act path.act) ~
|
|
[(invite-poke path.act act)]~
|
|
==
|
|
::
|
|
++ invite-hook-poke
|
|
|= [=ship action=invite-action]
|
|
^- move
|
|
[ost.bol %poke /invite-hook [ship %invite-hook] [%invite-action action]]
|
|
::
|
|
++ invite-poke
|
|
|= [pax=path action=invite-action]
|
|
^- move
|
|
[ost.bol %poke pax [our.bol %invite-store] [%invite-action action]]
|
|
::
|
|
++ invitatory-scry
|
|
|= pax=path
|
|
^- (unit invitatory)
|
|
=. pax
|
|
;:(weld /=invite-store/(scot %da now.bol)/invitatory pax /noun)
|
|
.^((unit invitatory) %gx pax)
|
|
::
|
|
++ invite-scry
|
|
|= [uid=serial pax=path]
|
|
^- (unit invite)
|
|
=. pax
|
|
;:(weld /=invite-store/(scot %da now.bol)/invite/(scot %uv uid) pax /noun)
|
|
.^((unit invite) %gx pax)
|
|
--
|
|
|