Bugfix in show and moved setup code to init method
This commit is contained in:
parent
29c275bb93
commit
f2ae33d47c
98
converse.js
98
converse.js
@ -540,7 +540,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
show: function () {
|
show: function () {
|
||||||
if (this.$el.is(':visible')) {
|
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
|
||||||
return this.focus();
|
return this.focus();
|
||||||
}
|
}
|
||||||
this.$el.css({'opacity': 0, 'display': 'inline'}) .animate({opacity: '1'}, 200);
|
this.$el.css({'opacity': 0, 'display': 'inline'}) .animate({opacity: '1'}, 200);
|
||||||
@ -1912,6 +1912,55 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xmppchat.init = function () {
|
||||||
|
this.connection = connection;
|
||||||
|
this.connection.xmlInput = function (body) { console.log(body); };
|
||||||
|
this.connection.xmlOutput = function (body) { console.log(body); };
|
||||||
|
this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid);
|
||||||
|
this.domain = Strophe.getDomainFromJid(this.connection.jid);
|
||||||
|
this.muc_domain = 'conference.' + this.domain;
|
||||||
|
|
||||||
|
// Set up the roster
|
||||||
|
this.roster = new this.RosterItems();
|
||||||
|
this.roster.localStorage = new Backbone.LocalStorage(
|
||||||
|
hex_sha1('converse.rosteritems-'+this.bare_jid));
|
||||||
|
|
||||||
|
this.xmppstatus = new this.XMPPStatus({id:1});
|
||||||
|
this.xmppstatus.localStorage = new Backbone.LocalStorage(
|
||||||
|
'converse.xmppstatus'+this.bare_jid);
|
||||||
|
|
||||||
|
this.chatboxes.onConnected();
|
||||||
|
this.rosterview = new this.RosterView({'model':this.roster});
|
||||||
|
|
||||||
|
this.xmppstatusview = new this.XMPPStatusView({'model': this.xmppstatus}).render();
|
||||||
|
this.xmppstatus.fetch();
|
||||||
|
|
||||||
|
this.connection.addHandler(
|
||||||
|
$.proxy(this.roster.subscribeToSuggestedItems, this.roster),
|
||||||
|
'http://jabber.org/protocol/rosterx', 'message', null);
|
||||||
|
|
||||||
|
this.connection.roster.registerCallback(
|
||||||
|
$.proxy(this.roster.rosterHandler, this.roster),
|
||||||
|
null, 'presence', null);
|
||||||
|
|
||||||
|
this.connection.roster.get($.proxy(function () {
|
||||||
|
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.xmppstatus.initStatus();
|
||||||
|
}, this));
|
||||||
|
this.$feedback.text('Online Contacts');
|
||||||
|
};
|
||||||
|
|
||||||
// Event handlers
|
// Event handlers
|
||||||
// --------------
|
// --------------
|
||||||
$(document).ready($.proxy(function () {
|
$(document).ready($.proxy(function () {
|
||||||
@ -1936,52 +1985,7 @@
|
|||||||
|
|
||||||
$(document).unbind('jarnxmpp.connected');
|
$(document).unbind('jarnxmpp.connected');
|
||||||
$(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) {
|
$(document).bind('jarnxmpp.connected', $.proxy(function (ev, connection) {
|
||||||
this.connection = connection;
|
this.init();
|
||||||
this.connection.xmlInput = function (body) { console.log(body); };
|
|
||||||
this.connection.xmlOutput = function (body) { console.log(body); };
|
|
||||||
this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid);
|
|
||||||
this.domain = Strophe.getDomainFromJid(this.connection.jid);
|
|
||||||
this.muc_domain = 'conference.' + this.domain;
|
|
||||||
|
|
||||||
// Set up the roster
|
|
||||||
this.roster = new this.RosterItems();
|
|
||||||
this.roster.localStorage = new Backbone.LocalStorage(
|
|
||||||
hex_sha1('converse.rosteritems-'+this.bare_jid));
|
|
||||||
|
|
||||||
this.xmppstatus = new this.XMPPStatus({id:1});
|
|
||||||
this.xmppstatus.localStorage = new Backbone.LocalStorage(
|
|
||||||
'converse.xmppstatus'+this.bare_jid);
|
|
||||||
|
|
||||||
this.chatboxes.onConnected();
|
|
||||||
this.rosterview = new this.RosterView({'model':this.roster});
|
|
||||||
|
|
||||||
this.xmppstatusview = new this.XMPPStatusView({'model': this.xmppstatus}).render();
|
|
||||||
this.xmppstatus.fetch();
|
|
||||||
|
|
||||||
this.connection.addHandler(
|
|
||||||
$.proxy(this.roster.subscribeToSuggestedItems, this.roster),
|
|
||||||
'http://jabber.org/protocol/rosterx', 'message', null);
|
|
||||||
|
|
||||||
this.connection.roster.registerCallback(
|
|
||||||
$.proxy(this.roster.rosterHandler, this.roster),
|
|
||||||
null, 'presence', null);
|
|
||||||
|
|
||||||
this.connection.roster.get($.proxy(function () {
|
|
||||||
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.xmppstatus.initStatus();
|
|
||||||
}, this));
|
|
||||||
this.$feedback.text('Online Contacts');
|
|
||||||
}, this));
|
}, this));
|
||||||
}, xmppchat));
|
}, xmppchat));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user