fetchThreadList now pulls message_count
This commit is contained in:
@@ -740,9 +740,10 @@ class Client(object):
|
||||
if k['thread_type'] == 1:
|
||||
if k['other_user_fbid'] not in participants:
|
||||
raise Exception('A thread was not in participants: {}'.format(j['payload']))
|
||||
participants[k['other_user_fbid']].message_count = k['message_count']
|
||||
entries.append(participants[k['other_user_fbid']])
|
||||
elif k['thread_type'] == 2:
|
||||
entries.append(Group(k['thread_fbid'], participants=set([p.strip('fbid:') for p in k['participants']]), photo=k['image_src'], name=k['name']))
|
||||
entries.append(Group(k['thread_fbid'], participants=set([p.strip('fbid:') for p in k['participants']]), photo=k['image_src'], name=k['name'], message_count=k['message_count']))
|
||||
else:
|
||||
raise Exception('A thread had an unknown thread type: {}'.format(k))
|
||||
|
||||
|
@@ -15,14 +15,16 @@ class Thread(object):
|
||||
name = str
|
||||
#: Timestamp of last message
|
||||
last_message_timestamp = str
|
||||
|
||||
def __init__(self, _type, uid, photo=None, name=None, last_message_timestamp=None):
|
||||
#: Number of messages in the thread
|
||||
message_count = int
|
||||
def __init__(self, _type, uid, photo=None, name=None, last_message_timestamp=None, message_count=None):
|
||||
"""Represents a Facebook thread"""
|
||||
self.uid = str(uid)
|
||||
self.type = _type
|
||||
self.photo = photo
|
||||
self.name = name
|
||||
self.last_message_timestamp = last_message_timestamp
|
||||
self.message_count = message_count
|
||||
|
||||
def __repr__(self):
|
||||
return self.__unicode__()
|
||||
|
Reference in New Issue
Block a user