fixed indentation of comments
This commit is contained in:
parent
fa69bb1b0a
commit
8e18d736b4
@ -162,10 +162,10 @@
|
||||
|
||||
fetchArchivedMessages: function (options) {
|
||||
/* Fetch archived chat messages from the XMPP server.
|
||||
*
|
||||
* Then, upon receiving them, call onMessage on the chat box,
|
||||
* so that they are displayed inside it.
|
||||
*/
|
||||
*
|
||||
* Then, upon receiving them, call onMessage on the chat box,
|
||||
* so that they are displayed inside it.
|
||||
*/
|
||||
if (!converse.features.findWhere({'var': Strophe.NS.MAM})) {
|
||||
converse.log("Attempted to fetch archived messages but this user's server doesn't support XEP-0313");
|
||||
return;
|
||||
@ -186,16 +186,16 @@
|
||||
|
||||
insertIntoPage: function () {
|
||||
/* This method gets overridden in src/converse-controlbox.js if
|
||||
* the controlbox plugin is active.
|
||||
*/
|
||||
* the controlbox plugin is active.
|
||||
*/
|
||||
$('#conversejs').prepend(this.$el);
|
||||
return this;
|
||||
},
|
||||
|
||||
adjustToViewport: function () {
|
||||
/* Event handler called when viewport gets resized. We remove
|
||||
* custom width/height from chat boxes.
|
||||
*/
|
||||
* custom width/height from chat boxes.
|
||||
*/
|
||||
var viewport_width = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
var viewport_height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
if (viewport_width <= 480) {
|
||||
@ -210,8 +210,8 @@
|
||||
|
||||
initDragResize: function () {
|
||||
/* Determine and store the default box size.
|
||||
* We need this information for the drag-resizing feature.
|
||||
*/
|
||||
* We need this information for the drag-resizing feature.
|
||||
*/
|
||||
var $flyout = this.$el.find('.box-flyout');
|
||||
if (typeof this.model.get('height') === 'undefined') {
|
||||
var height = $flyout.height();
|
||||
@ -271,11 +271,11 @@
|
||||
|
||||
prependDayIndicator: function (date) {
|
||||
/* Prepends an indicator into the chat area, showing the day as
|
||||
* given by the passed in date.
|
||||
*
|
||||
* Parameters:
|
||||
* (String) date - An ISO8601 date string.
|
||||
*/
|
||||
* given by the passed in date.
|
||||
*
|
||||
* Parameters:
|
||||
* (String) date - An ISO8601 date string.
|
||||
*/
|
||||
var day_date = moment(date).startOf('day');
|
||||
this.$content.prepend(converse.templates.new_day({
|
||||
isodate: day_date.format(),
|
||||
@ -285,11 +285,11 @@
|
||||
|
||||
appendMessage: function (attrs) {
|
||||
/* Helper method which appends a message to the end of the chat
|
||||
* box's content area.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*/
|
||||
* box's content area.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*/
|
||||
_.compose(
|
||||
_.debounce(this.scrollDown.bind(this), 50),
|
||||
this.$content.append.bind(this.$content)
|
||||
@ -298,15 +298,15 @@
|
||||
|
||||
showMessage: function (attrs) {
|
||||
/* Inserts a chat message into the content area of the chat box.
|
||||
* Will also insert a new day indicator if the message is on a
|
||||
* different day.
|
||||
*
|
||||
* The message to show may either be newer than the newest
|
||||
* message, or older than the oldest message.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*/
|
||||
* Will also insert a new day indicator if the message is on a
|
||||
* different day.
|
||||
*
|
||||
* The message to show may either be newer than the newest
|
||||
* message, or older than the oldest message.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*/
|
||||
var $first_msg = this.$content.children('.chat-message:first'),
|
||||
first_msg_date = $first_msg.data('isodate'),
|
||||
last_msg_date, current_msg_date, day_date, $msgs, msg_dates, idx;
|
||||
@ -384,13 +384,13 @@
|
||||
|
||||
renderMessage: function (attrs) {
|
||||
/* Renders a chat message based on the passed in attributes.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*
|
||||
* Returns:
|
||||
* The DOM element representing the message.
|
||||
*/
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) attrs: An object containing the message attributes.
|
||||
*
|
||||
* Returns:
|
||||
* The DOM element representing the message.
|
||||
*/
|
||||
var msg_time = moment(attrs.time) || moment,
|
||||
text = attrs.message,
|
||||
match = text.match(/^\/(.*?)(?: (.*))?$/),
|
||||
@ -465,10 +465,10 @@
|
||||
|
||||
onMessageAdded: function (message) {
|
||||
/* Handler that gets called when a new message object is created.
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) message - The message Backbone object that was added.
|
||||
*/
|
||||
*
|
||||
* Parameters:
|
||||
* (Object) message - The message Backbone object that was added.
|
||||
*/
|
||||
if (typeof this.clear_status_timeout !== 'undefined') {
|
||||
window.clearTimeout(this.clear_status_timeout);
|
||||
delete this.clear_status_timeout;
|
||||
@ -492,10 +492,10 @@
|
||||
|
||||
sendMessage: function (message) {
|
||||
/* Responsible for sending off a text message.
|
||||
*
|
||||
* Parameters:
|
||||
* (Message) message - The chat message
|
||||
*/
|
||||
*
|
||||
* Parameters:
|
||||
* (Message) message - The chat message
|
||||
*/
|
||||
// TODO: We might want to send to specfic resources.
|
||||
// Especially in the OTR case.
|
||||
var messageStanza = this.createMessageStanza(message);
|
||||
@ -513,11 +513,11 @@
|
||||
|
||||
onMessageSubmitted: function (text) {
|
||||
/* This method gets called once the user has typed a message
|
||||
* and then pressed enter in a chat box.
|
||||
*
|
||||
* Parameters:
|
||||
* (string) text - The chat message text.
|
||||
*/
|
||||
* and then pressed enter in a chat box.
|
||||
*
|
||||
* Parameters:
|
||||
* (string) text - The chat message text.
|
||||
*/
|
||||
if (!converse.connection.authenticated) {
|
||||
return this.showHelpMessages(
|
||||
['Sorry, the connection has been lost, '+
|
||||
@ -553,9 +553,9 @@
|
||||
|
||||
sendChatState: function () {
|
||||
/* Sends a message with the status of the user in this chat session
|
||||
* as taken from the 'chat_state' attribute of the chat box.
|
||||
* See XEP-0085 Chat State Notifications.
|
||||
*/
|
||||
* as taken from the 'chat_state' attribute of the chat box.
|
||||
* See XEP-0085 Chat State Notifications.
|
||||
*/
|
||||
converse.connection.send(
|
||||
$msg({'to':this.model.get('jid'), 'type': 'chat'})
|
||||
.c(this.model.get('chat_state'), {'xmlns': Strophe.NS.CHATSTATES})
|
||||
@ -564,16 +564,16 @@
|
||||
|
||||
setChatState: function (state, no_save) {
|
||||
/* Mutator for setting the chat state of this chat session.
|
||||
* Handles clearing of any chat state notification timeouts and
|
||||
* setting new ones if necessary.
|
||||
* Timeouts are set when the state being set is COMPOSING or PAUSED.
|
||||
* After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE.
|
||||
* See XEP-0085 Chat State Notifications.
|
||||
*
|
||||
* Parameters:
|
||||
* (string) state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
|
||||
* (Boolean) no_save - Just do the cleanup or setup but don't actually save the state.
|
||||
*/
|
||||
* Handles clearing of any chat state notification timeouts and
|
||||
* setting new ones if necessary.
|
||||
* Timeouts are set when the state being set is COMPOSING or PAUSED.
|
||||
* After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE.
|
||||
* See XEP-0085 Chat State Notifications.
|
||||
*
|
||||
* Parameters:
|
||||
* (string) state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
|
||||
* (Boolean) no_save - Just do the cleanup or setup but don't actually save the state.
|
||||
*/
|
||||
if (typeof this.chat_state_timeout !== 'undefined') {
|
||||
window.clearTimeout(this.chat_state_timeout);
|
||||
delete this.chat_state_timeout;
|
||||
@ -593,7 +593,7 @@
|
||||
|
||||
keyPressed: function (ev) {
|
||||
/* Event handler for when a key is pressed in a chat box textarea.
|
||||
*/
|
||||
*/
|
||||
var $textarea = $(ev.target), message;
|
||||
if (ev.keyCode === KEY.ENTER) {
|
||||
ev.preventDefault();
|
||||
@ -865,9 +865,9 @@
|
||||
show: function (focus) {
|
||||
if (typeof this.debouncedShow === 'undefined') {
|
||||
/* We wrap the method in a debouncer and set it on the
|
||||
* instance, so that we have it debounced per instance.
|
||||
* Debouncing it on the class-level is too broad.
|
||||
*/
|
||||
* instance, so that we have it debounced per instance.
|
||||
* Debouncing it on the class-level is too broad.
|
||||
*/
|
||||
this.debouncedShow = _.debounce(function (focus) {
|
||||
if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
|
||||
if (focus) { this.focus(); }
|
||||
|
@ -247,8 +247,8 @@
|
||||
|
||||
initRoster: function () {
|
||||
/* We initialize the roster, which will appear inside the
|
||||
* Contacts Panel.
|
||||
*/
|
||||
* Contacts Panel.
|
||||
*/
|
||||
var rostergroups = new converse.RosterGroups();
|
||||
rostergroups.browserStorage = new Backbone.BrowserStorage[converse.storage](
|
||||
b64_sha1('converse.roster.groups'+converse.bare_jid));
|
||||
|
@ -61,7 +61,6 @@
|
||||
/* The initialize function gets called as soon as the plugin is
|
||||
* loaded by converse.js's plugin machinery.
|
||||
*/
|
||||
|
||||
this.updateSettings({
|
||||
archived_messages_page_size: '20',
|
||||
message_archiving: 'never', // Supported values are 'always', 'never', 'roster' (https://xmpp.org/extensions/xep-0313.html#prefs)
|
||||
@ -70,22 +69,22 @@
|
||||
|
||||
converse.queryForArchivedMessages = function (options, callback, errback) {
|
||||
/* Do a MAM (XEP-0313) query for archived messages.
|
||||
*
|
||||
* Parameters:
|
||||
* (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) errback - A function to call when an error stanza is received.
|
||||
*
|
||||
* The options parameter can also be an instance of
|
||||
* Strophe.RSM to enable easy querying between results pages.
|
||||
*
|
||||
* The callback function may be called multiple times, first
|
||||
* for the initial IQ result and then for each message
|
||||
* returned. The last time the callback is called, a
|
||||
* Strophe.RSM object is returned on which "next" or "previous"
|
||||
* can be called before passing it in again to this method, to
|
||||
* get the next or previous page in the result set.
|
||||
*/
|
||||
*
|
||||
* Parameters:
|
||||
* (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) errback - A function to call when an error stanza is received.
|
||||
*
|
||||
* The options parameter can also be an instance of
|
||||
* Strophe.RSM to enable easy querying between results pages.
|
||||
*
|
||||
* The callback function may be called multiple times, first
|
||||
* for the initial IQ result and then for each message
|
||||
* returned. The last time the callback is called, a
|
||||
* Strophe.RSM object is returned on which "next" or "previous"
|
||||
* can be called before passing it in again to this method, to
|
||||
* get the next or previous page in the result set.
|
||||
*/
|
||||
var date, messages = [];
|
||||
if (typeof options === "function") {
|
||||
callback = options;
|
||||
@ -153,7 +152,7 @@
|
||||
|
||||
_.extend(converse_api, {
|
||||
/* Extend default converse.js API to add methods specific to MAM
|
||||
*/
|
||||
*/
|
||||
'archive': {
|
||||
'query': converse.queryForArchivedMessages.bind(converse)
|
||||
}
|
||||
|
@ -125,12 +125,12 @@
|
||||
|
||||
trimChats: function (newchat) {
|
||||
/* This method is called when a newly created chat box will
|
||||
* be shown.
|
||||
*
|
||||
* It checks whether there is enough space on the page to show
|
||||
* another chat box. Otherwise it minimizes the oldest chat box
|
||||
* to create space.
|
||||
*/
|
||||
* be shown.
|
||||
*
|
||||
* It checks whether there is enough space on the page to show
|
||||
* another chat box. Otherwise it minimizes the oldest chat box
|
||||
* to create space.
|
||||
*/
|
||||
if (converse.no_trimming || (this.model.length <= 1)) {
|
||||
return;
|
||||
}
|
||||
|
@ -216,8 +216,8 @@
|
||||
|
||||
converse.ChatRoomView = converse.ChatBoxView.extend({
|
||||
/* Backbone View which renders a chat room, based upon the view
|
||||
* for normal one-on-one chat boxes.
|
||||
*/
|
||||
* for normal one-on-one chat boxes.
|
||||
*/
|
||||
length: 300,
|
||||
tagName: 'div',
|
||||
className: 'chatbox chatroom',
|
||||
@ -397,8 +397,8 @@
|
||||
|
||||
validateRoleChangeCommand: function (command, args) {
|
||||
/* Check that a command to change a chat room user's role or
|
||||
* affiliation has anough arguments.
|
||||
*/
|
||||
* affiliation has anough arguments.
|
||||
*/
|
||||
// TODO check if first argument is valid
|
||||
if (args.length < 1 || args.length > 2) {
|
||||
this.showStatusNotification(
|
||||
@ -421,11 +421,11 @@
|
||||
|
||||
onChatRoomMessageSubmitted: function (text) {
|
||||
/* Gets called when the user presses enter to send off a
|
||||
* message in a chat room.
|
||||
*
|
||||
* Parameters:
|
||||
* (String) text - The message text.
|
||||
*/
|
||||
* message in a chat room.
|
||||
*
|
||||
* Parameters:
|
||||
* (String) text - The message text.
|
||||
*/
|
||||
var match = text.replace(/^\s*/, "").match(/^\/(.*?)(?: (.*))?$/) || [false, '', ''],
|
||||
args = match[2] && match[2].splitOnce(' ') || [];
|
||||
switch (match[1]) {
|
||||
@ -723,27 +723,27 @@
|
||||
},
|
||||
|
||||
/* http://xmpp.org/extensions/xep-0045.html
|
||||
* ----------------------------------------
|
||||
* 100 message Entering a room Inform user that any occupant is allowed to see the user's full JID
|
||||
* 101 message (out of band) Affiliation change Inform user that his or her affiliation changed while not in the room
|
||||
* 102 message Configuration change Inform occupants that room now shows unavailable members
|
||||
* 103 message Configuration change Inform occupants that room now does not show unavailable members
|
||||
* 104 message Configuration change Inform occupants that a non-privacy-related room configuration change has occurred
|
||||
* 110 presence Any room presence Inform user that presence refers to one of its own room occupants
|
||||
* 170 message or initial presence Configuration change Inform occupants that room logging is now enabled
|
||||
* 171 message Configuration change Inform occupants that room logging is now disabled
|
||||
* 172 message Configuration change Inform occupants that the room is now non-anonymous
|
||||
* 173 message Configuration change Inform occupants that the room is now semi-anonymous
|
||||
* 174 message Configuration change Inform occupants that the room is now fully-anonymous
|
||||
* 201 presence Entering a room Inform user that a new room has been created
|
||||
* 210 presence Entering a room Inform user that the service has assigned or modified the occupant's roomnick
|
||||
* 301 presence Removal from room Inform user that he or she has been banned from the room
|
||||
* 303 presence Exiting a room Inform all occupants of new room nickname
|
||||
* 307 presence Removal from room Inform user that he or she has been kicked from the room
|
||||
* 321 presence Removal from room Inform user that he or she is being removed from the room because of an affiliation change
|
||||
* 322 presence Removal from room Inform user that he or she is being removed from the room because the room has been changed to members-only and the user is not a member
|
||||
* 332 presence Removal from room Inform user that he or she is being removed from the room because of a system shutdown
|
||||
*/
|
||||
* ----------------------------------------
|
||||
* 100 message Entering a room Inform user that any occupant is allowed to see the user's full JID
|
||||
* 101 message (out of band) Affiliation change Inform user that his or her affiliation changed while not in the room
|
||||
* 102 message Configuration change Inform occupants that room now shows unavailable members
|
||||
* 103 message Configuration change Inform occupants that room now does not show unavailable members
|
||||
* 104 message Configuration change Inform occupants that a non-privacy-related room configuration change has occurred
|
||||
* 110 presence Any room presence Inform user that presence refers to one of its own room occupants
|
||||
* 170 message or initial presence Configuration change Inform occupants that room logging is now enabled
|
||||
* 171 message Configuration change Inform occupants that room logging is now disabled
|
||||
* 172 message Configuration change Inform occupants that the room is now non-anonymous
|
||||
* 173 message Configuration change Inform occupants that the room is now semi-anonymous
|
||||
* 174 message Configuration change Inform occupants that the room is now fully-anonymous
|
||||
* 201 presence Entering a room Inform user that a new room has been created
|
||||
* 210 presence Entering a room Inform user that the service has assigned or modified the occupant's roomnick
|
||||
* 301 presence Removal from room Inform user that he or she has been banned from the room
|
||||
* 303 presence Exiting a room Inform all occupants of new room nickname
|
||||
* 307 presence Removal from room Inform user that he or she has been kicked from the room
|
||||
* 321 presence Removal from room Inform user that he or she is being removed from the room because of an affiliation change
|
||||
* 322 presence Removal from room Inform user that he or she is being removed from the room because the room has been changed to members-only and the user is not a member
|
||||
* 332 presence Removal from room Inform user that he or she is being removed from the room because of a system shutdown
|
||||
*/
|
||||
infoMessages: {
|
||||
100: __('This room is not anonymous'),
|
||||
102: __('This room now shows unavailable members'),
|
||||
@ -767,15 +767,15 @@
|
||||
|
||||
actionInfoMessages: {
|
||||
/* XXX: Note the triple underscore function and not double
|
||||
* underscore.
|
||||
*
|
||||
* This is a hack. We can't pass the strings to __ because we
|
||||
* don't yet know what the variable to interpolate is.
|
||||
*
|
||||
* Triple underscore will just return the string again, but we
|
||||
* can then at least tell gettext to scan for it so that these
|
||||
* strings are picked up by the translation machinery.
|
||||
*/
|
||||
* underscore.
|
||||
*
|
||||
* This is a hack. We can't pass the strings to __ because we
|
||||
* don't yet know what the variable to interpolate is.
|
||||
*
|
||||
* Triple underscore will just return the string again, but we
|
||||
* can then at least tell gettext to scan for it so that these
|
||||
* strings are picked up by the translation machinery.
|
||||
*/
|
||||
301: ___("<strong>%1$s</strong> has been banned"),
|
||||
303: ___("<strong>%1$s</strong>'s nickname has changed"),
|
||||
307: ___("<strong>%1$s</strong> has been kicked out"),
|
||||
@ -790,9 +790,9 @@
|
||||
|
||||
showStatusMessages: function (el, is_self) {
|
||||
/* Check for status codes and communicate their purpose to the user.
|
||||
* Allow user to configure chat room if they are the owner.
|
||||
* See: http://xmpp.org/registrar/mucstatus.html
|
||||
*/
|
||||
* Allow user to configure chat room if they are the owner.
|
||||
* See: http://xmpp.org/registrar/mucstatus.html
|
||||
*/
|
||||
var $el = $(el),
|
||||
i, disconnect_msgs = [], msgs = [], reasons = [];
|
||||
|
||||
@ -935,10 +935,10 @@
|
||||
|
||||
fetchArchivedMessages: function (options) {
|
||||
/* Fetch archived chat messages from the XMPP server.
|
||||
*
|
||||
* Then, upon receiving them, call onChatRoomMessage
|
||||
* so that they are displayed inside it.
|
||||
*/
|
||||
*
|
||||
* Then, upon receiving them, call onChatRoomMessage
|
||||
* so that they are displayed inside it.
|
||||
*/
|
||||
if (!converse.features.findWhere({'var': Strophe.NS.MAM})) {
|
||||
converse.log("Attempted to fetch archived messages but this user's server doesn't support XEP-0313");
|
||||
return;
|
||||
@ -1112,11 +1112,11 @@
|
||||
|
||||
converse.RoomsPanel = Backbone.View.extend({
|
||||
/* Backbone View which renders the "Rooms" tab and accompanying
|
||||
* panel in the control box.
|
||||
*
|
||||
* In this panel, chat rooms can be listed, joined and new rooms
|
||||
* can be created.
|
||||
*/
|
||||
* panel in the control box.
|
||||
*
|
||||
* In this panel, chat rooms can be listed, joined and new rooms
|
||||
* can be created.
|
||||
*/
|
||||
tagName: 'div',
|
||||
className: 'controlbox-pane',
|
||||
id: 'chatrooms',
|
||||
@ -1175,8 +1175,8 @@
|
||||
|
||||
onRoomsFound: function (iq) {
|
||||
/* Handle the IQ stanza returned from the server, containing
|
||||
* all its public rooms.
|
||||
*/
|
||||
* all its public rooms.
|
||||
*/
|
||||
var name, jid, i, fragment,
|
||||
$available_chatrooms = this.$el.find('#available-chatrooms');
|
||||
this.rooms = $(iq).find('query').find('item');
|
||||
@ -1207,7 +1207,7 @@
|
||||
|
||||
updateRoomsList: function () {
|
||||
/* Send and IQ stanza to the server asking for all rooms
|
||||
*/
|
||||
*/
|
||||
converse.connection.sendIQ(
|
||||
$iq({
|
||||
to: this.model.get('muc_domain'),
|
||||
@ -1338,8 +1338,8 @@
|
||||
|
||||
_.extend(converse_api, {
|
||||
/* We extend the default converse.js API to add methods specific to MUC
|
||||
* chat rooms.
|
||||
*/
|
||||
* chat rooms.
|
||||
*/
|
||||
'rooms': {
|
||||
'open': function (jids, nick) {
|
||||
if (!nick) {
|
||||
|
@ -120,8 +120,8 @@
|
||||
|
||||
registerHooks: function () {
|
||||
/* 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 connect_cb = conn._connect_cb.bind(conn);
|
||||
conn._connect_cb = function (req, callback, raw) {
|
||||
@ -137,11 +137,11 @@
|
||||
|
||||
getRegistrationFields: function (req, _callback, raw) {
|
||||
/* Send an IQ stanza to the XMPP server asking for the
|
||||
* registration fields.
|
||||
* Parameters:
|
||||
* (Strophe.Request) req - The current request
|
||||
* (Function) callback
|
||||
*/
|
||||
* registration fields.
|
||||
* Parameters:
|
||||
* (Strophe.Request) req - The current request
|
||||
* (Function) callback
|
||||
*/
|
||||
converse.log("sendQueryStanza was called");
|
||||
var conn = converse.connection;
|
||||
conn.connected = true;
|
||||
@ -172,10 +172,10 @@
|
||||
|
||||
onRegistrationFields: function (stanza) {
|
||||
/* Handler for Registration Fields Request.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) elem - The query stanza.
|
||||
*/
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) elem - The query stanza.
|
||||
*/
|
||||
if (stanza.getElementsByTagName("query").length !== 1) {
|
||||
converse.connection._changeConnectStatus(Strophe.Status.REGIFAIL, "unknown");
|
||||
return false;
|
||||
@ -204,11 +204,11 @@
|
||||
|
||||
onProviderChosen: function (ev) {
|
||||
/* Callback method that gets called when the user has chosen an
|
||||
* XMPP provider.
|
||||
*
|
||||
* Parameters:
|
||||
* (Submit Event) ev - Form submission event.
|
||||
*/
|
||||
* XMPP provider.
|
||||
*
|
||||
* Parameters:
|
||||
* (Submit Event) ev - Form submission event.
|
||||
*/
|
||||
if (ev && ev.preventDefault) { ev.preventDefault(); }
|
||||
var $form = $(ev.target),
|
||||
$domain_input = $form.find('input[name=domain]'),
|
||||
@ -287,11 +287,11 @@
|
||||
|
||||
renderRegistrationForm: function (stanza) {
|
||||
/* Renders the registration form based on the XForm fields
|
||||
* received from the XMPP server.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza received from the XMPP server.
|
||||
*/
|
||||
* received from the XMPP server.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza received from the XMPP server.
|
||||
*/
|
||||
var $form= this.$('form'),
|
||||
$stanza = $(stanza),
|
||||
$fields, $input;
|
||||
@ -344,12 +344,12 @@
|
||||
|
||||
reportErrors: function (stanza) {
|
||||
/* Report back to the user any error messages received from the
|
||||
* XMPP server after attempted registration.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza received from the
|
||||
* XMPP server.
|
||||
*/
|
||||
* XMPP server after attempted registration.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza received from the
|
||||
* XMPP server.
|
||||
*/
|
||||
var $form= this.$('form'), flash;
|
||||
var $errmsgs = $(stanza).find('error text');
|
||||
var $flash = $form.find('.form-errors');
|
||||
@ -377,7 +377,7 @@
|
||||
|
||||
cancelRegistration: function (ev) {
|
||||
/* Handler, when the user cancels the registration form.
|
||||
*/
|
||||
*/
|
||||
if (ev && ev.preventDefault) { ev.preventDefault(); }
|
||||
converse.connection.reset();
|
||||
this.render();
|
||||
@ -385,12 +385,12 @@
|
||||
|
||||
submitRegistrationForm : function (ev) {
|
||||
/* Handler, when the user submits the registration form.
|
||||
* Provides form error feedback or starts the registration
|
||||
* process.
|
||||
*
|
||||
* Parameters:
|
||||
* (Event) ev - the submit event.
|
||||
*/
|
||||
* Provides form error feedback or starts the registration
|
||||
* process.
|
||||
*
|
||||
* Parameters:
|
||||
* (Event) ev - the submit event.
|
||||
*/
|
||||
if (ev && ev.preventDefault) { ev.preventDefault(); }
|
||||
var $empty_inputs = this.$('input.required:emptyVal');
|
||||
if ($empty_inputs.length) {
|
||||
@ -418,11 +418,11 @@
|
||||
|
||||
setFields: function (stanza) {
|
||||
/* Stores the values that will be sent to the XMPP server
|
||||
* during attempted registration.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - the IQ stanza that will be sent to the XMPP server.
|
||||
*/
|
||||
* during attempted registration.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - the IQ stanza that will be sent to the XMPP server.
|
||||
*/
|
||||
var $query = $(stanza).find('query'), $xform;
|
||||
if ($query.length > 0) {
|
||||
$xform = $query.find('x[xmlns="'+Strophe.NS.XFORM+'"]');
|
||||
@ -470,12 +470,12 @@
|
||||
|
||||
_onRegisterIQ: function (stanza) {
|
||||
/* Callback method that gets called when a return IQ stanza
|
||||
* is received from the XMPP server, after attempting to
|
||||
* register a new user.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza.
|
||||
*/
|
||||
* is received from the XMPP server, after attempting to
|
||||
* register a new user.
|
||||
*
|
||||
* Parameters:
|
||||
* (XMLElement) stanza - The IQ stanza.
|
||||
*/
|
||||
var error = null,
|
||||
query = stanza.getElementsByTagName("query");
|
||||
if (query.length > 0) {
|
||||
|
@ -140,20 +140,20 @@
|
||||
success: function (collection) {
|
||||
if (collection.length === 0) {
|
||||
/* We don't have any roster contacts stored in sessionStorage,
|
||||
* so lets fetch the roster from the XMPP server. We pass in
|
||||
* 'sendPresence' as callback method, because after initially
|
||||
* fetching the roster we are ready to receive presence
|
||||
* updates from our contacts.
|
||||
*/
|
||||
* so lets fetch the roster from the XMPP server. We pass in
|
||||
* 'sendPresence' as callback method, because after initially
|
||||
* fetching the roster we are ready to receive presence
|
||||
* updates from our contacts.
|
||||
*/
|
||||
converse.roster.fetchFromServer(function () {
|
||||
converse.xmppstatus.sendPresence();
|
||||
});
|
||||
} else if (converse.send_initial_presence) {
|
||||
/* We're not going to fetch the roster again because we have
|
||||
* it already cached in sessionStorage, but we still need to
|
||||
* send out a presence stanza because this is a new session.
|
||||
* See: https://github.com/jcbrand/converse.js/issues/536
|
||||
*/
|
||||
* it already cached in sessionStorage, but we still need to
|
||||
* send out a presence stanza because this is a new session.
|
||||
* See: https://github.com/jcbrand/converse.js/issues/536
|
||||
*/
|
||||
converse.xmppstatus.sendPresence();
|
||||
}
|
||||
}
|
||||
@ -326,13 +326,13 @@
|
||||
|
||||
positionFetchedGroups: function (model, resp, options) {
|
||||
/* Instead of throwing an add event for each group
|
||||
* fetched, we wait until they're all fetched and then
|
||||
* we position them.
|
||||
* Works around the problem of positionGroup not
|
||||
* working when all groups besides the one being
|
||||
* positioned aren't already in inserted into the
|
||||
* roster DOM element.
|
||||
*/
|
||||
* fetched, we wait until they're all fetched and then
|
||||
* we position them.
|
||||
* Works around the problem of positionGroup not
|
||||
* working when all groups besides the one being
|
||||
* positioned aren't already in inserted into the
|
||||
* roster DOM element.
|
||||
*/
|
||||
model.sort();
|
||||
model.each(function (group, idx) {
|
||||
var view = this.get(group.get('name'));
|
||||
@ -350,8 +350,8 @@
|
||||
|
||||
positionGroup: function (view) {
|
||||
/* 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'),
|
||||
index = $groups.length ? this.model.indexOf(view.model) : 0;
|
||||
if (index === 0) {
|
||||
@ -366,7 +366,7 @@
|
||||
|
||||
appendGroup: function (view) {
|
||||
/* Add the group at the bottom of the roster
|
||||
*/
|
||||
*/
|
||||
var $last = this.$roster.find('.roster-group').last();
|
||||
var $siblings = $last.siblings('dd');
|
||||
if ($siblings.length > 0) {
|
||||
@ -379,8 +379,8 @@
|
||||
|
||||
getGroup: function (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);
|
||||
if (view) {
|
||||
return view.model;
|
||||
@ -466,16 +466,16 @@
|
||||
|
||||
if ((ask === 'subscribe') || (subscription === 'from')) {
|
||||
/* ask === 'subscribe'
|
||||
* Means we have asked to subscribe to them.
|
||||
*
|
||||
* subscription === 'from'
|
||||
* They are subscribed to use, but not vice versa.
|
||||
* We assume that there is a pending subscription
|
||||
* from us to them (otherwise we're in a state not
|
||||
* supported by converse.js).
|
||||
*
|
||||
* So in both cases the user is a "pending" contact.
|
||||
*/
|
||||
* Means we have asked to subscribe to them.
|
||||
*
|
||||
* subscription === 'from'
|
||||
* They are subscribed to use, but not vice versa.
|
||||
* We assume that there is a pending subscription
|
||||
* from us to them (otherwise we're in a state not
|
||||
* supported by converse.js).
|
||||
*
|
||||
* So in both cases the user is a "pending" contact.
|
||||
*/
|
||||
this.$el.addClass('pending-xmpp-contact');
|
||||
this.$el.html(converse.templates.pending_contact(
|
||||
_.extend(item.toJSON(), {
|
||||
@ -618,8 +618,8 @@
|
||||
|
||||
positionContact: function (contact) {
|
||||
/* 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 index = this.model.contacts.indexOf(contact);
|
||||
view.$el.detach();
|
||||
@ -648,10 +648,10 @@
|
||||
|
||||
filter: function (q) {
|
||||
/* Filter the group's contacts based on the query "q".
|
||||
* The query is matched against the contact's full name.
|
||||
* If all contacts are filtered out (i.e. hidden), then the
|
||||
* group must be filtered out as well.
|
||||
*/
|
||||
* The query is matched against the contact's full name.
|
||||
* If all contacts are filtered out (i.e. hidden), then the
|
||||
* group must be filtered out as well.
|
||||
*/
|
||||
var matches;
|
||||
if (q.length === 0) {
|
||||
if (this.model.get('state') === converse.OPENED) {
|
||||
@ -738,8 +738,8 @@
|
||||
model: converse.RosterGroup,
|
||||
comparator: function (a, b) {
|
||||
/* Groups are sorted alphabetically, ignoring case.
|
||||
* However, Ungrouped, Requesting Contacts and Pending Contacts
|
||||
* appear last and in that order. */
|
||||
* However, Ungrouped, Requesting Contacts and Pending Contacts
|
||||
* appear last and in that order. */
|
||||
a = a.get('name');
|
||||
b = b.get('name');
|
||||
var special_groups = _.keys(HEADER_WEIGHTS);
|
||||
|
Loading…
Reference in New Issue
Block a user