fix order of messages

This commit is contained in:
Romain Bignon 2014-10-11 20:04:20 +02:00
commit cf5740fbd3

View file

@ -79,7 +79,7 @@ class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
signature += u'\nLast online: %s' % user['last_online'] signature += u'\nLast online: %s' % user['last_online']
signature += u'\nPhotos:\n\t%s' % '\n\t'.join([user['photo_host'] + photo['large'] for photo in user['photos']]) signature += u'\nPhotos:\n\t%s' % '\n\t'.join([user['photo_host'] + photo['large'] for photo in user['photos']])
parent = None child = None
for msg in self.browser.get_thread_messages(thread.id): for msg in self.browser.get_thread_messages(thread.id):
flags = 0 flags = 0
@ -105,14 +105,15 @@ class PlayMeModule(Module, CapMessages, CapMessagesPost, CapDating):
date=utc2local(datetime.datetime.fromtimestamp(msg['utc_timestamp'])), date=utc2local(datetime.datetime.fromtimestamp(msg['utc_timestamp'])),
content=content, content=content,
children=[], children=[],
parent=parent, parent=None,
signature=signature if msg['from'] != self.browser.my_id else u'', signature=signature if msg['from'] != self.browser.my_id else u'',
flags=flags) flags=flags)
if parent: if child:
msg.children.append(parent) msg.children.append(child)
parent = msg child.parent = msg
thread.root = parent child = msg
thread.root = child
return thread return thread