From fd6fdd748d4fb2168d3c6f836aa3f225d9c9fec4 Mon Sep 17 00:00:00 2001 From: HaNdTriX Date: Tue, 13 Aug 2013 12:06:58 +0200 Subject: [PATCH 1/4] Update bower.json The version specified in the bower.json of package converse mismatches the tag (0.5.2 vs 0.5.0) --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 04b0ed6b9..46012323c 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" }, From 9b9bf1ce8979458207b6eaf6e42bf333097ea54c Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 15 Aug 2013 17:56:28 +0200 Subject: [PATCH 2/4] Fix markup --- index.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 2fe776c0d..945eb8efb 100644 --- a/index.html +++ b/index.html @@ -34,9 +34,7 @@

It's similar to Facebook chat, but also supports multi-user chatrooms.

-

Converse.js can connect to any accessible XMPP/Jabber server, either from a public provider such as - jabber.org, or to one you have set up - yourself. +

Converse.js can connect to any accessible XMPP/Jabber server, either from a public provider such as jabber.org, or to one you have set up yourself.

It's possible to enable single-site login, whereby users already authenticated in your website will also automatically be logged in on the chat server, but you will have to pre-authenticate them on your server. You can refer to the documentation for more @@ -82,13 +80,8 @@

Note: currently the demo doesn't work in Internet Explorer older than 10. This is due to lacking support for CORS, a standard which enables cross-domain XmlHttpRequests. There are ways - around this, but it hasn't been a priority for me to implement them for - this demo. -

-

- See here for more information. -

-
+ around this, but it hasn't been a priority for me to implement them for this demo. + See here for more information.

Is it secure?

Yes. In this demo Converse.js makes an @@ -120,14 +113,13 @@

Credits and Dependencies

-

Converse.js depends on a few third party libraries, including: +

Converse.js depends on a few third party libraries, including:

-

Some images were taken from Plone and the Open Icon Library. From 53359b7ddc8b16ee51adf5bddad675c81921db97 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 15 Aug 2013 19:29:20 +0200 Subject: [PATCH 3/4] Register presence and message handlers before getting the roster Otherwise some presence notifications might be lost --- CHANGES.rst | 6 ++++++ converse.js | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 763d30a7d..4e8e0b488 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +0.5.3 (Unreleased) +------------------ + +- Register presence and message handlers before fetching the roster. Otherwise + some presence notifications might be missed. [jcbrand] + 0.5.2 (2013-08-05) ------------------ diff --git a/converse.js b/converse.js index ce795527c..59f10c7a4 100644 --- a/converse.js +++ b/converse.js @@ -2626,18 +2626,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(); From 44d094f56fb03c9104609d7d7613843847ec6cb3 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 15 Aug 2013 19:34:40 +0200 Subject: [PATCH 4/4] Add a debug option (logs to browser console) --- CHANGES.rst | 1 + converse.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 4e8e0b488..f32fa27a9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ Changelog - 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/converse.js b/converse.js index 59f10c7a4..74e31b82f 100644 --- a/converse.js +++ b/converse.js @@ -48,6 +48,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; @@ -2614,8 +2615,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();