Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Determine remote jid correctly in all cases
· ff8e7bb6
Philipp Hörist
authored
Oct 05, 2019
ff8e7bb6
Message Properties: Expose from and to attribute
· 6a89fcfb
Philipp Hörist
authored
Oct 05, 2019
6a89fcfb
Hide whitespace changes
Inline
Side-by-side
nbxmpp/modules/message.py
View file @
6a89fcfb
...
...
@@ -40,7 +40,23 @@ class BaseMessage:
def
_process_message_base
(
self
,
_con
,
stanza
,
properties
):
properties
.
type
=
self
.
_parse_type
(
stanza
)
properties
.
jid
=
stanza
.
getFrom
()
# Determine remote JID
if
properties
.
is_carbon_message
and
properties
.
carbon
.
is_sent
:
properties
.
jid
=
stanza
.
getTo
()
elif
properties
.
is_mam_message
and
not
properties
.
type
.
is_groupchat
:
own_jid
=
self
.
_client
.
get_bound_jid
()
if
own_jid
.
bareMatch
(
stanza
.
getFrom
()):
properties
.
jid
=
stanza
.
getTo
()
else
:
properties
.
jid
=
stanza
.
getFrom
()
else
:
properties
.
jid
=
stanza
.
getFrom
()
properties
.
from_
=
stanza
.
getFrom
()
properties
.
to
=
stanza
.
getTo
()
properties
.
id
=
stanza
.
getID
()
properties
.
self_message
=
self
.
_parse_self_message
(
stanza
,
properties
)
...
...
nbxmpp/structs.py
View file @
6a89fcfb
...
...
@@ -495,6 +495,8 @@ class MessageProperties:
self
.
type
=
MessageType
.
NORMAL
self
.
id
=
None
self
.
stanza_id
=
None
self
.
from_
=
None
self
.
to
=
None
self
.
jid
=
None
self
.
subject
=
None
self
.
body
=
None
...
...