Added a section to the documentation concerning OTR
This commit is contained in:
parent
fb1ed29c8f
commit
f6e5b07729
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: 9cade5fa70d219453c215cec2a2631df
|
||||
config: 738ca7b60aed811ee1668ad08d26eabb
|
||||
tags: fbb0d17656682115ca4d033fb2f83ba1
|
||||
|
@ -349,6 +349,39 @@ The connection is already created inside Converse.js, so the
|
||||
If someone submits a sane patch that does the above, I'll be happy to merge it.
|
||||
Until then, people will have to do this themselves.
|
||||
|
||||
========
|
||||
Features
|
||||
========
|
||||
|
||||
Off-the-record encryption
|
||||
=========================
|
||||
|
||||
Converse.js supports `Off-the-record (OTR) <https://otr.cypherpunks.ca/>`_
|
||||
encrypted messaging.
|
||||
|
||||
The OTR protocol not only **encrypts your messages**, it provides ways to
|
||||
**verify the identity** of the person you are talking to,
|
||||
**plausible deniability** and **perfect forward secrecy** by generating
|
||||
new encryption keys for each conversation.
|
||||
|
||||
In its current state, Javascript cryptography is fraught with dangers and
|
||||
challenges that make it impossible to reach the same standard of security that
|
||||
is available with native "desktop" software.
|
||||
|
||||
This is due to its runtime malleability, the way it is "installed" (e.g.
|
||||
served) and the browser's lack of cryptographic primitives needed to implement
|
||||
secure crypto.
|
||||
|
||||
For harsh but fairly valid criticism of Javascript cryptography, read:
|
||||
`Javascript Cryptography Considered Harmful <http://www.matasano.com/articles/javascript-cryptography/>`_.
|
||||
|
||||
To get an idea on how this applies to OTR support in Converse.js, please read
|
||||
`my thoughts on it <https://opkode.com/media/blog/2013/11/11/conversejs-otr-support>`_.
|
||||
|
||||
For now, suffice to say that although its useful to have OTR support in
|
||||
Converse.js in order to avoid most eavesdroppers, if you need serious
|
||||
communications privacy, then you're much better off using native software.
|
||||
|
||||
===========
|
||||
Development
|
||||
===========
|
||||
@ -478,6 +511,137 @@ You can run both the tests and jshint in one go by calling:
|
||||
|
||||
grunt check
|
||||
|
||||
Minification
|
||||
============
|
||||
|
||||
Minifying Javascript and CSS
|
||||
----------------------------
|
||||
|
||||
Please make sure to read the section `Development`_ and that you have installed
|
||||
all development dependencies (long story short, you can run ``npm install``
|
||||
and then ``grunt fetch``).
|
||||
|
||||
We use `require.js`_ to keep track of *Converse.js* and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.
|
||||
|
||||
To minify the Javascript and CSS, run the following command:
|
||||
|
||||
::
|
||||
|
||||
grunt minify
|
||||
|
||||
Javascript will be bundled and minified with `require.js`_'s optimization tool,
|
||||
using `almond <https://github.com/jrburke/almond>`_.
|
||||
|
||||
You can `read more about require.js's optimizer here`_.
|
||||
|
||||
CSS is minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
|
||||
|
||||
Translations
|
||||
============
|
||||
|
||||
.. Note ::
|
||||
Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don't need. Remember to rebuild the
|
||||
minified file afterwards.
|
||||
|
||||
The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.
|
||||
|
||||
The POT file contains all translateable strings extracted from converse.js.
|
||||
|
||||
To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:
|
||||
|
||||
::
|
||||
|
||||
__('This string will be translated at runtime');
|
||||
|
||||
After adding the string, you'll need to regenerate the POT file, like so:
|
||||
|
||||
::
|
||||
|
||||
make pot
|
||||
|
||||
You can then create or update the PO file for a specific language by doing the following:
|
||||
|
||||
::
|
||||
|
||||
msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U
|
||||
|
||||
To do this for ALL languages, run:
|
||||
|
||||
::
|
||||
|
||||
make merge
|
||||
|
||||
The resulting PO file is then what gets translated.
|
||||
|
||||
If you've created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under *Content-Transfer-Encoding*). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we're using.
|
||||
|
||||
::
|
||||
|
||||
"domain: converse\n"
|
||||
"lang: de\n"
|
||||
"plural_forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
|
||||
Unfortunately `Jed <http://slexaxton.github.io/Jed>`_ cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.
|
||||
|
||||
To generate JSON from a PO file, you'll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):
|
||||
|
||||
::
|
||||
|
||||
npm install po2json
|
||||
|
||||
You can then convert the translations into JSON format:
|
||||
|
||||
::
|
||||
|
||||
po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json
|
||||
|
||||
Now from converse.json paste the data as a value for the "locale_data" key in the
|
||||
object in the language's .js file.
|
||||
|
||||
So, if you are for example translating into German (language code 'de'), you'll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:
|
||||
|
||||
::
|
||||
|
||||
(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));
|
||||
|
||||
making sure to also paste the JSON data as value to the "locale_data" key.
|
||||
|
||||
.. Note ::
|
||||
If you are adding translations for a new language that is not already supported,
|
||||
you'll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.
|
||||
|
||||
Congratulations, you've now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.
|
||||
|
||||
|
||||
===============
|
||||
Troubleshooting
|
||||
@ -972,140 +1136,6 @@ 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.
|
||||
The query string will be included in the request with ``q`` as its key.
|
||||
|
||||
============
|
||||
Minification
|
||||
============
|
||||
|
||||
Minifying Javascript and CSS
|
||||
============================
|
||||
|
||||
Please make sure to read the section `Development`_ and that you have installed
|
||||
all development dependencies (long story short, you can run ``npm install``
|
||||
and then ``grunt fetch``).
|
||||
|
||||
We use `require.js`_ to keep track of *Converse.js* and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.
|
||||
|
||||
To minify the Javascript and CSS, run the following command:
|
||||
|
||||
::
|
||||
|
||||
grunt minify
|
||||
|
||||
Javascript will be bundled and minified with `require.js`_'s optimization tool,
|
||||
using `almond <https://github.com/jrburke/almond>`_.
|
||||
|
||||
You can `read more about require.js's optimizer here`_.
|
||||
|
||||
CSS is minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
|
||||
|
||||
|
||||
============
|
||||
Translations
|
||||
============
|
||||
|
||||
.. Note ::
|
||||
Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don't need. Remember to rebuild the
|
||||
minified file afterwards.
|
||||
|
||||
The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.
|
||||
|
||||
The POT file contains all translateable strings extracted from converse.js.
|
||||
|
||||
To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:
|
||||
|
||||
::
|
||||
|
||||
__('This string will be translated at runtime');
|
||||
|
||||
After adding the string, you'll need to regenerate the POT file, like so:
|
||||
|
||||
::
|
||||
|
||||
make pot
|
||||
|
||||
You can then create or update the PO file for a specific language by doing the following:
|
||||
|
||||
::
|
||||
|
||||
msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U
|
||||
|
||||
To do this for ALL languages, run:
|
||||
|
||||
::
|
||||
|
||||
make merge
|
||||
|
||||
The resulting PO file is then what gets translated.
|
||||
|
||||
If you've created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under *Content-Transfer-Encoding*). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we're using.
|
||||
|
||||
::
|
||||
|
||||
"domain: converse\n"
|
||||
"lang: de\n"
|
||||
"plural_forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
|
||||
Unfortunately `Jed <http://slexaxton.github.io/Jed>`_ cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.
|
||||
|
||||
To generate JSON from a PO file, you'll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):
|
||||
|
||||
::
|
||||
|
||||
npm install po2json
|
||||
|
||||
You can then convert the translations into JSON format:
|
||||
|
||||
::
|
||||
|
||||
po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json
|
||||
|
||||
Now from converse.json paste the data as a value for the "locale_data" key in the
|
||||
object in the language's .js file.
|
||||
|
||||
So, if you are for example translating into German (language code 'de'), you'll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:
|
||||
|
||||
::
|
||||
|
||||
(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));
|
||||
|
||||
making sure to also paste the JSON data as value to the "locale_data" key.
|
||||
|
||||
.. Note ::
|
||||
If you are adding translations for a new language that is not already supported,
|
||||
you'll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.
|
||||
|
||||
Congratulations, you've now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.
|
||||
|
||||
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||
|
@ -9,7 +9,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Index — Converse.js 0.7.2 documentation</title>
|
||||
<title>Index — Converse.js 0.7.3 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="_static/stylesheet.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
@ -17,7 +17,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '0.7.2',
|
||||
VERSION: '0.7.3',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
@ -26,7 +26,7 @@
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Converse.js 0.7.2 documentation" href="index.html" />
|
||||
<link rel="top" title="Converse.js 0.7.3 documentation" href="index.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="header_wrap" class="outer">
|
||||
@ -51,7 +51,7 @@
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="#" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li><a href="index.html">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="index.html">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="main_content" class="inner">
|
||||
@ -80,7 +80,7 @@
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="#" title="General Index"
|
||||
>index</a></li>
|
||||
<li><a href="index.html">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="index.html">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Quickstart (to get a demo up and running) — Converse.js 0.7.2 documentation</title>
|
||||
<title>Quickstart (to get a demo up and running) — Converse.js 0.7.3 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="_static/stylesheet.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
@ -15,7 +15,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '0.7.2',
|
||||
VERSION: '0.7.3',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
@ -24,7 +24,7 @@
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="Converse.js 0.7.2 documentation" href="#" />
|
||||
<link rel="top" title="Converse.js 0.7.3 documentation" href="#" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="header_wrap" class="outer">
|
||||
@ -49,7 +49,7 @@
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li><a href="#">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="#">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="main_content" class="inner">
|
||||
@ -82,66 +82,70 @@
|
||||
<li><a class="reference internal" href="#facebook-integration" id="id13">Facebook integration</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#development" id="id14">Development</a><ul>
|
||||
<li><a class="reference internal" href="#install-node-js-and-development-dependencies" id="id15">Install Node.js and development dependencies</a></li>
|
||||
<li><a class="reference internal" href="#install-3rd-party-dependencies" id="id16">Install 3rd party dependencies</a></li>
|
||||
<li><a class="reference internal" href="#with-amd-and-require-js-recommended" id="id17">With AMD and require.js (recommended)</a></li>
|
||||
<li><a class="reference internal" href="#without-amd-and-require-js" id="id18">Without AMD and require.js</a></li>
|
||||
<li><a class="reference internal" href="#before-submitting-a-pull-request" id="id19">Before submitting a pull request</a><ul>
|
||||
<li><a class="reference internal" href="#add-tests-for-your-bugfix-or-feature" id="id20">Add tests for your bugfix or feature</a></li>
|
||||
<li><a class="reference internal" href="#check-that-the-tests-pass" id="id21">Check that the tests pass</a></li>
|
||||
<li><a class="reference internal" href="#check-your-code-for-errors-or-bad-habits-by-running-jshint" id="id22">Check your code for errors or bad habits by running JSHint</a></li>
|
||||
<li><a class="reference internal" href="#features" id="id14">Features</a><ul>
|
||||
<li><a class="reference internal" href="#off-the-record-encryption" id="id15">Off-the-record encryption</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#development" id="id16">Development</a><ul>
|
||||
<li><a class="reference internal" href="#install-node-js-and-development-dependencies" id="id17">Install Node.js and development dependencies</a></li>
|
||||
<li><a class="reference internal" href="#install-3rd-party-dependencies" id="id18">Install 3rd party dependencies</a></li>
|
||||
<li><a class="reference internal" href="#with-amd-and-require-js-recommended" id="id19">With AMD and require.js (recommended)</a></li>
|
||||
<li><a class="reference internal" href="#without-amd-and-require-js" id="id20">Without AMD and require.js</a></li>
|
||||
<li><a class="reference internal" href="#before-submitting-a-pull-request" id="id21">Before submitting a pull request</a><ul>
|
||||
<li><a class="reference internal" href="#add-tests-for-your-bugfix-or-feature" id="id22">Add tests for your bugfix or feature</a></li>
|
||||
<li><a class="reference internal" href="#check-that-the-tests-pass" id="id23">Check that the tests pass</a></li>
|
||||
<li><a class="reference internal" href="#check-your-code-for-errors-or-bad-habits-by-running-jshint" id="id24">Check your code for errors or bad habits by running JSHint</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#minification" id="id25">Minification</a><ul>
|
||||
<li><a class="reference internal" href="#minifying-javascript-and-css" id="id26">Minifying Javascript and CSS</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#translations" id="id27">Translations</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#troubleshooting" id="id28">Troubleshooting</a><ul>
|
||||
<li><a class="reference internal" href="#conflicts-with-other-javascript-libraries" id="id29">Conflicts with other Javascript libraries</a><ul>
|
||||
<li><a class="reference internal" href="#problem" id="id30">Problem:</a></li>
|
||||
<li><a class="reference internal" href="#solution" id="id31">Solution:</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#troubleshooting" id="id23">Troubleshooting</a><ul>
|
||||
<li><a class="reference internal" href="#conflicts-with-other-javascript-libraries" id="id24">Conflicts with other Javascript libraries</a><ul>
|
||||
<li><a class="reference internal" href="#problem" id="id25">Problem:</a></li>
|
||||
<li><a class="reference internal" href="#solution" id="id26">Solution:</a></li>
|
||||
<li><a class="reference internal" href="#events" id="id32">Events</a><ul>
|
||||
<li><a class="reference internal" href="#event-methods" id="id33">Event Methods</a></li>
|
||||
<li><a class="reference internal" href="#event-types" id="id34">Event Types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#configuration" id="id35">Configuration</a><ul>
|
||||
<li><a class="reference internal" href="#configuration-variables" id="id36">Configuration variables</a><ul>
|
||||
<li><a class="reference internal" href="#allow-contact-requests" id="id37">allow_contact_requests</a></li>
|
||||
<li><a class="reference internal" href="#allow-muc" id="id38">allow_muc</a></li>
|
||||
<li><a class="reference internal" href="#animate" id="id39">animate</a></li>
|
||||
<li><a class="reference internal" href="#auto-list-rooms" id="id40">auto_list_rooms</a></li>
|
||||
<li><a class="reference internal" href="#auto-reconnect" id="id41">auto_reconnect</a></li>
|
||||
<li><a class="reference internal" href="#auto-subscribe" id="id42">auto_subscribe</a></li>
|
||||
<li><a class="reference internal" href="#bosh-service-url" id="id43">bosh_service_url</a></li>
|
||||
<li><a class="reference internal" href="#cache-otr-key" id="id44">cache_otr_key</a></li>
|
||||
<li><a class="reference internal" href="#debug" id="id45">debug</a></li>
|
||||
<li><a class="reference internal" href="#expose-rid-and-sid" id="id46">expose_rid_and_sid</a></li>
|
||||
<li><a class="reference internal" href="#fullname" id="id47">fullname</a></li>
|
||||
<li><a class="reference internal" href="#hide-muc-server" id="id48">hide_muc_server</a></li>
|
||||
<li><a class="reference internal" href="#i18n" id="id49">i18n</a></li>
|
||||
<li><a class="reference internal" href="#prebind" id="id50">prebind</a></li>
|
||||
<li><a class="reference internal" href="#show-controlbox-by-default" id="id51">show_controlbox_by_default</a></li>
|
||||
<li><a class="reference internal" href="#show-call-button" id="id52">show_call_button</a></li>
|
||||
<li><a class="reference internal" href="#show-only-online-users" id="id53">show_only_online_users</a></li>
|
||||
<li><a class="reference internal" href="#use-otr-by-default" id="id54">use_otr_by_default</a></li>
|
||||
<li><a class="reference internal" href="#use-vcards" id="id55">use_vcards</a></li>
|
||||
<li><a class="reference internal" href="#xhr-custom-status" id="id56">xhr_custom_status</a></li>
|
||||
<li><a class="reference internal" href="#xhr-custom-status-url" id="id57">xhr_custom_status_url</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search" id="id58">xhr_user_search</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search-url" id="id59">xhr_user_search_url</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#events" id="id27">Events</a><ul>
|
||||
<li><a class="reference internal" href="#event-methods" id="id28">Event Methods</a></li>
|
||||
<li><a class="reference internal" href="#event-types" id="id29">Event Types</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#configuration" id="id30">Configuration</a><ul>
|
||||
<li><a class="reference internal" href="#configuration-variables" id="id31">Configuration variables</a><ul>
|
||||
<li><a class="reference internal" href="#allow-contact-requests" id="id32">allow_contact_requests</a></li>
|
||||
<li><a class="reference internal" href="#allow-muc" id="id33">allow_muc</a></li>
|
||||
<li><a class="reference internal" href="#animate" id="id34">animate</a></li>
|
||||
<li><a class="reference internal" href="#auto-list-rooms" id="id35">auto_list_rooms</a></li>
|
||||
<li><a class="reference internal" href="#auto-reconnect" id="id36">auto_reconnect</a></li>
|
||||
<li><a class="reference internal" href="#auto-subscribe" id="id37">auto_subscribe</a></li>
|
||||
<li><a class="reference internal" href="#bosh-service-url" id="id38">bosh_service_url</a></li>
|
||||
<li><a class="reference internal" href="#cache-otr-key" id="id39">cache_otr_key</a></li>
|
||||
<li><a class="reference internal" href="#debug" id="id40">debug</a></li>
|
||||
<li><a class="reference internal" href="#expose-rid-and-sid" id="id41">expose_rid_and_sid</a></li>
|
||||
<li><a class="reference internal" href="#fullname" id="id42">fullname</a></li>
|
||||
<li><a class="reference internal" href="#hide-muc-server" id="id43">hide_muc_server</a></li>
|
||||
<li><a class="reference internal" href="#i18n" id="id44">i18n</a></li>
|
||||
<li><a class="reference internal" href="#prebind" id="id45">prebind</a></li>
|
||||
<li><a class="reference internal" href="#show-controlbox-by-default" id="id46">show_controlbox_by_default</a></li>
|
||||
<li><a class="reference internal" href="#show-call-button" id="id47">show_call_button</a></li>
|
||||
<li><a class="reference internal" href="#show-only-online-users" id="id48">show_only_online_users</a></li>
|
||||
<li><a class="reference internal" href="#use-otr-by-default" id="id49">use_otr_by_default</a></li>
|
||||
<li><a class="reference internal" href="#use-vcards" id="id50">use_vcards</a></li>
|
||||
<li><a class="reference internal" href="#xhr-custom-status" id="id51">xhr_custom_status</a></li>
|
||||
<li><a class="reference internal" href="#xhr-custom-status-url" id="id52">xhr_custom_status_url</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search" id="id53">xhr_user_search</a></li>
|
||||
<li><a class="reference internal" href="#xhr-user-search-url" id="id54">xhr_user_search_url</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#minification" id="id55">Minification</a><ul>
|
||||
<li><a class="reference internal" href="#minifying-javascript-and-css" id="id56">Minifying Javascript and CSS</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#translations" id="id57">Translations</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="quickstart-to-get-a-demo-up-and-running">
|
||||
@ -186,7 +190,7 @@ practical.</p>
|
||||
<p>You’ll most likely want to implement some kind of single-signon solution for
|
||||
your website, where users authenticate once in your website and then stay
|
||||
logged into their XMPP session upon page reload.</p>
|
||||
<p>For more info on this, read: <a href="#id58"><span class="problematic" id="id59">`Pre-binding and Single Session Support`_</span></a>.</p>
|
||||
<p>For more info on this, read: <a href="#id60"><span class="problematic" id="id61">`Pre-binding and Single Session Support`_</span></a>.</p>
|
||||
<p>You might also want to have more fine-grained control of what gets included in
|
||||
the minified Javascript file. Read <a class="reference internal" href="#configuration">Configuration</a> and <a class="reference internal" href="#minification">Minification</a> for more info on how to do
|
||||
that.</p>
|
||||
@ -412,14 +416,39 @@ connection.facebookConnect(
|
||||
Until then, people will have to do this themselves.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="features">
|
||||
<h1><a class="toc-backref" href="#id14">Features</a><a class="headerlink" href="#features" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="off-the-record-encryption">
|
||||
<h2><a class="toc-backref" href="#id15">Off-the-record encryption</a><a class="headerlink" href="#off-the-record-encryption" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Converse.js supports <a class="reference external" href="https://otr.cypherpunks.ca/">Off-the-record (OTR)</a>
|
||||
encrypted messaging.</p>
|
||||
<p>The OTR protocol not only <strong>encrypts your messages</strong>, it provides ways to
|
||||
<strong>verify the identity</strong> of the person you are talking to,
|
||||
<strong>plausible deniability</strong> and <strong>perfect forward secrecy</strong> by generating
|
||||
new encryption keys for each conversation.</p>
|
||||
<p>In its current state, Javascript cryptography is fraught with dangers and
|
||||
challenges that make it impossible to reach the same standard of security that
|
||||
is available with native “desktop” software.</p>
|
||||
<p>This is due to its runtime malleability, the way it is “installed” (e.g.
|
||||
served) and the browser’s lack of cryptographic primitives needed to implement
|
||||
secure crypto.</p>
|
||||
<p>For harsh but fairly valid criticism of Javascript cryptography, read:
|
||||
<a class="reference external" href="http://www.matasano.com/articles/javascript-cryptography/">Javascript Cryptography Considered Harmful</a>.</p>
|
||||
<p>To get an idea on how this applies to OTR support in Converse.js, please read
|
||||
<a class="reference external" href="https://opkode.com/media/blog/2013/11/11/conversejs-otr-support">my thoughts on it</a>.</p>
|
||||
<p>For now, suffice to say that although its useful to have OTR support in
|
||||
Converse.js in order to avoid most eavesdroppers, if you need serious
|
||||
communications privacy, then you’re much better off using native software.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="development">
|
||||
<h1><a class="toc-backref" href="#id14">Development</a><a class="headerlink" href="#development" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><a class="toc-backref" href="#id16">Development</a><a class="headerlink" href="#development" title="Permalink to this headline">¶</a></h1>
|
||||
<p>If you want to work with the non-minified Javascript and CSS files you’ll soon
|
||||
notice that there are references to a missing <em>components</em> folder. Please
|
||||
follow the instructions below to create this folder and fetch Converse’s
|
||||
3rd-party dependencies.</p>
|
||||
<div class="section" id="install-node-js-and-development-dependencies">
|
||||
<h2><a class="toc-backref" href="#id15">Install Node.js and development dependencies</a><a class="headerlink" href="#install-node-js-and-development-dependencies" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id17">Install Node.js and development dependencies</a><a class="headerlink" href="#install-node-js-and-development-dependencies" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We use development tools (<a class="reference external" href="http://gruntjs.com">Grunt</a> and <a class="reference external" href="http://bower.io">Bower</a>)
|
||||
which depend on Node.js and npm (the Node package manager).</p>
|
||||
<p>If you don’t have Node.js installed, you can download and install the latest
|
||||
@ -433,7 +462,7 @@ curious to know what these are, take a look at whats under the <em>devDependenci
|
||||
<cite>package.json <https://github.com/jcbrand/converse.js/blob/master/package.json></cite>.</p>
|
||||
</div>
|
||||
<div class="section" id="install-3rd-party-dependencies">
|
||||
<h2><a class="toc-backref" href="#id16">Install 3rd party dependencies</a><a class="headerlink" href="#install-3rd-party-dependencies" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id18">Install 3rd party dependencies</a><a class="headerlink" href="#install-3rd-party-dependencies" title="Permalink to this headline">¶</a></h2>
|
||||
<p>After running <tt class="docutils literal"><span class="pre">npm</span> <span class="pre">install</span></tt>, you will now have Grunt and Bower installed.</p>
|
||||
<p>We use Bower to manage Converse’s front-end dependencies (e.g. Javascript that
|
||||
should get loaded in the browser).</p>
|
||||
@ -449,7 +478,7 @@ dependencies (like backbone.js, strophe.js etc.) and then put them in the
|
||||
<em>components</em> folder.</p>
|
||||
</div>
|
||||
<div class="section" id="with-amd-and-require-js-recommended">
|
||||
<h2><a class="toc-backref" href="#id17">With AMD and require.js (recommended)</a><a class="headerlink" href="#with-amd-and-require-js-recommended" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id19">With AMD and require.js (recommended)</a><a class="headerlink" href="#with-amd-and-require-js-recommended" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Converse.js uses <a class="reference external" href="http://requirejs.org">require.js</a> to asynchronously load dependencies.</p>
|
||||
<p>If you want to develop or customize converse.js, you’ll want to load the
|
||||
non-minified javascript files.</p>
|
||||
@ -462,7 +491,7 @@ attribute on the <em>script</em> tag), which will in turn cause converse.js to b
|
||||
parsed.</p>
|
||||
</div>
|
||||
<div class="section" id="without-amd-and-require-js">
|
||||
<h2><a class="toc-backref" href="#id18">Without AMD and require.js</a><a class="headerlink" href="#without-amd-and-require-js" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id20">Without AMD and require.js</a><a class="headerlink" href="#without-amd-and-require-js" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Converse.js can also be used without require.js. If you for some reason prefer
|
||||
to use it this way, please refer to
|
||||
<a class="reference external" href="https://github.com/jcbrand/converse.js/blob/master/non_amd.html">non_amd.html</a>
|
||||
@ -470,9 +499,9 @@ for an example of how and in what order all the Javascript files that converse.j
|
||||
depends on need to be loaded.</p>
|
||||
</div>
|
||||
<div class="section" id="before-submitting-a-pull-request">
|
||||
<h2><a class="toc-backref" href="#id19">Before submitting a pull request</a><a class="headerlink" href="#before-submitting-a-pull-request" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id21">Before submitting a pull request</a><a class="headerlink" href="#before-submitting-a-pull-request" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="add-tests-for-your-bugfix-or-feature">
|
||||
<h3><a class="toc-backref" href="#id20">Add tests for your bugfix or feature</a><a class="headerlink" href="#add-tests-for-your-bugfix-or-feature" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id22">Add tests for your bugfix or feature</a><a class="headerlink" href="#add-tests-for-your-bugfix-or-feature" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Add a test for any bug fixed or feature added. We use Jasmine
|
||||
for testing.</p>
|
||||
<p>Take a look at <tt class="docutils literal"><span class="pre">tests.html</span></tt> and <tt class="docutils literal"><span class="pre">spec/MainSpec.js</span></tt> to see how
|
||||
@ -481,7 +510,7 @@ the tests are implemented.</p>
|
||||
<a class="reference external" href="http://opkode.com/contact">contact me</a> and I’ll be happy to help.</p>
|
||||
</div>
|
||||
<div class="section" id="check-that-the-tests-pass">
|
||||
<h3><a class="toc-backref" href="#id21">Check that the tests pass</a><a class="headerlink" href="#check-that-the-tests-pass" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id23">Check that the tests pass</a><a class="headerlink" href="#check-that-the-tests-pass" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Check that the Jasmine tests complete sucessfully. Open
|
||||
<a class="reference external" href="https://github.com/jcbrand/converse.js/blob/master/tests.html">tests.html</a>
|
||||
in your browser, and the tests will run automatically.</p>
|
||||
@ -490,7 +519,7 @@ in your browser, and the tests will run automatically.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="check-your-code-for-errors-or-bad-habits-by-running-jshint">
|
||||
<h3><a class="toc-backref" href="#id22">Check your code for errors or bad habits by running JSHint</a><a class="headerlink" href="#check-your-code-for-errors-or-bad-habits-by-running-jshint" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id24">Check your code for errors or bad habits by running JSHint</a><a class="headerlink" href="#check-your-code-for-errors-or-bad-habits-by-running-jshint" title="Permalink to this headline">¶</a></h3>
|
||||
<p><a class="reference external" href="http://jshint.com">JSHint</a> will do a static analysis of your code and hightlight potential errors
|
||||
and/or bad habits.</p>
|
||||
<div class="highlight-python"><pre>grunt jshint</pre>
|
||||
@ -500,20 +529,115 @@ and/or bad habits.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="minification">
|
||||
<h2><a class="toc-backref" href="#id25">Minification</a><a class="headerlink" href="#minification" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="minifying-javascript-and-css">
|
||||
<h3><a class="toc-backref" href="#id26">Minifying Javascript and CSS</a><a class="headerlink" href="#minifying-javascript-and-css" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Please make sure to read the section <a class="reference internal" href="#development">Development</a> and that you have installed
|
||||
all development dependencies (long story short, you can run <tt class="docutils literal"><span class="pre">npm</span> <span class="pre">install</span></tt>
|
||||
and then <tt class="docutils literal"><span class="pre">grunt</span> <span class="pre">fetch</span></tt>).</p>
|
||||
<p>We use <a class="reference external" href="http://requirejs.org">require.js</a> to keep track of <em>Converse.js</em> and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.</p>
|
||||
<p>To minify the Javascript and CSS, run the following command:</p>
|
||||
<div class="highlight-python"><pre>grunt minify</pre>
|
||||
</div>
|
||||
<p>Javascript will be bundled and minified with <a class="reference external" href="http://requirejs.org">require.js</a>‘s optimization tool,
|
||||
using <a class="reference external" href="https://github.com/jrburke/almond">almond</a>.</p>
|
||||
<p>You can <a class="reference external" href="http://requirejs.org/docs/optimization.html">read more about require.js’s optimizer here</a>.</p>
|
||||
<p>CSS is minified via <a class="reference external" href="https://github.com/gruntjs/grunt-contrib-cssmin">cssmin</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="translations">
|
||||
<h2><a class="toc-backref" href="#id27">Translations</a><a class="headerlink" href="#translations" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don’t need. Remember to rebuild the
|
||||
minified file afterwards.</p>
|
||||
</div>
|
||||
<p>The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.</p>
|
||||
<p>The POT file contains all translateable strings extracted from converse.js.</p>
|
||||
<p>To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">__</span><span class="p">(</span><span class="s">'This string will be translated at runtime'</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>After adding the string, you’ll need to regenerate the POT file, like so:</p>
|
||||
<div class="highlight-python"><pre>make pot</pre>
|
||||
</div>
|
||||
<p>You can then create or update the PO file for a specific language by doing the following:</p>
|
||||
<div class="highlight-python"><pre>msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U</pre>
|
||||
</div>
|
||||
<p>To do this for ALL languages, run:</p>
|
||||
<div class="highlight-python"><pre>make merge</pre>
|
||||
</div>
|
||||
<p>The resulting PO file is then what gets translated.</p>
|
||||
<p>If you’ve created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under <em>Content-Transfer-Encoding</em>). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we’re using.</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="s">"domain: converse</span><span class="se">\n</span><span class="s">"</span>
|
||||
<span class="s">"lang: de</span><span class="se">\n</span><span class="s">"</span>
|
||||
<span class="s">"plural_forms: nplurals=2; plural=(n != 1);</span><span class="se">\n</span><span class="s">"</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Unfortunately <a class="reference external" href="http://slexaxton.github.io/Jed">Jed</a> cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.</p>
|
||||
<p>To generate JSON from a PO file, you’ll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):</p>
|
||||
<div class="highlight-python"><pre>npm install po2json</pre>
|
||||
</div>
|
||||
<p>You can then convert the translations into JSON format:</p>
|
||||
<div class="highlight-python"><pre>po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json</pre>
|
||||
</div>
|
||||
<p>Now from converse.json paste the data as a value for the “locale_data” key in the
|
||||
object in the language’s .js file.</p>
|
||||
<p>So, if you are for example translating into German (language code ‘de’), you’ll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:</p>
|
||||
<div class="highlight-python"><pre>(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));</pre>
|
||||
</div>
|
||||
<p>making sure to also paste the JSON data as value to the “locale_data” key.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">If you are adding translations for a new language that is not already supported,
|
||||
you’ll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.</p>
|
||||
</div>
|
||||
<p>Congratulations, you’ve now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="troubleshooting">
|
||||
<h1><a class="toc-backref" href="#id23">Troubleshooting</a><a class="headerlink" href="#troubleshooting" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><a class="toc-backref" href="#id28">Troubleshooting</a><a class="headerlink" href="#troubleshooting" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="conflicts-with-other-javascript-libraries">
|
||||
<h2><a class="toc-backref" href="#id24">Conflicts with other Javascript libraries</a><a class="headerlink" href="#conflicts-with-other-javascript-libraries" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id29">Conflicts with other Javascript libraries</a><a class="headerlink" href="#conflicts-with-other-javascript-libraries" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="problem">
|
||||
<h3><a class="toc-backref" href="#id25">Problem:</a><a class="headerlink" href="#problem" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id30">Problem:</a><a class="headerlink" href="#problem" title="Permalink to this headline">¶</a></h3>
|
||||
<p>You are using other Javascript libraries (like JQuery plugins), and
|
||||
get errors like these in your browser console:</p>
|
||||
<div class="highlight-python"><pre>Uncaught TypeError: Object [object Object] has no method 'xxx' from example.js</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="solution">
|
||||
<h3><a class="toc-backref" href="#id26">Solution:</a><a class="headerlink" href="#solution" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id31">Solution:</a><a class="headerlink" href="#solution" title="Permalink to this headline">¶</a></h3>
|
||||
<p>First, find out which object is referred to by <tt class="docutils literal"><span class="pre">Object</span> <span class="pre">[object</span> <span class="pre">Object]</span></tt>.</p>
|
||||
<p>It will probably be the jQuery object <tt class="docutils literal"><span class="pre">$</span></tt> or perhaps the underscore.js object <tt class="docutils literal"><span class="pre">_</span></tt>.</p>
|
||||
<p>For the purpose of demonstration, I’m going to assume its <tt class="docutils literal"><span class="pre">$</span></tt>, but the same
|
||||
@ -555,11 +679,11 @@ jQuery plugins must load after jQuery).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="events">
|
||||
<h1><a class="toc-backref" href="#id27">Events</a><a class="headerlink" href="#events" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><a class="toc-backref" href="#id32">Events</a><a class="headerlink" href="#events" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Converse.js emits events to which you can subscribe from your own Javascript.</p>
|
||||
<p>Concerning events, the following methods are available:</p>
|
||||
<div class="section" id="event-methods">
|
||||
<h2><a class="toc-backref" href="#id28">Event Methods</a><a class="headerlink" href="#event-methods" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id33">Event Methods</a><a class="headerlink" href="#event-methods" title="Permalink to this headline">¶</a></h2>
|
||||
<ul>
|
||||
<li><p class="first"><strong>on(eventName, callback)</strong>:</p>
|
||||
<blockquote>
|
||||
@ -603,7 +727,7 @@ exactly once.</p>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="event-types">
|
||||
<h2><a class="toc-backref" href="#id29">Event Types</a><a class="headerlink" href="#event-types" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id34">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>
|
||||
<ul>
|
||||
<li><p class="first"><strong>onInitialized</strong></p>
|
||||
@ -689,7 +813,7 @@ got all its ducks in a row.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#id30">Configuration</a><a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h1>
|
||||
<h1><a class="toc-backref" href="#id35">Configuration</a><a class="headerlink" href="#configuration" title="Permalink to this headline">¶</a></h1>
|
||||
<p>The included minified JS and CSS files can be used for demoing or testing, but
|
||||
you’ll want to configure <em>Converse.js</em> to suit your needs before you deploy it
|
||||
on your website.</p>
|
||||
@ -703,9 +827,9 @@ all the available configuration settings.</p>
|
||||
JS file so that it will include the new settings. Please refer to the
|
||||
<a class="reference internal" href="#minification">Minification</a> section for more info on how to do this.</p>
|
||||
<div class="section" id="configuration-variables">
|
||||
<h2><a class="toc-backref" href="#id31">Configuration variables</a><a class="headerlink" href="#configuration-variables" title="Permalink to this headline">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id36">Configuration variables</a><a class="headerlink" href="#configuration-variables" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="allow-contact-requests">
|
||||
<h3><a class="toc-backref" href="#id32">allow_contact_requests</a><a class="headerlink" href="#allow-contact-requests" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id37">allow_contact_requests</a><a class="headerlink" href="#allow-contact-requests" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">true</span></tt></p>
|
||||
<p>Allow users to add one another as contacts. If this is set to false, the
|
||||
<strong>Add a contact</strong> widget, <strong>Contact Requests</strong> and <strong>Pending Contacts</strong> roster
|
||||
@ -713,18 +837,18 @@ sections will all not appear. Additionally, all incoming contact requests will b
|
||||
ignored.</p>
|
||||
</div>
|
||||
<div class="section" id="allow-muc">
|
||||
<h3><a class="toc-backref" href="#id33">allow_muc</a><a class="headerlink" href="#allow-muc" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id38">allow_muc</a><a class="headerlink" href="#allow-muc" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">true</span></tt></p>
|
||||
<p>Allow multi-user chat (muc) in chatrooms. Setting this to <tt class="docutils literal"><span class="pre">false</span></tt> will remove
|
||||
the <tt class="docutils literal"><span class="pre">Chatrooms</span></tt> tab from the control box.</p>
|
||||
</div>
|
||||
<div class="section" id="animate">
|
||||
<h3><a class="toc-backref" href="#id34">animate</a><a class="headerlink" href="#animate" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id39">animate</a><a class="headerlink" href="#animate" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">true</span></tt></p>
|
||||
<p>Show animations, for example when opening and closing chat boxes.</p>
|
||||
</div>
|
||||
<div class="section" id="auto-list-rooms">
|
||||
<h3><a class="toc-backref" href="#id35">auto_list_rooms</a><a class="headerlink" href="#auto-list-rooms" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id40">auto_list_rooms</a><a class="headerlink" href="#auto-list-rooms" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>If true, and the XMPP server on which the current user is logged in supports
|
||||
multi-user chat, then a list of rooms on that server will be fetched.</p>
|
||||
@ -734,24 +858,24 @@ features, number of occupants etc.), so on servers with many rooms this
|
||||
option will create lots of extra connection traffic.</p>
|
||||
</div>
|
||||
<div class="section" id="auto-reconnect">
|
||||
<h3><a class="toc-backref" href="#id36">auto_reconnect</a><a class="headerlink" href="#auto-reconnect" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id41">auto_reconnect</a><a class="headerlink" href="#auto-reconnect" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">true</span></tt></p>
|
||||
<p>Automatically reconnect to the XMPP server if the connection drops
|
||||
unexpectedly.</p>
|
||||
</div>
|
||||
<div class="section" id="auto-subscribe">
|
||||
<h3><a class="toc-backref" href="#id37">auto_subscribe</a><a class="headerlink" href="#auto-subscribe" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id42">auto_subscribe</a><a class="headerlink" href="#auto-subscribe" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>If true, the user will automatically subscribe back to any contact requests.</p>
|
||||
</div>
|
||||
<div class="section" id="bosh-service-url">
|
||||
<h3><a class="toc-backref" href="#id38">bosh_service_url</a><a class="headerlink" href="#bosh-service-url" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id43">bosh_service_url</a><a class="headerlink" href="#bosh-service-url" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Connections to an XMPP server depend on a BOSH connection manager which acts as
|
||||
a middle man between HTTP and XMPP.</p>
|
||||
<p>See <a class="reference external" href="http://metajack.im/2008/09/08/which-bosh-server-do-you-need">here</a> for more information.</p>
|
||||
</div>
|
||||
<div class="section" id="cache-otr-key">
|
||||
<h3><a class="toc-backref" href="#id39">cache_otr_key</a><a class="headerlink" href="#cache-otr-key" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id44">cache_otr_key</a><a class="headerlink" href="#cache-otr-key" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>Let the <a class="reference external" href="https://otr.cypherpunks.ca">OTR (Off-the-record encryption)</a> private
|
||||
key be cached in your browser’s session storage.</p>
|
||||
@ -770,12 +894,12 @@ current session. Previous sessions however cannot be decrypted.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="debug">
|
||||
<h3><a class="toc-backref" href="#id40">debug</a><a class="headerlink" href="#debug" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id45">debug</a><a class="headerlink" href="#debug" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>If set to true, debugging output will be logged to the browser console.</p>
|
||||
</div>
|
||||
<div class="section" id="expose-rid-and-sid">
|
||||
<h3><a class="toc-backref" href="#id41">expose_rid_and_sid</a><a class="headerlink" href="#expose-rid-and-sid" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id46">expose_rid_and_sid</a><a class="headerlink" href="#expose-rid-and-sid" title="Permalink to this headline">¶</a></h3>
|
||||
<p>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
|
||||
these values.</p>
|
||||
@ -783,24 +907,24 @@ these values.</p>
|
||||
and inject fake chat messages.</p>
|
||||
</div>
|
||||
<div class="section" id="fullname">
|
||||
<h3><a class="toc-backref" href="#id42">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id47">fullname</a><a class="headerlink" href="#fullname" title="Permalink to this headline">¶</a></h3>
|
||||
<p>If you are using prebinding, can specify the fullname of the currently
|
||||
logged in user, otherwise the user’s vCard will be fetched.</p>
|
||||
</div>
|
||||
<div class="section" id="hide-muc-server">
|
||||
<h3><a class="toc-backref" href="#id43">hide_muc_server</a><a class="headerlink" href="#hide-muc-server" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id48">hide_muc_server</a><a class="headerlink" href="#hide-muc-server" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>Hide the <tt class="docutils literal"><span class="pre">server</span></tt> input field of the form inside the <tt class="docutils literal"><span class="pre">Room</span></tt> panel of the
|
||||
controlbox. Useful if you want to restrict users to a specific XMPP server of
|
||||
your choosing.</p>
|
||||
</div>
|
||||
<div class="section" id="i18n">
|
||||
<h3><a class="toc-backref" href="#id44">i18n</a><a class="headerlink" href="#i18n" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id49">i18n</a><a class="headerlink" href="#i18n" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Specify the locale/language. The language must be in the <tt class="docutils literal"><span class="pre">locales</span></tt> object. Refer to
|
||||
<tt class="docutils literal"><span class="pre">./locale/locales.js</span></tt> to see which locales are supported.</p>
|
||||
</div>
|
||||
<div class="section" id="prebind">
|
||||
<h3><a class="toc-backref" href="#id45">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id50">prebind</a><a class="headerlink" href="#prebind" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>Use this option when you want to attach to an existing XMPP connection that was
|
||||
already authenticated (usually on the backend before page load).</p>
|
||||
@ -813,7 +937,7 @@ values as <tt class="docutils literal"><span class="pre">jid</span></tt>, <tt cl
|
||||
<p>Additionally, you have to specify <tt class="docutils literal"><span class="pre">bosh_service_url</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="show-controlbox-by-default">
|
||||
<h3><a class="toc-backref" href="#id46">show_controlbox_by_default</a><a class="headerlink" href="#show-controlbox-by-default" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id51">show_controlbox_by_default</a><a class="headerlink" href="#show-controlbox-by-default" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>The “controlbox” refers to the special chatbox containing your contacts roster,
|
||||
status widget, chatrooms and other controls.</p>
|
||||
@ -823,7 +947,7 @@ the page with class <em>toggle-online-users</em>.</p>
|
||||
page load.</p>
|
||||
</div>
|
||||
<div class="section" id="show-call-button">
|
||||
<h3><a class="toc-backref" href="#id47">show_call_button</a><a class="headerlink" href="#show-call-button" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id52">show_call_button</a><a class="headerlink" href="#show-call-button" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>Enable to display a call button on the chatbox toolbar.</p>
|
||||
<p>When the call button is pressed, it will emit an event that can be used by a third-party library to initiate a call.</p>
|
||||
@ -837,26 +961,26 @@ page load.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="show-only-online-users">
|
||||
<h3><a class="toc-backref" href="#id48">show_only_online_users</a><a class="headerlink" href="#show-only-online-users" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id53">show_only_online_users</a><a class="headerlink" href="#show-only-online-users" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>If set to <tt class="docutils literal"><span class="pre">true</span></tt>, only online users will be shown in the contacts roster.
|
||||
Users with any other status (e.g. away, busy etc.) will not be shown.</p>
|
||||
</div>
|
||||
<div class="section" id="use-otr-by-default">
|
||||
<h3><a class="toc-backref" href="#id49">use_otr_by_default</a><a class="headerlink" href="#use-otr-by-default" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id54">use_otr_by_default</a><a class="headerlink" href="#use-otr-by-default" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<p>If set to <tt class="docutils literal"><span class="pre">true</span></tt>, Converse.js will automatically try to initiate an OTR (off-the-record)
|
||||
encrypted chat session every time you open a chat box.</p>
|
||||
</div>
|
||||
<div class="section" id="use-vcards">
|
||||
<h3><a class="toc-backref" href="#id50">use_vcards</a><a class="headerlink" href="#use-vcards" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id55">use_vcards</a><a class="headerlink" href="#use-vcards" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">true</span></tt></p>
|
||||
<p>Determines whether the XMPP server will be queried for roster contacts’ VCards
|
||||
or not. VCards contain extra personal information such as your fullname and
|
||||
avatar image.</p>
|
||||
</div>
|
||||
<div class="section" id="xhr-custom-status">
|
||||
<h3><a class="toc-backref" href="#id51">xhr_custom_status</a><a class="headerlink" href="#xhr-custom-status" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id56">xhr_custom_status</a><a class="headerlink" href="#xhr-custom-status" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
@ -866,7 +990,7 @@ avatar image.</p>
|
||||
remote server.</p>
|
||||
</div>
|
||||
<div class="section" id="xhr-custom-status-url">
|
||||
<h3><a class="toc-backref" href="#id52">xhr_custom_status_url</a><a class="headerlink" href="#xhr-custom-status-url" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id57">xhr_custom_status_url</a><a class="headerlink" href="#xhr-custom-status-url" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).</p>
|
||||
@ -878,7 +1002,7 @@ message will be made.</p>
|
||||
<p>The message itself is sent in the request under the key <tt class="docutils literal"><span class="pre">msg</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="xhr-user-search">
|
||||
<h3><a class="toc-backref" href="#id53">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id58">xhr_user_search</a><a class="headerlink" href="#xhr-user-search" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Default = <tt class="docutils literal"><span class="pre">false</span></tt></p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
@ -895,7 +1019,7 @@ message will be made.</p>
|
||||
corresponds to a matched user and needs the keys <tt class="docutils literal"><span class="pre">id</span></tt> and <tt class="docutils literal"><span class="pre">fullname</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="xhr-user-search-url">
|
||||
<h3><a class="toc-backref" href="#id54">xhr_user_search_url</a><a class="headerlink" href="#xhr-user-search-url" title="Permalink to this headline">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id59">xhr_user_search_url</a><a class="headerlink" href="#xhr-user-search-url" title="Permalink to this headline">¶</a></h3>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">XHR stands for XMLHTTPRequest, and is meant here in the AJAX sense (Asynchronous Javascript and XML).</p>
|
||||
@ -906,101 +1030,6 @@ corresponds to a matched user and needs the keys <tt class="docutils literal"><s
|
||||
The query string will be included in the request with <tt class="docutils literal"><span class="pre">q</span></tt> as its key.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="minification">
|
||||
<h1><a class="toc-backref" href="#id55">Minification</a><a class="headerlink" href="#minification" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="minifying-javascript-and-css">
|
||||
<h2><a class="toc-backref" href="#id56">Minifying Javascript and CSS</a><a class="headerlink" href="#minifying-javascript-and-css" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Please make sure to read the section <a class="reference internal" href="#development">Development</a> and that you have installed
|
||||
all development dependencies (long story short, you can run <tt class="docutils literal"><span class="pre">npm</span> <span class="pre">install</span></tt>
|
||||
and then <tt class="docutils literal"><span class="pre">grunt</span> <span class="pre">fetch</span></tt>).</p>
|
||||
<p>We use <a class="reference external" href="http://requirejs.org">require.js</a> to keep track of <em>Converse.js</em> and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.</p>
|
||||
<p>To minify the Javascript and CSS, run the following command:</p>
|
||||
<div class="highlight-python"><pre>grunt minify</pre>
|
||||
</div>
|
||||
<p>Javascript will be bundled and minified with <a class="reference external" href="http://requirejs.org">require.js</a>‘s optimization tool,
|
||||
using <a class="reference external" href="https://github.com/jrburke/almond">almond</a>.</p>
|
||||
<p>You can <a class="reference external" href="http://requirejs.org/docs/optimization.html">read more about require.js’s optimizer here</a>.</p>
|
||||
<p>CSS is minified via <a class="reference external" href="https://github.com/gruntjs/grunt-contrib-cssmin">cssmin</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="translations">
|
||||
<h1><a class="toc-backref" href="#id57">Translations</a><a class="headerlink" href="#translations" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don’t need. Remember to rebuild the
|
||||
minified file afterwards.</p>
|
||||
</div>
|
||||
<p>The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.</p>
|
||||
<p>The POT file contains all translateable strings extracted from converse.js.</p>
|
||||
<p>To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">__</span><span class="p">(</span><span class="s">'This string will be translated at runtime'</span><span class="p">);</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>After adding the string, you’ll need to regenerate the POT file, like so:</p>
|
||||
<div class="highlight-python"><pre>make pot</pre>
|
||||
</div>
|
||||
<p>You can then create or update the PO file for a specific language by doing the following:</p>
|
||||
<div class="highlight-python"><pre>msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U</pre>
|
||||
</div>
|
||||
<p>To do this for ALL languages, run:</p>
|
||||
<div class="highlight-python"><pre>make merge</pre>
|
||||
</div>
|
||||
<p>The resulting PO file is then what gets translated.</p>
|
||||
<p>If you’ve created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under <em>Content-Transfer-Encoding</em>). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we’re using.</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="s">"domain: converse</span><span class="se">\n</span><span class="s">"</span>
|
||||
<span class="s">"lang: de</span><span class="se">\n</span><span class="s">"</span>
|
||||
<span class="s">"plural_forms: nplurals=2; plural=(n != 1);</span><span class="se">\n</span><span class="s">"</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Unfortunately <a class="reference external" href="http://slexaxton.github.io/Jed">Jed</a> cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.</p>
|
||||
<p>To generate JSON from a PO file, you’ll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):</p>
|
||||
<div class="highlight-python"><pre>npm install po2json</pre>
|
||||
</div>
|
||||
<p>You can then convert the translations into JSON format:</p>
|
||||
<div class="highlight-python"><pre>po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json</pre>
|
||||
</div>
|
||||
<p>Now from converse.json paste the data as a value for the “locale_data” key in the
|
||||
object in the language’s .js file.</p>
|
||||
<p>So, if you are for example translating into German (language code ‘de’), you’ll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:</p>
|
||||
<div class="highlight-python"><pre>(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));</pre>
|
||||
</div>
|
||||
<p>making sure to also paste the JSON data as value to the “locale_data” key.</p>
|
||||
<div class="admonition note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">If you are adding translations for a new language that is not already supported,
|
||||
you’ll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.</p>
|
||||
</div>
|
||||
<p>Congratulations, you’ve now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.</p>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1016,7 +1045,7 @@ those hoops you had to jump through.</p>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li><a href="#">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="#">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Sphinx inventory version 2
|
||||
# Project: Converse.js
|
||||
# Version: 0.7.2
|
||||
# Version: 0.7.3
|
||||
# The remainder of this file is compressed using zlib.
|
||||
xÚmÎÁ
|
||||
à à{Ÿ"°³ƒ]÷;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Search — Converse.js 0.7.2 documentation</title>
|
||||
<title>Search — Converse.js 0.7.3 documentation</title>
|
||||
|
||||
<link rel="stylesheet" href="_static/stylesheet.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
@ -15,7 +15,7 @@
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '0.7.2',
|
||||
VERSION: '0.7.3',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
@ -25,7 +25,7 @@
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<script type="text/javascript" src="_static/searchtools.js"></script>
|
||||
<link rel="top" title="Converse.js 0.7.2 documentation" href="index.html" />
|
||||
<link rel="top" title="Converse.js 0.7.3 documentation" href="index.html" />
|
||||
<script type="text/javascript">
|
||||
jQuery(function() { Search.loadIndex("searchindex.js"); });
|
||||
</script>
|
||||
@ -55,7 +55,7 @@
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li><a href="index.html">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="index.html">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<section id="main_content" class="inner">
|
||||
@ -100,7 +100,7 @@
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li><a href="index.html">Converse.js 0.7.2 documentation</a> »</li>
|
||||
<li><a href="index.html">Converse.js 0.7.3 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -349,6 +349,39 @@ The connection is already created inside Converse.js, so the
|
||||
If someone submits a sane patch that does the above, I'll be happy to merge it.
|
||||
Until then, people will have to do this themselves.
|
||||
|
||||
========
|
||||
Features
|
||||
========
|
||||
|
||||
Off-the-record encryption
|
||||
=========================
|
||||
|
||||
Converse.js supports `Off-the-record (OTR) <https://otr.cypherpunks.ca/>`_
|
||||
encrypted messaging.
|
||||
|
||||
The OTR protocol not only **encrypts your messages**, it provides ways to
|
||||
**verify the identity** of the person you are talking to,
|
||||
**plausible deniability** and **perfect forward secrecy** by generating
|
||||
new encryption keys for each conversation.
|
||||
|
||||
In its current state, Javascript cryptography is fraught with dangers and
|
||||
challenges that make it impossible to reach the same standard of security that
|
||||
is available with native "desktop" software.
|
||||
|
||||
This is due to its runtime malleability, the way it is "installed" (e.g.
|
||||
served) and the browser's lack of cryptographic primitives needed to implement
|
||||
secure crypto.
|
||||
|
||||
For harsh but fairly valid criticism of Javascript cryptography, read:
|
||||
`Javascript Cryptography Considered Harmful <http://www.matasano.com/articles/javascript-cryptography/>`_.
|
||||
|
||||
To get an idea on how this applies to OTR support in Converse.js, please read
|
||||
`my thoughts on it <https://opkode.com/media/blog/2013/11/11/conversejs-otr-support>`_.
|
||||
|
||||
For now, suffice to say that although its useful to have OTR support in
|
||||
Converse.js in order to avoid most eavesdroppers, if you need serious
|
||||
communications privacy, then you're much better off using native software.
|
||||
|
||||
===========
|
||||
Development
|
||||
===========
|
||||
@ -478,6 +511,137 @@ You can run both the tests and jshint in one go by calling:
|
||||
|
||||
grunt check
|
||||
|
||||
Minification
|
||||
============
|
||||
|
||||
Minifying Javascript and CSS
|
||||
----------------------------
|
||||
|
||||
Please make sure to read the section `Development`_ and that you have installed
|
||||
all development dependencies (long story short, you can run ``npm install``
|
||||
and then ``grunt fetch``).
|
||||
|
||||
We use `require.js`_ to keep track of *Converse.js* and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.
|
||||
|
||||
To minify the Javascript and CSS, run the following command:
|
||||
|
||||
::
|
||||
|
||||
grunt minify
|
||||
|
||||
Javascript will be bundled and minified with `require.js`_'s optimization tool,
|
||||
using `almond <https://github.com/jrburke/almond>`_.
|
||||
|
||||
You can `read more about require.js's optimizer here`_.
|
||||
|
||||
CSS is minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
|
||||
|
||||
Translations
|
||||
============
|
||||
|
||||
.. Note ::
|
||||
Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don't need. Remember to rebuild the
|
||||
minified file afterwards.
|
||||
|
||||
The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.
|
||||
|
||||
The POT file contains all translateable strings extracted from converse.js.
|
||||
|
||||
To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:
|
||||
|
||||
::
|
||||
|
||||
__('This string will be translated at runtime');
|
||||
|
||||
After adding the string, you'll need to regenerate the POT file, like so:
|
||||
|
||||
::
|
||||
|
||||
make pot
|
||||
|
||||
You can then create or update the PO file for a specific language by doing the following:
|
||||
|
||||
::
|
||||
|
||||
msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U
|
||||
|
||||
To do this for ALL languages, run:
|
||||
|
||||
::
|
||||
|
||||
make merge
|
||||
|
||||
The resulting PO file is then what gets translated.
|
||||
|
||||
If you've created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under *Content-Transfer-Encoding*). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we're using.
|
||||
|
||||
::
|
||||
|
||||
"domain: converse\n"
|
||||
"lang: de\n"
|
||||
"plural_forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
|
||||
Unfortunately `Jed <http://slexaxton.github.io/Jed>`_ cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.
|
||||
|
||||
To generate JSON from a PO file, you'll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):
|
||||
|
||||
::
|
||||
|
||||
npm install po2json
|
||||
|
||||
You can then convert the translations into JSON format:
|
||||
|
||||
::
|
||||
|
||||
po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json
|
||||
|
||||
Now from converse.json paste the data as a value for the "locale_data" key in the
|
||||
object in the language's .js file.
|
||||
|
||||
So, if you are for example translating into German (language code 'de'), you'll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:
|
||||
|
||||
::
|
||||
|
||||
(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));
|
||||
|
||||
making sure to also paste the JSON data as value to the "locale_data" key.
|
||||
|
||||
.. Note ::
|
||||
If you are adding translations for a new language that is not already supported,
|
||||
you'll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.
|
||||
|
||||
Congratulations, you've now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.
|
||||
|
||||
|
||||
===============
|
||||
Troubleshooting
|
||||
@ -972,140 +1136,6 @@ 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.
|
||||
The query string will be included in the request with ``q`` as its key.
|
||||
|
||||
============
|
||||
Minification
|
||||
============
|
||||
|
||||
Minifying Javascript and CSS
|
||||
============================
|
||||
|
||||
Please make sure to read the section `Development`_ and that you have installed
|
||||
all development dependencies (long story short, you can run ``npm install``
|
||||
and then ``grunt fetch``).
|
||||
|
||||
We use `require.js`_ to keep track of *Converse.js* and its dependencies and to
|
||||
to bundle them together in a single minified file fit for deployment to a
|
||||
production site.
|
||||
|
||||
To minify the Javascript and CSS, run the following command:
|
||||
|
||||
::
|
||||
|
||||
grunt minify
|
||||
|
||||
Javascript will be bundled and minified with `require.js`_'s optimization tool,
|
||||
using `almond <https://github.com/jrburke/almond>`_.
|
||||
|
||||
You can `read more about require.js's optimizer here`_.
|
||||
|
||||
CSS is minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
|
||||
|
||||
|
||||
============
|
||||
Translations
|
||||
============
|
||||
|
||||
.. Note ::
|
||||
Translations take up a lot of space and will bloat your minified file.
|
||||
At the time of writing, all the translations add about 50KB of extra data to
|
||||
the minified javascript file. Therefore, make sure to only
|
||||
include those languages that you intend to support and remove from
|
||||
./locale/locales.js those which you don't need. Remember to rebuild the
|
||||
minified file afterwards.
|
||||
|
||||
The gettext POT file located in ./locale/converse.pot is the template
|
||||
containing all translations and from which for each language an individual PO
|
||||
file is generated.
|
||||
|
||||
The POT file contains all translateable strings extracted from converse.js.
|
||||
|
||||
To make a user facing string translateable, wrap it in the double underscore helper
|
||||
function like so:
|
||||
|
||||
::
|
||||
|
||||
__('This string will be translated at runtime');
|
||||
|
||||
After adding the string, you'll need to regenerate the POT file, like so:
|
||||
|
||||
::
|
||||
|
||||
make pot
|
||||
|
||||
You can then create or update the PO file for a specific language by doing the following:
|
||||
|
||||
::
|
||||
|
||||
msgmerge ./locale/de/LC_MESSAGES/converse.po ./locale/converse.pot -U
|
||||
|
||||
To do this for ALL languages, run:
|
||||
|
||||
::
|
||||
|
||||
make merge
|
||||
|
||||
The resulting PO file is then what gets translated.
|
||||
|
||||
If you've created a new PO file, please make sure to add the following
|
||||
attributes at the top of the file (under *Content-Transfer-Encoding*). They are
|
||||
required as configuration settings for Jed, the Javascript translations library
|
||||
that we're using.
|
||||
|
||||
::
|
||||
|
||||
"domain: converse\n"
|
||||
"lang: de\n"
|
||||
"plural_forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
|
||||
Unfortunately `Jed <http://slexaxton.github.io/Jed>`_ cannot use the PO files directly. We have to generate from it
|
||||
a file in JSON format and then put that in a .js file for the specific
|
||||
language.
|
||||
|
||||
To generate JSON from a PO file, you'll need po2json for node.js. Run the
|
||||
following command to install it (npm being the node.js package manager):
|
||||
|
||||
::
|
||||
|
||||
npm install po2json
|
||||
|
||||
You can then convert the translations into JSON format:
|
||||
|
||||
::
|
||||
|
||||
po2json locale/de/LC_MESSAGES/converse.po locale/de/LC_MESSAGES/converse.json
|
||||
|
||||
Now from converse.json paste the data as a value for the "locale_data" key in the
|
||||
object in the language's .js file.
|
||||
|
||||
So, if you are for example translating into German (language code 'de'), you'll
|
||||
create or update the file ./locale/LC_MESSAGES/de.js with the following code:
|
||||
|
||||
::
|
||||
|
||||
(function (root, factory) {
|
||||
define("de", ['jed'], function () {
|
||||
return factory(new Jed({
|
||||
"domain": "converse",
|
||||
"locale_data": {
|
||||
// Paste the JSON data from converse.json here
|
||||
}
|
||||
})
|
||||
}
|
||||
}(this, function (i18n) {
|
||||
return i18n;
|
||||
}));
|
||||
|
||||
making sure to also paste the JSON data as value to the "locale_data" key.
|
||||
|
||||
.. Note ::
|
||||
If you are adding translations for a new language that is not already supported,
|
||||
you'll have to make one more edit in ./locale/locales.js to make sure the
|
||||
language is loaded by require.js.
|
||||
|
||||
Congratulations, you've now succesfully added your translations. Sorry for all
|
||||
those hoops you had to jump through.
|
||||
|
||||
.. _`read more about require.js's optimizer here`: http://requirejs.org/docs/optimization.html
|
||||
.. _`HTTP`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
|
||||
.. _`XMPP`: https://en.wikipedia.org/wiki/Xmpp
|
||||
|
Loading…
Reference in New Issue
Block a user