/- chat |% +$ eyre-id @ta +$ card card:agent:gall :: cards ++ watch-chat |= [our=ship =term] ^- card :* %pass /listen/[term] %agent [our %chat] %watch /chat/(scot %p our)/[term]/ui/writs == ++ leave-chat |= [our=ship =term] ^- card [%pass /listen/[term] %agent [our %chat] %leave ~] ++ handle-msg |= [=wire =sign:agent:gall] ^- (quip card _this) ?. ?=(%fact -.sign) `this =* mark p.cage.sign =* vase q.cage.sign ?. ?=(%writ-diff p.cage.sign) `this =^ cards state (handle-chat-update:do source !<(diff:writs:chat vase)) [cards this] == == ++ handle-chat-update |= =diff:writs:chat ^- (list card) :: TODO other stuff ?. ?=(%add -.q.diff) `this (send-to-viewers p.q.diff) ++ send-to-viewers |= =memo:chat =/ ids=(set eyre-id) (sy ~['lol']) :_ ~ :* %give %fact :: %+ turn ~(tap in ids) |= =eyre-id /http-response/[eyre-id] :: %http-response-data !> ^- (unit octs) %- some (make-stream-data (scot %uw (jam memo))) == +$ channel-event $% $>(%poke-ack sign:agent:gall) $>(%watch-ack sign:agent:gall) $>(%kick sign:agent:gall) [%fact =desk =mark =noun] == ++ channel-event-to-tape |= [request-id=@ud =channel-event] =+ [request-id channel-event] (scow %uw (jam -)) ++ make-stream-data |= =cord ^- octs %- as-octs:mimes:html (rap 3 'data:' cord '\0a\0a' ~) :: user management :: ++ ban-comet :: |= who=ship :: ^- (quip card _state) :: :- ~ :: %_ state :: guests (~(del by guests) who) :: banned (~(uni in banned) (~(get ju guests) who)) :: == :: :: :: ++ unban-ip :: |= =address:eyre :: ^- (quip card _state) :: :- ~ :: %_ state :: banned (~(del in banned) address.action) :: == --