Merge remote-tracking branches 'anton/pojo-tco' and 'anton/talkfix' into pending

This commit is contained in:
Philip C Monk 2015-10-29 19:38:53 -04:00
commit da87528526
14 changed files with 411 additions and 259 deletions

View File

@ -13,37 +13,25 @@
::
[. talk sole]
=> |% :: data structures
++ house ,[%3 house-3] :: full state
++ house ,[%4 house-4] :: full state
++ house-any :: app history
$% [%1 house-1] :: 1: talk
[%2 house-2] :: 2: talk
[%3 house-3] :: 3: talk
== ::
++ house-1 ::
$: stories=(map span story) :: conversations
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
folks=(map ship human) :: human identities
shells=(map bone shell) :: interaction state
== ::
++ house-2 ::
$: stories=(map span story) :: conversations
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
folks=(map ship human) :: human identities
shells=(map bone shell) :: interaction state
log=(map span ,@ud) :: logged to clay
$% [%3 house-3] :: 3: talk
[%4 house-4] :: 4: talk
== ::
++ house-3 ::
%+ cork house-4 |= house-4 :: modern house with
+<(stories (~(run by stories) story-3)) :: old stories
++ house-4 ::
$: stories=(map span story) :: conversations
general=(set bone) :: meta-subscribe
outbox=(pair ,@ud (map ,@ud thought)) :: urbit outbox
folks=(map ship human) :: human identities
shells=(map bone shell) :: interaction state
log=(map span ,@ud) :: logged to clay
nik=(map (set partner) char) ::
nak=(jug char (set partner)) ::
nik=(map (set partner) char) :: bound station glyphs
nak=(jug char (set partner)) :: station glyph lookup
== ::
++ story-3 (cork story |=(story +<(|10 &11.+<))) :: missing glyphers
++ story :: wire content
$: count=@ud :: (lent grams)
grams=(list telegram) :: all history
@ -53,9 +41,10 @@
sequence=(map partner ,@ud) :: partners heard
shape=config :: configuration
known=(map serial ,@ud) :: messages heard
guests=(map bone river) :: message followers
viewers=(set bone) :: presence followers
owners=(set bone) :: config followers
gramsers=(map bone river) :: message followers
groupers=(set bone) :: presence followers
cabalers=(set bone) :: config followers
glyphers=(set bone) :: glyph followers
== ::
++ shell :: console session
$: her=ship :: client identity
@ -64,7 +53,7 @@
say=sole-share :: console state
active=(unit (set partner)) :: active targets
passive=(set partner) :: passive targets
guests=register :: presence mirror
owners=register :: presence mirror
harbor=(map span (pair posture cord)) :: stations mirror
system=cabal :: config mirror
== ::
@ -694,15 +683,15 @@
++ sh-repo-group-here :: update local
|= loc=atlas
^+ +>
=+ cul=(sh-repo-atlas-diff p.guests.she loc)
=. p.guests.she loc
=+ cul=(sh-repo-atlas-diff p.owners.she loc)
=. p.owners.she loc
(sh-repo-group-diff-here "" cul)
::
++ sh-repo-group-there :: update foreign
|= yid=(map partner atlas)
=+ day=(sh-repo-rogue-diff q.guests.she yid)
=+ dun=q.guests.she
=. q.guests.she yid
=+ day=(sh-repo-rogue-diff q.owners.she yid)
=+ dun=q.owners.she
=. q.owners.she yid
=. +>.$
|- ^+ +>.^$
?~ old.day +>.^$
@ -750,6 +739,18 @@
?~ gaz +>
$(gaz t.gaz, num +(num), +> (sh-repo-gram num i.gaz))
::
++ sh-repo-glyph :: apply binding
|= nac=(jug char (set partner))
^+ +>
%_ sh-prod
nak nac
nik %- ~(gas by *(map (set partner) char))
=- (zing `(list (list ,[(set partner) char]))`-)
%+ turn (~(tap by nac))
|= [a=char b=(set (set partner))]
(turn (~(tap by b)) |=(c=(set partner) [c a]))
==
::
++ sh-repo :: apply report
|= rad=report
^+ +>
@ -757,6 +758,7 @@
?- -.rad
%cabal (sh-repo-cabal +.rad)
%grams (sh-repo-grams +.rad)
%glyph (sh-repo-glyph +.rad) :: XX ever happens?
%group (sh-repo-group +.rad)
%house (sh-repo-house +.rad)
==
@ -924,7 +926,7 @@
|= lix=?((set partner) char) ^+ ..sh-work
=< ?~(lix (. lix) ?^(lix (. lix) (fetch-nik lix .)))
|= pan=(set partner)
=< (sh-fact %mor (murn (sort (~(tap by q.guests.she)) aor) .))
=< (sh-fact %mor (murn (sort (~(tap by q.owners.she)) aor) .))
|= [pon=partner alt=atlas] ^- (unit sole-effect)
?. |(=(~ pan) (~(has in pan) pon)) ~
=- `[%tan rose/[", " `~]^- leaf/~(ta-full ta man.she pon) ~]
@ -946,6 +948,9 @@
=: nak (~(put ju nak) cha u.pan)
nik (~(put by nik) u.pan cha)
==
=. ..pa
%- (ra-know man.she)
|=(_pa pa-abet:(pa-report glyphers %glyph nak))
..sh-work
::
++ invite :: %invite
@ -1168,7 +1173,8 @@
^+ +>
=+ shu=(~(get by shells) ost.hid)
?~ shu
~& [%ra-console-broken ost.hid ?:((~(has by sup.hid) ost.hid) %lost %unknown)]
~& :+ %ra-console-broken ost.hid
?:((~(has by sup.hid) ost.hid) %lost %unknown)
+>.$
sh-abet:(~(sh-sole sh ~ u.shu) act)
::
@ -1311,21 +1317,18 @@
(ra-house(general (~(put in general) ost.hid)) ost.hid)
?. ?=([@ @ *] pax)
(ra-evil %talk-bad-path)
=+ ^= vab ^- (set ,@tas)
=| vab=(set ,@tas)
|- ^+ vab
?: =(0 i.pax) vab
$(i.pax (rsh 3 1 i.pax), vab (~(put in vab) (end 3 1 i.pax)))
=+ vab=(~(gas in *(set ,@tas)) (rip 3 i.pax))
=+ pur=(~(get by stories) i.t.pax)
?~ pur
~& [%bad-subscribe-story-c i.t.pax]
(ra-evil %talk-no-story)
=+ soy=~(. pa i.t.pax u.pur)
=^ who +>.$ (ra-human her)
=. soy ?.((~(has in vab) %a) soy (pa-watch:soy her))
=. soy ?.((~(has in vab) %x) soy (pa-master:soy her))
=. soy ?.((~(has in vab) %a) soy (pa-watch-group:soy her))
=. soy ?.((~(has in vab) %v) soy (pa-watch-glyph:soy her))
=. soy ?.((~(has in vab) %x) soy (pa-watch-cabal:soy her))
=. soy ?.((~(has in vab) %f) soy (pa-watch-grams:soy her t.t.pax))
=. soy (pa-notify:soy her %hear who)
=. soy ?.((~(has in vab) %f) soy (pa-listen:soy her t.t.pax))
pa-abet:soy
::
++ ra-think :: publish/review
@ -1410,44 +1413,50 @@
::==
&
::
++ pa-watch :: watch presence
++ pa-report :: update
|= [wac=(set bone) caw=report]
:: ~& [%pa-report man -.caw]
^+ +>
?~ wac +>
=. +> $(wac l.wac)
=. +> $(wac r.wac)
:: ~& [%pa-report-cabal man shape]
(pa-sauce n.wac [%diff %talk-report caw]~)
::
++ pa-watch-group :: subscribe presence
|= her=ship
?. (pa-admire her)
(pa-sauce ost.hid [%quit ~]~)
=. viewers (~(put in viewers) ost.hid)
(pa-display ost.hid ~ ~)
=. groupers (~(put in groupers) ost.hid)
(pa-report-group ost.hid ~ ~)
::
++ pa-master :: hear config
++ pa-watch-cabal :: subscribe config
|= her=ship
?. (pa-admire her)
~& [%pa-admire-not her]
(pa-sauce ost.hid [%quit ~]~)
=. owners (~(put in owners) ost.hid)
:: ~& [%pa-master her man shape]
=. cabalers (~(put in cabalers) ost.hid)
:: ~& [%pa-watch-cabal her man shape]
(pa-sauce ost.hid [[%diff %talk-report %cabal shape mirrors] ~])
::
++ pa-display :: update presence
|= vew=(set bone)
=+ ^= reg
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
:: ~& [%pa-display man reg]
|- ^+ +>.^$
?~ vew +>.^$
=. +>.^$ $(vew l.vew)
=. +>.^$ $(vew r.vew)
(pa-sauce n.vew [[%diff %talk-report %group reg] ~])
++ pa-watch-glyph :: subscribe config
|= her=ship
?. (pa-admire her)
~& [%pa-admire-not her]
(pa-sauce ost.hid [%quit ~]~)
=. glyphers (~(put in glyphers) ost.hid)
(pa-report [ost.hid ~ ~] %glyph nak)
::
++ pa-monitor :: update config
=+ owe=owners
|- ^+ +>
?~ owe +>
=. +> $(owe l.owe)
=. +> $(owe r.owe)
:: ~& [%pa-monitor man shape]
(pa-sauce n.owe [[%diff %talk-report %cabal shape mirrors] ~])
++ pa-report-group :: update presence
|= vew=(set bone)
%^ pa-report vew %group
:_ remotes
|- ^- atlas
?~ locals ~
[[p.n.locals q.q.n.locals] $(locals l.locals) $(locals r.locals)]
::
++ pa-report-cabal :: update config
(pa-report cabalers %cabal shape mirrors)
::
++ pa-cabal
|= [cuz=station con=config ham=(map station config)]
@ -1456,7 +1465,7 @@
=. mirrors (~(put by mirrors) cuz con)
?: =(mirrors old)
+>.$
pa-monitor
pa-report-cabal
::
++ pa-diff-talk-report :: subscribed update
|= [cuz=station rad=report]
@ -1476,7 +1485,7 @@
::
++ pa-quit :: stop subscription
|= tay=partner
pa-monitor(sources.shape (~(del in sources.shape) tay))
pa-report-cabal(sources.shape (~(del in sources.shape) tay))
::
++ pa-sauce :: send backward
|= [ost=bone cub=(list card)]
@ -1534,14 +1543,15 @@
=. +>.$ (pa-acquire p.dif)
=. +>.$ (pa-abjure q.dif)
=. shape cof
pa-monitor
pa-report-cabal
::
++ pa-cancel :: unsubscribe from
~& [%pa-cancel ost.hid]
%_ .
guests (~(del by guests) ost.hid)
viewers (~(del in viewers) ost.hid)
owners (~(del in owners) ost.hid)
gramsers (~(del by gramsers) ost.hid)
groupers (~(del in groupers) ost.hid)
glyphers (~(del in glyphers) ost.hid)
cabalers (~(del in cabalers) ost.hid)
==
::
++ pa-notify :: local presence
@ -1552,7 +1562,7 @@
(~(del by locals) her)
(~(put by locals) her now.hid saz)
?: =(nol locals) +>.$
(pa-display(locals nol) viewers)
(pa-report-group(locals nol) groupers)
::
++ pa-remind :: remote presence
|= [tay=partner loc=atlas rem=(map partner atlas)]
@ -1579,16 +1589,17 @@
?. |(?=(~ gub) !=(buk u.gub))
+>.$
=. remotes (~(put by remotes) tay buk)
(pa-display viewers)
(pa-report-group groupers)
::
++ pa-start :: start stream
|= riv=river
^+ +>
=- :: ~& [%pa-start riv lab]
=. +>.$ (pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~])
=. +>.$
(pa-sauce ost.hid [[%diff %talk-report %grams q.lab r.lab] ~])
?: p.lab
(pa-sauce ost.hid [[%quit ~] ~])
+>.$(guests (~(put by guests) ost.hid riv))
+>.$(gramsers (~(put by gramsers) ost.hid riv))
^= lab
=+ [end=count gaz=grams dun=| zeg=*(list telegram)]
|- ^- (trel ,? ,@ud (list telegram))
@ -1605,56 +1616,55 @@
[dun end zeg]
$(end (dec end), gaz t.gaz, zeg [i.gaz zeg])
::
++ pa-listen :: subscribe
++ pa-watch-grams :: subscribe messages
|= [her=ship pax=path]
^+ +>
?. (pa-admire her)
~& [%pa-listen-admire ~]
~& [%pa-watch-grams-admire ~]
(pa-sauce ost.hid [%quit ~]~)
=+ ^= ruv ^- (unit river)
?: ?=(~ pax)
`[[%ud ?:((lth count 64) 0 (sub count 64))] [%da (dec (bex 128))]]
?: ?=([@ ~] pax)
=+ say=(slay i.pax)
?. ?=([~ %$ ?(%ud %da) @] say) ~
`[(point +>.say) [%da (dec (bex 128))]]
?. ?=([@ @ ~] pax) ~
=+ [say=(slay i.pax) den=(slay i.t.pax)]
?. ?=([~ %$ ?(%ud %da) @] say) ~
?. ?=([~ %$ ?(%ud %da) @] den) ~
`[(point +>.say) (point +>.den)]
:: ~& [%pa-listen her pax ruv]
%+ biff
(zl:jo (turn pax ;~(biff slay |=(a=coin `(unit dime)`?~(-.a a ~)))))
|= paf=(list dime)
?~ paf
$(paf [%ud (sub (max 64 count) 64)]~)
?~ t.paf
$(t.paf [%da (dec (bex 128))]~)
?. ?=([[?(%ud %da) @] [?(%ud %da) @] ~] paf)
~
`[[?+(- . %ud .)]:i.paf [?+(- . %ud .)]:i.t.paf] :: XX types
:: ~& [%pa-watch-grams her pax ruv]
?~ ruv
~& [%pa-listen-malformed pax]
~& [%pa-watch-grams-malformed pax]
(pa-sauce ost.hid [%quit ~]~)
(pa-start u.ruv)
::
++ pa-refresh :: update to guests
++ pa-refresh :: update to listeners
|= [num=@ud gam=telegram]
^+ +>
=+ ^= moy
|- ^- (pair (list bone) (list move))
?~ guests [~ ~]
:: ~& [%pa-refresh num n.guests]
=+ lef=$(guests l.guests)
=+ rit=$(guests r.guests)
?~ gramsers [~ ~]
:: ~& [%pa-refresh num n.gramsers]
=+ lef=$(gramsers l.gramsers)
=+ rit=$(gramsers r.gramsers)
=+ old=[p=(welp p.lef p.rit) q=(welp q.lef q.rit)]
?: ?- -.q.q.n.guests :: after the end
%ud (lte p.q.q.n.guests num)
%da (lte p.q.q.n.guests p.r.q.gam)
?: ?- -.q.q.n.gramsers :: after the end
%ud (lte p.q.q.n.gramsers num)
%da (lte p.q.q.n.gramsers p.r.q.gam)
==
[[p.n.guests p.old] [[p.n.guests %quit ~] q.old]]
?: ?- -.p.q.n.guests :: before the start
%ud (gth p.p.q.n.guests num)
%da (gth p.p.q.n.guests p.r.q.gam)
[[p.n.gramsers p.old] [[p.n.gramsers %quit ~] q.old]]
?: ?- -.p.q.n.gramsers :: before the start
%ud (gth p.p.q.n.gramsers num)
%da (gth p.p.q.n.gramsers p.r.q.gam)
==
old
:- p.old
[[p.n.guests %diff %talk-report %grams num gam ~] q.old]
[[p.n.gramsers %diff %talk-report %grams num gam ~] q.old]
=. moves (welp q.moy moves)
|- ^+ +>.^$
?~ p.moy +>.^$
$(p.moy t.p.moy, guests (~(del by guests) i.p.moy))
$(p.moy t.p.moy, gramsers (~(del by gramsers) i.p.moy))
::
++ pa-lesson :: learn multiple
|= gaz=(list telegram)
@ -2084,14 +2094,14 @@
+>.$(log (~(del by log) man))
::
++ prep
|= [old=(unit house-any)]
^- (quip move +>)
|= old=(unit house-any)
^- (quip move ..prep)
?~ old
ra-abet:ra-init:ra
|-
?- -.u.old
%1 $(u.old [%2 stories general outbox folks shells ~]:u.old)
%2 $(u.old [%3 stories general outbox folks shells log ~ ~]:u.old)
%3 [~ +>.^$(+<+ u.old)]
%4 [~ ..prep(+<+ u.old)]
%3 =< ^$(-.u.old %4, stories.u.old (~(run by stories.u.old) .))
|=(story-3 `story`+<(cabalers [cabalers glyphers=*(set bone)]))
==
--

View File

@ -588,44 +588,41 @@
--
::
++ pojo :: print json
=| rez=tape
|= val=json
^- tape
?~ val "null"
?~ val (weld "null" rez)
?- -.val
%a
;: weld
"["
=| rez=tape
|- ^+ rez
?~ p.val rez
$(p.val t.p.val, rez :(weld rez ^$(val i.p.val) ?~(t.p.val ~ ",")))
"]"
==
:- '['
=. rez [']' rez]
!.
?~ p.val rez
|-
?~ t.p.val ^$(val i.p.val)
^$(val i.p.val, rez [',' $(p.val t.p.val)])
::
%b ?:(p.val "true" "false")
%n (trip p.val)
%b (weld ?:(p.val "true" "false") rez)
%n (weld (trip p.val) rez)
%s
;: welp
"\""
%+ reel
(turn (trip p.val) jesc)
|=([p=tape q=tape] (welp +<))
"\""
==
:- '"'
=. rez ['"' rez]
=+ viz=(trip p.val)
!.
|-
?~ viz rez
(weld (jesc i.viz) $(viz t.viz))
::
%o
;: welp
"\{"
=+ viz=(~(tap by p.val) ~)
=| rez=tape
|- ^+ rez
?~ viz rez
%= $
viz t.viz
rez
:(welp rez "\"" (trip p.i.viz) "\":" ^$(val q.i.viz) ?~(t.viz ~ ","))
==
"}"
==
:- '{'
=. rez ['}' rez]
=+ viz=(~(tap by p.val))
?~ viz rez
!.
|- ^+ rez
?~ t.viz ^$(val [%s p.i.viz], rez [':' ^$(val q.i.viz)])
=. rez [',' $(viz t.viz)]
^$(val [%s p.i.viz], rez [':' ^$(val q.i.viz)])
==
::
::

View File

@ -13,8 +13,8 @@
=- |= tub=nail ^- (like ,@t) %. tub :: export context
=+(poxa enty(ent mapping))
^- mapping=(map span ,@tF)
=+ pax=/==1%%/'html5-entities.json'/txt :: XX %%/
=+ maf=%.(pax ;~(biff file (soft ,@t) poja (om so):jo))
=+ pax=/==5%%/html5-entities/json :: XX %%/
=+ maf=%.(pax ;~(biff file (soft json) (om so):jo))
?^ maf u.maf
~& no-enty/pax
(mo amp/'&' quot/'"' apos/'\'' lt/'<' gt/'>' ~) :: fallback

View File

@ -21,6 +21,7 @@
?- -.rep
%cabal (cabl +.rep)
%house a/(turn (~(tap by +.rep)) jose)
%glyph ((jome |=(a=char a) nack) +.rep)
%grams (jobe num/(jone p.rep) tele/[%a (turn q.rep gram)] ~)
%group (jobe local/(grop p.rep) global/%.(q.rep (jome parn grop)) ~)
==
@ -54,6 +55,7 @@
|=(c=_[+<.a +<.b] [(a -.c) (b +.c)])
::
::
++ nack |=(a=(set (set partner)) [%a (turn (~(tap in a)) sorc)])
++ grop (jome phon stas) :: (map ship status)
++ phon |=(a=ship (scot %p a))
++ stas |=(status (jobe presence/(joce p) human/(huma q) ~))
@ -125,10 +127,14 @@
ham/((jome stat conf) ham)
==
::
++ sorc
|= a=(set partner) ^- json
[%a (turn (~(tap in a)) |=(b=partner s/(parn b)))]
::
++ conf
|= config
%- jobe :~
sources/[%a (turn (~(tap in sources)) |=(a=partner [%s (parn a)]))]
sources/(sorc sources)
caption/[%s caption]
=- cordon/(jobe posture/[%s -.cordon] list/[%a -] ~)
(turn (~(tap in q.cordon)) jope) :: XX jase

View File

@ -61,7 +61,8 @@ module.exports =
[speech]
else
{say,txt} = speech.lin
txt.match(/(.{1,64}$|.{0,64} |.{64}|.+$)/g).map (s)->
txt.match(/(.{1,64}$|.{0,64} |.{64}|.+$)/g).map (s,i)->
say ||= i isnt 0
lin: {say, txt:
if s.slice -1 isnt " "
s

View File

@ -7,6 +7,12 @@ module.exports =
station:station
config:config
loadGlyphs: (glyphs) ->
StationDispatcher.handleServerAction
type: "glyphs-load"
station:station
glyphs:glyphs
switchStation: (station) ->
StationDispatcher.handleViewAction
type:"station-switch"
@ -67,4 +73,4 @@ module.exports =
StationDispatcher.handleViewAction
type: "station-create"
station: station
window.talk.StationPersistence.createStation station
window.talk.StationPersistence.createStation station

View File

@ -7,5 +7,6 @@ module.exports = recl
k = "ship"
k+= " #{@props.presence}" if @props.presence
div {className:"iden"}, [
# div {}, @props.glyph || "*"
div {className:k}, @props.ship
]

View File

@ -1,7 +1,8 @@
moment = require 'moment-timezone'
clas = require 'classnames'
recl = React.createClass
{div,pre,br,input,textarea,a} = React.DOM
{div,pre,br,span,input,textarea,a} = React.DOM
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
@ -10,6 +11,7 @@ StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
Message = recl
displayName: "Message"
lz: (n) -> if n<10 then "0#{n}" else "#{n}"
convTime: (time) ->
@ -39,42 +41,42 @@ Message = recl
else "Unknown speech type:" + (" %"+x for x of speech).join ''
render: ->
# pendingClass = if @props.pending isnt "received" then "pending" else ""
# pendingClass = clas pending: @props.pending isnt "received"
delivery = _.uniq _.pluck @props.thought.audience, "delivery"
klass = if delivery.indexOf("received") isnt -1 then " received" else " pending"
speech = @props.thought.statement.speech
attachments = []
while speech.fat?
attachments.push pre {}, speech.fat.tor.tank.join("\n")
speech = speech.fat.taf # XX
if !speech? then return;
if speech.lin?.say is false then klass += " say"
if speech.url then klass += " url"
if @props.unseen is true then klass += " new"
if @props.sameAs is true then klass += " same" else klass += " first"
name = if @props.name then @props.name else ""
aude = _.keys @props.thought.audience
audi = window.util.clipAudi(aude).map (_audi) -> (div {}, _audi.slice(1))
type = ['private','public']
type = type[Number(aude.indexOf(window.util.mainStationPath(window.urb.user)) is -1)]
mess = @renderSpeech speech
klass += switch
when speech.app? then " say"
when speech.exp? then " exp"
else ""
mainStation = window.util.mainStationPath(window.urb.user)
type = if mainStation in aude then 'private' else 'public'
className = clas {message:true},
(if @props.sameAs then "same" else "first"),
(if delivery.indexOf("received") isnt -1 then "received" else "pending"),
{say: speech.lin?.say is false, url: speech.url, 'new': @props.unseen},
switch
when speech.app? then "say"
when speech.exp? then "exp"
div {className:"message#{klass}"}, [
div {className}, [
(div {className:"attr"}, [
div {className:"type #{type}"}, ""
(div {onClick:@_handlePm}, (React.createElement Member,{ship:@props.ship}))
(div {onClick:@_handlePm},
(React.createElement Member,{ship:@props.ship,glyph:@props.glyph}))
div {onClick:@_handleAudi,className:"audi"}, audi
div {className:"time"}, @convTime @props.thought.statement.date
])
div {className:"mess"}, mess,
div {className:"mess"},
(span {className:"glyph"}, @props.glyph || "*"), " ", # XX css
(@renderSpeech speech)
if attachments.length
div {className:"fat"}, attachments
]
@ -93,6 +95,7 @@ module.exports = recl
stations:StationStore.getStations()
configs:StationStore.getConfigs()
typing:MessageStore.getTyping()
glyph:StationStore.getGlyphMap()
}
getInitialState: -> @stateFromStore()
@ -194,14 +197,18 @@ module.exports = recl
lastIndex = if @lastSeen then _messages.indexOf(@lastSeen)+1 else null
lastSaid = null
messages = _messages.map (_message,k) =>
if lastIndex and lastIndex is k then _message.unseen = true
div {id: "messages"}, _messages.map (_message,k) =>
nowSaid = [_message.ship,_message.thought.audience]
{station} = @state
mess = {
station, @_handlePm, @_handleAudi,
glyph: @state.glyph[(_.keys _message.thought.audience).join " "]
unseen: lastIndex and lastIndex is k
sameAs: _.isEqual lastSaid, nowSaid
}
lastSaid = nowSaid
if _message.thought.statement.speech?.app
_message.ship = "system"
_message.sameAs = lastSaid is _message.ship
_message.station = @state.station
_message._handlePm = @_handlePm
_message._handleAudi = @_handleAudi
lastSaid = _message.ship
React.createElement Message,_message
div {id: "messages"}, messages
mess.ship = "system"
React.createElement Message, (_.extend {}, _message, mess)

View File

@ -37,7 +37,7 @@ module.exports = {
return window.talk.MessagePersistence.get(station, start, end);
},
sendMessage: function(message, audience) {
var _audi, _message, i, k, len, ref, ref1, results, say, serial, speech, speeches, txt, v;
var _audi, _message, j, k, len, ref, ref1, results, say, serial, speech, speeches, txt, v;
serial = window.util.uuid32();
audience = _.uniq(audience);
_audi = {};
@ -69,7 +69,8 @@ module.exports = {
url: message
};
}
speeches = !(((ref = speech.lin) != null ? ref.txt.length : void 0) > 64) ? [speech] : ((ref1 = speech.lin, say = ref1.say, txt = ref1.txt, ref1), txt.match(/(.{1,64}$|.{0,64} |.{64}|.+$)/g).map(function(s) {
speeches = !(((ref = speech.lin) != null ? ref.txt.length : void 0) > 64) ? [speech] : ((ref1 = speech.lin, say = ref1.say, txt = ref1.txt, ref1), txt.match(/(.{1,64}$|.{0,64} |.{64}|.+$)/g).map(function(s, i) {
say || (say = i !== 0);
return {
lin: {
say: say,
@ -78,8 +79,8 @@ module.exports = {
};
}));
results = [];
for (i = 0, len = speeches.length; i < len; i++) {
speech = speeches[i];
for (j = 0, len = speeches.length; j < len; j++) {
speech = speeches[j];
_message = {
ship: window.urb.ship,
thought: {
@ -117,6 +118,13 @@ module.exports = {
config: config
});
},
loadGlyphs: function(glyphs) {
return StationDispatcher.handleServerAction({
type: "glyphs-load",
station: station,
glyphs: glyphs
});
},
switchStation: function(station) {
return StationDispatcher.handleViewAction({
type: "station-switch",
@ -222,13 +230,16 @@ module.exports = recl({
},{}],4:[function(require,module,exports){
var Member, Message, MessageActions, MessageStore, StationActions, StationStore, a, br, div, input, moment, pre, recl, ref, textarea;
var Member, Message, MessageActions, MessageStore, StationActions, StationStore, a, br, clas, div, input, moment, pre, recl, ref, span, textarea,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
moment = require('moment-timezone');
clas = require('classnames');
recl = React.createClass;
ref = React.DOM, div = ref.div, pre = ref.pre, br = ref.br, input = ref.input, textarea = ref.textarea, a = ref.a;
ref = React.DOM, div = ref.div, pre = ref.pre, br = ref.br, span = ref.span, input = ref.input, textarea = ref.textarea, a = ref.a;
MessageActions = require('../actions/MessageActions.coffee');
@ -299,9 +310,8 @@ Message = recl({
}
},
render: function() {
var attachments, aude, audi, delivery, klass, mess, name, ref1, speech, type;
var attachments, aude, audi, className, delivery, mainStation, name, ref1, speech, type;
delivery = _.uniq(_.pluck(this.props.thought.audience, "delivery"));
klass = delivery.indexOf("received") !== -1 ? " received" : " pending";
speech = this.props.thought.statement.speech;
attachments = [];
while (speech.fat != null) {
@ -311,40 +321,29 @@ Message = recl({
if (speech == null) {
return;
}
if (((ref1 = speech.lin) != null ? ref1.say : void 0) === false) {
klass += " say";
}
if (speech.url) {
klass += " url";
}
if (this.props.unseen === true) {
klass += " new";
}
if (this.props.sameAs === true) {
klass += " same";
} else {
klass += " first";
}
name = this.props.name ? this.props.name : "";
aude = _.keys(this.props.thought.audience);
audi = window.util.clipAudi(aude).map(function(_audi) {
return div({}, _audi.slice(1));
});
type = ['private', 'public'];
type = type[Number(aude.indexOf(window.util.mainStationPath(window.urb.user)) === -1)];
mess = this.renderSpeech(speech);
klass += (function() {
mainStation = window.util.mainStationPath(window.urb.user);
type = indexOf.call(aude, mainStation) >= 0 ? 'private' : 'public';
className = clas({
message: true
}, (this.props.sameAs ? "same" : "first"), (delivery.indexOf("received") !== -1 ? "received" : "pending"), {
say: ((ref1 = speech.lin) != null ? ref1.say : void 0) === false,
url: speech.url,
'new': this.props.unseen
}, (function() {
switch (false) {
case speech.app == null:
return " say";
return "say";
case speech.exp == null:
return " exp";
default:
return "";
return "exp";
}
})();
})());
return div({
className: "message" + klass
className: className
}, [
div({
className: "attr"
@ -354,7 +353,8 @@ Message = recl({
}, ""), div({
onClick: this._handlePm
}, React.createElement(Member, {
ship: this.props.ship
ship: this.props.ship,
glyph: this.props.glyph
})), div({
onClick: this._handleAudi,
className: "audi"
@ -363,7 +363,9 @@ Message = recl({
}, this.convTime(this.props.thought.statement.date))
]), div({
className: "mess"
}, mess, attachments.length ? div({
}, span({
className: "glyph"
}, this.props.glyph || "*"), " ", this.renderSpeech(speech), attachments.length ? div({
className: "fat"
}, attachments) : void 0)
]);
@ -383,7 +385,8 @@ module.exports = recl({
station: window.util.mainStation(),
stations: StationStore.getStations(),
configs: StationStore.getConfigs(),
typing: MessageStore.getTyping()
typing: MessageStore.getTyping(),
glyph: StationStore.getGlyphMap()
};
},
getInitialState: function() {
@ -482,7 +485,7 @@ module.exports = recl({
return StationActions.setAudience(audi);
},
render: function() {
var _messages, _station, lastIndex, lastSaid, messages, ref1, ref2, ref3, sources, station;
var _messages, _station, lastIndex, lastSaid, ref1, ref2, ref3, sources, station;
station = this.state.station;
_station = "~" + window.urb.ship + "/" + station;
sources = _.clone((ref1 = (ref2 = this.state.configs[this.state.station]) != null ? ref2.sources : void 0) != null ? ref1 : []);
@ -502,32 +505,34 @@ module.exports = recl({
})(this), 1);
lastIndex = this.lastSeen ? _messages.indexOf(this.lastSeen) + 1 : null;
lastSaid = null;
messages = _messages.map((function(_this) {
return function(_message, k) {
var ref4;
if (lastIndex && lastIndex === k) {
_message.unseen = true;
}
if ((ref4 = _message.thought.statement.speech) != null ? ref4.app : void 0) {
_message.ship = "system";
}
_message.sameAs = lastSaid === _message.ship;
_message.station = _this.state.station;
_message._handlePm = _this._handlePm;
_message._handleAudi = _this._handleAudi;
lastSaid = _message.ship;
return React.createElement(Message, _message);
};
})(this));
return div({
id: "messages"
}, messages);
}, _messages.map((function(_this) {
return function(_message, k) {
var mess, nowSaid, ref4;
nowSaid = [_message.ship, _message.thought.audience];
station = _this.state.station;
mess = {
station: station,
_handlePm: _this._handlePm,
_handleAudi: _this._handleAudi,
glyph: _this.state.glyph[(_.keys(_message.thought.audience)).join(" ")],
unseen: lastIndex && lastIndex === k,
sameAs: _.isEqual(lastSaid, nowSaid)
};
lastSaid = nowSaid;
if ((ref4 = _message.thought.statement.speech) != null ? ref4.app : void 0) {
mess.ship = "system";
}
return React.createElement(Message, _.extend({}, _message, mess));
};
})(this)));
}
});
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":19,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3,"moment-timezone":14}],5:[function(require,module,exports){
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":20,"../stores/StationStore.coffee":21,"./MemberComponent.coffee":3,"classnames":10,"moment-timezone":15}],5:[function(require,module,exports){
var Member, StationActions, StationStore, a, div, h1, input, recl, ref, textarea;
recl = React.createClass;
@ -714,7 +719,7 @@ module.exports = recl({
},{"../actions/StationActions.coffee":2,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3}],6:[function(require,module,exports){
},{"../actions/StationActions.coffee":2,"../stores/StationStore.coffee":21,"./MemberComponent.coffee":3}],6:[function(require,module,exports){
var Audience, Member, MessageActions, MessageStore, PO, SHIPSHAPE, StationActions, StationStore, br, div, input, recl, ref, textarea;
recl = React.createClass;
@ -1004,7 +1009,7 @@ module.exports = recl({
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":19,"../stores/StationStore.coffee":20,"./MemberComponent.coffee":3}],7:[function(require,module,exports){
},{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":20,"../stores/StationStore.coffee":21,"./MemberComponent.coffee":3}],7:[function(require,module,exports){
var Dispatcher;
Dispatcher = require('flux').Dispatcher;
@ -1026,7 +1031,7 @@ module.exports = _.merge(new Dispatcher(), {
},{"flux":10}],8:[function(require,module,exports){
},{"flux":11}],8:[function(require,module,exports){
$(function() {
var $c, MessagesComponent, StationActions, StationComponent, WritingComponent, clean, rend;
StationActions = require('./actions/StationActions.coffee');
@ -1057,7 +1062,7 @@ $(function() {
},{"./actions/StationActions.coffee":2,"./components/MessagesComponent.coffee":4,"./components/StationComponent.coffee":5,"./components/WritingComponent.coffee":6,"./move.coffee":9,"./persistence/MessagePersistence.coffee":17,"./persistence/StationPersistence.coffee":18,"./util.coffee":21}],9:[function(require,module,exports){
},{"./actions/StationActions.coffee":2,"./components/MessagesComponent.coffee":4,"./components/StationComponent.coffee":5,"./components/WritingComponent.coffee":6,"./move.coffee":9,"./persistence/MessagePersistence.coffee":18,"./persistence/StationPersistence.coffee":19,"./util.coffee":22}],9:[function(require,module,exports){
var ldy, setSo, so;
so = {};
@ -1159,6 +1164,56 @@ $(window).on('scroll', window.util.checkScroll);
},{}],10:[function(require,module,exports){
/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = '';
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes += ' ' + arg;
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes += ' ' + key;
}
}
}
}
return classes.substr(1);
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
// register as 'classnames', consistent with npm package name
define('classnames', function () {
return classNames;
});
} else {
window.classNames = classNames;
}
}());
},{}],11:[function(require,module,exports){
/**
* Copyright (c) 2014-2015, Facebook, Inc.
* All rights reserved.
@ -1170,7 +1225,7 @@ $(window).on('scroll', window.util.checkScroll);
module.exports.Dispatcher = require('./lib/Dispatcher')
},{"./lib/Dispatcher":11}],11:[function(require,module,exports){
},{"./lib/Dispatcher":12}],12:[function(require,module,exports){
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -1422,7 +1477,7 @@ var _prefix = 'ID_';
module.exports = Dispatcher;
},{"./invariant":12}],12:[function(require,module,exports){
},{"./invariant":13}],13:[function(require,module,exports){
/**
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
@ -1477,7 +1532,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) {
module.exports = invariant;
},{}],13:[function(require,module,exports){
},{}],14:[function(require,module,exports){
module.exports={
"version": "2014j",
"zones": [
@ -2067,11 +2122,11 @@ module.exports={
"Pacific/Pohnpei|Pacific/Ponape"
]
}
},{}],14:[function(require,module,exports){
},{}],15:[function(require,module,exports){
var moment = module.exports = require("./moment-timezone");
moment.tz.load(require('./data/packed/latest.json'));
},{"./data/packed/latest.json":13,"./moment-timezone":15}],15:[function(require,module,exports){
},{"./data/packed/latest.json":14,"./moment-timezone":16}],16:[function(require,module,exports){
//! moment-timezone.js
//! version : 0.2.5
//! author : Tim Wood
@ -2474,7 +2529,7 @@ moment.tz.load(require('./data/packed/latest.json'));
return moment;
}));
},{"moment":16}],16:[function(require,module,exports){
},{"moment":17}],17:[function(require,module,exports){
//! moment.js
//! version : 2.10.6
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@ -5670,7 +5725,7 @@ moment.tz.load(require('./data/packed/latest.json'));
return _moment;
}));
},{}],17:[function(require,module,exports){
},{}],18:[function(require,module,exports){
var MessageActions, send;
MessageActions = require('../actions/MessageActions.coffee');
@ -5744,7 +5799,7 @@ module.exports = {
},{"../actions/MessageActions.coffee":1}],18:[function(require,module,exports){
},{"../actions/MessageActions.coffee":1}],19:[function(require,module,exports){
var StationActions, design, send;
StationActions = require('../actions/StationActions.coffee');
@ -5825,14 +5880,14 @@ module.exports = {
});
},
listenStation: function(station) {
return window.urb.bind("/ax/" + station, function(err, res) {
return window.urb.bind("/avx/" + station, function(err, res) {
var ref;
if (err || !res) {
console.log('/ax/ err');
console.log('/avx/ err');
console.log(err);
return;
}
console.log('/ax/');
console.log('/avx/');
console.log(res.data);
if (res.data.ok === true) {
StationActions.listeningStation(station);
@ -5842,7 +5897,10 @@ module.exports = {
StationActions.loadMembers(res.data.group.global);
}
if ((ref = res.data.cabal) != null ? ref.loc : void 0) {
return StationActions.loadConfig(station, res.data.cabal.loc);
StationActions.loadConfig(station, res.data.cabal.loc);
}
if (res.data.glyph) {
return StationActions.loadGlyphs(res.data.glyph);
}
});
}
@ -5850,7 +5908,7 @@ module.exports = {
},{"../actions/StationActions.coffee":2}],19:[function(require,module,exports){
},{"../actions/StationActions.coffee":2}],20:[function(require,module,exports){
var EventEmitter, MessageDispatcher, MessageStore, _fetching, _last, _listening, _messages, _station, _typing, moment;
moment = require('moment-timezone');
@ -5997,8 +6055,8 @@ module.exports = MessageStore;
},{"../dispatcher/Dispatcher.coffee":7,"events":22,"moment-timezone":14}],20:[function(require,module,exports){
var EventEmitter, StationDispatcher, StationStore, _audience, _config, _listening, _members, _station, _stations, _typing, _validAudience;
},{"../dispatcher/Dispatcher.coffee":7,"events":23,"moment-timezone":15}],21:[function(require,module,exports){
var EventEmitter, StationDispatcher, StationStore, _audience, _config, _glyphs, _listening, _members, _shpylg, _station, _stations, _typing, _validAudience;
EventEmitter = require('events').EventEmitter;
@ -6018,6 +6076,10 @@ _config = {};
_typing = {};
_glyphs = {};
_shpylg = {};
_validAudience = true;
StationStore = _.merge(new EventEmitter, {
@ -6058,6 +6120,19 @@ StationStore = _.merge(new EventEmitter, {
getConfig: function(station) {
return _config[station];
},
getGlyph: function(station) {
return _shpylg[station];
},
getGlyphMap: function() {
return _shpylg;
},
getGlyphAudience: function(glyph) {
var aud, ref;
aud = (ref = _glyphs[glyph]) != null ? ref : [];
if (aud.length === 1) {
return aud[0];
}
},
getMember: function(ship) {
return {
ship: ship
@ -6105,6 +6180,25 @@ StationStore = _.merge(new EventEmitter, {
loadStations: function(stations) {
return _stations = stations;
},
loadGlyphs: function(glyphs) {
var aud, auds, char, results;
_glyphs = glyphs;
_shpylg = {};
results = [];
for (char in glyphs) {
auds = glyphs[char];
results.push((function() {
var i, len, results1;
results1 = [];
for (i = 0, len = auds.length; i < len; i++) {
aud = auds[i];
results1.push(_shpylg[aud.join(" ")] = char);
}
return results1;
})());
}
return results;
},
getStations: function() {
return _stations;
},
@ -6169,6 +6263,10 @@ StationStore.dispatchToken = StationDispatcher.register(function(payload) {
StationStore.loadConfig(action.station, action.config);
StationStore.emitChange();
break;
case "glyphs-load":
StationStore.loadGlyphs(action.glyphs);
StationStore.emitChange();
break;
case "stations-load":
StationStore.loadStations(action.stations);
StationStore.emitChange();
@ -6197,7 +6295,7 @@ module.exports = StationStore;
},{"../dispatcher/Dispatcher.coffee":7,"events":22}],21:[function(require,module,exports){
},{"../dispatcher/Dispatcher.coffee":7,"events":23}],22:[function(require,module,exports){
if (!window.util) {
window.util = {};
}
@ -6309,7 +6407,7 @@ _.merge(window.util, {
},{}],22:[function(require,module,exports){
},{}],23:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a

View File

@ -2,12 +2,13 @@
"name": "urbit-talk",
"version": "0.0.0",
"repository": {
"type":"git",
"url":"https://github.com/urbit/urbit"
"type": "git",
"url": "https://github.com/urbit/urbit"
},
"description": "urbit talk frontend",
"main": "main.js",
"dependencies": {
"classnames": "^2.2.0",
"coffeeify": "~0.7.0",
"flux": "~2.0.1",
"lodash": "~2.4.1",

View File

@ -38,12 +38,12 @@ module.exports =
if res.data.house
StationActions.loadStations res.data.house
listenStation: (station) -> window.urb.bind "/ax/#{station}", (err,res) ->
listenStation: (station) -> window.urb.bind "/avx/#{station}", (err,res) ->
if err or not res
console.log '/ax/ err'
console.log '/avx/ err'
console.log err
return
console.log('/ax/')
console.log('/avx/')
console.log(res.data)
if res.data.ok is true
StationActions.listeningStation station
@ -53,3 +53,5 @@ module.exports =
StationActions.loadMembers res.data.group.global
if res.data.cabal?.loc
StationActions.loadConfig station,res.data.cabal.loc
if res.data.glyph
StationActions.loadGlyphs res.data.glyph

View File

@ -9,6 +9,8 @@ _listening = []
_station = null
_config = {}
_typing = {}
_glyphs = {}
_shpylg = {}
_validAudience = true
@ -38,6 +40,15 @@ StationStore = _.merge new EventEmitter,{
getConfigs: -> _config
getConfig: (station) -> _config[station]
getGlyph: (station) -> _shpylg[station]
getGlyphMap: -> _shpylg
getGlyphAudience: (glyph) ->
aud = _glyphs[glyph] ? []
if aud.length is 1
aud[0]
getMember: (ship) -> {ship:ship}
@ -62,6 +73,13 @@ StationStore = _.merge new EventEmitter,{
_stations.push(station) if _stations.indexOf(station) is -1
loadStations: (stations) -> _stations = stations
loadGlyphs: (glyphs) ->
_glyphs = glyphs
_shpylg = {}
for char,auds of glyphs
for aud in auds
_shpylg[aud.join " "] = char
getStations: -> _stations
@ -115,6 +133,10 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.loadConfig action.station,action.config
StationStore.emitChange()
break
when "glyphs-load" #[name:'loadConfig', args:['station', 'config']]
StationStore.loadGlyphs action.glyphs
StationStore.emitChange()
break
when "stations-load"
StationStore.loadStations action.stations
StationStore.emitChange()
@ -140,4 +162,4 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
StationStore.emitChange()
break
module.exports = StationStore
module.exports = StationStore

View File

@ -51,6 +51,7 @@
[%grams (pair ,@ud (list telegram))] :: beginning, thoughts
[%group register] :: presence
[%house shelf] :: station set
[%glyph (jug char (set partner))] :: relevant binding
== ::
++ speech :: narrative action
$% [%lan p=span q=@t] :: local announce