Commit d6038c7c authored by JC Brand's avatar JC Brand

Allow the URL to the sounds to be configurable.

Made some modifications to the code contributed by @thierrytiti and documented
the change.

Fixes #344
parent 310d2b77
......@@ -262,7 +262,7 @@
message_carbons: false,
no_trimming: false, // Set to true for phantomjs tests (where browser apparently has no width)
play_sounds: false,
play_sounds_path: '/sounds/',
sounds_path: '/sounds/',
password: undefined,
authentication: 'login', // Available values are "login", "prebind", "anonymous".
prebind: false, // XXX: Deprecated, use "authentication" instead.
......@@ -368,11 +368,11 @@
this.playNotification = function () {
var audio;
if (converse.play_sounds && typeof Audio !== "undefined"){
audio = new Audio(converse.play_sounds_path+"msg_received.ogg");
audio = new Audio(converse.sounds_path+"msg_received.ogg");
if (audio.canPlayType('/audio/ogg')) {
audio.play();
} else {
audio = new Audio(converse.play_sounds_path+"msg_received.mp3");
audio = new Audio(converse.sounds_path+"msg_received.mp3");
audio.play();
}
}
......
......@@ -6,10 +6,12 @@ Changelog
* Add the ability to log in anonymously. [jcbrand]
* Add the ability to log in automatically. [jcbrand]
* #344 Enable the path to the sound files to be configured [thierrytiti and jcbrand]
* #370 Unable to register a new user to ejabberd 2.1.11. [gbonvehi]
* #372 Some offline users have a visible empty <dd> in the roster. [floriancargoet]
* #374 Fix collapsed group visibility on page load. [floriancargoet]
* #378 Expect full JIDs to be returned via XHR user search [thierrytiti]
* #379 Fix for bower not finding crypto-js-evanvosberg#3.1.2-5 any more. [jcbrand]
0.9.2 (2015-04-09)
------------------
......
......@@ -70,7 +70,7 @@ A JID (jabber ID), SID (session ID) and RID (Request ID).
Converse.js needs these tokens in order to attach to that same session.
There are two complementary configuration settings to ``prebind``.
They are :ref:`keepalive` and :ref:`prebind_url`.
They are :ref:`keepalive` and `prebind_url`_.
``keepalive`` can be used keep the session alive without having to pass in
new RID and SID tokens to ``converse.initialize`` every time you reload the page.
......@@ -78,7 +78,7 @@ This removes the need to set up a new BOSH session every time a page loads.
You do however still need to supply the user's JID so that converse.js can be
sure that the session it's resuming is for the right user.
``prebind_url`` lets you specify a URL which converse.js will call whenever a
`prebind_url`_ lets you specify a URL which converse.js will call whenever a
new BOSH session needs to be set up.
Here's an example of converse.js being initialized with these three options:
......@@ -370,17 +370,12 @@ play_sounds
Plays a notification sound when you receive a personal message or when your
nickname is mentioned in a chat room.
Inside the ``./sounds`` directory of the Converse.js repo, you'll see MP3 and Ogg
Inside the ``./sounds`` directory of the Converse.js repo you'll see MP3 and Ogg
formatted sound files. We need both, because neither format is supported by all browsers.
Sound files are looked up by convention, not configuration. So to have
a sound play when a message is received, make sure that your webserver serves
it in both formats as ``http://yoursite.com/sounds/msg_received.mp3`` and
``http://yoursite.com/sounds/msg_received.ogg``.
You can set the URL where the sound files are hosted with the `sounds_path`_
option.
``http://yoursite.com`` should of course be your site's URL.
.. _`prebind_url`:
prebind_url
-----------
......@@ -449,6 +444,18 @@ show_only_online_users
If set to ``true``, only online users will be shown in the contacts roster.
Users with any other status (e.g. away, busy etc.) will not be shown.
sounds_path
-----------
* Default: ``/sounds/``
This option only makes sense in conjunction with the `play_sounds`_ option and
specifies the URL of the sound files to be played (exluding the file names
themselves).
In order to support all browsers we need both an MP3 and an Ogg file. Make sure
to name your files ``msg_received.ogg`` and ``msg_received.mp3``.
storage
-------
......
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