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
abe21dce
Commit
abe21dce
authored
Feb 07, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include `origin-id` in outgoing messages
parent
590d8769
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
14 deletions
+37
-14
dist/converse.js
dist/converse.js
+16
-7
spec/http-file-upload.js
spec/http-file-upload.js
+2
-0
spec/messages.js
spec/messages.js
+6
-0
src/headless/converse-chatboxes.js
src/headless/converse-chatboxes.js
+12
-7
src/headless/converse-muc.js
src/headless/converse-muc.js
+1
-0
No files found.
dist/converse.js
View file @
abe21dce
...
...
@@ -61761,23 +61761,23 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
'id': message.get('edited') && _converse.connection.getUniqueId() || message.get('msgid')
}).c('body').t(message.get('message')).up().c(_converse.ACTIVE, {
'xmlns': Strophe.NS.CHATSTATES
}).
up
();
}).
root
();
if (message.get('type') === 'chat') {
stanza.c('request', {
'xmlns': Strophe.NS.RECEIPTS
}).
up
();
}).
root
();
}
if (message.get('is_spoiler')) {
if (message.get('spoiler_hint')) {
stanza.c('spoiler', {
'xmlns': Strophe.NS.SPOILER
}, message.get('spoiler_hint')).
up
();
}, message.get('spoiler_hint')).
root
();
} else {
stanza.c('spoiler', {
'xmlns': Strophe.NS.SPOILER
}).
up
();
}).
root
();
}
}
...
...
@@ -61793,20 +61793,27 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
attrs.uri = reference.uri;
}
stanza.c('reference', attrs).
up
();
stanza.c('reference', attrs).
root
();
});
if (message.get('oob_url')) {
stanza.c('x', {
'xmlns': Strophe.NS.OUTOFBAND
}).c('url').t(message.get('oob_url')).
up
();
}).c('url').t(message.get('oob_url')).
root
();
}
if (message.get('edited')) {
stanza.c('replace', {
'xmlns': Strophe.NS.MESSAGE_CORRECT,
'id': message.get('msgid')
}).up();
}).root();
}
if (message.get('origin_id')) {
stanza.c('origin-id', {
'xmlns': Strophe.NS.SID,
'id': message.get('origin_id')
}).root();
}
return stanza;
...
...
@@ -61833,6 +61840,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
const is_spoiler = this.get('composing_spoiler');
return _.extend(this.toJSON(), {
'id': _converse.connection.getUniqueId(),
'origin_id': _converse.connection.getUniqueId(),
'fullname': _converse.xmppstatus.get('fullname'),
'from': _converse.bare_jid,
'sender': 'me',
...
...
@@ -66308,6 +66316,7 @@ _converse_core__WEBPACK_IMPORTED_MODULE_6__["default"].plugins.add('converse-muc
text = _this$parseTextForRef2[0];
references = _this$parseTextForRef2[1];
return {
'origin_id': _converse.connection.getUniqueId(),
'from': `${this.get('jid')}/${this.get('nick')}`,
'fullname': this.get('nick'),
'is_spoiler': is_spoiler,
spec/http-file-upload.js
View file @
abe21dce
...
...
@@ -362,6 +362,7 @@
`<x xmlns="jabber:x:oob">`
+
`<url>
${
message
}
</url>`
+
`</x>`
+
`<origin-id id="
${
sent_stanza
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-image
'
),
1000
);
// Check that the image renders
...
...
@@ -464,6 +465,7 @@
`<x xmlns="jabber:x:oob">`
+
`<url>
${
message
}
</url>`
+
`</x>`
+
`<origin-id id="
${
sent_stanza
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
await
test_utils
.
waitUntil
(()
=>
view
.
el
.
querySelector
(
'
.chat-image
'
),
1000
);
// Check that the image renders
...
...
spec/messages.js
View file @
abe21dce
...
...
@@ -72,6 +72,7 @@
`<active xmlns="http://jabber.org/protocol/chatstates"/>`
+
`<request xmlns="urn:xmpp:receipts"/>`
+
`<replace id="
${
first_msg
.
get
(
"
msgid
"
)}
" xmlns="urn:xmpp:message-correct:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
expect
(
view
.
model
.
messages
.
models
.
length
).
toBe
(
1
);
const
corrected_message
=
view
.
model
.
messages
.
at
(
0
);
...
...
@@ -177,6 +178,7 @@
`<active xmlns="http://jabber.org/protocol/chatstates"/>`
+
`<request xmlns="urn:xmpp:receipts"/>`
+
`<replace id="
${
first_msg
.
get
(
"
msgid
"
)}
" xmlns="urn:xmpp:message-correct:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
expect
(
view
.
model
.
messages
.
models
.
length
).
toBe
(
1
);
const
corrected_message
=
view
.
model
.
messages
.
at
(
0
);
...
...
@@ -2269,6 +2271,7 @@
`<body>But soft, what light through yonder window breaks?</body>`
+
`<active xmlns="http://jabber.org/protocol/chatstates"/>`
+
`<replace id="
${
first_msg
.
get
(
"
msgid
"
)}
" xmlns="urn:xmpp:message-correct:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
expect
(
view
.
model
.
messages
.
models
.
length
).
toBe
(
1
);
...
...
@@ -2492,6 +2495,7 @@
`<reference begin="18" end="26" type="mention" uri="xmpp:mr.robot@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<reference begin="11" end="17" type="mention" uri="xmpp:gibson@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<reference begin="6" end="10" type="mention" uri="xmpp:z3r0@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
const
first_msg
=
view
.
model
.
messages
.
findWhere
({
'
message
'
:
'
hello z3r0 gibson mr.robot, how are you?
'
});
...
...
@@ -2518,6 +2522,7 @@
`<reference begin="11" end="17" type="mention" uri="xmpp:gibson@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<reference begin="6" end="10" type="mention" uri="xmpp:z3r0@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<replace id="
${
msg
.
nodeTree
.
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:message-correct:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
done
();
}));
...
...
@@ -2565,6 +2570,7 @@
`<reference begin="18" end="26" type="mention" uri="xmpp:mr.robot@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<reference begin="11" end="17" type="mention" uri="xmpp:gibson@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<reference begin="6" end="10" type="mention" uri="xmpp:z3r0@localhost" xmlns="urn:xmpp:reference:0"/>`
+
`<origin-id id="
${
msg
.
nodeTree
.
querySelector
(
'
origin-id
'
).
getAttribute
(
"
id
"
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
...
...
src/headless/converse-chatboxes.js
View file @
abe21dce
...
...
@@ -401,15 +401,16 @@ converse.plugins.add('converse-chatboxes', {
'
type
'
:
this
.
get
(
'
message_type
'
),
'
id
'
:
message
.
get
(
'
edited
'
)
&&
_converse
.
connection
.
getUniqueId
()
||
message
.
get
(
'
msgid
'
),
}).
c
(
'
body
'
).
t
(
message
.
get
(
'
message
'
)).
up
()
.
c
(
_converse
.
ACTIVE
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
up
();
.
c
(
_converse
.
ACTIVE
,
{
'
xmlns
'
:
Strophe
.
NS
.
CHATSTATES
}).
root
();
if
(
message
.
get
(
'
type
'
)
===
'
chat
'
)
{
stanza
.
c
(
'
request
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
RECEIPTS
}).
up
();
stanza
.
c
(
'
request
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
RECEIPTS
}).
root
();
}
if
(
message
.
get
(
'
is_spoiler
'
))
{
if
(
message
.
get
(
'
spoiler_hint
'
))
{
stanza
.
c
(
'
spoiler
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
SPOILER
},
message
.
get
(
'
spoiler_hint
'
)).
up
();
stanza
.
c
(
'
spoiler
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
SPOILER
},
message
.
get
(
'
spoiler_hint
'
)).
root
();
}
else
{
stanza
.
c
(
'
spoiler
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
SPOILER
}).
up
();
stanza
.
c
(
'
spoiler
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
SPOILER
}).
root
();
}
}
(
message
.
get
(
'
references
'
)
||
[]).
forEach
(
reference
=>
{
...
...
@@ -422,17 +423,20 @@ converse.plugins.add('converse-chatboxes', {
if
(
reference
.
uri
)
{
attrs
.
uri
=
reference
.
uri
;
}
stanza
.
c
(
'
reference
'
,
attrs
).
up
();
stanza
.
c
(
'
reference
'
,
attrs
).
root
();
});
if
(
message
.
get
(
'
oob_url
'
))
{
stanza
.
c
(
'
x
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
OUTOFBAND
}).
c
(
'
url
'
).
t
(
message
.
get
(
'
oob_url
'
)).
up
();
stanza
.
c
(
'
x
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
OUTOFBAND
}).
c
(
'
url
'
).
t
(
message
.
get
(
'
oob_url
'
)).
root
();
}
if
(
message
.
get
(
'
edited
'
))
{
stanza
.
c
(
'
replace
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
MESSAGE_CORRECT
,
'
id
'
:
message
.
get
(
'
msgid
'
)
}).
up
();
}).
root
();
}
if
(
message
.
get
(
'
origin_id
'
))
{
stanza
.
c
(
'
origin-id
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
SID
,
'
id
'
:
message
.
get
(
'
origin_id
'
)}).
root
();
}
return
stanza
;
},
...
...
@@ -459,6 +463,7 @@ converse.plugins.add('converse-chatboxes', {
const
is_spoiler
=
this
.
get
(
'
composing_spoiler
'
);
return
_
.
extend
(
this
.
toJSON
(),
{
'
id
'
:
_converse
.
connection
.
getUniqueId
(),
'
origin_id
'
:
_converse
.
connection
.
getUniqueId
(),
'
fullname
'
:
_converse
.
xmppstatus
.
get
(
'
fullname
'
),
'
from
'
:
_converse
.
bare_jid
,
'
sender
'
:
'
me
'
,
...
...
src/headless/converse-muc.js
View file @
abe21dce
...
...
@@ -405,6 +405,7 @@ converse.plugins.add('converse-muc', {
[
text
,
references
]
=
this
.
parseTextForReferences
(
text
);
return
{
'
origin_id
'
:
_converse
.
connection
.
getUniqueId
(),
'
from
'
:
`
${
this
.
get
(
'
jid
'
)}
/
${
this
.
get
(
'
nick
'
)}
`
,
'
fullname
'
:
this
.
get
(
'
nick
'
),
'
is_spoiler
'
:
is_spoiler
,
...
...
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