Commit 5c5b7b9d authored by ichim-david's avatar ichim-david

Changed the following:

- Removed situation where extra data passed in keyPressed was overriden
  with the same result because of the two assignments inside the if
  statements
- Cached fullname and presence_type at initialize of ChatBoxView
parent 87d66b0d
......@@ -519,7 +519,6 @@
notify = $msg({'to':this.model.get('jid'), 'type': 'chat'})
.c('composing', {'xmlns':'http://jabber.org/protocol/chatstates'});
xmppchat.connection.send(notify);
this.$el.data('composing', true);
}
this.$el.data('composing', true);
}
......@@ -542,19 +541,21 @@
},
initialize: function (){
$('body').append($(this.el).hide());
$('body').append(this.$el.hide());
xmppchat.roster.on('change', function (item, changed) {
var fullname = this.model.get('fullname'),
presence_type = item.get('presence_type');
if (item.get('jid') === this.model.get('jid')) {
if (_.has(changed.changes, 'presence_type')) {
if (this.$el.is(':visible')) {
if (item.get('presence_type') === 'offline') {
this.insertStatusNotification(this.model.get('fullname')+' '+'has gone offline');
} else if (item.get('presence_type') === 'away') {
this.insertStatusNotification(this.model.get('fullname')+' '+'has gone away');
} else if ((item.get('presence_type') === 'busy') || (item.get('presence_type') === 'dnd')) {
this.insertStatusNotification(this.model.get('fullname')+' '+'is busy');
} else if (item.get('presence_type') === 'online') {
if (presence_type === 'offline') {
this.insertStatusNotification(fullname+' '+'has gone offline');
} else if (presence_type === 'away') {
this.insertStatusNotification(fullname+' '+'has gone away');
} else if ((presence_type === 'busy') || (presence_type === 'dnd')) {
this.insertStatusNotification(fullname+' '+'is busy');
} else if (presence_type === 'online') {
this.$el.find('div.chat-event').remove();
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment