Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
python-nbxmpp
Commits
dd932855
Commit
dd932855
authored
May 02, 2022
by
Philipp Hörist
Browse files
fix: Handle multiple stanza-id elements
parent
da624496
Changes
2
Hide whitespace changes
Inline
Side-by-side
nbxmpp/modules/message.py
View file @
dd932855
...
...
@@ -61,10 +61,7 @@ class BaseMessage(BaseModule):
properties
.
id
=
stanza
.
getID
()
properties
.
self_message
=
self
.
_parse_self_message
(
stanza
,
properties
)
# Stanza ID
id_
,
by
=
stanza
.
getStanzaIDAttrs
()
if
id_
is
not
None
and
by
is
not
None
:
properties
.
stanza_id
=
StanzaIDData
(
id
=
id_
,
by
=
by
)
properties
.
stanza_ids
=
self
.
_parse_stanza_ids
(
stanza
)
if
properties
.
type
.
is_error
:
properties
.
error
=
error_factory
(
stanza
)
...
...
@@ -107,3 +104,17 @@ class BaseMessage(BaseModule):
if
properties
.
type
.
is_groupchat
:
return
False
return
stanza
.
getFrom
().
bare_match
(
stanza
.
getTo
())
def
_parse_stanza_ids
(
self
,
stanza
):
stanza_ids
=
[]
for
stanza_id
in
stanza
.
getTags
(
'stanza-id'
,
namespace
=
Namespace
.
SID
):
id_
=
stanza_id
.
getAttr
(
'id'
)
by
=
stanza_id
.
getAttr
(
'by'
)
if
not
id_
or
not
by
:
self
.
_log
.
warning
(
'Missing attributes on stanza-id'
)
self
.
_log
.
warning
(
stanza
)
continue
stanza_ids
.
append
(
StanzaIDData
(
id
=
id_
,
by
=
by
))
return
stanza_ids
\ No newline at end of file
nbxmpp/structs.py
View file @
dd932855
...
...
@@ -945,7 +945,7 @@ class MessageProperties:
carbon
:
Optional
[
CarbonData
]
=
None
type
:
MessageType
=
MessageType
.
NORMAL
id
:
Optional
[
str
]
=
None
stanza_id
:
Optional
[
str
]
=
None
stanza_id
s
:
list
[
StanzaIDData
]
=
field
(
default_factory
=
list
)
from_
:
Optional
[
JID
]
=
None
to
:
Optional
[
JID
]
=
None
jid
:
Optional
[
JID
]
=
None
...
...
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