Use strict mode. Emit an event when the connection drops.
This commit is contained in:
parent
64408d2e0a
commit
d69a165b05
@ -5,6 +5,7 @@
|
|||||||
* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com>
|
* Copyright (c) 2012, Jan-Carel Brand <jc@opkode.com>
|
||||||
* Dual licensed under the MIT and GPL Licenses
|
* Dual licensed under the MIT and GPL Licenses
|
||||||
*/
|
*/
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// AMD/global registrations
|
// AMD/global registrations
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
@ -340,6 +341,7 @@
|
|||||||
|
|
||||||
this.reconnect = function () {
|
this.reconnect = function () {
|
||||||
converse.giveFeedback(__('Reconnecting'), 'error');
|
converse.giveFeedback(__('Reconnecting'), 'error');
|
||||||
|
converse.emit('onReconnect');
|
||||||
if (!converse.prebind) {
|
if (!converse.prebind) {
|
||||||
this.connection.connect(
|
this.connection.connect(
|
||||||
this.connection.jid,
|
this.connection.jid,
|
||||||
@ -3219,6 +3221,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getPrettyStatus: function (stat) {
|
getPrettyStatus: function (stat) {
|
||||||
|
var pretty_status;
|
||||||
if (stat === 'chat') {
|
if (stat === 'chat') {
|
||||||
pretty_status = __('online');
|
pretty_status = __('online');
|
||||||
} else if (stat === 'dnd') {
|
} else if (stat === 'dnd') {
|
||||||
|
@ -4,16 +4,17 @@ Changelog
|
|||||||
0.8 (Unreleased)
|
0.8 (Unreleased)
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
.. note:: Converse.js is now relicensed under the `Mozilla Public License http://www.mozilla.org/MPL/2.0/`_.
|
||||||
|
|
||||||
* Chat boxes and rooms can now be resized vertically. [jcbrand]
|
* Chat boxes and rooms can now be resized vertically. [jcbrand]
|
||||||
* Upgraded many dependencies to their latest versions. [jcbrand]
|
* Upgraded many dependencies to their latest versions. [jcbrand]
|
||||||
* Add new configuration setting `forward_messages <https://conversejs.org/docs/html/index.html#forward_messages>`_
|
* Add new configuration setting `forward_messages <https://conversejs.org/docs/html/index.html#forward_messages>`_
|
||||||
Message forwarding was before default behavior but is now optional (and disabled by default).
|
Message forwarding was before default behavior but is now optional (and disabled by default). [jcbrand]
|
||||||
[jcbrand]
|
* Newly opened chat boxes always appear immediately left of the controlbox.
|
||||||
* #71 Chat boxes and rooms can be minimized. [jcbrand]
|
* #71 Chat boxes and rooms can be minimized. [jcbrand]
|
||||||
* #130 Fixed bootstrap conflicts. [jcbrand]
|
* #130 Fixed bootstrap conflicts. [jcbrand]
|
||||||
* #132 Support for `XEP-0280: Message Carbons <https://xmpp.org/extensions/xep-0280.html'>`_.
|
* #132 Support for `XEP-0280: Message Carbons <https://xmpp.org/extensions/xep-0280.html'>`_.
|
||||||
Configured via `enable_message_carbons <https://conversejs.org/docs/html/index.html#enable_message_carbons>`_
|
Configured via `enable_message_carbons <https://conversejs.org/docs/html/index.html#enable_message_carbons>`_ [hejazee]
|
||||||
[hejazee]
|
|
||||||
|
|
||||||
0.7.4 (2014-03-05)
|
0.7.4 (2014-03-05)
|
||||||
------------------
|
------------------
|
||||||
|
Binary file not shown.
@ -280,7 +280,7 @@ These values are then passed to converse.js's ``initialize`` method.
|
|||||||
Example code for server-side prebinding
|
Example code for server-side prebinding
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
* PHP:
|
* PHP:
|
||||||
See `xmpp-prebind-php <https://github.com/candy-chat/xmpp-prebind-php>`_ by
|
See `xmpp-prebind-php <https://github.com/candy-chat/xmpp-prebind-php>`_ by
|
||||||
Michael Weibel and the folks from Candy chat.
|
Michael Weibel and the folks from Candy chat.
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ Converse.js directly depends and which will therefore be loaded in the browser.
|
|||||||
|
|
||||||
If you are curious to know what the different dependencies are:
|
If you are curious to know what the different dependencies are:
|
||||||
|
|
||||||
* Development dependencies:
|
* Development dependencies:
|
||||||
Take a look at whats under the *devDependencies* key in
|
Take a look at whats under the *devDependencies* key in
|
||||||
`package.json <https://github.com/jcbrand/converse.js/blob/master/package.json>`_.
|
`package.json <https://github.com/jcbrand/converse.js/blob/master/package.json>`_.
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ Troubleshooting
|
|||||||
Conflicts with other Javascript libraries
|
Conflicts with other Javascript libraries
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
Problem:
|
Problem:
|
||||||
---------
|
---------
|
||||||
|
|
||||||
You are using other Javascript libraries (like JQuery plugins), and
|
You are using other Javascript libraries (like JQuery plugins), and
|
||||||
@ -668,7 +668,7 @@ rules apply if its something else.
|
|||||||
The bundled and minified default build of converse.js, ``converse.min.js``
|
The bundled and minified default build of converse.js, ``converse.min.js``
|
||||||
includes within it all of converse.js's dependencies, which include for example *jQuery*.
|
includes within it all of converse.js's dependencies, which include for example *jQuery*.
|
||||||
|
|
||||||
If you are having conflicts where attributes or methods aren't available
|
If you are having conflicts where attributes or methods aren't available
|
||||||
on the jQuery object, you are probably loading ``converse.min.js`` (which
|
on the jQuery object, you are probably loading ``converse.min.js`` (which
|
||||||
includes jQuery) as well as your own jQuery version separately.
|
includes jQuery) as well as your own jQuery version separately.
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ Concerning events, the following methods are available:
|
|||||||
Event Methods
|
Event Methods
|
||||||
=============
|
=============
|
||||||
|
|
||||||
* **on(eventName, callback)**:
|
* **on(eventName, callback)**:
|
||||||
|
|
||||||
Calling the ``on`` method allows you to subscribe to an event.
|
Calling the ``on`` method allows you to subscribe to an event.
|
||||||
Every time the event fires, the callback method specified by ``callback`` will be
|
Every time the event fires, the callback method specified by ``callback`` will be
|
||||||
@ -745,7 +745,7 @@ Event Methods
|
|||||||
|
|
||||||
* ``eventName`` is the event name as a string.
|
* ``eventName`` is the event name as a string.
|
||||||
* ``callback`` is the callback method to be called when the event is emitted.
|
* ``callback`` is the callback method to be called when the event is emitted.
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
converse.once('onMessage', function (messageXML) { ... });
|
converse.once('onMessage', function (messageXML) { ... });
|
||||||
@ -765,91 +765,39 @@ Event Types
|
|||||||
|
|
||||||
Here are the different events that are emitted:
|
Here are the different events that are emitted:
|
||||||
|
|
||||||
* **onInitialized**
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| Event Type | When is it triggered? | Example |
|
||||||
``converse.on('onInitialized', function () { ... });``
|
+==================================+===================================================================================================+=========================================================================================+
|
||||||
|
| **onInitialized** | Once converse.js has been initialized. | ``converse.on('onInitialized', function () { ... });`` |
|
||||||
Triggered once converse.js has been initialized.
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| **onReady** | After connection has been established and converse.js has got all its ducks in a row. | ``converse.on('onReady', function () { ... });`` |
|
||||||
* **onReady**
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| **onReconnect** | After the connection has dropped. Converse.js will attempt to reconnect when not in prebind mode. | ``converse.on('onReconnect', function () { ... });`` |
|
||||||
Triggered after a connection has been established and converse.js has
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
got all its ducks in a row.
|
| **onMessage** | When a message is received. | ``converse.on('onMessage', function (messageXML) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onReady', function () { ... });``
|
| **onMessageSend** | When a message will be sent out. | ``converse.on('onMessageSend', function (messageText) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onMessage**
|
| **onRoster** | When the roster is updated. | ``converse.on('onRoster', function (items) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onMessage', function (messageXML) { ... });``
|
| **onRosterViewUpdated** | Whenever the roster view (i.e. the rendered HTML) has changed. | ``converse.on('onRosterViewUpdated', function (items) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when a message is received.
|
| **onChatBoxOpened** | When a chat box has been opened. | ``converse.on('onChatBoxOpened', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onMessageSend**
|
| **onChatBoxClosed** | When a chat box has been closed. | ``converse.on('onChatBoxClosed', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onMessageSend', function (messageText) { ... });``
|
| **onChatBoxFocused** | When the focus has been moved to a chat box. | ``converse.on('onChatBoxFocused', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when a message will be sent out.
|
| **onChatBoxToggled** | When a chat box has been minimized or maximized. | ``converse.on('onChatBoxToggled', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onRoster**
|
| **onStatusChanged** | When own chat status has changed. | ``converse.on('onStatusChanged', function (status) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onRoster', function (items) { ... });``
|
| **onStatusMessageChanged** | When own custom status message has changed. | ``converse.on('onStatusMessageChanged', function (message) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when the roster is updated.
|
| **onBuddyStatusChanged** | When a chat buddy's chat status has changed. | ``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onRosterViewUpdated**
|
| **onBuddyStatusMessageChanged** | When a chat buddy's custom status message has changed. | ``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onRosterViewUpdated', function (items) { ... });``
|
|
||||||
|
|
||||||
Triggered whenever the roster view (i.e. the rendered HTML) has changed.
|
|
||||||
|
|
||||||
* **onChatBoxClosed**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxClosed', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been closed.
|
|
||||||
|
|
||||||
* **onChatBoxFocused**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxFocused', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when the focus has been moved to a chat box.
|
|
||||||
|
|
||||||
* **onChatBoxOpened**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxOpened', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been opened.
|
|
||||||
|
|
||||||
* **onChatBoxToggled**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxToggled', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been minimized or maximized.
|
|
||||||
|
|
||||||
* **onStatusChanged**
|
|
||||||
|
|
||||||
``converse.on('onStatusChanged', function (status) { ... });``
|
|
||||||
|
|
||||||
Triggered when own chat status has changed.
|
|
||||||
|
|
||||||
* **onStatusMessageChanged**
|
|
||||||
|
|
||||||
``converse.on('onStatusMessageChanged', function (message) { ... });``
|
|
||||||
|
|
||||||
Triggered when own custom status message has changed.
|
|
||||||
|
|
||||||
* **onBuddyStatusChanged**
|
|
||||||
|
|
||||||
``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat buddy's chat status has changed.
|
|
||||||
|
|
||||||
* **onBuddyStatusMessageChanged**
|
|
||||||
|
|
||||||
``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat buddy's custom status message has changed.
|
|
||||||
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Configuration
|
Configuration
|
||||||
@ -954,7 +902,7 @@ for each page load. While more inconvenient, this is a much more secure option.
|
|||||||
This setting can only be used together with ``allow_otr = true``.
|
This setting can only be used together with ``allow_otr = true``.
|
||||||
|
|
||||||
|
|
||||||
.. Note ::
|
.. Note ::
|
||||||
A browser window's session storage is accessible by all javascript that
|
A browser window's session storage is accessible by all javascript that
|
||||||
is served from the same domain. So if there is malicious javascript served by
|
is served from the same domain. So if there is malicious javascript served by
|
||||||
the same server (or somehow injected via an attacker), then they will be able
|
the same server (or somehow injected via an attacker), then they will be able
|
||||||
@ -982,7 +930,7 @@ Default = ``false``
|
|||||||
|
|
||||||
Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
|
Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
|
||||||
globally via the API. This allows other scripts served on the same page to use
|
globally via the API. This allows other scripts served on the same page to use
|
||||||
these values.
|
these values.
|
||||||
|
|
||||||
*Beware*: a malicious script could use these tokens to assume your identity
|
*Beware*: a malicious script could use these tokens to assume your identity
|
||||||
and inject fake chat messages.
|
and inject fake chat messages.
|
||||||
@ -1161,6 +1109,10 @@ Used only in conjunction with ``xhr_user_search``.
|
|||||||
This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
||||||
The query string will be included in the request with ``q`` as its key.
|
The query string will be included in the request with ``q`` as its key.
|
||||||
|
|
||||||
|
The calendar can be configured through a `data-pat-calendar` attribute.
|
||||||
|
The available options are:
|
||||||
|
|
||||||
|
|
||||||
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
||||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||||
|
@ -733,93 +733,81 @@ exactly once.</p>
|
|||||||
<div class="section" id="event-types">
|
<div class="section" id="event-types">
|
||||||
<h2><a class="toc-backref" href="#id33">Event Types</a><a class="headerlink" href="#event-types" title="Permalink to this headline">¶</a></h2>
|
<h2><a class="toc-backref" href="#id33">Event Types</a><a class="headerlink" href="#event-types" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>Here are the different events that are emitted:</p>
|
<p>Here are the different events that are emitted:</p>
|
||||||
<ul>
|
<table border="1" class="docutils">
|
||||||
<li><p class="first"><strong>onInitialized</strong></p>
|
<colgroup>
|
||||||
<blockquote>
|
<col width="15%" />
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onInitialized',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<col width="45%" />
|
||||||
<p>Triggered once converse.js has been initialized.</p>
|
<col width="40%" />
|
||||||
</div></blockquote>
|
</colgroup>
|
||||||
</li>
|
<thead valign="bottom">
|
||||||
<li><p class="first"><strong>onReady</strong></p>
|
<tr class="row-odd"><th class="head">Event Type</th>
|
||||||
<blockquote>
|
<th class="head">When is it triggered?</th>
|
||||||
<div><p>Triggered after a connection has been established and converse.js has
|
<th class="head">Example</th>
|
||||||
got all its ducks in a row.</p>
|
</tr>
|
||||||
<p><tt class="docutils literal"><span class="pre">converse.on('onReady',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</thead>
|
||||||
</div></blockquote>
|
<tbody valign="top">
|
||||||
</li>
|
<tr class="row-even"><td><strong>onInitialized</strong></td>
|
||||||
<li><p class="first"><strong>onMessage</strong></p>
|
<td>Once converse.js has been initialized.</td>
|
||||||
<blockquote>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onInitialized',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessage',</span> <span class="pre">function</span> <span class="pre">(messageXML)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</tr>
|
||||||
<p>Triggered when a message is received.</p>
|
<tr class="row-odd"><td><strong>onReady</strong></td>
|
||||||
</div></blockquote>
|
<td>After connection has been established and converse.js has got all its ducks in a row.</td>
|
||||||
</li>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onReady',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<li><p class="first"><strong>onMessageSend</strong></p>
|
</tr>
|
||||||
<blockquote>
|
<tr class="row-even"><td><strong>onReconnect</strong></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onMessageSend',</span> <span class="pre">function</span> <span class="pre">(messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<td>After the connection has dropped. Converse.js will attempt to reconnect when not in prebind mode.</td>
|
||||||
<p>Triggered when a message will be sent out.</p>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onReconnect',</span> <span class="pre">function</span> <span class="pre">()</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
</div></blockquote>
|
</tr>
|
||||||
</li>
|
<tr class="row-odd"><td><strong>onMessage</strong></td>
|
||||||
<li><p class="first"><strong>onRoster</strong></p>
|
<td>When a message is received.</td>
|
||||||
<blockquote>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onMessage',</span> <span class="pre">function</span> <span class="pre">(messageXML)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onRoster',</span> <span class="pre">function</span> <span class="pre">(items)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</tr>
|
||||||
<p>Triggered when the roster is updated.</p>
|
<tr class="row-even"><td><strong>onMessageSend</strong></td>
|
||||||
</div></blockquote>
|
<td>When a message will be sent out.</td>
|
||||||
</li>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onMessageSend',</span> <span class="pre">function</span> <span class="pre">(messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<li><p class="first"><strong>onRosterViewUpdated</strong></p>
|
</tr>
|
||||||
<blockquote>
|
<tr class="row-odd"><td><strong>onRoster</strong></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onRosterViewUpdated',</span> <span class="pre">function</span> <span class="pre">(items)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<td>When the roster is updated.</td>
|
||||||
<p>Triggered whenever the roster view (i.e. the rendered HTML) has changed.</p>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onRoster',</span> <span class="pre">function</span> <span class="pre">(items)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
</div></blockquote>
|
</tr>
|
||||||
</li>
|
<tr class="row-even"><td><strong>onRosterViewUpdated</strong></td>
|
||||||
<li><p class="first"><strong>onChatBoxClosed</strong></p>
|
<td>Whenever the roster view (i.e. the rendered HTML) has changed.</td>
|
||||||
<blockquote>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onRosterViewUpdated',</span> <span class="pre">function</span> <span class="pre">(items)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onChatBoxClosed',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</tr>
|
||||||
<p>Triggered when a chat box has been closed.</p>
|
<tr class="row-odd"><td><strong>onChatBoxOpened</strong></td>
|
||||||
</div></blockquote>
|
<td>When a chat box has been opened.</td>
|
||||||
</li>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onChatBoxOpened',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<li><p class="first"><strong>onChatBoxFocused</strong></p>
|
</tr>
|
||||||
<blockquote>
|
<tr class="row-even"><td><strong>onChatBoxClosed</strong></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onChatBoxFocused',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<td>When a chat box has been closed.</td>
|
||||||
<p>Triggered when the focus has been moved to a chat box.</p>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onChatBoxClosed',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
</div></blockquote>
|
</tr>
|
||||||
</li>
|
<tr class="row-odd"><td><strong>onChatBoxFocused</strong></td>
|
||||||
<li><p class="first"><strong>onChatBoxOpened</strong></p>
|
<td>When the focus has been moved to a chat box.</td>
|
||||||
<blockquote>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onChatBoxFocused',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onChatBoxOpened',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</tr>
|
||||||
<p>Triggered when a chat box has been opened.</p>
|
<tr class="row-even"><td><strong>onChatBoxToggled</strong></td>
|
||||||
</div></blockquote>
|
<td>When a chat box has been minimized or maximized.</td>
|
||||||
</li>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onChatBoxToggled',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<li><p class="first"><strong>onChatBoxToggled</strong></p>
|
</tr>
|
||||||
<blockquote>
|
<tr class="row-odd"><td><strong>onStatusChanged</strong></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onChatBoxToggled',</span> <span class="pre">function</span> <span class="pre">(chatbox)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<td>When own chat status has changed.</td>
|
||||||
<p>Triggered when a chat box has been minimized or maximized.</p>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onStatusChanged',</span> <span class="pre">function</span> <span class="pre">(status)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
</div></blockquote>
|
</tr>
|
||||||
</li>
|
<tr class="row-even"><td><strong>onStatusMessageChanged</strong></td>
|
||||||
<li><p class="first"><strong>onStatusChanged</strong></p>
|
<td>When own custom status message has changed.</td>
|
||||||
<blockquote>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(message)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onStatusChanged',</span> <span class="pre">function</span> <span class="pre">(status)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
</tr>
|
||||||
<p>Triggered when own chat status has changed.</p>
|
<tr class="row-odd"><td><strong>onBuddyStatusChanged</strong></td>
|
||||||
</div></blockquote>
|
<td>When a chat buddy’s chat status has changed.</td>
|
||||||
</li>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">status)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
<li><p class="first"><strong>onStatusMessageChanged</strong></p>
|
</tr>
|
||||||
<blockquote>
|
<tr class="row-even"><td><strong>onBuddyStatusMessageChanged</strong></td>
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(message)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
<td>When a chat buddy’s custom status message has changed.</td>
|
||||||
<p>Triggered when own custom status message has changed.</p>
|
<td><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></td>
|
||||||
</div></blockquote>
|
</tr>
|
||||||
</li>
|
</tbody>
|
||||||
<li><p class="first"><strong>onBuddyStatusChanged</strong></p>
|
</table>
|
||||||
<blockquote>
|
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">status)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
|
||||||
<p>Triggered when a chat buddy’s chat status has changed.</p>
|
|
||||||
</div></blockquote>
|
|
||||||
</li>
|
|
||||||
<li><p class="first"><strong>onBuddyStatusMessageChanged</strong></p>
|
|
||||||
<blockquote>
|
|
||||||
<div><p><tt class="docutils literal"><span class="pre">converse.on('onBuddyStatusMessageChanged',</span> <span class="pre">function</span> <span class="pre">(buddy,</span> <span class="pre">messageText)</span> <span class="pre">{</span> <span class="pre">...</span> <span class="pre">});</span></tt></p>
|
|
||||||
<p>Triggered when a chat buddy’s custom status message has changed.</p>
|
|
||||||
</div></blockquote>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="configuration">
|
<div class="section" id="configuration">
|
||||||
@ -1053,6 +1041,8 @@ corresponds to a matched user and needs the keys <tt class="docutils literal"><s
|
|||||||
<p>Used only in conjunction with <tt class="docutils literal"><span class="pre">xhr_user_search</span></tt>.</p>
|
<p>Used only in conjunction with <tt class="docutils literal"><span class="pre">xhr_user_search</span></tt>.</p>
|
||||||
<p>This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
<p>This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
||||||
The query string will be included in the request with <tt class="docutils literal"><span class="pre">q</span></tt> as its key.</p>
|
The query string will be included in the request with <tt class="docutils literal"><span class="pre">q</span></tt> as its key.</p>
|
||||||
|
<p>The calendar can be configured through a <cite>data-pat-calendar</cite> attribute.
|
||||||
|
The available options are:</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -280,7 +280,7 @@ These values are then passed to converse.js's ``initialize`` method.
|
|||||||
Example code for server-side prebinding
|
Example code for server-side prebinding
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
* PHP:
|
* PHP:
|
||||||
See `xmpp-prebind-php <https://github.com/candy-chat/xmpp-prebind-php>`_ by
|
See `xmpp-prebind-php <https://github.com/candy-chat/xmpp-prebind-php>`_ by
|
||||||
Michael Weibel and the folks from Candy chat.
|
Michael Weibel and the folks from Candy chat.
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ Converse.js directly depends and which will therefore be loaded in the browser.
|
|||||||
|
|
||||||
If you are curious to know what the different dependencies are:
|
If you are curious to know what the different dependencies are:
|
||||||
|
|
||||||
* Development dependencies:
|
* Development dependencies:
|
||||||
Take a look at whats under the *devDependencies* key in
|
Take a look at whats under the *devDependencies* key in
|
||||||
`package.json <https://github.com/jcbrand/converse.js/blob/master/package.json>`_.
|
`package.json <https://github.com/jcbrand/converse.js/blob/master/package.json>`_.
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ Troubleshooting
|
|||||||
Conflicts with other Javascript libraries
|
Conflicts with other Javascript libraries
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
Problem:
|
Problem:
|
||||||
---------
|
---------
|
||||||
|
|
||||||
You are using other Javascript libraries (like JQuery plugins), and
|
You are using other Javascript libraries (like JQuery plugins), and
|
||||||
@ -668,7 +668,7 @@ rules apply if its something else.
|
|||||||
The bundled and minified default build of converse.js, ``converse.min.js``
|
The bundled and minified default build of converse.js, ``converse.min.js``
|
||||||
includes within it all of converse.js's dependencies, which include for example *jQuery*.
|
includes within it all of converse.js's dependencies, which include for example *jQuery*.
|
||||||
|
|
||||||
If you are having conflicts where attributes or methods aren't available
|
If you are having conflicts where attributes or methods aren't available
|
||||||
on the jQuery object, you are probably loading ``converse.min.js`` (which
|
on the jQuery object, you are probably loading ``converse.min.js`` (which
|
||||||
includes jQuery) as well as your own jQuery version separately.
|
includes jQuery) as well as your own jQuery version separately.
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ Concerning events, the following methods are available:
|
|||||||
Event Methods
|
Event Methods
|
||||||
=============
|
=============
|
||||||
|
|
||||||
* **on(eventName, callback)**:
|
* **on(eventName, callback)**:
|
||||||
|
|
||||||
Calling the ``on`` method allows you to subscribe to an event.
|
Calling the ``on`` method allows you to subscribe to an event.
|
||||||
Every time the event fires, the callback method specified by ``callback`` will be
|
Every time the event fires, the callback method specified by ``callback`` will be
|
||||||
@ -745,7 +745,7 @@ Event Methods
|
|||||||
|
|
||||||
* ``eventName`` is the event name as a string.
|
* ``eventName`` is the event name as a string.
|
||||||
* ``callback`` is the callback method to be called when the event is emitted.
|
* ``callback`` is the callback method to be called when the event is emitted.
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
converse.once('onMessage', function (messageXML) { ... });
|
converse.once('onMessage', function (messageXML) { ... });
|
||||||
@ -765,91 +765,39 @@ Event Types
|
|||||||
|
|
||||||
Here are the different events that are emitted:
|
Here are the different events that are emitted:
|
||||||
|
|
||||||
* **onInitialized**
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| Event Type | When is it triggered? | Example |
|
||||||
``converse.on('onInitialized', function () { ... });``
|
+==================================+===================================================================================================+=========================================================================================+
|
||||||
|
| **onInitialized** | Once converse.js has been initialized. | ``converse.on('onInitialized', function () { ... });`` |
|
||||||
Triggered once converse.js has been initialized.
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| **onReady** | After connection has been established and converse.js has got all its ducks in a row. | ``converse.on('onReady', function () { ... });`` |
|
||||||
* **onReady**
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
|
| **onReconnect** | After the connection has dropped. Converse.js will attempt to reconnect when not in prebind mode. | ``converse.on('onReconnect', function () { ... });`` |
|
||||||
Triggered after a connection has been established and converse.js has
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
got all its ducks in a row.
|
| **onMessage** | When a message is received. | ``converse.on('onMessage', function (messageXML) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onReady', function () { ... });``
|
| **onMessageSend** | When a message will be sent out. | ``converse.on('onMessageSend', function (messageText) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onMessage**
|
| **onRoster** | When the roster is updated. | ``converse.on('onRoster', function (items) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onMessage', function (messageXML) { ... });``
|
| **onRosterViewUpdated** | Whenever the roster view (i.e. the rendered HTML) has changed. | ``converse.on('onRosterViewUpdated', function (items) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when a message is received.
|
| **onChatBoxOpened** | When a chat box has been opened. | ``converse.on('onChatBoxOpened', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onMessageSend**
|
| **onChatBoxClosed** | When a chat box has been closed. | ``converse.on('onChatBoxClosed', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onMessageSend', function (messageText) { ... });``
|
| **onChatBoxFocused** | When the focus has been moved to a chat box. | ``converse.on('onChatBoxFocused', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when a message will be sent out.
|
| **onChatBoxToggled** | When a chat box has been minimized or maximized. | ``converse.on('onChatBoxToggled', function (chatbox) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onRoster**
|
| **onStatusChanged** | When own chat status has changed. | ``converse.on('onStatusChanged', function (status) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onRoster', function (items) { ... });``
|
| **onStatusMessageChanged** | When own custom status message has changed. | ``converse.on('onStatusMessageChanged', function (message) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
Triggered when the roster is updated.
|
| **onBuddyStatusChanged** | When a chat buddy's chat status has changed. | ``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
* **onRosterViewUpdated**
|
| **onBuddyStatusMessageChanged** | When a chat buddy's custom status message has changed. | ``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });`` |
|
||||||
|
+----------------------------------+---------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+
|
||||||
``converse.on('onRosterViewUpdated', function (items) { ... });``
|
|
||||||
|
|
||||||
Triggered whenever the roster view (i.e. the rendered HTML) has changed.
|
|
||||||
|
|
||||||
* **onChatBoxClosed**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxClosed', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been closed.
|
|
||||||
|
|
||||||
* **onChatBoxFocused**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxFocused', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when the focus has been moved to a chat box.
|
|
||||||
|
|
||||||
* **onChatBoxOpened**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxOpened', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been opened.
|
|
||||||
|
|
||||||
* **onChatBoxToggled**
|
|
||||||
|
|
||||||
``converse.on('onChatBoxToggled', function (chatbox) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat box has been minimized or maximized.
|
|
||||||
|
|
||||||
* **onStatusChanged**
|
|
||||||
|
|
||||||
``converse.on('onStatusChanged', function (status) { ... });``
|
|
||||||
|
|
||||||
Triggered when own chat status has changed.
|
|
||||||
|
|
||||||
* **onStatusMessageChanged**
|
|
||||||
|
|
||||||
``converse.on('onStatusMessageChanged', function (message) { ... });``
|
|
||||||
|
|
||||||
Triggered when own custom status message has changed.
|
|
||||||
|
|
||||||
* **onBuddyStatusChanged**
|
|
||||||
|
|
||||||
``converse.on('onBuddyStatusChanged', function (buddy, status) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat buddy's chat status has changed.
|
|
||||||
|
|
||||||
* **onBuddyStatusMessageChanged**
|
|
||||||
|
|
||||||
``converse.on('onBuddyStatusMessageChanged', function (buddy, messageText) { ... });``
|
|
||||||
|
|
||||||
Triggered when a chat buddy's custom status message has changed.
|
|
||||||
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Configuration
|
Configuration
|
||||||
@ -954,7 +902,7 @@ for each page load. While more inconvenient, this is a much more secure option.
|
|||||||
This setting can only be used together with ``allow_otr = true``.
|
This setting can only be used together with ``allow_otr = true``.
|
||||||
|
|
||||||
|
|
||||||
.. Note ::
|
.. Note ::
|
||||||
A browser window's session storage is accessible by all javascript that
|
A browser window's session storage is accessible by all javascript that
|
||||||
is served from the same domain. So if there is malicious javascript served by
|
is served from the same domain. So if there is malicious javascript served by
|
||||||
the same server (or somehow injected via an attacker), then they will be able
|
the same server (or somehow injected via an attacker), then they will be able
|
||||||
@ -982,7 +930,7 @@ Default = ``false``
|
|||||||
|
|
||||||
Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
|
Allow the prebind tokens, RID (request ID) and SID (session ID), to be exposed
|
||||||
globally via the API. This allows other scripts served on the same page to use
|
globally via the API. This allows other scripts served on the same page to use
|
||||||
these values.
|
these values.
|
||||||
|
|
||||||
*Beware*: a malicious script could use these tokens to assume your identity
|
*Beware*: a malicious script could use these tokens to assume your identity
|
||||||
and inject fake chat messages.
|
and inject fake chat messages.
|
||||||
@ -1161,6 +1109,10 @@ Used only in conjunction with ``xhr_user_search``.
|
|||||||
This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
This is the URL to which an AJAX GET request will be made to fetch user data from your remote server.
|
||||||
The query string will be included in the request with ``q`` as its key.
|
The query string will be included in the request with ``q`` as its key.
|
||||||
|
|
||||||
|
The calendar can be configured through a `data-pat-calendar` attribute.
|
||||||
|
The available options are:
|
||||||
|
|
||||||
|
|
||||||
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
||||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||||
|
Loading…
Reference in New Issue
Block a user