From c7d5b8b13f3d8eed7790915987241b0f30e0fe1a Mon Sep 17 00:00:00 2001 From: JC Brand Date: Sun, 1 Mar 2015 13:32:53 +0100 Subject: [PATCH] Refactor to no longer call muc.listRooms. updates #307 --- converse.js | 18 ++++++++++++------ spec/controlbox.js | 10 ++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/converse.js b/converse.js index f0d610f21..04ba0362e 100644 --- a/converse.js +++ b/converse.js @@ -1790,9 +1790,16 @@ }, updateRoomsList: function () { - converse.connection.muc.listRooms( - this.model.get('muc_domain'), - $.proxy(function (iq) { // Success + /* Send and IQ stanza to the server asking for all rooms + */ + converse.connection.sendIQ( + $iq({ + to: this.model.get('muc_domain'), + from: converse.connection.jid, + type: "get" + }).c("query", {xmlns: Strophe.NS.DISCO_ITEMS}), + // Succcess Handler + $.proxy(function (iq) { var name, jid, i, fragment, that = this, $available_chatrooms = this.$el.find('#available-chatrooms'); @@ -1821,9 +1828,8 @@ } return true; }, this), - $.proxy(function (iq) { // Failure - this.informNoRoomsFound(); - }, this)); + // Error handler + $.proxy(function (iq) { this.informNoRoomsFound(); }, this)); }, showRooms: function (ev) { diff --git a/spec/controlbox.js b/spec/controlbox.js index 0cce4b318..2d553d6c3 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -1005,7 +1005,7 @@ expect(_.isEqual(new_attrs.sort(), old_attrs.sort())).toEqual(true); } }, converse)); - + it("will show fullname and jid properties on tooltip", $.proxy(function () { var jid, name, i, t; for (i=0; i