Commit 80c26e70 authored by JC Brand's avatar JC Brand

Add new option strict_plugin_dependencies

parent 45bc7f11
...@@ -417,7 +417,7 @@ state. The only defined states are: ...@@ -417,7 +417,7 @@ state. The only defined states are:
* dnd -- The entity or resource is busy (dnd = "Do Not Disturb"). * dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
* xa -- The entity or resource is away for an extended period (xa = "eXtended Away"). * xa -- The entity or resource is away for an extended period (xa = "eXtended Away").
Read the [relevant section in the XMPP spec](https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show) for more info. Read the [relevant section in the XMPP spec](https://xmpp.org/rfcs/rfc6121.html#presence-syntax-children-show) for more info.
What used to happen in converse.js when the `offline` state was chosen, is What used to happen in converse.js when the `offline` state was chosen, is
that a presence stanza with a `type` of `unavailable` was sent out. that a presence stanza with a `type` of `unavailable` was sent out.
...@@ -717,6 +717,20 @@ Data in localStorage on the other hand is kept indefinitely. ...@@ -717,6 +717,20 @@ Data in localStorage on the other hand is kept indefinitely.
roster contact statuses will not become out of sync in a single session, roster contact statuses will not become out of sync in a single session,
only across more than one session. only across more than one session.
strict_plugin_dependencies
--------------------------
* Default: ``false``
When set to ``true`` and a plugin tries to override an object which doesn't
exist (for example because the plugin which provides that object is not
loaded), then an error will be raised.
Otherwise a message will simply be logged and the override instruction ignored.
This allows plugins to have "soft" dependencies which aren't declared as
as dependencies.
synchronize_availability synchronize_availability
-------------------- --------------------
...@@ -789,7 +803,7 @@ websocket_url ...@@ -789,7 +803,7 @@ websocket_url
* Default: ``undefined`` * Default: ``undefined``
This option is used to specify a This option is used to specify a
`websocket <https://developer.mozilla.org/en/docs/WebSockets>`_ URI to which `websocket <https://developer.mozilla.org/en/docs/WebSockets>`_ URI to which
converse.js can connect to. converse.js can connect to.
...@@ -805,7 +819,7 @@ support. ...@@ -805,7 +819,7 @@ support.
Please note that not older browsers do not support websockets. For older Please note that not older browsers do not support websockets. For older
browsers you'll want to specify a BOSH URL. See the :ref:`bosh-service-url` browsers you'll want to specify a BOSH URL. See the :ref:`bosh-service-url`
configuration setting). configuration setting).
.. note:: .. note::
Converse.js does not yet support "keepalive" with websockets. Converse.js does not yet support "keepalive" with websockets.
......
...@@ -279,6 +279,7 @@ ...@@ -279,6 +279,7 @@
show_only_online_users: false, show_only_online_users: false,
sid: undefined, sid: undefined,
storage: 'session', storage: 'session',
strict_plugin_dependencies: false,
synchronize_availability: true, // Set to false to not sync with other clients or with resource name of the particular client that it should synchronize with synchronize_availability: true, // Set to false to not sync with other clients or with resource name of the particular client that it should synchronize with
use_vcards: true, use_vcards: true,
visible_toolbar_buttons: { visible_toolbar_buttons: {
...@@ -1875,8 +1876,17 @@ ...@@ -1875,8 +1876,17 @@
/* We automatically override all methods and Backbone views and /* We automatically override all methods and Backbone views and
* models that are in the "overrides" namespace. * models that are in the "overrides" namespace.
*/ */
var override = plugin.overrides[key]; var msg,
override = plugin.overrides[key];
if (typeof override === "object") { if (typeof override === "object") {
if (typeof converse[key] === 'undefined') {
msg = "Error: Plugin tried to override "+key+" but it's not found.";
if (converse.strict_plugin_dependencies) {
throw msg;
} else {
converse.log(msg);
}
}
this._extendObject(converse[key], override); this._extendObject(converse[key], override);
} else { } else {
this._overrideAttribute(key, plugin); this._overrideAttribute(key, plugin);
......
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