diff --git a/www/common/common-messaging.js b/www/common/common-messaging.js index 51777b607..59b2f16c6 100644 --- a/www/common/common-messaging.js +++ b/www/common/common-messaging.js @@ -1,8 +1,9 @@ define([ 'jquery', '/bower_components/chainpad-crypto/crypto.js', - '/common/curve.js' -], function ($, Crypto, Curve) { + '/common/curve.js', + '/bower_components/marked/marked.min.js', +], function ($, Crypto, Curve, Marked) { var Msg = {}; var Types = { @@ -19,6 +20,10 @@ define([ var ready = []; var pending = {}; + var parseMessage = function (content) { + return Marked(content); + }; + var createData = Msg.createData = function (common, hash) { var proxy = common.getProxy(); return { @@ -199,6 +204,7 @@ define([ var onChannelReady = function (common, chanId) { if (ready.indexOf(chanId) !== -1) { return; } ready.push(chanId); + channels[chanId].updateStatus(); var friends = getFriendList(common); if (ready.length === Object.keys(friends).length) { // All channels are ready @@ -220,8 +226,9 @@ define([ if (!isId) { return; } var decryptedMsg = channel.encryptor.decrypt(msg); + console.log(decryptedMsg); var parsed = JSON.parse(decryptedMsg); - if (parsed[0] !== Types.mapId && parsed[0] !== Types.mapidAck) { return; } + if (parsed[0] !== Types.mapId && parsed[0] !== Types.mapIdAck) { return; } if (parsed[2] !== sender || !parsed[1]) { return; } channel.mapId[sender] = parsed[1]; @@ -300,7 +307,9 @@ define([ // Input var channel = channels[data.channel]; - var $input = $('', {type: 'text'}).appendTo($inputBlock); + var $input = $('