diff --git a/config/alot/config b/config/alot/config index 6216606..9acf872 100644 --- a/config/alot/config +++ b/config/alot/config @@ -3,7 +3,7 @@ initial_command = search tag:inbox periodic_hook_frequency = 60 edit_headers_blacklist = Content-Type, MIME-Version attachment_prefix = /data/temporary -prefer_plaintext = False +prefer_plaintext = True editor_cmd = st -e vis @@ -98,8 +98,7 @@ theme = "mutt" [[thread]] a = toggletags inbox ; fold A = toggletags inbox,muted ; fold - n = nextpart - p = prevpart + n = togglemimepart r = reply --all u = pipeto --background selecturl 1 = call hooks.delay(ui,1) diff --git a/config/alot/hooks.py b/config/alot/hooks.py index cc8f71d..72b95a1 100644 --- a/config/alot/hooks.py +++ b/config/alot/hooks.py @@ -12,14 +12,25 @@ async def spam(ui): message = ui.current_buffer.get_selected_message() message.add_tags(['spam']) message.remove_tags(['unread']) - envelope = Envelope( - headers=dict( - From=['Felix Van der Jeugt '], - To=['spam@ugent.be'], - Subject=['spam'], - References=['<' + message.get_message_id() + '>']), - bodytext='spam', - tags=['spam'], - account=settings.account_matching_address('felix.vanderjeugt@ugent.be')) + if 'ugent' in message.get_tags(): + envelope = Envelope( + headers=dict( + From=['Felix Van der Jeugt '], + To=['spam@ugent.be'], + Subject=['spam'], + References=['<' + message.get_message_id() + '>']), + bodytext='spam', + tags=['spam'], + account=settings.account_matching_address('felix.vanderjeugt@ugent.be')) + else: + envelope = Envelope( + headers=dict( + From=['Felix Van der Jeugt '], + To=['spamreport@posteo.de'], + Subject=['spam'], + References=['<' + message.get_message_id() + '>']), + bodytext='', + tags=['spam'], + account=settings.account_matching_address('felix.vanderjeugt@posteo.net')) envelope.attach(message.get_filename()) ui.buffer_open(EnvelopeBuffer(ui, envelope))