Commit 50a67331 authored by JC Brand's avatar JC Brand

Find MUC VCard by real JID if we know what it is.

parent ec5a57b9
...@@ -97,17 +97,7 @@ ...@@ -97,17 +97,7 @@
}, },
initialize () { initialize () {
if (this.get('type') === 'groupchat' && this.setVCard();
this.collection.chatbox.get('nick') === Strophe.getResourceFromJid(this.get('from'))) {
this.vcard = _converse.xmppstatus.vcard;
} else {
this.vcard = _converse.vcards.findWhere({'jid': this.get('from')});
if (_.isNil(this.vcard)) {
this.vcard = _converse.vcards.create({'jid': this.get('from')});
}
}
if (this.get('file')) { if (this.get('file')) {
this.on('change:put', this.uploadFile, this); this.on('change:put', this.uploadFile, this);
...@@ -120,6 +110,23 @@ ...@@ -120,6 +110,23 @@
} }
}, },
setVCard () {
if (this.get('type') === 'groupchat') {
const chatbox = this.collection.chatbox,
nick = Strophe.getResourceFromJid(this.get('from'));
if (chatbox.get('nick') === nick) {
this.vcard = _converse.xmppstatus.vcard;
} else {
const occupant = chatbox.occupants.findWhere({'nick': nick});
const jid = (occupant && occupant.get('jid')) ? occupant.get('jid') : this.get('from');
this.vcard = _converse.vcards.findWhere({'jid': jid}) || _converse.vcards.create({'jid': jid});
}
} else {
const jid = this.get('from');
this.vcard = _converse.vcards.findWhere({'jid': jid}) || _converse.vcards.create({'jid': jid});
}
},
isOnlyChatStateNotification () { isOnlyChatStateNotification () {
return u.isOnlyChatStateNotification(this); return u.isOnlyChatStateNotification(this);
}, },
...@@ -744,8 +751,8 @@ ...@@ -744,8 +751,8 @@
closeAllChatBoxes () { closeAllChatBoxes () {
/* This method gets overridden in src/converse-controlbox.js if /* This method gets overridden in src/converse-controlbox.js if
* the controlbox plugin is active. * the controlbox plugin is active.
*/ */
this.each(function (view) { view.close(); }); this.each(function (view) { view.close(); });
return this; return this;
}, },
......
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