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
13
converse.js
13
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,6 +376,7 @@
|
|||||||
$('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 (item.get('jid') === this.model.get('jid')) {
|
||||||
if (_.has(changed.changes, 'presence_type')) {
|
if (_.has(changed.changes, 'presence_type')) {
|
||||||
if (this.$el.is(':visible')) {
|
if (this.$el.is(':visible')) {
|
||||||
if (item.get('presence_type') === 'offline') {
|
if (item.get('presence_type') === 'offline') {
|
||||||
@ -389,7 +390,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} 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