summaryrefslogtreecommitdiff
path: root/alot/db/thread.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/db/thread.py')
-rw-r--r--alot/db/thread.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/alot/db/thread.py b/alot/db/thread.py
index 2792737c..a76997f8 100644
--- a/alot/db/thread.py
+++ b/alot/db/thread.py
@@ -40,7 +40,7 @@ class Thread:
toplevel_messages = None
"""A list of ids of all messages in this thread in depth-first order"""
- message_ids = None
+ message_list = None
"""A dict mapping Message-Id strings to Message instances"""
messages = None
@@ -58,7 +58,7 @@ class Thread:
self._tags = set()
self.toplevel_messages = []
- self.message_ids = []
+ self.message_list = []
self.messages = {}
self.refresh(thread)
@@ -97,7 +97,7 @@ class Thread:
self._tags = {t for t in thread.get_tags()}
- self.messages, self.toplevel_messages, self.message_ids = self._gather_messages()
+ self.messages, self.toplevel_messages, self.message_list = self._gather_messages()
def _gather_messages(self):
query = self._dbman.query('thread:' + self.id)
@@ -105,25 +105,26 @@ class Thread:
msgs = {}
msg_tree = []
- ids = []
+ msg_list = []
- def thread_tree_walk(nm_msg):
- msg_id = nm_msg.get_message_id()
- ids.append(msg_id)
+ def thread_tree_walk(nm_msg, depth):
+ msg = Message(self._dbman, self, nm_msg, depth)
+
+ msg_list.append(msg)
replies = []
for m in nm_msg.get_replies():
- replies.append(thread_tree_walk(m))
- msg = Message(self._dbman, nm_msg, self, replies)
+ replies.append(thread_tree_walk(m, depth + 1))
- msgs[msg_id] = msg
+ msg.replies = replies
+ msgs[msg.id] = msg
return msg
for m in nm_thread.get_toplevel_messages():
- msg_tree.append(thread_tree_walk(m))
+ msg_tree.append(thread_tree_walk(m, 0))
- return msgs, msg_tree, ids
+ return msgs, msg_tree, msg_list
def __str__(self):
return "thread:%s: %s" % (self.id, self.subject)