Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
ec65bb35
Commit
ec65bb35
authored
Jun 07, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`createMessage` doesn't need the delay parameter
parent
ce3ba2a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
35 deletions
+21
-35
dist/converse.js
dist/converse.js
+10
-18
src/converse-chatboxes.js
src/converse-chatboxes.js
+7
-11
src/converse-headline.js
src/converse-headline.js
+1
-1
src/converse-mam.js
src/converse-mam.js
+1
-1
src/converse-muc.js
src/converse-muc.js
+1
-3
src/converse-otr.js
src/converse-otr.js
+1
-1
No files found.
dist/converse.js
View file @
ec65bb35
...
...
@@ -62520,7 +62520,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
getMessageAttributesFromStanza(message,
delay,
original_stanza) {
getMessageAttributesFromStanza(message, original_stanza) {
/* Parses a passed in message stanza and returns an object
* of attributes.
*
...
...
@@ -62582,11 +62582,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
return attrs;
},
createMessage(message,
delay,
original_stanza) {
createMessage(message, original_stanza) {
/* Create a Backbone.Message object inside this chat box
* based on the identified message stanza.
*/
const attrs = this.getMessageAttributesFromStanza
.apply(this, arguments
);
const attrs = this.getMessageAttributesFromStanza
(message, original_stanza
);
const is_csn = u.isOnlyChatStateNotification(attrs);
if (is_csn && (attrs.delayed || attrs.type === 'groupchat' && Strophe.getResourceFromJid(attrs.from) == this.get('nick'))) {
...
...
@@ -62694,7 +62694,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
return true;
}
chatbox.createMessage(message,
null,
message);
chatbox.createMessage(message, message);
return true;
},
...
...
@@ -62705,10 +62705,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
* Parameters:
* (XMLElement) message - The incoming message stanza
*/
let contact_jid,
delay,
resource,
from_jid = message.getAttribute('from'),
let from_jid = message.getAttribute('from'),
to_jid = message.getAttribute('to');
const original_stanza = message,
to_resource = Strophe.getResourceFromJid(to_jid),
...
...
@@ -62735,13 +62732,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
if (is_carbon && Strophe.getBareJidFromJid(forwarded_from) !== from_jid) {
// Prevent message forging via carbons
//
// https://xmpp.org/extensions/xep-0280.html#security
return true;
}
message = forwarded_message;
delay = forwarded.querySelector('delay');
from_jid = message.getAttribute('from');
to_jid = message.getAttribute('to');
}
...
...
@@ -62749,14 +62744,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
const from_bare_jid = Strophe.getBareJidFromJid(from_jid),
from_resource = Strophe.getResourceFromJid(from_jid),
is_me = from_bare_jid === _converse.bare_jid;
let contact_jid;
if (is_me) {
// I am the sender, so this must be a forwarded message...
contact_jid = Strophe.getBareJidFromJid(to_jid);
resource = Strophe.getResourceFromJid(to_jid);
} else {
contact_jid = from_bare_jid;
resource = from_resource;
} // Get chat box, but only create a new one when the message has a body.
...
...
@@ -62775,7 +62769,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
// Only create the message when we're sure it's not a
// duplicate
chatbox.incrementUnreadMsgCounter(original_stanza);
chatbox.createMessage(message,
delay,
original_stanza);
chatbox.createMessage(message, original_stanza);
}
}
...
...
@@ -67676,7 +67670,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
'from': from_jid
});
chatbox.createMessage(message,
undefined,
message);
chatbox.createMessage(message, message);
_converse.emit('message', {
'chatbox': chatbox,
...
...
@@ -67875,7 +67869,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//
// New functions which don't exist yet can also be added.
ChatBox: {
getMessageAttributesFromStanza(message,
delay,
original_stanza) {
getMessageAttributesFromStanza(message, original_stanza) {
const attrs = this.__super__.getMessageAttributesFromStanza.apply(this, arguments);
const archive_id = getMessageArchiveID(original_stanza);
...
...
@@ -72079,11 +72073,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.fetchFeaturesIfConfigurationChanged(stanza);
const original_stanza = stanza,
forwarded = stanza.querySelector('forwarded');
let delay;
if (!_.isNull(forwarded)) {
stanza = forwarded.querySelector('message');
delay = forwarded.querySelector('delay');
}
const jid = stanza.getAttribute('from'),
...
...
@@ -72109,7 +72101,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
this.incrementUnreadMsgCounter(original_stanza);
this.createMessage(stanza,
delay,
original_stanza);
this.createMessage(stanza, original_stanza);
if (sender !== this.get('nick')) {
// We only emit an event if it's not our own message
src/converse-chatboxes.js
View file @
ec65bb35
...
...
@@ -427,7 +427,7 @@
},
getMessageAttributesFromStanza
(
message
,
delay
,
original_stanza
)
{
getMessageAttributesFromStanza
(
message
,
original_stanza
)
{
/* Parses a passed in message stanza and returns an object
* of attributes.
*
...
...
@@ -487,11 +487,11 @@
return
attrs
;
},
createMessage
(
message
,
delay
,
original_stanza
)
{
createMessage
(
message
,
original_stanza
)
{
/* Create a Backbone.Message object inside this chat box
* based on the identified message stanza.
*/
const
attrs
=
this
.
getMessageAttributesFromStanza
.
apply
(
this
,
arguments
)
const
attrs
=
this
.
getMessageAttributesFromStanza
(
message
,
original_stanza
);
const
is_csn
=
u
.
isOnlyChatStateNotification
(
attrs
);
if
(
is_csn
&&
(
attrs
.
delayed
||
(
attrs
.
type
===
'
groupchat
'
&&
Strophe
.
getResourceFromJid
(
attrs
.
from
)
==
this
.
get
(
'
nick
'
))))
{
// XXX: MUC leakage
...
...
@@ -591,7 +591,7 @@
if
(
!
chatbox
)
{
return
true
;
}
chatbox
.
createMessage
(
message
,
null
,
message
);
chatbox
.
createMessage
(
message
,
message
);
return
true
;
},
...
...
@@ -602,8 +602,7 @@
* Parameters:
* (XMLElement) message - The incoming message stanza
*/
let
contact_jid
,
delay
,
resource
,
from_jid
=
message
.
getAttribute
(
'
from
'
),
let
from_jid
=
message
.
getAttribute
(
'
from
'
),
to_jid
=
message
.
getAttribute
(
'
to
'
);
const
original_stanza
=
message
,
...
...
@@ -632,12 +631,10 @@
const
forwarded_from
=
forwarded_message
.
getAttribute
(
'
from
'
);
if
(
is_carbon
&&
Strophe
.
getBareJidFromJid
(
forwarded_from
)
!==
from_jid
)
{
// Prevent message forging via carbons
//
// https://xmpp.org/extensions/xep-0280.html#security
return
true
;
}
message
=
forwarded_message
;
delay
=
forwarded
.
querySelector
(
'
delay
'
);
from_jid
=
message
.
getAttribute
(
'
from
'
);
to_jid
=
message
.
getAttribute
(
'
to
'
);
}
...
...
@@ -646,13 +643,12 @@
from_resource
=
Strophe
.
getResourceFromJid
(
from_jid
),
is_me
=
from_bare_jid
===
_converse
.
bare_jid
;
let
contact_jid
;
if
(
is_me
)
{
// I am the sender, so this must be a forwarded message...
contact_jid
=
Strophe
.
getBareJidFromJid
(
to_jid
);
resource
=
Strophe
.
getResourceFromJid
(
to_jid
);
}
else
{
contact_jid
=
from_bare_jid
;
resource
=
from_resource
;
}
// Get chat box, but only create a new one when the message has a body.
const
attrs
=
{
...
...
@@ -667,7 +663,7 @@
// Only create the message when we're sure it's not a
// duplicate
chatbox
.
incrementUnreadMsgCounter
(
original_stanza
);
chatbox
.
createMessage
(
message
,
delay
,
original_stanza
);
chatbox
.
createMessage
(
message
,
original_stanza
);
}
}
_converse
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
chatbox
});
...
...
src/converse-headline.js
View file @
ec65bb35
...
...
@@ -138,7 +138,7 @@
'
type
'
:
'
headline
'
,
'
from
'
:
from_jid
});
chatbox
.
createMessage
(
message
,
undefined
,
message
);
chatbox
.
createMessage
(
message
,
message
);
_converse
.
emit
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
}
return
true
;
...
...
src/converse-mam.js
View file @
ec65bb35
...
...
@@ -128,7 +128,7 @@
//
// New functions which don't exist yet can also be added.
ChatBox
:
{
getMessageAttributesFromStanza
(
message
,
delay
,
original_stanza
)
{
getMessageAttributesFromStanza
(
message
,
original_stanza
)
{
const
attrs
=
this
.
__super__
.
getMessageAttributesFromStanza
.
apply
(
this
,
arguments
);
const
archive_id
=
getMessageArchiveID
(
original_stanza
);
if
(
archive_id
)
{
...
...
src/converse-muc.js
View file @
ec65bb35
...
...
@@ -843,10 +843,8 @@
const
original_stanza
=
stanza
,
forwarded
=
stanza
.
querySelector
(
'
forwarded
'
);
let
delay
;
if
(
!
_
.
isNull
(
forwarded
))
{
stanza
=
forwarded
.
querySelector
(
'
message
'
);
delay
=
forwarded
.
querySelector
(
'
delay
'
);
}
const
jid
=
stanza
.
getAttribute
(
'
from
'
),
resource
=
Strophe
.
getResourceFromJid
(
jid
),
...
...
@@ -863,7 +861,7 @@
return
;
}
this
.
incrementUnreadMsgCounter
(
original_stanza
);
this
.
createMessage
(
stanza
,
delay
,
original_stanza
);
this
.
createMessage
(
stanza
,
original_stanza
);
if
(
sender
!==
this
.
get
(
'
nick
'
))
{
// We only emit an event if it's not our own message
_converse
.
emit
(
'
message
'
,
{
'
stanza
'
:
original_stanza
,
'
chatbox
'
:
this
});
...
...
src/converse-otr.js
View file @
ec65bb35
...
...
@@ -94,7 +94,7 @@
!
(
utils
.
isOTRMessage
(
$message
[
0
])
&&
!
_
.
includes
([
UNVERIFIED
,
VERIFIED
],
this
.
get
(
'
otr_status
'
)));
},
createMessage
(
message
,
delay
,
original_stanza
)
{
createMessage
(
message
,
original_stanza
)
{
const
{
_converse
}
=
this
.
__super__
,
text
=
_
.
propertyOf
(
message
.
querySelector
(
'
body
'
))(
'
textContent
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment