Disable friends chat in pad messenger
This commit is contained in:
@@ -204,7 +204,7 @@ define([
|
||||
};
|
||||
|
||||
// Make sure the data we have about our friends are up-to-date when we see them online
|
||||
var checkFriendData = function (curve, data) {
|
||||
var checkFriendData = function (curve, data, channel) {
|
||||
if (curve === proxy.curvePublic) { return; }
|
||||
var friend = getFriend(proxy, curve);
|
||||
if (!friend) { return; }
|
||||
@@ -217,7 +217,7 @@ define([
|
||||
});
|
||||
|
||||
eachHandler('update', function (f) {
|
||||
f(clone(data), types);
|
||||
f(clone(data), types, channel);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -261,7 +261,7 @@ define([
|
||||
// the sender field. This is to prevent replay attacks.
|
||||
if (parsed[2] !== sender || !parsed[1]) { return; }
|
||||
channel.mapId[sender] = parsed[1];
|
||||
checkFriendData(parsed[1].curvePublic, parsed[1]);
|
||||
checkFriendData(parsed[1].curvePublic, parsed[1], channel.id);
|
||||
eachHandler('join', function (f) {
|
||||
f(parsed[1], channel.id);
|
||||
});
|
||||
@@ -328,7 +328,7 @@ define([
|
||||
return true;
|
||||
}
|
||||
if (parsedMsg[0] === Types.update) {
|
||||
checkFriendData(parsedMsg[1], parsedMsg[3]);
|
||||
checkFriendData(parsedMsg[1], parsedMsg[3], channel.id);
|
||||
return;
|
||||
}
|
||||
if (parsedMsg[0] === Types.unfriend) {
|
||||
@@ -809,7 +809,10 @@ define([
|
||||
};
|
||||
|
||||
var ready = false;
|
||||
var initialized = false;
|
||||
var init = function () {
|
||||
if (initialized) { return; }
|
||||
initialized = true;
|
||||
var friends = getFriendList(proxy);
|
||||
|
||||
nThen(function (waitFor) {
|
||||
@@ -827,7 +830,7 @@ define([
|
||||
emit('READY');
|
||||
});
|
||||
};
|
||||
init();
|
||||
//init();
|
||||
|
||||
var getRooms = function (data, cb) {
|
||||
if (data && data.curvePublic) {
|
||||
@@ -931,6 +934,10 @@ define([
|
||||
messenger.execCommand = function (obj, cb) {
|
||||
var cmd = obj.cmd;
|
||||
var data = obj.data;
|
||||
if (cmd === 'INIT_FRIENDS') {
|
||||
init();
|
||||
return void cb();
|
||||
}
|
||||
if (cmd === 'IS_READY') {
|
||||
return void cb(ready);
|
||||
}
|
||||
|
||||
@@ -1366,10 +1366,11 @@ define([
|
||||
channel: channel,
|
||||
});
|
||||
});
|
||||
messenger.on('update', function (info, types) {
|
||||
messenger.on('update', function (info, types, channel) {
|
||||
sendMessengerEvent('CONTACTS_UPDATE', {
|
||||
types: types,
|
||||
info: info,
|
||||
channel: channel
|
||||
});
|
||||
});
|
||||
messenger.on('friend', function (curvePublic) {
|
||||
|
||||
@@ -35,7 +35,7 @@ define([], function () {
|
||||
});
|
||||
sFrameChan.on('EV_CONTACTS_UPDATE', function (data) {
|
||||
_handlers.update.forEach(function (f) {
|
||||
f(data.info, data.types);
|
||||
f(data.info, data.types, data.channel);
|
||||
});
|
||||
});
|
||||
sFrameChan.on('EV_CONTACTS_FRIEND', function (data) {
|
||||
|
||||
@@ -234,16 +234,15 @@ Messenger, MessengerUI, Messages) {
|
||||
var name = data.name || Messages.anonymous;
|
||||
var $span = $('<span>', {'class': 'cp-avatar'});
|
||||
var $rightCol = $('<span>', {'class': 'cp-toolbar-userlist-rightcol'});
|
||||
var $nameSpan = $('<span>', {'class': 'cp-toolbar-userlist-name'}).text(name).appendTo($rightCol);
|
||||
var $nameSpan = $('<span>', {'class': 'cp-toolbar-userlist-name'}).appendTo($rightCol);
|
||||
var $nameValue = $('<span>', {
|
||||
'class': 'cp-toolbar-userlist-name-value'
|
||||
}).text(name).appendTo($nameSpan);
|
||||
var isMe = data.uid === user.uid;
|
||||
if (isMe && !priv.readOnly) {
|
||||
$nameSpan.html('');
|
||||
var $nameValue = $('<span>', {
|
||||
'class': 'cp-toolbar-userlist-name-value'
|
||||
}).text(name).appendTo($nameSpan);
|
||||
if (!Config.disableProfile) {
|
||||
var $button = $('<button>', {
|
||||
'class': 'fa fa-pencil cp-toolbar-userlist-name-edit',
|
||||
'class': 'fa fa-pencil cp-toolbar-userlist-button',
|
||||
title: Messages.user_rename
|
||||
}).appendTo($nameSpan);
|
||||
$button.hover(function (e) { e.preventDefault(); e.stopPropagation(); });
|
||||
@@ -299,16 +298,24 @@ Messenger, MessengerUI, Messages) {
|
||||
$('<span>', {'class': 'cp-toolbar-userlist-friend'}).text(Messages.userlist_pending)
|
||||
.appendTo($rightCol);
|
||||
} else {
|
||||
$('<span>', {
|
||||
'class': 'fa fa-user-plus cp-toolbar-userlist-friend',
|
||||
$('<button>', {
|
||||
'class': 'fa fa-user-plus cp-toolbar-userlist-button',
|
||||
'title': Messages._getKey('userlist_addAsFriendTitle', [
|
||||
name
|
||||
])
|
||||
}).appendTo($rightCol).click(function (e) {
|
||||
}).appendTo($nameSpan).click(function (e) {
|
||||
e.stopPropagation();
|
||||
Common.sendFriendRequest(data.netfluxId);
|
||||
});
|
||||
}
|
||||
} else if (Common.isLoggedIn() && data.curvePublic && friends[data.curvePublic]) {
|
||||
$('<button>', {
|
||||
'class': 'fa fa-comments-o cp-toolbar-userlist-button',
|
||||
'title': Messages.userlist_chat
|
||||
}).appendTo($nameSpan).click(function (e) {
|
||||
e.stopPropagation();
|
||||
Common.openURL('/contacts/');
|
||||
});
|
||||
}
|
||||
if (data.profile) {
|
||||
$span.addClass('cp-userlist-clickable');
|
||||
|
||||
Reference in New Issue
Block a user