Let MUC plugin override the chatbox wrapper.

This commit is contained in:
JC Brand 2016-03-14 16:01:42 +00:00
parent 82107c0d96
commit fc251db59e
2 changed files with 11 additions and 2 deletions

View File

@ -184,8 +184,6 @@
'close': view.close.bind(view),
'focus': view.focus.bind(view),
'get': chatbox.get.bind(chatbox),
// FIXME: leaky abstraction from MUC
'is_chatroom': view.is_chatroom,
'maximize': chatbox.maximize.bind(chatbox),
'minimize': chatbox.minimize.bind(chatbox),
'open': view.show.bind(view),

View File

@ -52,6 +52,17 @@
//
// New functions which don't exist yet can also be added.
wrappedChatBox: function (chatbox) {
/* Wrap a chatbox for outside consumption (i.e. so that it can be
* returned via the API.
*/
if (!chatbox) { return; }
var view = converse.chatboxviews.get(chatbox.get('jid'));
var box = this._super.wrappedChatBox.apply(this, arguments);
box.is_chatroom = view.is_chatroom;
return box;
},
Features: {
addClientFeatures: function () {
this._super.addClientFeatures.apply(this, arguments);