add flags IS_THREADS and IS_DISCUSSION to Thread to know how to display messages

This commit is contained in:
Romain Bignon 2010-11-28 11:34:12 +01:00
commit 912d3496c9
2 changed files with 6 additions and 0 deletions

View file

@ -107,6 +107,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
self.report_spam(contact.get_id(), contact.get_suppr_id())
continue
thread = Thread(contact.get_id())
thread.flags = Thread.IS_DISCUSSION
thread.title = 'Discussion with %s' % contact.get_name()
yield thread
@ -123,6 +124,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
if not thread:
thread = Thread(id)
thread.flags = Thread.IS_DISCUSSION
full = False
else:
full = True

View file

@ -95,6 +95,9 @@ class Message(CapBaseObject):
return result.encode('utf-8')
class Thread(CapBaseObject):
IS_THREADS = 0x001
IS_DISCUSSION = 0x002
def __init__(self, id):
CapBaseObject.__init__(self, id)
self.add_field('root', Message)
@ -102,6 +105,7 @@ class Thread(CapBaseObject):
self.add_field('date', datetime.datetime)
self.add_field('nb_messages', int)
self.add_field('nb_unread', int)
self.add_field('flags', int, self.IS_THREADS)
def iter_all_messages(self):
if self.root: