Commit 77f93a64 authored by JC Brand's avatar JC Brand

Some initial work on removing jQuery

parent 34946912
This diff is collapsed.
......@@ -1804,25 +1804,25 @@
this.scrollDown();
},
onChatRoomMessage: function (msg) {
onChatRoomMessage: function (message) {
/* Given a <message> stanza, create a message
* Backbone.Model if appropriate.
*
* Parameters:
* (XMLElement) msg: The received message stanza
*/
var $message = $(msg),
$forwarded = $message.find('forwarded'),
$delay;
if ($forwarded.length) {
$message = $forwarded.children('message');
$delay = $forwarded.children('delay');
}
var jid = msg.getAttribute('from'),
msgid = msg.getAttribute('id'),
var original_stanza = message,
forwarded = message.querySelector('forwarded'),
delay;
if (!_.isNull(forwarded)) {
message = forwarded.querySelector('message');
delay = forwarded.querySelector('delay');
}
var jid = message.getAttribute('from'),
msgid = message.getAttribute('id'),
resource = Strophe.getResourceFromJid(jid),
sender = resource && Strophe.unescapeNode(resource) || '',
subject = $message.children('subject').text(),
subject = _.propertyOf(message.querySelector('subject'))('textContent'),
dupes = msgid && this.model.messages.filter(function (msg) {
// Find duplicates.
// Some bots (like HAL in the prosody chatroom)
......@@ -1839,7 +1839,7 @@
if (sender === '') {
return true;
}
this.model.createMessage($message, $delay, msg);
this.model.createMessage(message, delay, original_stanza);
if (sender !== this.model.get('nick')) {
// We only emit an event if it's not our own message
converse.emit('message', msg);
......
......@@ -107,10 +107,9 @@
!(utils.isOTRMessage($message[0]) && !_.includes([UNVERIFIED, VERIFIED], this.get('otr_status')));
},
createMessage: function ($message, $delay, original_stanza) {
createMessage: function (message, delay, original_stanza) {
var converse = this.__super__.converse,
$body = $message.children('body'),
text = ($body.length > 0 ? $body.text() : undefined);
text = _.propertyOf(message.querySelector('body'))('textContent');
if ((!text) || (!converse.allow_otr)) {
return this.__super__.createMessage.apply(this, arguments);
......
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