Merge branch '0.6.x'

This commit is contained in:
JC Brand 2013-10-03 18:52:39 +02:00
commit 646fcb36c7

View File

@ -1469,7 +1469,7 @@
}, },
featureAdded: function (feature) { featureAdded: function (feature) {
if (feature.get('var') == 'http://jabber.org/protocol/muc') { if ((feature.get('var') == 'http://jabber.org/protocol/muc') && (converse.allow_muc)) {
this.roomspanel.muc_domain = feature.get('from'); this.roomspanel.muc_domain = feature.get('from');
var $server= this.$el.find('input.new-chatroom-server'); var $server= this.$el.find('input.new-chatroom-server');
if (! $server.is(':focus')) { if (! $server.is(':focus')) {
@ -2072,6 +2072,14 @@
} }
// This will make sure the Roster is set up // This will make sure the Roster is set up
this.get('controlbox').set({connected:true}); this.get('controlbox').set({connected:true});
// Register message handler
converse.connection.addHandler(
$.proxy(function (message) {
this.messageReceived(message);
return true;
}, this), null, 'message', 'chat');
// Get cached chatboxes from localstorage // Get cached chatboxes from localstorage
this.fetch({ this.fetch({
add: true, add: true,
@ -3136,9 +3144,24 @@
this.roster = new this.RosterItems(); this.roster = new this.RosterItems();
this.roster.localStorage = new Backbone.LocalStorage( this.roster.localStorage = new Backbone.LocalStorage(
hex_sha1('converse.rosteritems-'+converse.bare_jid)); hex_sha1('converse.rosteritems-'+converse.bare_jid));
// Register callbacks that depend on the roster
this.connection.roster.registerCallback( this.connection.roster.registerCallback(
$.proxy(this.roster.rosterHandler, this.roster), $.proxy(this.roster.rosterHandler, this.roster),
null, 'presence', null); null, 'presence', null);
this.connection.addHandler(
$.proxy(this.roster.subscribeToSuggestedItems, this.roster),
'http://jabber.org/protocol/rosterx', 'message', null);
this.connection.addHandler(
$.proxy(function (presence) {
this.presenceHandler(presence);
return true;
}, this.roster), null, 'presence', null);
// No create the view which will fetch roster items from
// localStorage
this.rosterview = new this.RosterView({'model':this.roster}); this.rosterview = new this.RosterView({'model':this.roster});
}; };
@ -3155,22 +3178,6 @@
this.initStatus($.proxy(function () { this.initStatus($.proxy(function () {
this.initRoster(); this.initRoster();
this.chatboxes.onConnected(); this.chatboxes.onConnected();
this.connection.addHandler(
$.proxy(this.roster.subscribeToSuggestedItems, this.roster),
'http://jabber.org/protocol/rosterx', 'message', null);
this.connection.addHandler(
$.proxy(function (presence) {
this.presenceHandler(presence);
return true;
}, this.roster), null, 'presence', null);
this.connection.addHandler(
$.proxy(function (message) {
this.chatboxes.messageReceived(message);
return true;
}, this), null, 'message', 'chat');
this.connection.roster.get(function () {}); this.connection.roster.get(function () {});
$(window).on("blur focus", $.proxy(function(e) { $(window).on("blur focus", $.proxy(function(e) {