blob: 9cda0415edd29703f5882f4c842e1bbf77b1094a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/- sur=nostrill, nsur=nostr, comms=nostrill-comms, feed=trill-feed
/+ lib=nostrill, js=json-nostr, shim, sr=sortug, nlib=nostr, constants, gatelib=trill-gate, feedlib=trill-feed, jsonlib=json-nostrill
|_ [=state:sur =bowl:gall]
++ handle-add |= =user:sur
^- (quip card:agent:gall _state)
?- -.user
%urbit =/ c (urbit-watch +.user)
:- :~(c) state
%nostr =/ shimm ~(. shim [state bowl])
:: TODO now or on receival?
=. following.state (~(put by following.state) user *feed:feed)
=/ graph (~(get by follow-graph.state) [%urbit our.bowl])
=/ follows ?~ graph (silt ~[user]) (~(put in u.graph) user)
=. follow-graph.state (~(put by follow-graph.state) [%urbit our.bowl] follows)
=^ cards state (get-user-feed:shimm +.user)
[cards state]
==
++ handle-del |= =user:sur
^- (quip card:agent:gall _state)
=. following.state (~(del by following.state) user)
=/ graph (~(get by follow-graph.state) [%urbit our.bowl])
?~ graph `state
=/ nset (~(del in u.graph) user)
=. follow-graph.state (~(put by follow-graph.state) [%urbit our.bowl] nset)
:_ state
=/ =fact:ui:sur [%fols %quit user]
=/ c1 (update-ui:cards:lib fact)
?. ?=(%urbit -.user) :~(c1)
~& >> leaving=user
=/ c2 (urbit-leave +.user)
:~(c1 c2)
++ handle-follow-res |= =res:comms
?- -.res
%ng :: bruh
`state
%ok
?- -.p.res
%feed (handle-follow-ok [%urbit src.bowl] fc.+.p.res profile.+.p.res)
%thread `state
==
==
++ handle-refollow |= sip=@p
:_ state :_ ~
:: (urbit-watch sip)
[%pass /follow %agent [sip dap.bowl] %watch /follow]
++ handle-follow-ok |= [=user:sur =fc:feed profile=(unit user-meta:nsur)]
^- (quip card:agent:gall _state)
=. following.state (~(put by following.state) user feed.fc)
=/ graph (~(get by follow-graph.state) [%urbit our.bowl])
=/ follows ?~ graph (silt ~[user]) (~(put in u.graph) user)
=. follow-graph.state (~(put by follow-graph.state) [%urbit our.bowl] follows)
=. profiles.state ?~ profile profiles.state (~(put by profiles.state) user u.profile)
:_ state
=/ =fact:ui:sur [%fols %new [%urbit src.bowl] fc profile]
=/ c (update-ui:cards:lib fact) :~(c)
++ handle-kick-nack |= p=@p
^- (quip card:agent:gall _state)
=. following.state (~(del by following.state) [%urbit p])
=/ graph (~(get by follow-graph.state) [%urbit our.bowl])
?~ graph `state
=/ ngraph (~(del in u.graph) [%urbit p])
=. follow-graph.state (~(put by follow-graph.state) [%urbit our.bowl] ngraph)
:_ state
=/ =fact:ui:sur [%fols %quit %urbit src.bowl]
=/ c (update-ui:cards:lib fact) :~(c)
++ urbit-leave |= sip=@p ^- card:agent:gall
[%pass /follow %agent [sip dap.bowl] %leave ~]
++ urbit-watch |= sip=@p ^- card:agent:gall
[%pass /follow %agent [sip dap.bowl] %watch /follow]
:: ++ res-fact |= =res:comms ^- (list card:agent:gall)
:: =/ paths ~[/beg/feed]
:: =/ =poke:comms [%res res]
:: ~& > giving-res-fact=res
:: =/ jon (beg-res:en:jsonlib res)
:: =/ cage [%json !>(jon)]
:: :~
:: [%give %fact paths cage]
:: [%give %kick paths ~]
:: ==
--
|