/- sur=nostrill, nsur=nostr, comms=nostrill-comms, feed=trill-feed /+ js=json-nostr, 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 `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 ++ handle-follow-ok |= [=user:sur =feed:feed profile=(unit user-meta:nsur)] ^- (quip card:agent:gall _state) =. following (~(put by following) user feed) =. profiles ?~ profile profiles (~(put by profiles) user u.profile) `state ++ urbit-watch |= sip=@p ^- card:agent:gall [%pass /watch %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 ~] :: == --