diff options
author | tmolitor <thilo@eightysoft.de> | 2016-04-20 00:43:01 +0300 |
---|---|---|
committer | tmolitor <thilo@eightysoft.de> | 2016-04-20 00:43:01 +0300 |
commit | 0b57a50402c0cd45267efbc09918c04c28be9f9c (patch) | |
tree | efccf06b7c0caa7952412ed2e3d394015efbdd84 /src | |
parent | 59471e3339fd680fed5078366b3d9b5e7d145024 (diff) |
Cleaner version of the mam message timestamp fix. Fixes #8277
Diffstat (limited to 'src')
-rw-r--r-- | src/common/connection_handlers_events.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/common/connection_handlers_events.py b/src/common/connection_handlers_events.py index e7e98018f..63f725d67 100644 --- a/src/common/connection_handlers_events.py +++ b/src/common/connection_handlers_events.py @@ -1033,19 +1033,17 @@ class MamMessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent): if not self.stanza: return account = self.conn.name + self.msg_ = self.stanza.getTag('message') + # use timestamp of archived message, if available and archive timestamp otherwise delay = self.stanza.getTag('delay', namespace=nbxmpp.NS_DELAY2) + delay2 = self.msg_.getTag('delay', namespace=nbxmpp.NS_DELAY2) + if delay2: + delay = delay2 if not delay: return tim = delay.getAttr('stamp') tim = helpers.datetime_tuple(tim) self.tim = localtime(timegm(tim)) - self.msg_ = self.stanza.getTag('message') - # use delay of archived message, if possible - delay = self.msg_.getTag('delay', namespace=nbxmpp.NS_DELAY2) - if delay: - tim = delay.getAttr('stamp') - tim = helpers.datetime_tuple(tim) - self.tim = localtime(timegm(tim)) to_ = self.msg_.getAttr('to') if to_: to_ = gajim.get_jid_without_resource(to_) |