Commit f37f2c9d authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Delay: Improve discovering server added delays

parent 1abe1eab
...@@ -44,16 +44,21 @@ class Delay: ...@@ -44,16 +44,21 @@ class Delay:
# to indicate when the user has set the subject, # to indicate when the user has set the subject,
# the 'from' attr on these delays is the MUC server # the 'from' attr on these delays is the MUC server
# but we treat it as user timestamp # but we treat it as user timestamp
properties.user_timestamp = parse_delay( jids = [properties.jid.getBare(),
stanza, from_=properties.jid.getBare()) properties.jid.getDomain()]
properties.user_timestamp = parse_delay(stanza, from_=jids)
else: else:
jid = self._client.get_bound_jid().getDomain() if properties.from_muc:
timestamp = parse_delay(stanza, from_=jid) # Some servers use the MUC JID, others the domain
if timestamp is not None: jids = [properties.jid.getBare(),
properties.timestamp = timestamp properties.jid.getDomain()]
else:
jids = [self._client.get_bound_jid().getDomain()]
properties.user_timestamp = parse_delay(stanza, not_from=[jid]) properties.timestamp = parse_delay(stanza, from_=jids)
properties.user_timestamp = parse_delay(stanza, not_from=jids)
@staticmethod @staticmethod
def _process_presence_delay(_con, stanza, properties): def _process_presence_delay(_con, stanza, properties):
...@@ -85,7 +90,7 @@ def parse_delay(stanza, epoch=True, convert='utc', from_=None, not_from=None): ...@@ -85,7 +90,7 @@ def parse_delay(stanza, epoch=True, convert='utc', from_=None, not_from=None):
delay_from = delay.getAttr('from') delay_from = delay.getAttr('from')
if from_ is not None: if from_ is not None:
if delay_from != from_: if delay_from not in from_:
continue continue
if not_from is not None: if not_from is not None:
if delay_from in not_from: if delay_from in not_from:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment