add flags IS_THREADS and IS_DISCUSSION to Thread to know how to display messages
This commit is contained in:
parent
fb5e8cfbaa
commit
912d3496c9
2 changed files with 6 additions and 0 deletions
|
|
@ -107,6 +107,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
self.report_spam(contact.get_id(), contact.get_suppr_id())
|
self.report_spam(contact.get_id(), contact.get_suppr_id())
|
||||||
continue
|
continue
|
||||||
thread = Thread(contact.get_id())
|
thread = Thread(contact.get_id())
|
||||||
|
thread.flags = Thread.IS_DISCUSSION
|
||||||
thread.title = 'Discussion with %s' % contact.get_name()
|
thread.title = 'Discussion with %s' % contact.get_name()
|
||||||
yield thread
|
yield thread
|
||||||
|
|
||||||
|
|
@ -123,6 +124,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
|
|
||||||
if not thread:
|
if not thread:
|
||||||
thread = Thread(id)
|
thread = Thread(id)
|
||||||
|
thread.flags = Thread.IS_DISCUSSION
|
||||||
full = False
|
full = False
|
||||||
else:
|
else:
|
||||||
full = True
|
full = True
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ class Message(CapBaseObject):
|
||||||
return result.encode('utf-8')
|
return result.encode('utf-8')
|
||||||
|
|
||||||
class Thread(CapBaseObject):
|
class Thread(CapBaseObject):
|
||||||
|
IS_THREADS = 0x001
|
||||||
|
IS_DISCUSSION = 0x002
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, id):
|
||||||
CapBaseObject.__init__(self, id)
|
CapBaseObject.__init__(self, id)
|
||||||
self.add_field('root', Message)
|
self.add_field('root', Message)
|
||||||
|
|
@ -102,6 +105,7 @@ class Thread(CapBaseObject):
|
||||||
self.add_field('date', datetime.datetime)
|
self.add_field('date', datetime.datetime)
|
||||||
self.add_field('nb_messages', int)
|
self.add_field('nb_messages', int)
|
||||||
self.add_field('nb_unread', int)
|
self.add_field('nb_unread', int)
|
||||||
|
self.add_field('flags', int, self.IS_THREADS)
|
||||||
|
|
||||||
def iter_all_messages(self):
|
def iter_all_messages(self):
|
||||||
if self.root:
|
if self.root:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue