From 4c31d5307c81297617e43f7d035d1d8909b67bc9 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 8 Nov 2018 09:05:44 -0400 Subject: [PATCH] Displaying messages emitted by the user --- src/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 02578c9..5b6b3db 100644 --- a/src/index.js +++ b/src/index.js @@ -98,20 +98,20 @@ ui.logEntry(`Rejoining Channels....`); (async () => { const status = new StatusJS(); - - await status.connect("ws://localhost:8546"); - ui.logEntry(`PK: ${await status.getPublicKey()}`); + await status.connect("ws://localhost:8546"); + const pubKey = await status.getPublicKey(); + const userName = await status.getUserName(); + + ui.logEntry(`PK: ${pubKey}`); ui.logEntry(`-----------------------------------------------------------`); - /* const fs = require('fs'); fs.writeFile("/tmp/test", await status.getPublicKey(), function(err) { if(err) { return console.log(err); } }); - */ setInterval(function() { const channel = channels.getCurrentChannel(); @@ -146,6 +146,7 @@ ui.logEntry(`Rejoining Channels....`); if (JSON.parse(data.payload)[1][1] === 'content/json') { handleProtocolMessages(data.username, data); } else { + ui.logEntry(data.payload); channels.addMessage(data.username, msg, data.data.sig, data.username) } }) @@ -181,6 +182,7 @@ ui.logEntry(`Rejoining Channels....`); const channel = channels.getCurrentChannel(); if(channel.pubKey){ status.sendMessage(channel.pubKey, cmd); + channels.addMessage(channel.name, cmd, pubKey, userName); } else { status.sendMessage(channel.name, cmd); }