Merge pull request #507 from Fang-/hall-command-mark

Add json conversions to &hall-command.
This commit is contained in:
Ted Blackman 2017-12-16 10:23:09 -08:00 committed by GitHub
commit 60b4024516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 17 deletions

View File

@ -11,5 +11,30 @@
++ grab :: convert from
|%
++ noun command :: from %noun
++ json :: from %json
=> [. dejs:hall-json] ::TODO =,
=, dejs-soft:format
|= a/json
^- command:hall
=- (need ((of -) a))
:~ publish+(ar thot)
present+(ot nos+(as so) dif+disa ~)
:: bearing not needed
==
--
::
++ grow :: convert to
|%
++ json :: to %json
=> [. enjs:hall-json] ::TODO =,
=, enjs:format
%+ frond -.cod
:: only %publish has just a single piece of data.
?: ?=($publish -.cod) a+(turn tos.cod thot)
%- pairs
?+ -.cod !!
$present ~[nos+(sa nos.cod cord:enjs:hall-json) dif+(disa dif.cod)]
:: bearing nto needed
==
--
--

View File

@ -1212,7 +1212,7 @@ module.exports = recl({
return;
}
if (this.props['audience-lock'] != null) {
audi = _.union(audi, ["~" + window.urb.ship + "/" + this.props.station]);
audi = ["~" + window.urb.ship + "/" + this.props.station];
}
audi = this.addCC(audi);
txt = this.$message.text().trim().replace(/\xa0/g, ' ');
@ -1542,18 +1542,12 @@ TreeActions.registerComponent("talk-station", StationComponent);
},{"./actions/StationActions.coffee":2,"./components/MessageListComponent.coffee":6,"./components/StationComponent.coffee":7,"./components/WritingComponent.coffee":8,"./util.coffee":15}],11:[function(require,module,exports){
var send, util;
var util;
util = require('../util.coffee');
window.urb.appl = "hall";
send = function(data, cb) {
return window.urb.send(data, {
mark: "hall-action"
}, cb);
};
module.exports = function(arg) {
var MessageActions;
MessageActions = arg.MessageActions;
@ -1624,15 +1618,31 @@ module.exports = function(arg) {
});
},
sendMessage: function(message, cb) {
return send({
convey: [message]
}, function(err, res) {
console.log('sent');
console.log(arguments);
if (cb) {
return cb(err, res);
}
});
if (window.urb.user === window.urb.ship) {
return window.urb.send({
convey: [message]
}, {
mark: "hall-action"
}, function(err, res) {
console.log('sent local');
console.log(arguments);
if (cb) {
return cb(err, res);
}
});
} else {
return window.urb.send({
publish: [message]
}, {
mark: "hall-command"
}, function(err, res) {
console.log('sent remote');
console.log(arguments);
if (cb) {
return cb(err, res);
}
});
}
}
};
};