Commit cb241dd5 authored by JC Brand's avatar JC Brand

Moved all the registration code into a plugin

parent 147a3c9e
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
define("converse", [ define("converse", [
/* Removable components /* Removable components
* -------------------- * --------------------
* Any of the following components can be removed if they're not needed. * Any of the following components may be removed if they're not needed.
*/ */
"converse-muc", // XEP-0045 Multi-user chat "converse-muc", // XEP-0045 Multi-user chat
"converse-otr", // Off-the-record encryption for one-on-one messages "converse-otr", // Off-the-record encryption for one-on-one messages
"converse-register", // XEP-0077 In-band registration
/* End: Removable components */ /* End: Removable components */
"converse-core" "converse-core"
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
## 0.11.0 (Unreleased) ## 0.11.0 (Unreleased)
- Split converse.js into different modules. The code for the OTR and MUC - Split converse.js into different modules.
features are now in separate modules and these can be removed completely from The code for the OTR, MUC and registration features are now in separate
the build. [jcbrand] modules and these can be removed completely from the build. [jcbrand]
- Don't play sound notifications for OTR messages which are setting up an - Don't play sound notifications for OTR messages which are setting up an
encrypted session. [jcbrand] encrypted session. [jcbrand]
- Removed the `account.logout` API, instead use `user.logout`. [jcbrand] - Removed the `account.logout` API, instead use `user.logout`. [jcbrand]
......
...@@ -47,6 +47,7 @@ require.config({ ...@@ -47,6 +47,7 @@ require.config({
"converse-core": "src/converse-core", "converse-core": "src/converse-core",
"converse-muc": "src/converse-muc", "converse-muc": "src/converse-muc",
"converse-otr": "src/converse-otr", "converse-otr": "src/converse-otr",
"converse-register": "src/converse-register",
"converse-dependencies": "src/deps-full", "converse-dependencies": "src/deps-full",
"converse-templates": "src/templates", "converse-templates": "src/templates",
......
This diff is collapsed.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
factory(converse, utils); factory(converse, utils);
} }
}(this, function (converse_api, utils) { }(this, function (converse_api, utils) {
"use strict";
// Strophe methods for building stanzas // Strophe methods for building stanzas
var Strophe = converse_api.env.Strophe, var Strophe = converse_api.env.Strophe,
$iq = converse_api.env.$iq, $iq = converse_api.env.$iq,
...@@ -36,7 +37,10 @@ ...@@ -36,7 +37,10 @@
// Translation machinery // Translation machinery
// --------------------- // ---------------------
var __ = utils.__.bind(this); // __ is just a placeholder for now, we need to bind the utils.__ method
// to the inner converse object, which we can't here, so we do it in the
// initialize method.
var __ = function () {};
var ___ = utils.___; var ___ = utils.___;
// Add Strophe Namespaces // Add Strophe Namespaces
...@@ -194,8 +198,9 @@ ...@@ -194,8 +198,9 @@
/* The initialize function gets called as soon as the plugin is /* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
// For translations
__ = utils.__.bind(converse);
// Configuration values for this plugin // Configuration values for this plugin
var settings = { var settings = {
allow_muc: true, allow_muc: true,
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
factory(otr, converse, utils); factory(otr, converse, utils);
} }
}(this, function (otr, converse_api, utils) { }(this, function (otr, converse_api, utils) {
"use strict";
// Strophe methods for building stanzas // Strophe methods for building stanzas
var Strophe = converse_api.env.Strophe, var Strophe = converse_api.env.Strophe,
b64_sha1 = converse_api.env.b64_sha1; b64_sha1 = converse_api.env.b64_sha1;
...@@ -30,10 +31,6 @@ ...@@ -30,10 +31,6 @@
var $ = converse_api.env.jQuery, var $ = converse_api.env.jQuery,
_ = converse_api.env._; _ = converse_api.env._;
// Translation machinery
// ---------------------
var __ = utils.__.bind(this);
var HAS_CSPRNG = ((typeof crypto !== 'undefined') && var HAS_CSPRNG = ((typeof crypto !== 'undefined') &&
((typeof crypto.randomBytes === 'function') || ((typeof crypto.randomBytes === 'function') ||
(typeof crypto.getRandomValues === 'function') (typeof crypto.getRandomValues === 'function')
...@@ -49,20 +46,28 @@ ...@@ -49,20 +46,28 @@
var VERIFIED= 2; var VERIFIED= 2;
var FINISHED = 3; var FINISHED = 3;
// Translation aware constants
// ---------------------------
var OTR_CLASS_MAPPING = {}; var OTR_CLASS_MAPPING = {};
OTR_CLASS_MAPPING[UNENCRYPTED] = 'unencrypted'; OTR_CLASS_MAPPING[UNENCRYPTED] = 'unencrypted';
OTR_CLASS_MAPPING[UNVERIFIED] = 'unverified'; OTR_CLASS_MAPPING[UNVERIFIED] = 'unverified';
OTR_CLASS_MAPPING[VERIFIED] = 'verified'; OTR_CLASS_MAPPING[VERIFIED] = 'verified';
OTR_CLASS_MAPPING[FINISHED] = 'finished'; OTR_CLASS_MAPPING[FINISHED] = 'finished';
// Translation aware constants
// ---------------------------
// Just a placeholder for now, we need to bind the utils.__ method to the
// inner converse object, which we can't here, so we do it in the
// initialize method.
var __ = function () {};
var OTR_TRANSLATED_MAPPING = {}; var OTR_TRANSLATED_MAPPING = {};
OTR_TRANSLATED_MAPPING[UNENCRYPTED] = __('unencrypted'); OTR_TRANSLATED_MAPPING[UNENCRYPTED] = __('unencrypted');
OTR_TRANSLATED_MAPPING[UNVERIFIED] = __('unverified'); OTR_TRANSLATED_MAPPING[UNVERIFIED] = __('unverified');
OTR_TRANSLATED_MAPPING[VERIFIED] = __('verified'); OTR_TRANSLATED_MAPPING[VERIFIED] = __('verified');
OTR_TRANSLATED_MAPPING[FINISHED] = __('finished'); OTR_TRANSLATED_MAPPING[FINISHED] = __('finished');
converse_api.plugins.add('otr', { converse_api.plugins.add('otr', {
overrides: { overrides: {
...@@ -486,6 +491,8 @@ ...@@ -486,6 +491,8 @@
* loaded by converse.js's plugin machinery. * loaded by converse.js's plugin machinery.
*/ */
var converse = this.converse; var converse = this.converse;
// For translations
__ = utils.__.bind(converse);
// Configuration values for this plugin // Configuration values for this plugin
var settings = { var settings = {
allow_otr: true, allow_otr: true,
......
This diff is collapsed.
/*global jQuery, templates, escape, Jed, _, locales */ /*global jQuery, templates, escape, _, locales */
(function (root, factory) { (function (root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(["jquery", "underscore", "converse-templates", "locales"], factory); define(["jquery", "underscore", "jed", "converse-templates", "locales"], factory);
} else { } else {
root.utils = factory(jQuery, _, templates, locales); root.utils = factory(jQuery, _, templates, locales);
} }
}(this, function ($, _, templates, locales) { }(this, function ($, _, Jed, templates, locales) {
"use strict"; "use strict";
var XFORM_TYPE_MAP = { var XFORM_TYPE_MAP = {
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
* they require variable interpolation and we don't yet have the * they require variable interpolation and we don't yet have the
* variables at scan time. * variables at scan time.
* *
* See actionInfoMessages * See actionInfoMessages in src/converse-muc.js
*/ */
return str; return str;
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment