From 7f3840ba263818391d2637735844153eab60d070 Mon Sep 17 00:00:00 2001 From: CronyAkatsuki Date: Tue, 24 Oct 2023 18:10:42 +0200 Subject: [PATCH] Add in mblaze function for better mail managment. --- .config/zsh/functions.zsh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.config/zsh/functions.zsh b/.config/zsh/functions.zsh index 7c22299..a36fd50 100755 --- a/.config/zsh/functions.zsh +++ b/.config/zsh/functions.zsh @@ -128,3 +128,30 @@ n () { upfast () { curl -F "file=@$(readlink -f $1)" "https://upfast.cronyakatsuki.xyz/" } + +# mblaze functions + +# Get new mail for current profile +mnew () { + maildir=$(grep "^Maildir:" $HOME/.mblaze/profile | cut -d: -f 2 | sed 's/ //g') + profile=$(basename $maildir) + if [ "$profile" = "local" ]; then + mlist -s "$maildir"| msort -dr | mseq -S + else + mbsync -V $profile + mlist -s "$maildir"/INBOX | msort -dr | mseq -S + fi +} + +# Get full mail for current profile including threads +mall () { + maildir=$(grep "^Maildir:" $HOME/.mblaze/profile | cut -d: -f 2 | sed 's/ //g') + sent=$(grep "^Outbox:" $HOME/.mblaze/profile | cut -d: -f 2 | sed 's/ //g') + profile=$(basename $maildir) + if [ "$profile" = "local" ]; then + mlist "$maildir" | mthread -r -S "$maildir" | mseq -S + else + mbsync -V $profile + mlist "$maildir"/INBOX | mthread -r -S "$sent" | mseq -S + fi +}