handle user renames

This commit is contained in:
ansuz
2017-08-25 14:42:05 +02:00
parent f9cdbe66a0
commit 22d754d514
2 changed files with 34 additions and 8 deletions

View File

@@ -395,9 +395,9 @@ define([
});
if (typeof(idx) !== 'undefined') {
console.error('found old message at %s', idx);
//console.error('found old message at %s', idx);
} else {
console.error("did not find desired message");
//console.error("did not find desired message");
}
// TODO improve performance
@@ -439,9 +439,8 @@ define([
return true;
}
if (parsedMsg[0] === Types.update) {
// TODO emit update event
if (parsedMsg[1] === proxy.curvePublic) { return; }
var curvePublic = parsedMsg[1];
var newdata = parsedMsg[3];
var data = getFriend(proxy, parsedMsg[1]);
var types = [];
@@ -451,13 +450,19 @@ define([
data[k] = newdata[k];
}
});
//channel.updateUI(types);
eachHandler('update', function (f) {
f(clone(newdata), curvePublic);
});
return;
}
if (parsedMsg[0] === Types.unfriend) {
console.log('UNFRIEND');
removeFromFriendList(proxy, realtime, channel.friendEd, function () {
channel.wc.leave(Types.unfriend);
//channel.removeUI();
});
return;
}
@@ -483,6 +488,9 @@ define([
channel.wc.bcast(cryptMsg).then(function () {
// TODO send event
//channel.refresh();
eachHandler('update', function (f) {
f(myData, myData.curvePublic);
});
}, function (err) {
console.error(err);
});