Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
ff8e7bb6 by Philipp Hörist at 2019-10-05T11:16:42Z
Determine remote jid correctly in all cases
- - - - -
6a89fcfb by Philipp Hörist at 2019-10-05T21:52:59Z
Message Properties: Expose from and to attribute
- - - - -
2 changed files:
- nbxmpp/modules/message.py
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/modules/message.py
=====================================
@@ -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
=====================================
@@ -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
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/compare/35cb5c69d84938bec1c2eeab820ad2b8b06f75bc...6a89fcfbd803d6a8cba202a5456dec8e7a49d43d
--
View it on GitLab:
https://dev.gajim.org/gajim/python-nbxmpp/compare/35cb5c69d84938bec1c2eeab820ad2b8b06f75bc...6a89fcfbd803d6a8cba202a5456dec8e7a49d43d
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits