Added %source action for un/subscribing, %convey and %phrase actions for sending.

New actions are used in reader to simplify implementation.
This commit is contained in:
Fang 2017-04-13 23:40:53 +02:00
parent 108431b2c9
commit 8b82260408
3 changed files with 36 additions and 33 deletions

View File

@ -511,22 +511,6 @@
^+ +>
+>(moves :_(moves [id.she %diff %sole-effect fec]))
::
++ sh-tell :: add command
::x adds talk command to ++ra's moves.
::
|= cod/command
^+ +>
%= +>
moves
:_ moves
:* ost.hid
%poke
/reader/command
(broker our.hid)
[%talk-command cod]
==
==
::
++ sh-action
::x adds a talk-action to ++ra's moves
::
@ -1047,14 +1031,6 @@
|= txt/tape
(sh-fact [%txt txt])
::
++ sh-whom :: current audience
::x produces the currently selected audience for this shell.
::
^- audience
%- ~(gas by *audience)
%+ turn (~(tap in active.she))
|=(a/partner [a *envelope %pending])
::
++ sh-twig-head ^- vase :: eval data
::x makes a vase of environment data to evaluate against (#-messages).
::
@ -1130,16 +1106,14 @@
sh-prod(active.she pan)
=+ loc=(~(got by mirrors) [our.hid man])
::x change local mailbox config to include subscription to pan.
%^ sh-tell %design man
`loc(sources (~(uni in sources.loc) pan))
(sh-action %source man & pan)
::
++ leave :: %leave
|= pan/(set partner)
^+ ..sh-work
=+ loc=(~(got by mirrors) [our.hid man])
::x change local mailbox config to exclude subscription to pan.
%^ sh-tell %design man
`loc(sources (~(dif in sources.loc) pan))
(sh-action %source man | pan)
::
++ what :: %what
|= qur/$@(char (set partner)) ^+ ..sh-work
@ -1303,11 +1277,7 @@
++ say :: publish
|= sep/(list speech)
^+ ..sh-work
=- (sh-tell [%publish tot])
|- ^- tot/(list thought)
?~ sep ~
=^ sir ..sh-work sh-uniq
[[sir sh-whom [now.hid ~ i.sep]] $(sep t.sep)]
(sh-action %phrase active.she sep)
--
::
++ sh-done :: apply result

View File

@ -218,6 +218,35 @@
$permit :: invite/banish
%- (ra-affect p.act red `act) |= par/_pa =< pa-abet
(pa-permit:par q.act r.act)
::
$source :: un/sub p to/from r
=+ pur=(~(get by stories) p.act)
?~ pur
%+ ra-react red
[%fail (crip "no story {(trip p.act)}") `act]
=. sources.shape.u.pur
%. r.act
?: q.act
~(uni in sources.shape.u.pur)
~(dif in sources.shape.u.pur)
(ra-config p.act shape.u.pur)
::
:: messaging
::
$convey :: post exact
(ra-think & our.hid +.act)
::
$phrase :: post easy
=- (ra-think & our.hid tos)
|- ^- tos/(list thought)
?~ q.act ~
=^ sir eny.hid (uniq eny.hid)
:_ $(q.act t.q.act)
:+ sir
%- ~(gas by *audience)
%+ turn (~(tap in p.act))
|=(p/partner [p *envelope %pending])
[now.hid ~ i.q.act]
::
:: personal metadata
::

View File

@ -14,6 +14,10 @@
$% :: station configuration ::
{$create (trel knot cord posture)} :: create station
{$permit (trel knot ? (set ship))} :: invite/banish
{$source (trel knot ? (set partner))} :: un/sub p to/from r
:: messaging ::
{$convey (list thought)} :: post exact
{$phrase (pair (set partner) (list speech))} :: post easy
:: personal metadata ::
::TODO change to target partners, not only our stations.
{$status (pair (set knot) status)} :: our status update