Commit b1ffb34b authored by JC Brand's avatar JC Brand

Add docstrings

parent 7870fc53
...@@ -117,6 +117,17 @@ ...@@ -117,6 +117,17 @@
}, },
getMessageAttributes (message, delay, original_stanza) { getMessageAttributes (message, delay, original_stanza) {
/* Parses a passed in message stanza and returns an object
* of attributes.
*
* Parameters:
* (XMLElement) message - The message stanza
* (XMLElement) delay - The <delay> node from the
* stanza, if there was one.
* (XMLElement) original_stanza - The original stanza,
* that contains the message stanza, if it was
* contained, otherwise it's the message stanza itself.
*/
delay = delay || message.querySelector('delay'); delay = delay || message.querySelector('delay');
const type = message.getAttribute('type'), const type = message.getAttribute('type'),
body = this.getMessageBody(message); body = this.getMessageBody(message);
...@@ -157,13 +168,16 @@ ...@@ -157,13 +168,16 @@
}, },
createMessage (message, delay, original_stanza) { createMessage (message, delay, original_stanza) {
/* Create a Backbone.Message object inside this chat box
* based on the identified message stanza.
*/
return this.messages.create(this.getMessageAttributes.apply(this, arguments)); return this.messages.create(this.getMessageAttributes.apply(this, arguments));
}, },
newMessageWillBeHidden () { newMessageWillBeHidden () {
/* Returns a boolean to indicate whether a newly received /* Returns a boolean to indicate whether a newly received
* message will be visible to the user or not. * message will be visible to the user or not.
*/ */
return this.get('hidden') || return this.get('hidden') ||
this.get('minimized') || this.get('minimized') ||
this.isScrolledUp() || this.isScrolledUp() ||
...@@ -256,8 +270,11 @@ ...@@ -256,8 +270,11 @@
onMessage (message) { onMessage (message) {
/* Handler method for all incoming single-user chat "message" /* Handler method for all incoming single-user chat "message"
* stanzas. * stanzas.
*/ *
* Parameters:
* (XMLElement) message - The incoming message stanza
*/
let contact_jid, delay, resource, let contact_jid, delay, resource,
from_jid = message.getAttribute('from'), from_jid = message.getAttribute('from'),
to_jid = message.getAttribute('to'); to_jid = message.getAttribute('to');
......
...@@ -946,7 +946,9 @@ ...@@ -946,7 +946,9 @@
}, },
renderToolbar (toolbar, options) { renderToolbar (toolbar, options) {
if (!_converse.show_toolbar) { return; } if (!_converse.show_toolbar) {
return this;
}
toolbar = toolbar || tpl_toolbar; toolbar = toolbar || tpl_toolbar;
options = _.assign( options = _.assign(
this.model.toJSON(), this.model.toJSON(),
......
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