Commit 8e18d736 authored by JC Brand's avatar JC Brand

fixed indentation of comments

parent fa69bb1b
This diff is collapsed.
...@@ -247,8 +247,8 @@ ...@@ -247,8 +247,8 @@
initRoster: function () { initRoster: function () {
/* We initialize the roster, which will appear inside the /* We initialize the roster, which will appear inside the
* Contacts Panel. * Contacts Panel.
*/ */
var rostergroups = new converse.RosterGroups(); var rostergroups = new converse.RosterGroups();
rostergroups.browserStorage = new Backbone.BrowserStorage[converse.storage]( rostergroups.browserStorage = new Backbone.BrowserStorage[converse.storage](
b64_sha1('converse.roster.groups'+converse.bare_jid)); b64_sha1('converse.roster.groups'+converse.bare_jid));
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
/* 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.
*/ */
this.updateSettings({ this.updateSettings({
archived_messages_page_size: '20', archived_messages_page_size: '20',
message_archiving: 'never', // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs) message_archiving: 'never', // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
...@@ -70,22 +69,22 @@ ...@@ -70,22 +69,22 @@
converse.queryForArchivedMessages = function (options, callback, errback) { converse.queryForArchivedMessages = function (options, callback, errback) {
/* Do a MAM (XEP-0313) query for archived messages. /* Do a MAM (XEP-0313) query for archived messages.
* *
* Parameters: * Parameters:
* (Object) options - Query parameters, either MAM-specific or also for Result Set Management. * (Object) options - Query parameters, either MAM-specific or also for Result Set Management.
* (Function) callback - A function to call whenever we receive query-relevant stanza. * (Function) callback - A function to call whenever we receive query-relevant stanza.
* (Function) errback - A function to call when an error stanza is received. * (Function) errback - A function to call when an error stanza is received.
* *
* The options parameter can also be an instance of * The options parameter can also be an instance of
* Strophe.RSM to enable easy querying between results pages. * Strophe.RSM to enable easy querying between results pages.
* *
* The callback function may be called multiple times, first * The callback function may be called multiple times, first
* for the initial IQ result and then for each message * for the initial IQ result and then for each message
* returned. The last time the callback is called, a * returned. The last time the callback is called, a
* Strophe.RSM object is returned on which "next" or "previous" * Strophe.RSM object is returned on which "next" or "previous"
* can be called before passing it in again to this method, to * can be called before passing it in again to this method, to
* get the next or previous page in the result set. * get the next or previous page in the result set.
*/ */
var date, messages = []; var date, messages = [];
if (typeof options === "function") { if (typeof options === "function") {
callback = options; callback = options;
...@@ -153,7 +152,7 @@ ...@@ -153,7 +152,7 @@
_.extend(converse_api, { _.extend(converse_api, {
/* Extend default converse.js API to add methods specific to MAM /* Extend default converse.js API to add methods specific to MAM
*/ */
'archive': { 'archive': {
'query': converse.queryForArchivedMessages.bind(converse) 'query': converse.queryForArchivedMessages.bind(converse)
} }
......
...@@ -125,12 +125,12 @@ ...@@ -125,12 +125,12 @@
trimChats: function (newchat) { trimChats: function (newchat) {
/* This method is called when a newly created chat box will /* This method is called when a newly created chat box will
* be shown. * be shown.
* *
* It checks whether there is enough space on the page to show * It checks whether there is enough space on the page to show
* another chat box. Otherwise it minimizes the oldest chat box * another chat box. Otherwise it minimizes the oldest chat box
* to create space. * to create space.
*/ */
if (converse.no_trimming || (this.model.length <= 1)) { if (converse.no_trimming || (this.model.length <= 1)) {
return; return;
} }
......
This diff is collapsed.
...@@ -120,8 +120,8 @@ ...@@ -120,8 +120,8 @@
registerHooks: function () { registerHooks: function () {
/* Hook into Strophe's _connect_cb, so that we can send an IQ /* Hook into Strophe's _connect_cb, so that we can send an IQ
* requesting the registration fields. * requesting the registration fields.
*/ */
var conn = converse.connection; var conn = converse.connection;
var connect_cb = conn._connect_cb.bind(conn); var connect_cb = conn._connect_cb.bind(conn);
conn._connect_cb = function (req, callback, raw) { conn._connect_cb = function (req, callback, raw) {
...@@ -137,11 +137,11 @@ ...@@ -137,11 +137,11 @@
getRegistrationFields: function (req, _callback, raw) { getRegistrationFields: function (req, _callback, raw) {
/* Send an IQ stanza to the XMPP server asking for the /* Send an IQ stanza to the XMPP server asking for the
* registration fields. * registration fields.
* Parameters: * Parameters:
* (Strophe.Request) req - The current request * (Strophe.Request) req - The current request
* (Function) callback * (Function) callback
*/ */
converse.log("sendQueryStanza was called"); converse.log("sendQueryStanza was called");
var conn = converse.connection; var conn = converse.connection;
conn.connected = true; conn.connected = true;
...@@ -172,10 +172,10 @@ ...@@ -172,10 +172,10 @@
onRegistrationFields: function (stanza) { onRegistrationFields: function (stanza) {
/* Handler for Registration Fields Request. /* Handler for Registration Fields Request.
* *
* Parameters: * Parameters:
* (XMLElement) elem - The query stanza. * (XMLElement) elem - The query stanza.
*/ */
if (stanza.getElementsByTagName("query").length !== 1) { if (stanza.getElementsByTagName("query").length !== 1) {
converse.connection._changeConnectStatus(Strophe.Status.REGIFAIL, "unknown"); converse.connection._changeConnectStatus(Strophe.Status.REGIFAIL, "unknown");
return false; return false;
...@@ -204,11 +204,11 @@ ...@@ -204,11 +204,11 @@
onProviderChosen: function (ev) { onProviderChosen: function (ev) {
/* Callback method that gets called when the user has chosen an /* Callback method that gets called when the user has chosen an
* XMPP provider. * XMPP provider.
* *
* Parameters: * Parameters:
* (Submit Event) ev - Form submission event. * (Submit Event) ev - Form submission event.
*/ */
if (ev && ev.preventDefault) { ev.preventDefault(); } if (ev && ev.preventDefault) { ev.preventDefault(); }
var $form = $(ev.target), var $form = $(ev.target),
$domain_input = $form.find('input[name=domain]'), $domain_input = $form.find('input[name=domain]'),
...@@ -287,11 +287,11 @@ ...@@ -287,11 +287,11 @@
renderRegistrationForm: function (stanza) { renderRegistrationForm: function (stanza) {
/* Renders the registration form based on the XForm fields /* Renders the registration form based on the XForm fields
* received from the XMPP server. * received from the XMPP server.
* *
* Parameters: * Parameters:
* (XMLElement) stanza - The IQ stanza received from the XMPP server. * (XMLElement) stanza - The IQ stanza received from the XMPP server.
*/ */
var $form= this.$('form'), var $form= this.$('form'),
$stanza = $(stanza), $stanza = $(stanza),
$fields, $input; $fields, $input;
...@@ -344,12 +344,12 @@ ...@@ -344,12 +344,12 @@
reportErrors: function (stanza) { reportErrors: function (stanza) {
/* Report back to the user any error messages received from the /* Report back to the user any error messages received from the
* XMPP server after attempted registration. * XMPP server after attempted registration.
* *
* Parameters: * Parameters:
* (XMLElement) stanza - The IQ stanza received from the * (XMLElement) stanza - The IQ stanza received from the
* XMPP server. * XMPP server.
*/ */
var $form= this.$('form'), flash; var $form= this.$('form'), flash;
var $errmsgs = $(stanza).find('error text'); var $errmsgs = $(stanza).find('error text');
var $flash = $form.find('.form-errors'); var $flash = $form.find('.form-errors');
...@@ -377,7 +377,7 @@ ...@@ -377,7 +377,7 @@
cancelRegistration: function (ev) { cancelRegistration: function (ev) {
/* Handler, when the user cancels the registration form. /* Handler, when the user cancels the registration form.
*/ */
if (ev && ev.preventDefault) { ev.preventDefault(); } if (ev && ev.preventDefault) { ev.preventDefault(); }
converse.connection.reset(); converse.connection.reset();
this.render(); this.render();
...@@ -385,12 +385,12 @@ ...@@ -385,12 +385,12 @@
submitRegistrationForm : function (ev) { submitRegistrationForm : function (ev) {
/* Handler, when the user submits the registration form. /* Handler, when the user submits the registration form.
* Provides form error feedback or starts the registration * Provides form error feedback or starts the registration
* process. * process.
* *
* Parameters: * Parameters:
* (Event) ev - the submit event. * (Event) ev - the submit event.
*/ */
if (ev && ev.preventDefault) { ev.preventDefault(); } if (ev && ev.preventDefault) { ev.preventDefault(); }
var $empty_inputs = this.$('input.required:emptyVal'); var $empty_inputs = this.$('input.required:emptyVal');
if ($empty_inputs.length) { if ($empty_inputs.length) {
...@@ -418,11 +418,11 @@ ...@@ -418,11 +418,11 @@
setFields: function (stanza) { setFields: function (stanza) {
/* Stores the values that will be sent to the XMPP server /* Stores the values that will be sent to the XMPP server
* during attempted registration. * during attempted registration.
* *
* Parameters: * Parameters:
* (XMLElement) stanza - the IQ stanza that will be sent to the XMPP server. * (XMLElement) stanza - the IQ stanza that will be sent to the XMPP server.
*/ */
var $query = $(stanza).find('query'), $xform; var $query = $(stanza).find('query'), $xform;
if ($query.length > 0) { if ($query.length > 0) {
$xform = $query.find('x[xmlns="'+Strophe.NS.XFORM+'"]'); $xform = $query.find('x[xmlns="'+Strophe.NS.XFORM+'"]');
...@@ -470,12 +470,12 @@ ...@@ -470,12 +470,12 @@
_onRegisterIQ: function (stanza) { _onRegisterIQ: function (stanza) {
/* Callback method that gets called when a return IQ stanza /* Callback method that gets called when a return IQ stanza
* is received from the XMPP server, after attempting to * is received from the XMPP server, after attempting to
* register a new user. * register a new user.
* *
* Parameters: * Parameters:
* (XMLElement) stanza - The IQ stanza. * (XMLElement) stanza - The IQ stanza.
*/ */
var error = null, var error = null,
query = stanza.getElementsByTagName("query"); query = stanza.getElementsByTagName("query");
if (query.length > 0) { if (query.length > 0) {
......
...@@ -140,20 +140,20 @@ ...@@ -140,20 +140,20 @@
success: function (collection) { success: function (collection) {
if (collection.length === 0) { if (collection.length === 0) {
/* We don't have any roster contacts stored in sessionStorage, /* We don't have any roster contacts stored in sessionStorage,
* so lets fetch the roster from the XMPP server. We pass in * so lets fetch the roster from the XMPP server. We pass in
* 'sendPresence' as callback method, because after initially * 'sendPresence' as callback method, because after initially
* fetching the roster we are ready to receive presence * fetching the roster we are ready to receive presence
* updates from our contacts. * updates from our contacts.
*/ */
converse.roster.fetchFromServer(function () { converse.roster.fetchFromServer(function () {
converse.xmppstatus.sendPresence(); converse.xmppstatus.sendPresence();
}); });
} else if (converse.send_initial_presence) { } else if (converse.send_initial_presence) {
/* We're not going to fetch the roster again because we have /* We're not going to fetch the roster again because we have
* it already cached in sessionStorage, but we still need to * it already cached in sessionStorage, but we still need to
* send out a presence stanza because this is a new session. * send out a presence stanza because this is a new session.
* See: https://github.com/jcbrand/converse.js/issues/536 * See: https://github.com/jcbrand/converse.js/issues/536
*/ */
converse.xmppstatus.sendPresence(); converse.xmppstatus.sendPresence();
} }
} }
...@@ -326,13 +326,13 @@ ...@@ -326,13 +326,13 @@
positionFetchedGroups: function (model, resp, options) { positionFetchedGroups: function (model, resp, options) {
/* Instead of throwing an add event for each group /* Instead of throwing an add event for each group
* fetched, we wait until they're all fetched and then * fetched, we wait until they're all fetched and then
* we position them. * we position them.
* Works around the problem of positionGroup not * Works around the problem of positionGroup not
* working when all groups besides the one being * working when all groups besides the one being
* positioned aren't already in inserted into the * positioned aren't already in inserted into the
* roster DOM element. * roster DOM element.
*/ */
model.sort(); model.sort();
model.each(function (group, idx) { model.each(function (group, idx) {
var view = this.get(group.get('name')); var view = this.get(group.get('name'));
...@@ -350,8 +350,8 @@ ...@@ -350,8 +350,8 @@
positionGroup: function (view) { positionGroup: function (view) {
/* Place the group's DOM element in the correct alphabetical /* Place the group's DOM element in the correct alphabetical
* position amongst the other groups in the roster. * position amongst the other groups in the roster.
*/ */
var $groups = this.$roster.find('.roster-group'), var $groups = this.$roster.find('.roster-group'),
index = $groups.length ? this.model.indexOf(view.model) : 0; index = $groups.length ? this.model.indexOf(view.model) : 0;
if (index === 0) { if (index === 0) {
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
appendGroup: function (view) { appendGroup: function (view) {
/* Add the group at the bottom of the roster /* Add the group at the bottom of the roster
*/ */
var $last = this.$roster.find('.roster-group').last(); var $last = this.$roster.find('.roster-group').last();
var $siblings = $last.siblings('dd'); var $siblings = $last.siblings('dd');
if ($siblings.length > 0) { if ($siblings.length > 0) {
...@@ -379,8 +379,8 @@ ...@@ -379,8 +379,8 @@
getGroup: function (name) { getGroup: function (name) {
/* Returns the group as specified by name. /* Returns the group as specified by name.
* Creates the group if it doesn't exist. * Creates the group if it doesn't exist.
*/ */
var view = this.get(name); var view = this.get(name);
if (view) { if (view) {
return view.model; return view.model;
...@@ -466,16 +466,16 @@ ...@@ -466,16 +466,16 @@
if ((ask === 'subscribe') || (subscription === 'from')) { if ((ask === 'subscribe') || (subscription === 'from')) {
/* ask === 'subscribe' /* ask === 'subscribe'
* Means we have asked to subscribe to them. * Means we have asked to subscribe to them.
* *
* subscription === 'from' * subscription === 'from'
* They are subscribed to use, but not vice versa. * They are subscribed to use, but not vice versa.
* We assume that there is a pending subscription * We assume that there is a pending subscription
* from us to them (otherwise we're in a state not * from us to them (otherwise we're in a state not
* supported by converse.js). * supported by converse.js).
* *
* So in both cases the user is a "pending" contact. * So in both cases the user is a "pending" contact.
*/ */
this.$el.addClass('pending-xmpp-contact'); this.$el.addClass('pending-xmpp-contact');
this.$el.html(converse.templates.pending_contact( this.$el.html(converse.templates.pending_contact(
_.extend(item.toJSON(), { _.extend(item.toJSON(), {
...@@ -618,8 +618,8 @@ ...@@ -618,8 +618,8 @@
positionContact: function (contact) { positionContact: function (contact) {
/* Place the contact's DOM element in the correct alphabetical /* Place the contact's DOM element in the correct alphabetical
* position amongst the other contacts in this group. * position amongst the other contacts in this group.
*/ */
var view = this.get(contact.get('id')); var view = this.get(contact.get('id'));
var index = this.model.contacts.indexOf(contact); var index = this.model.contacts.indexOf(contact);
view.$el.detach(); view.$el.detach();
...@@ -648,10 +648,10 @@ ...@@ -648,10 +648,10 @@
filter: function (q) { filter: function (q) {
/* Filter the group's contacts based on the query "q". /* Filter the group's contacts based on the query "q".
* The query is matched against the contact's full name. * The query is matched against the contact's full name.
* If all contacts are filtered out (i.e. hidden), then the * If all contacts are filtered out (i.e. hidden), then the
* group must be filtered out as well. * group must be filtered out as well.
*/ */
var matches; var matches;
if (q.length === 0) { if (q.length === 0) {
if (this.model.get('state') === converse.OPENED) { if (this.model.get('state') === converse.OPENED) {
...@@ -738,8 +738,8 @@ ...@@ -738,8 +738,8 @@
model: converse.RosterGroup, model: converse.RosterGroup,
comparator: function (a, b) { comparator: function (a, b) {
/* Groups are sorted alphabetically, ignoring case. /* Groups are sorted alphabetically, ignoring case.
* However, Ungrouped, Requesting Contacts and Pending Contacts * However, Ungrouped, Requesting Contacts and Pending Contacts
* appear last and in that order. */ * appear last and in that order. */
a = a.get('name'); a = a.get('name');
b = b.get('name'); b = b.get('name');
var special_groups = _.keys(HEADER_WEIGHTS); var special_groups = _.keys(HEADER_WEIGHTS);
......
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