plugin groupblog, XEP-0277: store both published and updated timestamps

This commit is contained in:
souliane 2013-12-19 13:54:40 +01:00
commit 5b623dbb5c

View file

@ -108,7 +108,11 @@ class XEP_0277(object):
microblog_data['content'] = _entry.title.text
if len(_entry.authors):
microblog_data['author'] = _entry.authors[0].name.text
microblog_data['timestamp'] = str(int(_entry.updated.tf))
microblog_data['updated'] = str(int(_entry.updated.tf))
try:
microblog_data['published'] = str(int(_entry.published.tf))
except (KeyError, TypeError):
microblog_data['published'] = microblog_data['updated']
microblog_data['id'] = item['id']
for link in _entry.links:
try:
@ -172,7 +176,8 @@ class XEP_0277(object):
_entry.author = atom.Author()
_entry.author.name = data.get('author', self.host.getJidNStream(profile)[0].userhost()).encode('utf-8')
_entry.updated = float(data.get('timestamp', time()))
_entry.updated = float(data.get('updated', time()))
_entry.published = float(data.get('published', time()))
entry_id = data.get('id', str(_uuid))
_entry.id = entry_id
if 'comments' in data: