Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 77 additions & 86 deletions desk/app/channels-server.hoon

Large diffs are not rendered by default.

662 changes: 298 additions & 364 deletions desk/app/channels.hoon

Large diffs are not rendered by default.

584 changes: 253 additions & 331 deletions desk/app/chat.hoon

Large diffs are not rendered by default.

70 changes: 40 additions & 30 deletions desk/app/contacts.hoon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/- activity-ver
/+ default-agent, dbug, verb, neg=negotiate
/+ default-agent, dbug, verb, neg=negotiate,
guard
/+ *contacts, kol
::
:: performance, keep warm
Expand All @@ -16,7 +17,8 @@
:: .sag: foreign subscription state
::
+| %types
+$ card card:agent:gall
+$ card card:guard
+$ rail rail:guard
+$ state-4
$: %4
rof=profile
Expand All @@ -41,6 +43,7 @@
cor ~(. raw bowl)
::
++ on-init
%- step:un:guard
^- (quip card _this)
=^ cards state abet:init:cor
[cards this]
Expand All @@ -49,18 +52,21 @@
::
++ on-load
|= old=vase
%- step:un:guard
^- (quip card _this)
=^ cards state abet:(load:cor old)
[cards this]
::
++ on-watch
|= =path
%- step:un:guard
^- (quip card _this)
=^ cards state abet:(peer:cor path)
[cards this]
::
++ on-poke
|= [=mark =vase]
%- step:un:guard
^- (quip card _this)
=^ cards state abet:(poke:cor mark vase)
[cards this]
Expand All @@ -70,12 +76,15 @@
::
++ on-agent
|= [=wire =sign:agent:gall]
%- step:un:guard
^- (quip card _this)
=^ cards state abet:(agent:cor wire sign)
[cards this]
::
++ on-arvo
|= [=wire sign=sign-arvo]
%- step:un:guard
^- (quip card _this)
=^ cards state abet:(arvo:cor wire sign)
[cards this]
::
Expand All @@ -99,17 +108,17 @@
++ cor .
++ emit |=(c=card cor(out [c out]))
++ emil |=(c=(list card) cor(out (weld (flop c) out)))
++ give |=(=gift:agent:gall (emit %give gift))
++ pass |=([=wire =note:agent:gall] (emit %pass wire note))
++ give |=(=gift:guard (emit %give gift))
++ pass |=([=wire =note:guard] (emit %pass wire note))
::
+| %operations
::
++ pass-activity
|= [who=ship field=(pair @tas value)]
~> %spin.['pass-activity']
^- card
=/ =cage activity-action+!>(`action:v8:activity-ver`[%add %contact who field])
[%pass /activity %agent [our.bowl %activity] %poke cage]
=/ =rail activity-action+`action:v8:activity-ver`[%add %contact who field]
[%pass /activity %agent [our.bowl %activity] %poke rail]
::
:: +pub: publication management
::
Expand Down Expand Up @@ -152,8 +161,8 @@
++ fact
|= [pat=(set path) u=update]
~> %spin.['fact']
^- gift:agent:gall
[%fact ~(tap in pat) %contact-update-1 !>(u)]
^- gift:guard
[%fact ~(tap in pat) contact-update-1+u]
--
::
|%
Expand Down Expand Up @@ -273,13 +282,13 @@
++ p-news-0
|= n=news-0:c0
~> %spin.['p-news-0']
(give %fact ~[/news] %contact-news !>(n))
(give %fact ~[/news] contact-news+n)
:: +p-response: publish response
::
++ p-response
|= r=response
~> %spin.['p-response']
(give %fact ~[/v1/news] %contact-response-0 !>(r))
(give %fact ~[/v1/news] contact-response-0+r)
--
::
:: +sub: subscription mgmt
Expand Down Expand Up @@ -507,7 +516,7 @@
::
++ init
=. wen.rof now.bowl
(emit %pass /migrate %agent [our dap]:bowl %poke noun+!>(%migrate))
(emit %pass /migrate %agent [our dap]:bowl %poke noun+%migrate)
::
++ load
|= old-vase=vase
Expand Down Expand Up @@ -744,7 +753,8 @@
++ peek
|= pat=(pole knot)
~> %spin.['peek']
^- (unit (unit cage))
%- peek:un:guard
^- (unit (unit rail))
?+ pat [~ ~]
::
[%x %all ~]
Expand All @@ -760,7 +770,7 @@
=/ lor-0=rolodex:c0
?: ?=(~ con.rof) rol-0
(~(put by rol-0) our.bowl (profile:to-0 rof) ~)
``contact-rolodex+!>(lor-0)
``contact-rolodex+lor-0
::
[%x %contact her=@ ~]
?~ who=(slaw %p her.pat)
Expand All @@ -772,37 +782,37 @@
?: |(?=(~ far) ?=(~ for.u.far)) ~
(contact:to-0 con.for.u.far)
?~ tac [~ ~]
``contact+!>(`contact-0:c0`tac)
``contact+`contact-0:c0`tac
::
[%x %v1 %self ~]
``contact-1+!>(`contact`con.rof)
``contact-1+`contact`con.rof
::
[%x %v1 %book ~]
``contact-book-0+!>(book)
``contact-book-0+book
::
[%u %v1 %book her=@p ~]
?~ who=(slaw %p her.pat)
[~ ~]
``loob+!>((~(has by book) u.who))
``loob+(~(has by book) u.who)
::
[%x %v1 %book her=@p ~]
?~ who=(slaw %p her.pat)
[~ ~]
=/ page=(unit page)
(~(get by book) u.who)
``contact-page-0+!>(`^page`(fall page *^page))
``contact-page-0+`^page`(fall page *^page)
::
[%u %v1 %book %id =cid ~]
?~ id=(slaw %uv cid.pat)
[~ ~]
``loob+!>((~(has by book) id+u.id))
``loob+(~(has by book) id+u.id)
::
[%x %v1 %book %id =cid ~]
?~ id=(slaw %uv cid.pat)
[~ ~]
=/ page=(unit page)
(~(get by book) id+u.id)
``contact-page-0+!>(`^page`(fall page *^page))
``contact-page-0+`^page`(fall page *^page)
::
[%x %v1 %directory ~]
=| dir=directory
Expand All @@ -825,13 +835,13 @@
?~ for.far dir
?: (~(has by dir) who) dir
(~(put by dir) who [| con.for.far ~])
``contact-directory-0+!>(dir)
``contact-directory-0+dir
::
[%x %v1 %changes since=@ ~]
=+ since=(slav %da since.pat)
:^ ~ ~
%contact-changed-contacts
!> ^- (map ship profile)
^- (map ship profile)
%- ~(rep by peers)
|= [[who=ship foreign] out=(map ship profile)]
?~ for out
Expand All @@ -842,7 +852,7 @@
=+ since=(slav %da since.pat)
:^ ~ ~
%contact-changed-pages
!> %- ~(gas by *(map kip [(unit contact) (unit contact)]))
%- ~(gas by *(map kip [(unit contact) (unit contact)]))
%+ turn (~(top ol last-updated) since)
|= [=kip @da]
^- [_kip con=(unit contact) mod=(unit contact)]
Expand All @@ -857,8 +867,8 @@
?~ who=(slaw %p her.pat)
[~ ~]
?: (~(has by book) u.who)
``loob+!>(&)
=- ``loob+!>(-)
``loob+&
=- ``loob+-
?~ far=(~(get by peers) u.who)
|
?~ for.u.far
Expand All @@ -869,24 +879,24 @@
?~ who=(slaw %p her.pat)
[~ ~]
?^ page=(~(get by book) u.who)
``contact-1+!>((contact-uni u.page))
``contact-1+(contact-uni u.page)
?~ far=(~(get by peers) u.who)
[~ ~]
?~ for.u.far
[~ ~]
``contact-1+!>(con.for.u.far)
``contact-1+con.for.u.far
::
[%u %v1 %peer her=@p ~]
?~ who=(slaw %p her.pat)
[~ ~]
``loob+!>((~(has by peers) u.who))
``loob+(~(has by peers) u.who)
::
[%x %v1 %peer her=@p ~]
?~ who=(slaw %p her.pat)
[~ ~]
?~ far=(~(get by peers) u.who)
[~ ~]
``contact-foreign-0+!>(`foreign`u.far)
``[%unsafe %contact-foreign-0 !>(`foreign`u.far)]
==
::
++ peer
Expand All @@ -903,7 +913,7 @@
[%v1 %contact %at wen=@ ~] (p-init:pub `(slav %da wen.pat))
[%v1 %news ~] ~|(local-news+src.bowl ?>(=(our src):bowl cor))
::
[%epic ~] (give %fact ~ epic+!>(okay))
[%epic ~] (give %fact ~ epic+okay)
==
::
++ agent
Expand Down
Loading