diff --git a/customize.dist/src/less/toolbar.less b/customize.dist/src/less/toolbar.less index 4edd3800c..22b4183ad 100644 --- a/customize.dist/src/less/toolbar.less +++ b/customize.dist/src/less/toolbar.less @@ -138,11 +138,22 @@ body .userlist-drawer { color: black; font-size: 40px; } - .name { + .right-col { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + display: flex; + flex-flow: column; + .name { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .friend { + padding: 0; + } } media-tag { min-height: 50px; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 901d33079..5c1e748f9 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1185,6 +1185,21 @@ define([ return button; }; + // Messaging + var addDirectMessageHandler = function () { + var network = getNetwork(); + if (!network) { return void console.error('Network not ready'); } + network.on('message', function (msg, sender) { + if (sender === network.historyKeeper) { return; } + + }); + }; + common.inviteFromUserlist = function (netfluxId) { + var network = getNetwork(); + network.sendto(netfluxId, '["FRIEND_REQ", "Salut"]') + }; + + var emoji_patt = /([\uD800-\uDBFF][\uDC00-\uDFFF])/; var isEmoji = function (str) { @@ -1691,6 +1706,8 @@ define([ Store.ready(function (err, storeObj) { store = common.store = env.store = storeObj; + addDirectMessageHandler(); + var proxy = getProxy(); var network = getNetwork(); diff --git a/www/common/rpc.js b/www/common/rpc.js index 0ce061dcf..277aae0fd 100644 --- a/www/common/rpc.js +++ b/www/common/rpc.js @@ -200,7 +200,8 @@ types of messages: return sendMsg(ctx, data, cb); }; - network.on('message', function (msg) { + network.on('message', function (msg, sender) { + if (sender !== network.historyKeeper) { return; } onMsg(ctx, msg); }); @@ -305,6 +306,7 @@ types of messages: }; network.on('message', function (msg) { + if (sender !== network.historyKeeper) { return; } onAnonMsg(ctx, msg); }); diff --git a/www/common/toolbar2.js b/www/common/toolbar2.js index d225c0184..d343dc5b6 100644 --- a/www/common/toolbar2.js +++ b/www/common/toolbar2.js @@ -148,7 +148,8 @@ define([ //if (user !== userNetfluxId) { var data = userData[user] || {}; var userId = data.uid; - if (!data.uid) { return; } + if (!userId) { return; } + data.netfluxId = user; if (uids.indexOf(userId) === -1) {// && (!myUid || userId !== myUid)) { uids.push(userId); list.push(data); @@ -206,8 +207,17 @@ define([ // Editors editUsersNames.forEach(function (data) { var name = data.name || Messages.anonymous; - var $name = $('', {'class': 'name'}).text(name); var $span = $('', {'title': name}); + var $rightCol = $('', {'class': 'right-col'}); + var $name = $('', {'class': 'name'}).text(name).appendTo($rightCol); + // TODO: if account + var $button = $('