better online/offline status handling

This commit is contained in:
j 2015-12-02 22:05:23 +01:00
commit 8a26285c88
11 changed files with 92 additions and 40 deletions

View file

@ -344,7 +344,12 @@ oml.ui.folders = function() {
Ox.print('peering.remove reload list')
Ox.Request.clearCache('getUsers');
that.updateElement();
}
},
status: function(data) {
if (data.id == oml.user.id) {
oml.user.online = data.online;
}
},
});
return that.updateElement();

View file

@ -42,9 +42,13 @@ oml.ui.statusIcon = function(user, index) {
}
function getStatus(data) {
return !oml.user.online ? 'unknown'
: data.online ? 'connected'
: 'disconnected';
if (!oml.user.online) {
return 'unknown';
}
if (user.id == data.id) {
return data.online ? 'connected' : 'disconnected';
}
return status || 'unknown';
}
function render() {
@ -75,7 +79,7 @@ oml.ui.statusIcon = function(user, index) {
}
function update(data) {
if (data.id == user.id) {
if (data.id == user.id || data.id == oml.user.id) {
var newStatus = getStatus(data);
if (status != newStatus) {
status = newStatus;

View file

@ -890,11 +890,17 @@ oml.renameUser = function(data) {
var ui = oml.user.ui,
index = Ox.getIndexById(ui._users, data.id),
name = ui._users[index].name,
name,
set = {},
oldFind = Ox.clone(ui.find, true),
newFind = Ox.clone(ui.find, true);
oldFind,
newFind;
if (index == -1) {
return;
}
name = ui._users[index].name;
oldFind = Ox.clone(ui.find, true);
newFind = Ox.clone(ui.find, true);
ui._users[index].name = data.name;
ui._users[index].nickname = data.nickname;
set['showFolder.' + name] = null;