|
|
@ -95,7 +95,7 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$remove.click(function (e) {
|
|
|
|
$remove.click(function (e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
Cryptpad.confirm("TODO: Are you sure?", function (yes) {
|
|
|
|
common.confirm("TODO: Are you sure?", function (yes) {
|
|
|
|
if (!yes) { return; }
|
|
|
|
if (!yes) { return; }
|
|
|
|
remove(data.edPublic);
|
|
|
|
remove(data.edPublic);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -142,12 +142,13 @@ define([
|
|
|
|
channel.messages.push([cryptMsg.slice(0,64), parsedMsg]);
|
|
|
|
channel.messages.push([cryptMsg.slice(0,64), parsedMsg]);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var proxy;
|
|
|
|
if (parsedMsg[0] === Types.update) {
|
|
|
|
if (parsedMsg[0] === Types.update) {
|
|
|
|
var proxy = common.getProxy();
|
|
|
|
proxy = common.getProxy();
|
|
|
|
if (parsedMsg[1] === common.getProxy().edPublic) { return; }
|
|
|
|
if (parsedMsg[1] === common.getProxy().edPublic) { return; }
|
|
|
|
var newdata = parsedMsg[3];
|
|
|
|
var newdata = parsedMsg[3];
|
|
|
|
var data = getFriend(common, parsedMsg[1]);
|
|
|
|
var data = getFriend(common, parsedMsg[1]);
|
|
|
|
var types = []
|
|
|
|
var types = [];
|
|
|
|
Object.keys(newdata).forEach(function (k) {
|
|
|
|
Object.keys(newdata).forEach(function (k) {
|
|
|
|
if (data[k] !== newdata[k]) {
|
|
|
|
if (data[k] !== newdata[k]) {
|
|
|
|
types.push(k);
|
|
|
|
types.push(k);
|
|
|
@ -158,7 +159,7 @@ define([
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (parsedMsg[0] === Types.unfriend) {
|
|
|
|
if (parsedMsg[0] === Types.unfriend) {
|
|
|
|
var proxy = common.getProxy();
|
|
|
|
proxy = common.getProxy();
|
|
|
|
if (parsedMsg[1] === common.getProxy().edPublic) { return; }
|
|
|
|
if (parsedMsg[1] === common.getProxy().edPublic) { return; }
|
|
|
|
channel.wc.leave(Types.unfriend);
|
|
|
|
channel.wc.leave(Types.unfriend);
|
|
|
|
channel.removeUI();
|
|
|
|
channel.removeUI();
|
|
|
@ -320,12 +321,12 @@ define([
|
|
|
|
var remove = function (edPublic) {
|
|
|
|
var remove = function (edPublic) {
|
|
|
|
var data = getFriend(common, edPublic);
|
|
|
|
var data = getFriend(common, edPublic);
|
|
|
|
var channel = channels[data.channel];
|
|
|
|
var channel = channels[data.channel];
|
|
|
|
var newdata = createData(common, data.channel);
|
|
|
|
//var newdata = createData(common, data.channel);
|
|
|
|
var msg = [Types.unfriend, proxy.edPublic, +new Date()];
|
|
|
|
var msg = [Types.unfriend, proxy.edPublic, +new Date()];
|
|
|
|
var msgStr = JSON.stringify(msg);
|
|
|
|
var msgStr = JSON.stringify(msg);
|
|
|
|
var cryptMsg = channel.encryptor.encrypt(msgStr);
|
|
|
|
var cryptMsg = channel.encryptor.encrypt(msgStr);
|
|
|
|
channel.wc.bcast(cryptMsg).then(function () {
|
|
|
|
channel.wc.bcast(cryptMsg).then(function () {
|
|
|
|
removeFromFriendList(common, edPublici, function () {
|
|
|
|
removeFromFriendList(common, edPublic, function () {
|
|
|
|
channel.wc.leave(Types.unfriend);
|
|
|
|
channel.wc.leave(Types.unfriend);
|
|
|
|
channel.removeUI();
|
|
|
|
channel.removeUI();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -421,7 +422,7 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Cryptpad.onDisplayNameChanged(function() {
|
|
|
|
common.onDisplayNameChanged(function() {
|
|
|
|
Object.keys(channels).forEach(function (chan) {
|
|
|
|
Object.keys(channels).forEach(function (chan) {
|
|
|
|
var channel = channels[chan];
|
|
|
|
var channel = channels[chan];
|
|
|
|
var newdata = createData(common, chan);
|
|
|
|
var newdata = createData(common, chan);
|
|
|
|