From e7b2188fe8dd715603dbd509fc62de6e872933a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Tue, 4 Jan 2022 18:16:12 +0100 Subject: Tue Jan 4 06:16:12 PM CET 2022 --- .bin/get-mailbox-imap | 34 ++++------- .bin/get-mailbox-local | 11 ++++ .bin/nmutt | 5 +- .config/neomutt/neomuttrc | 38 ++++++------ .config/neomutt/neomuttrc.back | 132 +++++++++++++++++++++++++++++++++++++++++ .config/newsboat/config | 5 -- 6 files changed, 175 insertions(+), 50 deletions(-) create mode 100755 .bin/get-mailbox-local create mode 100755 .config/neomutt/neomuttrc.back diff --git a/.bin/get-mailbox-imap b/.bin/get-mailbox-imap index 713873e..b78752d 100755 --- a/.bin/get-mailbox-imap +++ b/.bin/get-mailbox-imap @@ -5,25 +5,17 @@ import sys def get_boxes(list): - """ - Retrieve and decode all mailboxes. - """ + """ Retrieve and decode all mailboxes. """ return [box.decode('utf-8').rsplit(' ')[-1] for box in list] def flatten_output(list): - """ - Print all boxes with a flattened output, - primarily for neomutt usage. - """ + """ Print all boxes with a flattened output. """ return ''.join([f"+'{box}' " for box in list]) -def sort_boxes(bxs): - """ - Sort boxes list, - according to a predefined order - """ +def sort_mailboxes(mailboxes): + """ Sort boxes list according to a predefined order. """ order = [ "INBOX", @@ -36,20 +28,20 @@ def sort_boxes(bxs): "Archive" ] - bxs_orig = sorted(bxs) + mailboxes = sorted(mailboxes) # sort based on predefined order - bxs = [] + output = [] for exp in order: - matching = [s for s in bxs_orig if exp in s] - bxs.extend(matching) + matching = [s for s in mailboxes if exp in s] + output.extend(matching) # ensure all retrieved boxes are present - for bx in bxs_orig: - if bx not in bxs: - bxs.append(bx) + for box in mailboxes: + if box not in output: + output.append(box) - return bxs + return output def main(): @@ -67,7 +59,7 @@ def main(): mail.login(username, password) # parse folders output - bxs = sort_boxes(get_boxes(mail.list()[1])) + bxs = sort_mailboxes(get_boxes(mail.list()[1])) # oneline pretty-print for neomutt print(flatten_output(bxs), end=' ') diff --git a/.bin/get-mailbox-local b/.bin/get-mailbox-local new file mode 100755 index 0000000..b579016 --- /dev/null +++ b/.bin/get-mailbox-local @@ -0,0 +1,11 @@ +#!/bin/sh + +root_dir=$(readlink -f ${1}) + +mailboxes=$(find "${1}" -name "cur" | + xargs dirname | + sed "s@$root_dir/@+@g" | + grep "${2:-.*}" | + sort) + +echo ${mailboxes} diff --git a/.bin/nmutt b/.bin/nmutt index 2ea8170..f8172b1 100755 --- a/.bin/nmutt +++ b/.bin/nmutt @@ -15,8 +15,5 @@ export MAIL_SERVER=$(get_param "${NMUTT_CONFIGURATION_FILE}" "my_server") export MAIL_USERNAME=$(get_param "${NMUTT_CONFIGURATION_FILE}" "my_user") export MAIL_PASSWORD=$(get-pass "mailbox") -# get-mailbox-imap imap.${MAIL_SERVER} ${MAIL_USERNAME}@${MAIL_SERVER} ${MAIL_PASSWORD} -# offlineimap --dry-run -mbsync -a - +notmuch new exec neomutt ${@} diff --git a/.config/neomutt/neomuttrc b/.config/neomutt/neomuttrc index 1f85eb8..d1a8634 100755 --- a/.config/neomutt/neomuttrc +++ b/.config/neomutt/neomuttrc @@ -1,7 +1,4 @@ - -# rgoncalves.se - -# personal informations +#set folder = "~/.mail" set my_password = "" set my_server = "" set my_user = "" @@ -22,7 +19,21 @@ set smtp_url = "smtps://$my_user@$my_server:$my_password@smtp.$my_server" set ssl_verify_host = yes set ssl_force_tls = yes +# notmuch +#set virtual_spoolfile = yes +#set nm_query_type = threads +#set nm_default_url = "notmuch:///home/qwd/.mail" + # mailboxes +mailboxes `python3 ~/.bin/get-mailbox-imap \ +imap.$MAIL_SERVER \ +$MAIL_USERNAME@$MAIL_SERVER \ +$MAIL_PASSWORD` + +#mailboxes `get-mailbox-local ~/.mail INBOX` +#mailboxes `get-mailbox-local ~/.mail` +#virtual-mailboxes "Threads" "notmuch://?query=tag:f-sent" + set spoolfile = "+INBOX" set mbox = "+INBOX" set postponed = "+Drafts" @@ -31,11 +42,6 @@ set trash = "+Trash" set mail_check_stats = yes set imap_delim_chars = "aa" -mailboxes `python3 ~/.bin/get-mailbox-imap \ -imap.$MAIL_SERVER \ -$MAIL_USERNAME@$MAIL_SERVER \ -$MAIL_PASSWORD` - # dl set mail_check = 90 set sleep_time = 0 @@ -61,13 +67,10 @@ set index_format = "%4C %Z %{$date_format} %-15.15L (%?l?%4l&%4c?) %s" set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" set reply_regex = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" set send_charset = "utf-8:iso-8859-1:us-ascii" - set signature = "~/.signature" set header_cache = "~/.cache/neomutt" set message_cachedir = "$header_cache" - -# auto_view text/html -# alternative_order text/plain text/html +set mail_check_stats # headers ignore * @@ -82,13 +85,14 @@ set strict_threads ="yes" set collapse_unread = no # sidebar +set mbox_type = maildir set sidebar_visible = yes set sidebar_short_path = yes set sidebar_sort_method = "unsorted" set sidebar_delim_chars = "/" set sidebar_format = "%D %?F?[%F]?%* %4N|%4S" set sidebar_folder_indent = yes -set sidebar_indent_string = "> " +set sidebar_indent_string = "> " # keybinds bind editor noop @@ -124,9 +128,3 @@ bind index,pager,browser u half-up # colors color hdrdefault color07 default -#color quoted color08 default - -# notmuch -#set virtual_spoolfile = yes -#set nm_query_type = threads -#virtual-mailboxes "INBOX" "notmuch://?query=tag:inbox" diff --git a/.config/neomutt/neomuttrc.back b/.config/neomutt/neomuttrc.back new file mode 100755 index 0000000..1f85eb8 --- /dev/null +++ b/.config/neomutt/neomuttrc.back @@ -0,0 +1,132 @@ + +# rgoncalves.se + +# personal informations +set my_password = "" +set my_server = "" +set my_user = "" +source "~/.config/neomutt/personal" + +# IMAP +set imap_user = "$my_user@$my_server" +set imap_pass = "$my_password" +set hostname = "imap.$my_server" +set folder = "imaps://imap.$my_server:993" +#set folder = "~/.mail/personal" + +# SMTP +set smtp_pass = "$my_password" +set smtp_url = "smtps://$my_user@$my_server:$my_password@smtp.$my_server" + +# force tls +set ssl_verify_host = yes +set ssl_force_tls = yes + +# mailboxes +set spoolfile = "+INBOX" +set mbox = "+INBOX" +set postponed = "+Drafts" +set record = "+Sent" +set trash = "+Trash" +set mail_check_stats = yes +set imap_delim_chars = "aa" + +mailboxes `python3 ~/.bin/get-mailbox-imap \ +imap.$MAIL_SERVER \ +$MAIL_USERNAME@$MAIL_SERVER \ +$MAIL_PASSWORD` + +# dl +set mail_check = 90 +set sleep_time = 0 +set timeout = 15 +set beep = no +set edit_headers = yes +set fast_reply = yes +set forward_quote = yes +set include = yes +set pipe_decode = yes +set postpone = no +set recall = no +set reflow_space_quotes = yes +set reply_to = yes +set reverse_name = yes +set reverse_name = yes +set sig_dashes = no +set sort_re = yes + +set charset = "utf-8" +set date_format = "%d.%m.%Y-%H:%M" +set index_format = "%4C %Z %{$date_format} %-15.15L (%?l?%4l&%4c?) %s" +set quote_regex = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+" +set reply_regex = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*" +set send_charset = "utf-8:iso-8859-1:us-ascii" + +set signature = "~/.signature" +set header_cache = "~/.cache/neomutt" +set message_cachedir = "$header_cache" + +# auto_view text/html +# alternative_order text/plain text/html + +# headers +ignore * +unignore from date subject to cc +unignore organization organisation x-mailer: x-newsreader: x-mailing-list: +unignore posted-to: list-id: + +# threads +set sort ="threads" +set sort_aux = "reverse-last-date-received" +set strict_threads ="yes" +set collapse_unread = no + +# sidebar +set sidebar_visible = yes +set sidebar_short_path = yes +set sidebar_sort_method = "unsorted" +set sidebar_delim_chars = "/" +set sidebar_format = "%D %?F?[%F]?%* %4N|%4S" +set sidebar_folder_indent = yes +set sidebar_indent_string = "> " + +# keybinds +bind editor noop +bind editor "> " quote-char +bind pager c imap-fetch-mail +bind index G last-entry +bind index \CR imap-fetch-mail +bind index g noop +bind index gg first-entry +bind index - collapse-thread +bind index _ collapse-all +bind pager,attach h exit +bind attach view-mailcap +bind attach l view-mailcap +bind pager j next-line +bind pager k previous-line +bind pager l view-attachments +bind index D delete-message +bind index U undelete-message +bind index h noop +bind index l display-message +bind browser h goto-parent +bind browser l select-entry +bind index \CL limit +bind pager,browser gg top-page +bind pager,browser G bottom-page +bind index,pager R group-reply +bind index,pager K sidebar-prev +bind index,pager J sidebar-next +bind index,pager O sidebar-open +bind index,pager,browser d half-down +bind index,pager,browser u half-up + +# colors +color hdrdefault color07 default +#color quoted color08 default + +# notmuch +#set virtual_spoolfile = yes +#set nm_query_type = threads +#virtual-mailboxes "INBOX" "notmuch://?query=tag:inbox" diff --git a/.config/newsboat/config b/.config/newsboat/config index 0e8c120..4095c45 100755 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -1,8 +1,3 @@ - -# rgoncalves.se ~~ ~/.newsboat/config -# newsboat configuration - - max-items 100 reload-threads 100 auto-reload yes -- cgit v1.2.3