aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuestion Box Service <qbox@andrewyu.org>2023-04-07 10:20:47 +0200
committerQuestion Box Service <qbox@andrewyu.org>2023-04-07 10:20:47 +0200
commit958e0840142d113b50c30119f387b363403b45fe (patch)
treeda6ea3cef8fe9224e573257a96f5284eb5ab3b0a
parent75de78518235d3cab6e875e44839b1e81787a897 (diff)
downloadqbox-958e0840142d113b50c30119f387b363403b45fe.tar.gz
qbox-958e0840142d113b50c30119f387b363403b45fe.zip
Fix flushing and new->cur
-rwxr-xr-xapp.py8
-rw-r--r--todo4
2 files changed, 8 insertions, 4 deletions
diff --git a/app.py b/app.py
index b9e8bbe..5eaa3e4 100755
--- a/app.py
+++ b/app.py
@@ -143,10 +143,16 @@ def qboard(user):
# Why not in a separate email_stuff() function?
# Because lazy
mbox = mailbox.Maildir('/home/qbox/Mail/Inbox')
- for msg in mbox:
+ for msg_id, msg in mbox.items():
if msg.get_subdir() != "new": continue
+ print(f'{msg.get_subdir()=}')
+ mbox.lock()
+ msg.add_flag("SR")
msg.set_subdir("cur") # apparently it's not doing so
+ print(f'{msg.get_subdir()=} should be cur')
+ mbox[msg_id] = msg
mbox.flush()
+ mbox.unlock()
parsed_address = parse_address(msg["From"])
from_address = parsed_address[1] + "@" + parsed_address[2]
if from_address != MAPPING[user][0]: continue
diff --git a/todo b/todo
index b4c49dd..8415f8d 100644
--- a/todo
+++ b/todo
@@ -1,3 +1 @@
-- user list in seperate configuration file
- - {username: (database_file, email_address)}
- - Read email replies from maildir in seperate user
+fix new -> cur