summaryrefslogtreecommitdiff
path: root/src/common.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-26 00:51:07 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-26 00:51:07 +0000
commitbee3b7c75c27a7f162f2e745f6d5835ca16b11d6 (patch)
treeb9735b70d20a8a61b0dcaabff135e3b7cd84a15e /src/common.py
parent32925f51f2fc26a447ce8ae29d9653caac8af2c2 (diff)
downloadpoezio-bee3b7c75c27a7f162f2e745f6d5835ca16b11d6.tar.gz
poezio-bee3b7c75c27a7f162f2e745f6d5835ca16b11d6.tar.bz2
poezio-bee3b7c75c27a7f162f2e745f6d5835ca16b11d6.tar.xz
poezio-bee3b7c75c27a7f162f2e745f6d5835ca16b11d6.zip
Support old and deprecated XEP 0091 because it's still used on buggy servers like @conference.codingteam.net. Fixed #1677
Diffstat (limited to 'src/common.py')
-rw-r--r--src/common.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common.py b/src/common.py
index b71f84fc..6cd83248 100644
--- a/src/common.py
+++ b/src/common.py
@@ -264,7 +264,10 @@ def datetime_tuple(timestamp):
"""
timestamp = timestamp.split('.')[0]
timestamp = timestamp.replace('-', '')
- ret = datetime.strptime(timestamp, '%Y%m%dT%H:%M:%SZ')
+ try:
+ ret = datetime.strptime(timestamp, '%Y%m%dT%H:%M:%SZ')
+ except ValueError: # Support the deprecated format, XEP 0091 :(
+ ret = datetime.strptime(timestamp, '%Y%m%dT%H:%M:%S')
# convert UTC to local time, with DST etc.
dst = timedelta(seconds=time.altzone)
ret -= dst