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
ce1f7e09
Commit
ce1f7e09
authored
Apr 13, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `getMessageAttributesFromStanza` to `parseMessage`
parent
fef5292a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
24 deletions
+24
-24
src/converse-omemo.js
src/converse-omemo.js
+2
-2
src/headless/converse-chat.js
src/headless/converse-chat.js
+11
-11
src/headless/converse-headlines.js
src/headless/converse-headlines.js
+1
-1
src/headless/converse-muc.js
src/headless/converse-muc.js
+8
-8
src/headless/utils/stanza.js
src/headless/utils/stanza.js
+2
-2
No files found.
src/converse-omemo.js
View file @
ce1f7e09
...
@@ -169,10 +169,10 @@ converse.plugins.add('converse-omemo', {
...
@@ -169,10 +169,10 @@ converse.plugins.add('converse-omemo', {
},
},
ChatBox
:
{
ChatBox
:
{
async
getMessageAttributesFromStanza
(
stanza
,
original_stanza
)
{
async
parseMessage
(
stanza
,
original_stanza
)
{
const
{
_converse
}
=
this
.
__super__
;
const
{
_converse
}
=
this
.
__super__
;
const
encrypted
=
sizzle
(
`encrypted[xmlns="
${
Strophe
.
NS
.
OMEMO
}
"]`
,
original_stanza
).
pop
(),
const
encrypted
=
sizzle
(
`encrypted[xmlns="
${
Strophe
.
NS
.
OMEMO
}
"]`
,
original_stanza
).
pop
(),
attrs
=
await
this
.
__super__
.
getMessageAttributesFromStanza
.
apply
(
this
,
arguments
);
attrs
=
await
this
.
__super__
.
parseMessage
.
apply
(
this
,
arguments
);
if
(
!
encrypted
||
!
_converse
.
config
.
get
(
'
trusted
'
))
{
if
(
!
encrypted
||
!
_converse
.
config
.
get
(
'
trusted
'
))
{
return
attrs
;
return
attrs
;
...
...
src/headless/converse-chat.js
View file @
ce1f7e09
...
@@ -9,7 +9,7 @@ import { Model } from 'skeletor.js/src/model.js';
...
@@ -9,7 +9,7 @@ import { Model } from 'skeletor.js/src/model.js';
import
converse
from
"
./converse-core
"
;
import
converse
from
"
./converse-core
"
;
import
filesize
from
"
filesize
"
;
import
filesize
from
"
filesize
"
;
import
log
from
"
./log
"
;
import
log
from
"
./log
"
;
import
st
anza_utils
from
"
./utils/stanza
"
;
import
st
from
"
./utils/stanza
"
;
const
{
$msg
,
Strophe
,
sizzle
,
utils
}
=
converse
.
env
;
const
{
$msg
,
Strophe
,
sizzle
,
utils
}
=
converse
.
env
;
const
u
=
converse
.
env
.
utils
;
const
u
=
converse
.
env
.
utils
;
...
@@ -411,7 +411,7 @@ converse.plugins.add('converse-chat', {
...
@@ -411,7 +411,7 @@ converse.plugins.add('converse-chat', {
},
},
async
onMessage
(
stanza
,
original_stanza
,
from_jid
)
{
async
onMessage
(
stanza
,
original_stanza
,
from_jid
)
{
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
const
attrs
=
await
this
.
parseMessage
(
stanza
,
original_stanza
);
const
message
=
this
.
getDuplicateMessage
(
attrs
);
const
message
=
this
.
getDuplicateMessage
(
attrs
);
if
(
message
)
{
if
(
message
)
{
this
.
updateMessage
(
message
,
original_stanza
);
this
.
updateMessage
(
message
,
original_stanza
);
...
@@ -527,7 +527,7 @@ converse.plugins.add('converse-chat', {
...
@@ -527,7 +527,7 @@ converse.plugins.add('converse-chat', {
getUpdatedMessageAttributes
(
message
,
stanza
)
{
// eslint-disable-line no-unused-vars
getUpdatedMessageAttributes
(
message
,
stanza
)
{
// eslint-disable-line no-unused-vars
return
{
return
{
'
is_archived
'
:
st
anza_utils
.
isArchived
(
stanza
),
'
is_archived
'
:
st
.
isArchived
(
stanza
),
}
}
},
},
...
@@ -610,7 +610,7 @@ converse.plugins.add('converse-chat', {
...
@@ -610,7 +610,7 @@ converse.plugins.add('converse-chat', {
* @private
* @private
* @method _converse.ChatBox#findDanglingRetraction
* @method _converse.ChatBox#findDanglingRetraction
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns { _converse.Message }
* @returns { _converse.Message }
*/
*/
findDanglingRetraction
(
attrs
)
{
findDanglingRetraction
(
attrs
)
{
...
@@ -637,7 +637,7 @@ converse.plugins.add('converse-chat', {
...
@@ -637,7 +637,7 @@ converse.plugins.add('converse-chat', {
* @private
* @private
* @method _converse.ChatBox#handleRetraction
* @method _converse.ChatBox#handleRetraction
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns { Boolean } Returns `true` or `false` depending on
* @returns { Boolean } Returns `true` or `false` depending on
* whether a message was retracted or not.
* whether a message was retracted or not.
*/
*/
...
@@ -677,7 +677,7 @@ converse.plugins.add('converse-chat', {
...
@@ -677,7 +677,7 @@ converse.plugins.add('converse-chat', {
* @private
* @private
* @method _converse.ChatBox#handleCorrection
* @method _converse.ChatBox#handleCorrection
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns { _converse.Message|undefined } Returns the corrected
* @returns { _converse.Message|undefined } Returns the corrected
* message or `undefined` if not applicable.
* message or `undefined` if not applicable.
*/
*/
...
@@ -710,7 +710,7 @@ converse.plugins.add('converse-chat', {
...
@@ -710,7 +710,7 @@ converse.plugins.add('converse-chat', {
* @private
* @private
* @method _converse.ChatBox#getDuplicateMessage
* @method _converse.ChatBox#getDuplicateMessage
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns {Promise<_converse.Message>}
* @returns {Promise<_converse.Message>}
*/
*/
getDuplicateMessage
(
attrs
)
{
getDuplicateMessage
(
attrs
)
{
...
@@ -1084,17 +1084,17 @@ converse.plugins.add('converse-chat', {
...
@@ -1084,17 +1084,17 @@ converse.plugins.add('converse-chat', {
/**
/**
* Parses a passed in message stanza and returns an object of attributes.
* Parses a passed in message stanza and returns an object of attributes.
* @private
* @private
* @method _converse.ChatBox#
getMessageAttributesFromStanza
* @method _converse.ChatBox#
parseMessage
* @param { XMLElement } stanza - The message stanza
* @param { XMLElement } stanza - The message stanza
* @param { XMLElement } original_stanza - The original stanza, that contains the
* @param { XMLElement } original_stanza - The original stanza, that contains the
* message stanza, if it was contained, otherwise it's the message stanza itself.
* message stanza, if it was contained, otherwise it's the message stanza itself.
* @returns { Object }
* @returns { Object }
*/
*/
getMessageAttributesFromStanza
(
stanza
,
original_stanza
)
{
parseMessage
(
stanza
,
original_stanza
)
{
// XXX: Eventually we want to get rid of this pass-through
// XXX: Eventually we want to get rid of this pass-through
// method but currently we still need it because converse-omemo
// method but currently we still need it because converse-omemo
// overrides it.
// overrides it.
return
st
anza_utils
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
,
this
,
_converse
);
return
st
.
parseMessage
(
stanza
,
original_stanza
,
this
,
_converse
);
},
},
maybeShow
()
{
maybeShow
()
{
...
@@ -1169,7 +1169,7 @@ converse.plugins.add('converse-chat', {
...
@@ -1169,7 +1169,7 @@ converse.plugins.add('converse-chat', {
if
(
!
should_show
)
{
if
(
!
should_show
)
{
return
;
return
;
}
}
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
stanza
,
stanza
);
const
attrs
=
await
chatbox
.
parseMessage
(
stanza
,
stanza
);
await
chatbox
.
createMessage
(
attrs
);
await
chatbox
.
createMessage
(
attrs
);
}
}
...
...
src/headless/converse-headlines.js
View file @
ce1f7e09
...
@@ -99,7 +99,7 @@ converse.plugins.add('converse-headlines', {
...
@@ -99,7 +99,7 @@ converse.plugins.add('converse-headlines', {
'
type
'
:
_converse
.
HEADLINES_TYPE
,
'
type
'
:
_converse
.
HEADLINES_TYPE
,
'
from
'
:
from_jid
'
from
'
:
from_jid
});
});
const
attrs
=
await
chatbox
.
getMessageAttributesFromStanza
(
message
,
message
);
const
attrs
=
await
chatbox
.
parseMessage
(
message
,
message
);
await
chatbox
.
createMessage
(
attrs
);
await
chatbox
.
createMessage
(
attrs
);
api
.
trigger
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
api
.
trigger
(
'
message
'
,
{
'
chatbox
'
:
chatbox
,
'
stanza
'
:
message
});
}
}
...
...
src/headless/converse-muc.js
View file @
ce1f7e09
...
@@ -13,7 +13,7 @@ import { clone, debounce, intersection, invoke, isElement, isObject, isString, p
...
@@ -13,7 +13,7 @@ import { clone, debounce, intersection, invoke, isElement, isObject, isString, p
import
converse
from
"
./converse-core
"
;
import
converse
from
"
./converse-core
"
;
import
log
from
"
./log
"
;
import
log
from
"
./log
"
;
import
muc_utils
from
"
./utils/muc
"
;
import
muc_utils
from
"
./utils/muc
"
;
import
st
anza_utils
from
"
./utils/stanza
"
;
import
st
from
"
./utils/stanza
"
;
import
u
from
"
./utils/form
"
;
import
u
from
"
./utils/form
"
;
converse
.
MUC_TRAFFIC_STATES
=
[
'
entered
'
,
'
exited
'
];
converse
.
MUC_TRAFFIC_STATES
=
[
'
entered
'
,
'
exited
'
];
...
@@ -1566,7 +1566,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1566,7 +1566,7 @@ converse.plugins.add('converse-muc', {
* @param { XMLElement } pres - The presence stanza
* @param { XMLElement } pres - The presence stanza
*/
*/
updateOccupantsOnPresence
(
pres
)
{
updateOccupantsOnPresence
(
pres
)
{
const
data
=
this
.
parsePresence
(
pres
);
const
data
=
st
.
parseMUCPresenceStanza
(
pres
);
if
(
data
.
type
===
'
error
'
||
(
!
data
.
jid
&&
!
data
.
nick
))
{
if
(
data
.
type
===
'
error
'
||
(
!
data
.
jid
&&
!
data
.
nick
))
{
return
true
;
return
true
;
}
}
...
@@ -1703,7 +1703,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1703,7 +1703,7 @@ converse.plugins.add('converse-muc', {
* @private
* @private
* @method _converse.ChatRoom#handleSubjectChange
* @method _converse.ChatRoom#handleSubjectChange
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
*/
*/
async
handleSubjectChange
(
attrs
)
{
async
handleSubjectChange
(
attrs
)
{
if
(
isString
(
attrs
.
subject
)
&&
!
attrs
.
thread
&&
!
attrs
.
message
)
{
if
(
isString
(
attrs
.
subject
)
&&
!
attrs
.
thread
&&
!
attrs
.
message
)
{
...
@@ -1861,7 +1861,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1861,7 +1861,7 @@ converse.plugins.add('converse-muc', {
* @private
* @private
* @method _converse.ChatRoom#findDanglingModeration
* @method _converse.ChatRoom#findDanglingModeration
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns { _converse.ChatRoomMessage }
* @returns { _converse.ChatRoomMessage }
*/
*/
findDanglingModeration
(
attrs
)
{
findDanglingModeration
(
attrs
)
{
...
@@ -1892,7 +1892,7 @@ converse.plugins.add('converse-muc', {
...
@@ -1892,7 +1892,7 @@ converse.plugins.add('converse-muc', {
* @private
* @private
* @method _converse.ChatRoom#handleModeration
* @method _converse.ChatRoom#handleModeration
* @param { object } attrs - Attributes representing a received
* @param { object } attrs - Attributes representing a received
* message, as returned by {@link st
anza_utils.getMessageAttributesFromStanza
}
* message, as returned by {@link st
.parseMessage
}
* @returns { Boolean } Returns `true` or `false` depending on
* @returns { Boolean } Returns `true` or `false` depending on
* whether a message was moderated or not.
* whether a message was moderated or not.
*/
*/
...
@@ -2026,14 +2026,14 @@ converse.plugins.add('converse-muc', {
...
@@ -2026,14 +2026,14 @@ converse.plugins.add('converse-muc', {
await
this
.
createInfoMessages
(
stanza
);
await
this
.
createInfoMessages
(
stanza
);
this
.
fetchFeaturesIfConfigurationChanged
(
stanza
);
this
.
fetchFeaturesIfConfigurationChanged
(
stanza
);
const
attrs
=
await
this
.
getMessageAttributesFromStanza
(
stanza
,
original_stanza
);
const
attrs
=
await
this
.
parseMessage
(
stanza
,
original_stanza
);
const
message
=
this
.
getDuplicateMessage
(
attrs
);
const
message
=
this
.
getDuplicateMessage
(
attrs
);
if
(
message
)
{
if
(
message
)
{
this
.
updateMessage
(
message
,
original_stanza
);
this
.
updateMessage
(
message
,
original_stanza
);
}
}
if
(
message
||
if
(
message
||
st
anza_utils
.
isReceipt
(
stanza
)
||
st
.
isReceipt
(
stanza
)
||
st
anza_utils
.
isChatMarker
(
stanza
)
||
st
.
isChatMarker
(
stanza
)
||
this
.
ignorableCSN
(
attrs
))
{
this
.
ignorableCSN
(
attrs
))
{
return
api
.
trigger
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
return
api
.
trigger
(
'
message
'
,
{
'
stanza
'
:
original_stanza
});
}
}
...
...
src/headless/utils/stanza.js
View file @
ce1f7e09
...
@@ -284,7 +284,7 @@ const stanza_utils = {
...
@@ -284,7 +284,7 @@ const stanza_utils = {
/**
/**
* Parses a passed in message stanza and returns an object of attributes.
* Parses a passed in message stanza and returns an object of attributes.
* @private
* @private
* @method stanza_utils#
getMessageAttributesFromStanza
* @method stanza_utils#
parseMessage
* @param { XMLElement } stanza - The message stanza
* @param { XMLElement } stanza - The message stanza
* @param { XMLElement } original_stanza - The original stanza, that contains the
* @param { XMLElement } original_stanza - The original stanza, that contains the
* message stanza, if it was contained, otherwise it's the message stanza itself.
* message stanza, if it was contained, otherwise it's the message stanza itself.
...
@@ -292,7 +292,7 @@ const stanza_utils = {
...
@@ -292,7 +292,7 @@ const stanza_utils = {
* @param { _converse } _converse
* @param { _converse } _converse
* @returns { Object }
* @returns { Object }
*/
*/
getMessageAttributesFromStanza
(
stanza
,
original_stanza
,
chatbox
,
_converse
)
{
parseMessage
(
stanza
,
original_stanza
,
chatbox
,
_converse
)
{
const
is_muc
=
u
.
isChatRoom
(
chatbox
);
const
is_muc
=
u
.
isChatRoom
(
chatbox
);
let
attrs
=
Object
.
assign
(
let
attrs
=
Object
.
assign
(
stanza_utils
.
getStanzaIDs
(
stanza
,
original_stanza
),
stanza_utils
.
getStanzaIDs
(
stanza
,
original_stanza
),
...
...
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