Remove delays with 0
This commit is contained in:
parent
e071340930
commit
a93d6b56ba
@ -4,6 +4,7 @@ periodic_hook_frequency = 60
|
||||
edit_headers_blacklist = Content-Type, MIME-Version
|
||||
attachment_prefix = /data/temporary
|
||||
prefer_plaintext = True
|
||||
thread_authors_replace_me = False
|
||||
|
||||
editor_cmd = st -e vis
|
||||
|
||||
@ -93,6 +94,7 @@ theme = "mutt"
|
||||
7 = call hooks.delay(ui,7)
|
||||
8 = call hooks.delay(ui,8)
|
||||
9 = call hooks.delay(ui,9)
|
||||
0 = call hooks.delay(ui,0)
|
||||
i = call hooks.spam(ui)
|
||||
|
||||
[[thread]]
|
||||
@ -110,6 +112,7 @@ theme = "mutt"
|
||||
7 = call hooks.delay(ui,7)
|
||||
8 = call hooks.delay(ui,8)
|
||||
9 = call hooks.delay(ui,9)
|
||||
0 = call hooks.delay(ui,0)
|
||||
i = call hooks.spam(ui)
|
||||
|
||||
[tags]
|
||||
|
@ -1,17 +1,34 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
async def delay(ui, days):
|
||||
from datetime import date, timedelta
|
||||
datestr = str(date.today() + timedelta(days=days))
|
||||
await ui.apply_commandline(f'toggletags inbox,delay,delay/{datestr}')
|
||||
|
||||
async def spam(ui):
|
||||
from alot.buffers import EnvelopeBuffer
|
||||
from alot.db.envelope import Envelope
|
||||
from alot.settings.const import settings
|
||||
|
||||
async def delay(ui, days):
|
||||
datetag = 'delay/' + str(date.today() + timedelta(days=days))
|
||||
|
||||
if ui.current_buffer.modename == 'search':
|
||||
messages = ui.current_buffer.get_selected_thread().get_messages().keys()
|
||||
elif ui.current_buffer.modename == 'thread':
|
||||
messages = [ ui.current_buffer.get_selected_message() ]
|
||||
|
||||
if days != 0:
|
||||
for message in messages:
|
||||
if 'inbox' in message.get_tags():
|
||||
message.add_tags(['delay', datetag])
|
||||
await ui.apply_commandline('untag inbox,unread')
|
||||
else:
|
||||
for message in messages:
|
||||
if 'delay' in message.get_tags():
|
||||
message.remove_tags([t for t in message.get_tags() if t.startswith('delay')])
|
||||
message.add_tags(['inbox'])
|
||||
await ui.apply_commandline('untag delay,delay/*')
|
||||
|
||||
async def spam(ui):
|
||||
message = ui.current_buffer.get_selected_message()
|
||||
message.add_tags(['spam'])
|
||||
message.remove_tags(['unread'])
|
||||
message.remove_tags(['unread', 'inbox'])
|
||||
if 'ugent' in message.get_tags():
|
||||
envelope = Envelope(
|
||||
headers=dict(
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'alot==0.9','console_scripts','alot'
|
||||
__requires__ = 'alot==0.9'
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'alot==0.9.1','console_scripts','alot'
|
||||
__requires__ = 'alot==0.9.1'
|
||||
import re
|
||||
import sys
|
||||
from pkg_resources import load_entry_point
|
||||
@ -8,5 +8,5 @@ from pkg_resources import load_entry_point
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(
|
||||
load_entry_point('alot==0.9', 'console_scripts', 'alot')()
|
||||
load_entry_point('alot==0.9.1', 'console_scripts', 'alot')()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user