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
9fe7bfcd
Commit
9fe7bfcd
authored
Sep 16, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include `chatbox` in 'message' event data
parent
522e7706
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
9 deletions
+22
-9
docs/source/theming.rst
docs/source/theming.rst
+1
-1
src/headless/converse-chat.js
src/headless/converse-chat.js
+4
-4
src/headless/converse-muc.js
src/headless/converse-muc.js
+16
-3
src/headless/utils/muc.js
src/headless/utils/muc.js
+1
-1
No files found.
docs/source/theming.rst
View file @
9fe7bfcd
...
...
@@ -53,7 +53,7 @@ To generate the CSS you can run::
make css
Testing your changes
=======
=======
=============
The recommended way to test your changes is to run the tests that are part of the Converse source code.
By executing ``make test`` you'll run all tests (which live in the ``spec`` folder) which will open a browser window in which tests are processed.
...
...
src/headless/converse-chat.js
View file @
9fe7bfcd
...
...
@@ -1215,19 +1215,19 @@ converse.plugins.add('converse-chat', {
const
chatbox
=
await
api
.
chats
.
get
(
attrs
.
contact_jid
,
{
'
nickname
'
:
attrs
.
nick
},
has_body
);
await
chatbox
?.
queueMessage
(
attrs
);
/**
* @typedef { Object } MessageData
* An object containing the original message stanza, as well as the
* parsed attributes.
* @typedef { Object } MessageData
* @property { XMLElement } stanza
* @property { MessageAttributes } stanza
* @property { ChatBox } chatbox
*/
const
data
=
{
stanza
,
attrs
};
const
data
=
{
stanza
,
attrs
,
chatbox
};
/**
* Triggered when a message stanza is been received and processed.
* @event _converse#message
* @type { object }
* @property { MessageData|MUCMessageData } data
* @example _converse.api.listen.on('message', obj => { ... });
* @property { module:converse-chat~MessageData } data
*/
api
.
trigger
(
'
message
'
,
data
);
}
...
...
src/headless/converse-muc.js
View file @
9fe7bfcd
...
...
@@ -662,6 +662,12 @@ converse.plugins.add('converse-muc', {
}
},
/**
* Parses an incoming message stanza and queues it for processing.
* @private
* @method _converse.ChatRoom#handleMessageStanza
* @param { XMLElement } stanza
*/
async
handleMessageStanza
(
stanza
)
{
if
(
st
.
isArchived
(
stanza
))
{
// MAM messages are handled in converse-mam.
...
...
@@ -673,14 +679,21 @@ converse.plugins.add('converse-muc', {
this
.
fetchFeaturesIfConfigurationChanged
(
stanza
);
/**
* @typedef { Object } MUCMessageData
* An object containing the original groupchat message stanza,
* as well as the parsed attributes.
* @typedef { Object } MUCMessageData
* @property { XMLElement } stanza
* @property { MUCMessageAttributes } stanza
* @property { MUCMessageAttributes } attrs
* @property { ChatRoom } chatbox
*/
const
attrs
=
await
st
.
parseMUCMessage
(
stanza
,
this
,
_converse
);
const
data
=
{
stanza
,
attrs
};
const
data
=
{
stanza
,
attrs
,
'
chatbox
'
:
this
};
/**
* Triggered when a groupchat message stanza has been received and parsed.
* @event _converse#message
* @type { object }
* @property { module:converse-muc~MUCMessageData } data
*/
api
.
trigger
(
'
message
'
,
data
);
return
attrs
&&
this
.
queueMessage
(
attrs
);
},
...
...
src/headless/utils/muc.js
View file @
9fe7bfcd
/**
* @copyright
2020, t
he Converse.js contributors
* @copyright
T
he Converse.js contributors
* @license Mozilla Public License (MPLv2)
* @description This is the MUC utilities module.
*/
...
...
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