Created method insertIntoPage
Put the code that inserts a chat box into the page in it's own method, so that it can be overridden from a plugin.
This commit is contained in:
parent
f868917d54
commit
9f5f5da7ed
11
converse.js
11
converse.js
|
@ -1026,15 +1026,17 @@
|
||||||
this.model.on('showReceivedOTRMessage', function (text) {
|
this.model.on('showReceivedOTRMessage', function (text) {
|
||||||
this.showMessage({'message': text, 'sender': 'them'});
|
this.showMessage({'message': text, 'sender': 'them'});
|
||||||
}, this);
|
}, this);
|
||||||
|
this.updateVCard().insertIntoPage();
|
||||||
this.updateVCard();
|
|
||||||
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el);
|
|
||||||
this.hide().render().model.messages.fetch({add: true});
|
this.hide().render().model.messages.fetch({add: true});
|
||||||
if ((_.contains([UNVERIFIED, VERIFIED], this.model.get('otr_status'))) || converse.use_otr_by_default) {
|
if ((_.contains([UNVERIFIED, VERIFIED], this.model.get('otr_status'))) || converse.use_otr_by_default) {
|
||||||
this.model.initiateOTR();
|
this.model.initiateOTR();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
insertIntoPage: function () {
|
||||||
|
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el);
|
||||||
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
this.$el.attr('id', this.model.get('box_id'))
|
this.$el.attr('id', this.model.get('box_id'))
|
||||||
.html(converse.templates.chatbox(
|
.html(converse.templates.chatbox(
|
||||||
|
@ -1503,7 +1505,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVCard: function () {
|
updateVCard: function () {
|
||||||
if (!this.use_vcards) { return; }
|
if (!this.use_vcards) { return this; }
|
||||||
var jid = this.model.get('jid'),
|
var jid = this.model.get('jid'),
|
||||||
contact = converse.roster.get(jid);
|
contact = converse.roster.get(jid);
|
||||||
if ((contact) && (!contact.get('vcard_updated'))) {
|
if ((contact) && (!contact.get('vcard_updated'))) {
|
||||||
|
@ -1522,6 +1524,7 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
informOTRChange: function () {
|
informOTRChange: function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user