diff --git a/.gitignore b/.gitignore
index 9a643e001..d9c525c97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,10 @@
.project
.pydevproject
node_modules
+components
+docs/doctrees/environment.pickle
+tags
+test-reports
# OSX
.DS_Store
diff --git a/CHANGES.rst b/CHANGES.rst
index 763d30a7d..f32fa27a9 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,13 @@
Changelog
=========
+0.5.3 (Unreleased)
+------------------
+
+- Register presence and message handlers before fetching the roster. Otherwise
+ some presence notifications might be missed. [jcbrand]
+- Add a debug option (logs to the browser console). [jcbrand]
+
0.5.2 (2013-08-05)
------------------
diff --git a/bower.json b/bower.json
index 7b103b0df..3770d7f46 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "converse",
- "version": "0.5.0",
+ "version": "0.5.2",
"devDependencies": {
"jasmine": "https://github.com/jcbrand/jasmine.git#1_3_x"
},
diff --git a/converse.js b/converse.js
index 05ad19b67..f7d876293 100644
--- a/converse.js
+++ b/converse.js
@@ -49,6 +49,7 @@
this.auto_list_rooms = false;
this.auto_subscribe = false;
this.bosh_service_url = ''; // The BOSH connection manager URL. Required if you are not prebinding.
+ this.debug = false;
this.hide_muc_server = false;
this.i18n = locales.en;
this.prebind = false;
@@ -696,12 +697,8 @@
}, this),
$.proxy(function (stanza) {
console.log("An error occured while fetching vcard");
- if ($(stanza).find('error').attr('code') == '503') {
- // If we get service-unavailable, we continue to create
- // the user
- var jid = $(stanza).attr('from');
- this.addContact(jid, jid);
- }
+ var jid = $(stanza).attr('from');
+ this.addContact(jid, jid);
}, this));
$('.search-xmpp').hide();
},
@@ -1435,10 +1432,9 @@
},
showErrorMessage: function ($error, room) {
- var $chat_content = this.$el.find('.chat-content');
// We didn't enter the room, so we must remove it from the MUC
// add-on
- converse.connection.muc.removeRoom(room.name);
+ delete converse.connection.muc[room.name];
if ($error.attr('type') == 'auth') {
if ($error.find('not-authorized').length) {
this.renderPasswordForm();
@@ -2225,7 +2221,7 @@
this.XMPPStatus = Backbone.Model.extend({
initialize: function () {
this.set({
- 'status' : this.get('status') || 'online',
+ 'status' : this.get('status') || 'online'
});
this.on('change', $.proxy(function () {
if (this.get('fullname') === undefined) {
@@ -2615,8 +2611,13 @@
this.onConnected = function (connection, callback) {
this.connection = connection;
- this.connection.xmlInput = function (body) { console.log(body); };
- this.connection.xmlOutput = function (body) { console.log(body); };
+ if (this.debug) {
+ this.connection.xmlInput = function (body) { console.log(body); };
+ this.connection.xmlOutput = function (body) { console.log(body); };
+ Strophe.log = function (level, msg) {
+ console.log(level+' '+msg);
+ };
+ }
this.bare_jid = Strophe.getBareJidFromJid(this.connection.jid);
this.domain = Strophe.getDomainFromJid(this.connection.jid);
this.features = new this.Features();
@@ -2627,18 +2628,20 @@
$.proxy(this.roster.subscribeToSuggestedItems, this.roster),
'http://jabber.org/protocol/rosterx', 'message', null);
- this.connection.roster.get($.proxy(function (a) {
- 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));
+ 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 () {});
+
$(window).on("blur focus", $.proxy(function(e) {
if ((this.windowState != e.type) && (e.type == 'focus')) {
converse.clearMsgCounter();
diff --git a/docs/doctrees/index.doctree b/docs/doctrees/index.doctree
index 6e10ee392..482f49df9 100644
Binary files a/docs/doctrees/index.doctree and b/docs/doctrees/index.doctree differ
diff --git a/docs/html/.buildinfo b/docs/html/.buildinfo
index 2128e437a..7e9e54d78 100644
--- a/docs/html/.buildinfo
+++ b/docs/html/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 75b256f63edf933c138244d36b1fd86c
+config: cc4e774ae6c30c8f75f9540598d47e5a
tags: fbb0d17656682115ca4d033fb2f83ba1
diff --git a/docs/html/_sources/index.txt b/docs/html/_sources/index.txt
index 4ae12aa0a..61489499f 100644
--- a/docs/html/_sources/index.txt
+++ b/docs/html/_sources/index.txt
@@ -28,8 +28,14 @@ tags:
-Then, at the bottom of your page, after the closing *