Two bugfixes.
Show status change only in applicable chatbox. Don't show the "Remove connection changed" messages as status messages
This commit is contained in:
parent
37486118a2
commit
588825e01d
37
converse.js
37
converse.js
@ -285,9 +285,9 @@
|
|||||||
|
|
||||||
insertClientStoredMessages: function () {
|
insertClientStoredMessages: function () {
|
||||||
var msgs = xmppchat.storage.getMessages(this.model.get('jid')),
|
var msgs = xmppchat.storage.getMessages(this.model.get('jid')),
|
||||||
$content = this.$el.find('.chat-content');
|
$content = this.$el.find('.chat-content'), i;
|
||||||
|
|
||||||
for (var i=0; i<_.size(msgs); i++) {
|
for (i=0; i<_.size(msgs); i++) {
|
||||||
var msg = msgs[i],
|
var msg = msgs[i],
|
||||||
msg_array = msg.split(' ', 2),
|
msg_array = msg.split(' ', 2),
|
||||||
date = msg_array[0],
|
date = msg_array[0],
|
||||||
@ -376,20 +376,20 @@
|
|||||||
$('body').append($(this.el).hide());
|
$('body').append($(this.el).hide());
|
||||||
|
|
||||||
xmppchat.roster.on('change', function (item, changed) {
|
xmppchat.roster.on('change', function (item, changed) {
|
||||||
if (_.has(changed.changes, 'presence_type')) {
|
if (item.get('jid') === this.model.get('jid')) {
|
||||||
if (this.$el.is(':visible')) {
|
if (_.has(changed.changes, 'presence_type')) {
|
||||||
if (item.get('presence_type') === 'offline') {
|
if (this.$el.is(':visible')) {
|
||||||
this.insertStatusNotification(this.model.get('fullname'), 'has gone offline');
|
if (item.get('presence_type') === 'offline') {
|
||||||
} else if (item.get('presence_type') === 'away') {
|
this.insertStatusNotification(this.model.get('fullname'), 'has gone offline');
|
||||||
this.insertStatusNotification(this.model.get('fullname'), 'has gone away');
|
} else if (item.get('presence_type') === 'away') {
|
||||||
} else if ((item.get('presence_type') === 'busy') || (item.get('presence_type') === 'dnd')) {
|
this.insertStatusNotification(this.model.get('fullname'), 'has gone away');
|
||||||
this.insertStatusNotification(this.model.get('fullname'), 'is busy');
|
} else if ((item.get('presence_type') === 'busy') || (item.get('presence_type') === 'dnd')) {
|
||||||
} else if (item.get('presence_type') === 'online') {
|
this.insertStatusNotification(this.model.get('fullname'), 'is busy');
|
||||||
this.$el.find('div.chat-event').remove();
|
} else if (item.get('presence_type') === 'online') {
|
||||||
|
this.$el.find('div.chat-event').remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (_.has(changed.changes, 'status')) {
|
||||||
} else if (_.has(changed.changes, 'status')) {
|
|
||||||
if (item.get('jid') === this.model.get('jid')) {
|
|
||||||
this.$el.find('p.user-custom-message').text(item.get('status'));
|
this.$el.find('p.user-custom-message').text(item.get('status'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,7 +508,7 @@
|
|||||||
|
|
||||||
updateRoomsList: function () {
|
updateRoomsList: function () {
|
||||||
xmppchat.connection.muc.listRooms(xmppchat.connection.muc_domain, $.proxy(function (iq) {
|
xmppchat.connection.muc.listRooms(xmppchat.connection.muc_domain, $.proxy(function (iq) {
|
||||||
var room, name, jid,
|
var room, name, jid, i,
|
||||||
rooms = $(iq).find('query').find('item');
|
rooms = $(iq).find('query').find('item');
|
||||||
this.$el.find('#available-chatrooms').find('dd.chatroom').remove();
|
this.$el.find('#available-chatrooms').find('dd.chatroom').remove();
|
||||||
if (rooms.length) {
|
if (rooms.length) {
|
||||||
@ -516,7 +516,7 @@
|
|||||||
} else {
|
} else {
|
||||||
this.$el.find('#available-chatrooms dt').hide();
|
this.$el.find('#available-chatrooms dt').hide();
|
||||||
}
|
}
|
||||||
for (var i=0; i<rooms.length; i++) {
|
for (i=0; i<rooms.length; i++) {
|
||||||
name = Strophe.unescapeNode($(rooms[i]).attr('name'));
|
name = Strophe.unescapeNode($(rooms[i]).attr('name'));
|
||||||
jid = $(rooms[i]).attr('jid');
|
jid = $(rooms[i]).attr('jid');
|
||||||
this.$el.find('#available-chatrooms').append(this.room_template({'name':name, 'jid':jid}));
|
this.$el.find('#available-chatrooms').append(this.room_template({'name':name, 'jid':jid}));
|
||||||
@ -1188,7 +1188,7 @@
|
|||||||
// Ignore MUC or self-addressed stanzas
|
// Ignore MUC or self-addressed stanzas
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((status_message.length > 0)&&(status_message.text())) {
|
if ((status_message.length > 0) && (status_message.text() && (presence_type !== 'unavailable'))) {
|
||||||
model = this.getItem(bare_jid);
|
model = this.getItem(bare_jid);
|
||||||
model.set({'status': status_message.text()});
|
model.set({'status': status_message.text()});
|
||||||
}
|
}
|
||||||
@ -1511,7 +1511,6 @@
|
|||||||
this.auto_subscribe = chatdata.attr('auto_subscribe') === "True" || false;
|
this.auto_subscribe = chatdata.attr('auto_subscribe') === "True" || false;
|
||||||
|
|
||||||
$(document).unbind('jarnxmpp.connected');
|
$(document).unbind('jarnxmpp.connected');
|
||||||
|
|
||||||
$(document).bind('jarnxmpp.connected', $.proxy(function () {
|
$(document).bind('jarnxmpp.connected', $.proxy(function () {
|
||||||
// this.connection.xmlInput = function (body) { console.log(body); };
|
// this.connection.xmlInput = function (body) { console.log(body); };
|
||||||
// this.connection.xmlOutput = function (body) { console.log(body); };
|
// this.connection.xmlOutput = function (body) { console.log(body); };
|
||||||
|
Loading…
Reference in New Issue
Block a user