diff --git a/ape/talk.hoon b/ape/talk.hoon index 5651dcc4e6..f67efda5d6 100644 --- a/ape/talk.hoon +++ b/ape/talk.hoon @@ -179,7 +179,10 @@ ++ nump :: number reference ;~ pose ;~(pfix hep dem:ag) - ;~(plug (cook lent (plus (just '0'))) dem:ag) + ;~ plug + (cook lent (plus (just '0'))) + ;~(pose dem:ag (easy 0)) + == (stag 0 dem:ag) == :: @@ -356,7 +359,7 @@ :: =+ pad=(sub 36 (lent bun)) :: =+ now=`@da`(dis now.hid 0xffff.ffff.ffff.ffff.0000.0000.0000.0000) %+ sh-fact %txt - (runt [(sub 15 (lent bun)) '-'] "[{bun}]") + (runt [(sub 13 (lent bun)) '-'] "[{bun}]") :: ++ sh-repo-house-diff |= [one=shelf two=shelf] @@ -1055,7 +1058,9 @@ =. ..sh-fact (sh-fact %txt "? {(scow %s (new:si | +(num)))}") (activate (snag num grams.roy)) ?. (gth q.num count.roy) - =+ msg=(deli count.roy num) + ?~ count.roy + (sh-lame "0: no messages") + =+ msg=(deli (dec count.roy) num) =. ..sh-fact (sh-fact %txt "? {(scow %ud msg)}") (activate (snag (sub count.roy +(msg)) grams.roy)) (sh-lame "…{(reap p.num '0')}{(scow %ud q.num)}: no such telegram") @@ -1748,7 +1753,7 @@ ^- tape ?: =(p.one our.hid) ?: =(q.one man) - "=" + ":" ['%' (trip q.one)] ?: =(p.one (sein our.hid)) ['/' (trip q.one)] @@ -1841,16 +1846,24 @@ ++ te-whom :: render sender (~(ta-show ta man (need te-best)) ~ te-maud) :: + ++ ta-dire :: direct message + |= pan=partner ^- ? + ?& ?=(& -.pan) + =(p.p.pan our.hid) + :: + =+ sot=(~(get by stories) q.p.pan) + &(?=(^ sot) ?=(%brown p.cordon.shape.u.sot)) + == + :: ++ te-pref :: audience glyph ^- tape =+ cha=(~(get by nik) lix) ?^ cha ~[u.cha ' '] - ?. ?=([[& ^] ~ ~] lix) "* " - =+ sta=p.n.lix - =+ sot=(~(get by stories) q.sta) - ?: &(=(p.sta our.hid) ?=(^ sot) ?=(%brown p.cordon.shape.u.sot)) + ?. (lien (~(tap by lix)) ta-dire) + "* " + ?: ?=([[& ^] ~ ~] lix) ": " - "* " + "; " -- :: ++ tr :: telegram renderer @@ -1944,7 +1957,10 @@ %lin =+ txt=(trip q.sep) ?: p.sep - (weld ~(te-pref te man tr-pals) txt) + =+ pal=tr-pals + =. pal ?: =(who our.hid) pal + (~(del in pal) [%& who (main who)]) + (weld ~(te-pref te man pal) txt) ?: oug (weld "@ " txt) (weld " " txt) diff --git a/arvo/gall.hoon b/arvo/gall.hoon index 646ef2d901..671435c039 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -700,7 +700,7 @@ ^- [? _.] =+ suy=(fall (~(get by qel.ged) ost) 0) ?: =(20 suy) - ~& [%ap-fill-full [our dap] q.q.pry ost] + :: ~& [%ap-fill-full [our dap] q.q.pry ost] [%| +] :: ~? !=(20 suy) [%ap-fill-add [[our dap] q.q.pry ost] +(suy)] [%& +(qel.ged (~(put by qel.ged) ost +(suy)))] diff --git a/pub/docs/user/talk.mdy b/pub/docs/user/talk.mdy index 16759a0165..022a06cfa1 100644 --- a/pub/docs/user/talk.mdy +++ b/pub/docs/user/talk.mdy @@ -126,7 +126,7 @@ insert a Unicode bullet-point character in an appropriate space in your post, to show you the prospective linebreak. Your essay will be posted in multiple lines. -A URL is any valid URL. A command is any line starting with `;`. +A URL is any valid URL. A command is any line starting with `;`. ### Source annotation @@ -138,13 +138,23 @@ Any post you see reached you in one of three ways. Either it was sent directly to just you; to you and others; or to a station you subscribe to. -Posts to just you are `:`. Posts to you and others (a multiparty -conversation) are `*`, unless you've bound this conversation to a -glyph. Posts to a station use that station's glyph. +Informational messages are `|`. Posts directly to you are `:`. Posts to +you and others (a multiparty conversation) are `;`, unless you've bound +this conversation to a glyph. Posts to a station use that station's +glyph. Posts to a complex audience that doesn't directly include you are +`*`. + +### Station Glyphs + +Glyphs are assigned by station hash out of the lists `>=+-`, `}),.`, +``"'`^``, and `$%&@`, in decreasing order of preference, and cycling +back to the first in case of sufficient collisions. You can see a list of glyph bindings with `;what`. Write -`;what >` to see what station `>` is bound to, or -`;what /urbit-meta` to see if `/urbit-meta` has a binding. + +Alphanumeric characters and `|#;:*~_` are reserved; all others (the above +lists, and `\/!?({<`) can be manually assigned. `;bind > /urbit-test` +will assign the `>` annotation to `/urbit-test`. ### Audience selection @@ -228,6 +238,8 @@ most recent; etc. ### Nicknames +Not yet implemented + Sometimes you know your Urbit friends by other names, on or offline. Use the `;nick` command to assign or look up nicknames. @@ -253,6 +265,8 @@ lists everyone in that station. ### Typing indicator +Not yet implemented + If one or more urbits in your audience is typing, `:talk`'s presence system will detect it and change the prompt: @@ -260,6 +274,10 @@ presence system will detect it and change the prompt: ### Creating and managing stations + +Non-channel stations, and managing white/blacklists, +are a planned feature that is not yet implemented + To create your own mailbox, party, journal or board: ;create party %myfunparty @@ -284,10 +302,3 @@ To ban from `%bizarre-board`: To appoint a coauthor of `%serious-journal`: ;author %serious-journal ~lagret-marpub - -#### Station glyphs - -Station are assigned out of the list `:|}>`, then -randomly out of it and the sets `-+*.`, ``,=`'^\/``, -`$%&@`, and `{<[]()`, in decreasing order of probabilty. -Alphanumeric characters and `!#?;~_` are reserved. diff --git a/pub/talk/src/js/components/MessagesComponent.coffee b/pub/talk/src/js/components/MessagesComponent.coffee index a976ba4048..f775649ce4 100644 --- a/pub/talk/src/js/components/MessagesComponent.coffee +++ b/pub/talk/src/js/components/MessagesComponent.coffee @@ -94,7 +94,7 @@ module.exports = recl stations:StationStore.getStations() configs:StationStore.getConfigs() typing:MessageStore.getTyping() - glyph:StationStore.getGlyphMap() + glyphs:StationStore.getGlyphMap() } getInitialState: -> @stateFromStore() @@ -198,10 +198,10 @@ module.exports = recl div {id: "messages"}, _messages.map (_message,k) => nowSaid = [_message.ship,_message.thought.audience] + glyph = window.util.getGlyph @state.glyphs, _.keys _message.thought.audience {station} = @state mess = { - station, @_handlePm, @_handleAudi, - glyph: @state.glyph[(_.keys _message.thought.audience).join " "] + glyph, station, @_handlePm, @_handleAudi, unseen: lastIndex and lastIndex is k sameAs: _.isEqual lastSaid, nowSaid } diff --git a/pub/talk/src/js/main.js b/pub/talk/src/js/main.js index 9d933b93d1..943d99c975 100644 --- a/pub/talk/src/js/main.js +++ b/pub/talk/src/js/main.js @@ -385,7 +385,7 @@ module.exports = recl({ stations: StationStore.getStations(), configs: StationStore.getConfigs(), typing: MessageStore.getTyping(), - glyph: StationStore.getGlyphMap() + glyphs: StationStore.getGlyphMap() }; }, getInitialState: function() { @@ -508,14 +508,15 @@ module.exports = recl({ id: "messages" }, _messages.map((function(_this) { return function(_message, k) { - var mess, nowSaid, ref4; + var glyph, mess, nowSaid, ref4; nowSaid = [_message.ship, _message.thought.audience]; + glyph = window.util.getGlyph(_this.state.glyphs, _.keys(_message.thought.audience)); station = _this.state.station; mess = { + glyph: glyph, 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) }; @@ -6293,10 +6294,13 @@ if (!window.util) { _.merge(window.util, { mainStations: ["court", "floor", "porch"], mainStationPath: function(user) { + if (user == null) { + user = window.urb.user; + } return "~" + user + "/" + (window.util.mainStation(user)); }, mainStation: function(user) { - if (!user) { + if (user == null) { user = window.urb.user; } switch (user.length) { @@ -6308,10 +6312,22 @@ _.merge(window.util, { return "porch"; } }, + getGlyph: function(glyphs, audi) { + return glyphs[audi.join(" ")] || (function() { + switch (false) { + case !!_.contains(audi, window.util.mainStationPath()): + return "*"; + case audi.length !== 1: + return ":"; + default: + return ";"; + } + })(); + }, clipAudi: function(audi) { var ms, regx; audi = audi.join(" "); - ms = window.util.mainStationPath(window.urb.user); + ms = window.util.mainStationPath(); regx = new RegExp("/" + ms, "g"); audi = audi.replace(regx, ""); return audi.split(" "); @@ -6319,7 +6335,7 @@ _.merge(window.util, { expandAudi: function(audi) { var ms; audi = audi.join(" "); - ms = window.util.mainStationPath(window.urb.user); + ms = window.util.mainStationPath(); if (audi.indexOf(ms) === -1) { if (audi.length > 0) { audi += " "; diff --git a/pub/talk/src/js/util.coffee b/pub/talk/src/js/util.coffee index 23929aa24f..7841ab2fdf 100644 --- a/pub/talk/src/js/util.coffee +++ b/pub/talk/src/js/util.coffee @@ -2,10 +2,10 @@ if not window.util then window.util = {} _.merge window.util, mainStations: ["court","floor","porch"] - mainStationPath: (user) -> "~#{user}/#{window.util.mainStation(user)}" + mainStationPath: (user = window.urb.user) -> + "~#{user}/#{window.util.mainStation(user)}" - mainStation: (user) -> - if not user then user = window.urb.user + mainStation: (user = window.urb.user) -> switch user.length when 3 return "court" @@ -14,16 +14,24 @@ _.merge window.util, when 13 return "porch" + getGlyph: (glyphs, audi)-> + glyphs[audi.join " "] or switch + when not _.contains audi, window.util.mainStationPath() + "*" + when audi.length is 1 + ":" + else ";" + clipAudi: (audi) -> audi = audi.join " " - ms = window.util.mainStationPath window.urb.user + ms = window.util.mainStationPath() regx = new RegExp "/#{ms}","g" audi = audi.replace regx,"" audi.split " " expandAudi: (audi) -> audi = audi.join " " - ms = window.util.mainStationPath window.urb.user + ms = window.util.mainStationPath() if audi.indexOf(ms) is -1 if audi.length > 0 audi += " " @@ -82,4 +90,4 @@ _.merge window.util, if window.util.isScrolling() $('body').addClass 'scrolling' else - $('body').removeClass 'scrolling' \ No newline at end of file + $('body').removeClass 'scrolling'