Also use _converse
as pluggable object reference.
This commit is contained in:
parent
55dbbede8a
commit
b701c4830f
|
@ -134,7 +134,7 @@ An example plugin
|
||||||
sendPresence: function (type, status_message, jid) {
|
sendPresence: function (type, status_message, jid) {
|
||||||
// The "_converse" object is available via the __super__
|
// The "_converse" object is available via the __super__
|
||||||
// attribute.
|
// attribute.
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
|
|
||||||
// Custom code can come here
|
// Custom code can come here
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
/* 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;
|
||||||
// Configuration values for this plugin
|
// Configuration values for this plugin
|
||||||
// ====================================
|
// ====================================
|
||||||
// Refer to docs/source/configuration.rst for explanations of these
|
// Refer to docs/source/configuration.rst for explanations of these
|
||||||
|
|
|
@ -201,7 +201,7 @@
|
||||||
/* 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;
|
||||||
this.updateSettings({
|
this.updateSettings({
|
||||||
allow_logout: true,
|
allow_logout: true,
|
||||||
default_domain: undefined,
|
default_domain: undefined,
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
_converse.emit = _converse.trigger;
|
_converse.emit = _converse.trigger;
|
||||||
|
|
||||||
// Make converse pluggable
|
// Make converse pluggable
|
||||||
pluggable.enable(_converse, 'converse', 'pluggable');
|
pluggable.enable(_converse, '_converse', 'pluggable');
|
||||||
|
|
||||||
// Module-level constants
|
// Module-level constants
|
||||||
_converse.STATUS_WEIGHTS = {
|
_converse.STATUS_WEIGHTS = {
|
||||||
|
@ -1974,8 +1974,7 @@
|
||||||
|
|
||||||
_converse.pluggable.initializePlugins({
|
_converse.pluggable.initializePlugins({
|
||||||
'updateSettings': updateSettings,
|
'updateSettings': updateSettings,
|
||||||
// TODO: rename
|
'_converse': _converse
|
||||||
'converse': _converse
|
|
||||||
});
|
});
|
||||||
_converse.emit('pluginsInitialized');
|
_converse.emit('pluginsInitialized');
|
||||||
_converse._initialize();
|
_converse._initialize();
|
||||||
|
|
|
@ -301,7 +301,7 @@
|
||||||
/* 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;
|
||||||
this.updateSettings({
|
this.updateSettings({
|
||||||
allow_dragresize: true,
|
allow_dragresize: true,
|
||||||
});
|
});
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
ControlBoxView: {
|
ControlBoxView: {
|
||||||
renderContactsPanel: function () {
|
renderContactsPanel: function () {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
this.__super__.renderContactsPanel.apply(this, arguments);
|
this.__super__.renderContactsPanel.apply(this, arguments);
|
||||||
if (_converse.allow_muc) {
|
if (_converse.allow_muc) {
|
||||||
this.roomspanel = new _converse.RoomsPanel({
|
this.roomspanel = new _converse.RoomsPanel({
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onConnected: function () {
|
onConnected: function () {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
this.__super__.onConnected.apply(this, arguments);
|
this.__super__.onConnected.apply(this, arguments);
|
||||||
if (!this.model.get('connected')) {
|
if (!this.model.get('connected')) {
|
||||||
return;
|
return;
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
featureAdded: function (feature) {
|
featureAdded: function (feature) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
if ((feature.get('var') === Strophe.NS.MUC) && (_converse.allow_muc)) {
|
if ((feature.get('var') === Strophe.NS.MUC) && (_converse.allow_muc)) {
|
||||||
this.setMUCDomain(feature.get('from'));
|
this.setMUCDomain(feature.get('from'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/* 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;
|
||||||
_converse.supports_html5_notification = "Notification" in window;
|
_converse.supports_html5_notification = "Notification" in window;
|
||||||
|
|
||||||
this.updateSettings({
|
this.updateSettings({
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
createMessage: function (message, delay, original_stanza) {
|
createMessage: function (message, delay, original_stanza) {
|
||||||
var _converse = this.__super__.converse,
|
var _converse = this.__super__._converse,
|
||||||
text = _.propertyOf(message.querySelector('body'))('textContent');
|
text = _.propertyOf(message.querySelector('body'))('textContent');
|
||||||
|
|
||||||
if ((!text) || (!_converse.allow_otr)) {
|
if ((!text) || (!_converse.allow_otr)) {
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
getSession: function (callback) {
|
getSession: function (callback) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
var cipher = CryptoJS.lib.PasswordBasedCipher;
|
var cipher = CryptoJS.lib.PasswordBasedCipher;
|
||||||
var pass, instance_tag, saved_key, pass_check;
|
var pass, instance_tag, saved_key, pass_check;
|
||||||
if (_converse.cache_otr_key) {
|
if (_converse.cache_otr_key) {
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
// send the query message to them.
|
// send the query message to them.
|
||||||
this.save({'otr_status': UNENCRYPTED});
|
this.save({'otr_status': UNENCRYPTED});
|
||||||
this.getSession(function (session) {
|
this.getSession(function (session) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
this.otr = new otr.OTR({
|
this.otr = new otr.OTR({
|
||||||
fragment_size: 140,
|
fragment_size: 140,
|
||||||
send_interval: 200,
|
send_interval: 200,
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
this.__super__.initialize.apply(this, arguments);
|
this.__super__.initialize.apply(this, arguments);
|
||||||
this.model.on('change:otr_status', this.onOTRStatusChanged, this);
|
this.model.on('change:otr_status', this.onOTRStatusChanged, this);
|
||||||
this.model.on('showOTRError', this.showOTRError, this);
|
this.model.on('showOTRError', this.showOTRError, this);
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onMessageSubmitted: function (text) {
|
onMessageSubmitted: function (text) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
if (!_converse.connection.authenticated) {
|
if (!_converse.connection.authenticated) {
|
||||||
return this.showHelpMessages(
|
return this.showHelpMessages(
|
||||||
['Sorry, the connection has been lost, '+
|
['Sorry, the connection has been lost, '+
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
showOTRError: function (msg) {
|
showOTRError: function (msg) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
if (msg === 'Message cannot be sent at this time.') {
|
if (msg === 'Message cannot be sent at this time.') {
|
||||||
this.showHelpMessages(
|
this.showHelpMessages(
|
||||||
[__('Your message could not be sent')], 'error');
|
[__('Your message could not be sent')], 'error');
|
||||||
|
@ -378,7 +378,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
authOTR: function (ev) {
|
authOTR: function (ev) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
var scheme = $(ev.target).data().scheme;
|
var scheme = $(ev.target).data().scheme;
|
||||||
var result, question, answer;
|
var result, question, answer;
|
||||||
if (scheme === 'fingerprint') {
|
if (scheme === 'fingerprint') {
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
renderToolbar: function (toolbar, options) {
|
renderToolbar: function (toolbar, options) {
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
if (!_converse.show_toolbar) {
|
if (!_converse.show_toolbar) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@
|
||||||
/* 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;
|
||||||
// Translation aware constants
|
// Translation aware constants
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
// We can only call the __ translation method *after* converse.js
|
// We can only call the __ translation method *after* converse.js
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
/* 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;
|
||||||
|
|
||||||
this.updateSettings({
|
this.updateSettings({
|
||||||
ping_interval: 180 //in seconds
|
ping_interval: 180 //in seconds
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
* login panel.
|
* login panel.
|
||||||
*/
|
*/
|
||||||
this.__super__.renderLoginPanel.apply(this, arguments);
|
this.__super__.renderLoginPanel.apply(this, arguments);
|
||||||
var _converse = this.__super__.converse;
|
var _converse = this.__super__._converse;
|
||||||
if (_converse.allow_registration) {
|
if (_converse.allow_registration) {
|
||||||
this.registerpanel = new _converse.RegisterPanel({
|
this.registerpanel = new _converse.RegisterPanel({
|
||||||
'$parent': this.$el.find('.controlbox-panes'),
|
'$parent': this.$el.find('.controlbox-panes'),
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
/* 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;
|
||||||
|
|
||||||
this.updateSettings({
|
this.updateSettings({
|
||||||
allow_registration: true,
|
allow_registration: true,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user