msg_id = os.path.basename(path)
thread["messages"].append(msg_id)
thread["date"] = datetime.datetime.utcnow()
- thread["unread"] = True
if from_field["address"] != thread["creator"]["address"]:
thread["lastreplyfrom"] = from_field
if username not in self.threads_index:
print "Setting threads_index for user : %s" % username
- self.threads_index[username] = {"threads_index": [], "dirty": True}
+ self.threads_index[username] = {"threads_index": [], "dirty": True, "unread_count": 0}
process_new_email(event["path"], self.threads_index[username]["threads_index"])
self.threads_index[username]["dirty"] = True
+ self.threads_index[username]["unread_count"] += 1
except IOError as e:
# This may be a Postfix/Dovecot temporary file. Ignore it.
print "caught ioerror %s" % e.strerror
return base64.b32encode(os.urandom(32))
def create_thread_structure():
- return {"date": datetime.datetime.utcnow(), "messages": [], "subject": "", "id": generate_random_id()}
+ return {"date": datetime.datetime.utcnow(), "messages": [], "subject": "", "id": generate_random_id(), "unread": True}