Commit 99c7b9cb authored by JC Brand's avatar JC Brand

Add a new emitted event: serviceDiscovered.

Gets thrown every time converse learns of a supported server service.
Useful when 3rd party code wants to use API methods that depend on the service
being discovered first.
parent 10e53468
...@@ -5188,6 +5188,7 @@ ...@@ -5188,6 +5188,7 @@
onFeatureAdded: function (feature) { onFeatureAdded: function (feature) {
var prefs = feature.get('preferences') || {}; var prefs = feature.get('preferences') || {};
converse.emit('serviceDiscovered', feature);
if (feature.get('var') == Strophe.NS.MAM && prefs['default'] !== converse.message_archiving) { if (feature.get('var') == Strophe.NS.MAM && prefs['default'] !== converse.message_archiving) {
// Ask the server for archiving preferences // Ask the server for archiving preferences
converse.connection.sendIQ( converse.connection.sendIQ(
......
...@@ -6,6 +6,7 @@ Changelog ...@@ -6,6 +6,7 @@ Changelog
* #439 auto_login and keepalive not working [jcbrand] * #439 auto_login and keepalive not working [jcbrand]
* #440 null added as resource to contact [jcbrand] * #440 null added as resource to contact [jcbrand]
* Add new event serviceDiscovered [jcbrand]
0.9.4 (2015-07-04) 0.9.4 (2015-07-04)
------------------ ------------------
......
This diff is collapsed.
...@@ -299,6 +299,10 @@ ...@@ -299,6 +299,10 @@
var box = converse_api.chats.open(jid); var box = converse_api.chats.open(jid);
expect(box instanceof Object).toBeTruthy(); expect(box instanceof Object).toBeTruthy();
expect(box.get('box_id')).toBe(b64_sha1(jid)); expect(box.get('box_id')).toBe(b64_sha1(jid));
expect(
Object.keys(box),
['close', 'endOTR', 'focus', 'get', 'initiateOTR', 'is_chatroom', 'maximize', 'minimize', 'open', 'set']
);
var chatboxview = this.chatboxviews.get(jid); var chatboxview = this.chatboxviews.get(jid);
expect(chatboxview.$el.is(':visible')).toBeTruthy(); expect(chatboxview.$el.is(':visible')).toBeTruthy();
......
...@@ -60,6 +60,7 @@ require([ ...@@ -60,6 +60,7 @@ require([
require([ require([
"console-runner", "console-runner",
"spec/converse", "spec/converse",
"spec/disco",
"spec/protocol", "spec/protocol",
"spec/mam", "spec/mam",
"spec/otr", "spec/otr",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment