Lay the groundwork for being able to have separate ChatRoom models
This commit is contained in:
parent
4db2e7bacf
commit
5e783e70e4
@ -62,7 +62,7 @@
|
||||
"npm": "^4.1.1",
|
||||
"otr": "0.2.16",
|
||||
"phantomjs-prebuilt": "~2.1.14",
|
||||
"pluggable.js": "1.0.0",
|
||||
"pluggable.js": "https://github.com/jcbrand/pluggable.js.git#8f8c8235816f44cda0f855d6ca879445aaa486a1",
|
||||
"po2json": "^0.4.4",
|
||||
"requirejs": "2.3.3",
|
||||
"sinon": "^2.1.0",
|
||||
|
@ -1463,9 +1463,12 @@
|
||||
});
|
||||
|
||||
this.ChatBoxes = Backbone.Collection.extend({
|
||||
model: _converse.ChatBox,
|
||||
comparator: 'time_opened',
|
||||
|
||||
model: function (attrs, options) {
|
||||
return new _converse.ChatBox(attrs, options);
|
||||
},
|
||||
|
||||
registerMessageHandler: function () {
|
||||
_converse.connection.addHandler(this.onMessage.bind(this), null, 'message', 'chat');
|
||||
_converse.connection.addHandler(this.onErrorMessage.bind(this), null, 'message', 'error');
|
||||
@ -1522,7 +1525,7 @@
|
||||
* stanzas.
|
||||
*/
|
||||
var original_stanza = message,
|
||||
contact_jid, forwarded, delay, from_bare_jid,
|
||||
contact_jid, delay, from_bare_jid,
|
||||
from_resource, is_me, msgid, messages,
|
||||
chatbox, resource,
|
||||
from_jid = message.getAttribute('from'),
|
||||
@ -1546,7 +1549,7 @@
|
||||
);
|
||||
return true;
|
||||
}
|
||||
forwarded = message.querySelector('forwarded');
|
||||
var forwarded = message.querySelector('forwarded');
|
||||
if (!_.isNull(forwarded)) {
|
||||
var forwarded_message = forwarded.querySelector('message');
|
||||
var forwarded_from = forwarded_message.getAttribute('from');
|
||||
|
@ -142,8 +142,18 @@
|
||||
}
|
||||
},
|
||||
|
||||
ControlBoxView: {
|
||||
ChatBoxes: {
|
||||
model: function (attrs, options) {
|
||||
var _converse = this.__super__._converse;
|
||||
if (attrs.type == 'chatroom') {
|
||||
return new _converse.ChatBox(attrs, options);
|
||||
} else {
|
||||
return this.__super__.model.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
ControlBoxView: {
|
||||
renderRoomsPanel: function () {
|
||||
var _converse = this.__super__._converse;
|
||||
this.roomspanel = new _converse.RoomsPanel({
|
||||
@ -1960,6 +1970,7 @@
|
||||
if (sender === '') {
|
||||
return true;
|
||||
}
|
||||
this.model.incrementUnreadMsgCounter(original_stanza);
|
||||
this.model.createMessage(message, delay, original_stanza);
|
||||
if (sender !== this.model.get('nick')) {
|
||||
// We only emit an event if it's not our own message
|
||||
|
Loading…
Reference in New Issue
Block a user