2019-10-01 02:25:25 +03:00
|
|
|
/- *chat-store, *chat-view
|
2019-10-08 21:54:02 +03:00
|
|
|
/+ chat-eval
|
2019-10-01 02:25:25 +03:00
|
|
|
|%
|
|
|
|
::
|
|
|
|
++ slan |=(mod/@tas |=(txt/@ta (need (slaw mod txt))))
|
|
|
|
::
|
|
|
|
++ seri ::: serial
|
|
|
|
=, dejs:format
|
|
|
|
^- $-(json serial)
|
|
|
|
(cu (slan %uv) so)
|
|
|
|
::
|
|
|
|
++ re :: recursive reparsers
|
|
|
|
|* {gar/* sef/_|.(fist:dejs-soft:format)}
|
|
|
|
|= jon/json
|
|
|
|
^- (unit _gar)
|
|
|
|
=- ~! gar ~! (need -) -
|
|
|
|
((sef) jon)
|
|
|
|
::
|
|
|
|
++ dank :: tank
|
|
|
|
^- $-(json (unit tank))
|
|
|
|
=, ^? dejs-soft:format
|
|
|
|
%+ re *tank |. ~+
|
|
|
|
%- of :~
|
|
|
|
leaf+sa
|
|
|
|
palm+(ot style+(ot mid+sa cap+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
rose+(ot style+(ot mid+sa open+sa close+sa ~) lines+(ar dank) ~)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ eval ::: %exp speech
|
|
|
|
::: extract contents of an %exp speech, evaluating
|
|
|
|
::: the {exp} if there is no {res} yet.
|
2019-10-08 22:13:25 +03:00
|
|
|
::
|
2019-10-01 02:25:25 +03:00
|
|
|
|= a=json
|
|
|
|
^- [cord (list tank)]
|
|
|
|
=, ^? dejs-soft:format
|
2019-10-08 22:13:25 +03:00
|
|
|
=+ exp=((ot expression+so ~) a)
|
2019-10-01 02:25:25 +03:00
|
|
|
%- need
|
2019-10-08 22:13:25 +03:00
|
|
|
?~ exp [~ '' ~]
|
2019-10-01 02:25:25 +03:00
|
|
|
:+ ~ u.exp
|
2019-10-08 23:44:20 +03:00
|
|
|
::NOTE when sending, if output is an empty list, chat-store will evaluate
|
|
|
|
(fall ((ot output+(ar dank) ~) a) ~)
|
2019-10-01 02:25:25 +03:00
|
|
|
::
|
|
|
|
++ lett
|
|
|
|
|= =letter
|
|
|
|
^- json
|
|
|
|
=, enjs:format
|
|
|
|
?- -.letter
|
|
|
|
%text
|
|
|
|
(frond %text s+text.letter)
|
|
|
|
::
|
|
|
|
%url
|
|
|
|
(frond %url s+url.letter)
|
|
|
|
::
|
|
|
|
%code
|
|
|
|
%+ frond %code
|
|
|
|
%- pairs
|
|
|
|
:~ [%expression s+expression.letter]
|
|
|
|
[%output a+(turn output.letter tank)]
|
|
|
|
==
|
2019-10-03 23:33:07 +03:00
|
|
|
::
|
|
|
|
%me
|
|
|
|
(frond %me s+narrative.letter)
|
2019-10-01 02:25:25 +03:00
|
|
|
::
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ enve
|
|
|
|
|= =envelope
|
|
|
|
^- json
|
|
|
|
=, enjs:format
|
|
|
|
%- pairs
|
|
|
|
:~ [%uid s+(scot %uv uid.envelope)]
|
|
|
|
[%number (numb number.envelope)]
|
|
|
|
[%author (ship author.envelope)]
|
|
|
|
[%when (time when.envelope)]
|
|
|
|
[%letter (lett letter.envelope)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ conf
|
|
|
|
|= =config
|
|
|
|
^- json
|
|
|
|
=, enjs:format
|
|
|
|
%- pairs
|
2019-10-07 21:16:47 +03:00
|
|
|
:~ [%length (numb length.config)]
|
2019-10-01 02:25:25 +03:00
|
|
|
[%read (numb read.config)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ inbox-to-configs
|
|
|
|
|= =inbox
|
|
|
|
^- chat-configs
|
|
|
|
%- ~(run by inbox)
|
|
|
|
|= =mailbox
|
|
|
|
^- config
|
|
|
|
config.mailbox
|
|
|
|
::
|
|
|
|
++ configs-to-json
|
|
|
|
|= cfg=chat-configs
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %chat-configs
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by cfg)
|
|
|
|
|= [pax=^path =config]
|
|
|
|
^- [cord json]
|
|
|
|
[(spat pax) (conf config)]
|
|
|
|
::
|
|
|
|
++ inbox-to-json
|
|
|
|
|= box=inbox
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %chat-initial
|
|
|
|
%- pairs
|
|
|
|
%+ turn ~(tap by box)
|
|
|
|
|= [pax=^path =mailbox]
|
|
|
|
^- [cord json]
|
|
|
|
:- (spat pax)
|
|
|
|
%- pairs
|
|
|
|
:~ [%envelopes [%a (turn envelopes.mailbox enve)]]
|
|
|
|
[%config (conf config.mailbox)]
|
|
|
|
==
|
|
|
|
::
|
2019-11-16 02:19:28 +03:00
|
|
|
++ two-update-to-json
|
|
|
|
|= upd=chat-two-update
|
2019-10-01 02:25:25 +03:00
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %chat-update
|
|
|
|
%- pairs
|
|
|
|
:~
|
2019-11-14 03:53:47 +03:00
|
|
|
?: =(%messages -.upd)
|
|
|
|
?> ?=(%messages -.upd)
|
|
|
|
:- %messages
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%start (numb start.upd)]
|
|
|
|
[%end (numb end.upd)]
|
|
|
|
[%envelopes [%a (turn envelopes.upd enve)]]
|
|
|
|
==
|
2019-11-16 02:19:28 +03:00
|
|
|
[*@t *^json]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ update-to-json
|
|
|
|
|= upd=chat-update
|
|
|
|
=, enjs:format
|
|
|
|
^- json
|
|
|
|
%+ frond %chat-update
|
|
|
|
%- pairs
|
|
|
|
:~
|
|
|
|
?: =(%message -.upd)
|
|
|
|
?> ?=(%message -.upd)
|
|
|
|
:- %message
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%envelope (enve envelope.upd)]
|
|
|
|
==
|
2019-10-01 02:25:25 +03:00
|
|
|
?: =(%read -.upd)
|
|
|
|
?> ?=(%read -.upd)
|
|
|
|
[%read (pairs [%path (path path.upd)]~)]
|
|
|
|
?: =(%create -.upd)
|
|
|
|
?> ?=(%create -.upd)
|
|
|
|
:- %create
|
|
|
|
%- pairs
|
2019-10-07 21:16:47 +03:00
|
|
|
:~ [%ship (ship ship.upd)]
|
|
|
|
[%path (path path.upd)]
|
2019-10-01 02:25:25 +03:00
|
|
|
==
|
|
|
|
?: =(%delete -.upd)
|
|
|
|
?> ?=(%delete -.upd)
|
|
|
|
[%delete (pairs [%path (path path.upd)]~)]
|
|
|
|
?: =(%config -.upd)
|
|
|
|
?> ?=(%config -.upd)
|
|
|
|
:- %config
|
|
|
|
%- pairs
|
|
|
|
:~ [%path (path path.upd)]
|
|
|
|
[%config (conf config.upd)]
|
|
|
|
==
|
|
|
|
[*@t *^json]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ json-to-action
|
|
|
|
|= jon=json
|
|
|
|
^- chat-action
|
|
|
|
=, dejs:format
|
|
|
|
=< (parse-json jon)
|
|
|
|
|%
|
|
|
|
++ parse-json
|
|
|
|
%- of
|
|
|
|
:~ [%create create]
|
|
|
|
[%delete delete]
|
|
|
|
[%message message]
|
2019-11-14 03:53:47 +03:00
|
|
|
[%messages messages]
|
2019-10-01 02:25:25 +03:00
|
|
|
[%read read]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ create
|
|
|
|
%- ot
|
2019-10-07 21:16:47 +03:00
|
|
|
:~ [%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%path pa]
|
2019-10-01 02:25:25 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ delete
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
|
|
|
++ message
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%envelope envelope]
|
|
|
|
==
|
|
|
|
::
|
2019-11-14 03:53:47 +03:00
|
|
|
++ messages
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%envelopes (ar envelope)]
|
|
|
|
==
|
|
|
|
::
|
2019-10-01 02:25:25 +03:00
|
|
|
++ read
|
|
|
|
(ot [%path pa] ~)
|
|
|
|
::
|
|
|
|
++ envelope
|
|
|
|
%- ot
|
|
|
|
:~ [%uid seri]
|
|
|
|
[%number ni]
|
|
|
|
[%author (su ;~(pfix sig fed:ag))]
|
|
|
|
[%when di]
|
|
|
|
[%letter letter]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ letter
|
|
|
|
%- of
|
|
|
|
:~ [%text so]
|
|
|
|
[%url so]
|
|
|
|
[%code eval]
|
2019-10-03 23:33:07 +03:00
|
|
|
[%me so]
|
2019-10-01 02:25:25 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ json-to-view-action
|
|
|
|
|= jon=json
|
|
|
|
^- chat-view-action
|
|
|
|
=, dejs:format
|
|
|
|
=< (parse-json jon)
|
|
|
|
|%
|
|
|
|
++ parse-json
|
|
|
|
%- of
|
|
|
|
:~ [%create create]
|
|
|
|
[%delete delete]
|
2019-10-08 23:08:53 +03:00
|
|
|
[%join join]
|
2019-10-01 02:25:25 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ create
|
|
|
|
%- ot
|
|
|
|
:~ [%path pa]
|
|
|
|
[%security sec]
|
|
|
|
[%read (as (su ;~(pfix sig fed:ag)))]
|
|
|
|
[%write (as (su ;~(pfix sig fed:ag)))]
|
2019-11-14 03:53:47 +03:00
|
|
|
[%allow-history bo]
|
2019-10-01 02:25:25 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ delete
|
|
|
|
(ot [%path pa]~)
|
|
|
|
::
|
2019-10-08 23:08:53 +03:00
|
|
|
++ join
|
|
|
|
%- ot
|
|
|
|
:~ [%ship (su ;~(pfix sig fed:ag))]
|
|
|
|
[%path pa]
|
2019-11-14 03:53:47 +03:00
|
|
|
[%ask-history bo]
|
2019-10-08 23:08:53 +03:00
|
|
|
==
|
|
|
|
::
|
2019-10-01 02:25:25 +03:00
|
|
|
++ sec
|
|
|
|
=, dejs:format
|
2019-11-14 04:17:24 +03:00
|
|
|
^- $-(json rw-security)
|
2019-10-01 02:25:25 +03:00
|
|
|
(su (perk %channel %village %journal %mailbox ~))
|
|
|
|
--
|
|
|
|
--
|
|
|
|
|