hook to move a mail back to the inbox
This commit is contained in:
19
astroid/hooks/move2inbox
Executable file
19
astroid/hooks/move2inbox
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Moves a file to the INBOX directory
|
||||||
|
#
|
||||||
|
# $1 = message id
|
||||||
|
|
||||||
|
MAIL_ROOT=`notmuch config get database.path`
|
||||||
|
DIR_INBOX="INBOX"
|
||||||
|
LOG="/home/$USER/.config/astroid/hooks/hook.log"
|
||||||
|
|
||||||
|
ID=$1
|
||||||
|
FILE=$(notmuch search --exclude=false --output=files id:"${ID}") # get actual file path of MID
|
||||||
|
|
||||||
|
if ! $(echo ${FILE} | grep -q "${MAIL_ROOT}/${DIR_INBOX}/"); then # if mail is not in INBOX already
|
||||||
|
mv "${FILE}" "${MAIL_ROOT}/${DIR_INBOX}/cur/"
|
||||||
|
echo "[move2inbox] [SUCCESS] moved ${FILE} to ${MAIL_ROOT}/${DIR_INBOX}/cur/" >> $LOG
|
||||||
|
else
|
||||||
|
echo "[move2inbox] [ERROR] already in \"${DIR_INBOX}\" directory: ${FILE}" >> $LOG
|
||||||
|
fi
|
||||||
@@ -41,3 +41,4 @@ thread_view.toggle_unread=u # Toggle the unread tag on the message, default: N
|
|||||||
# HOOKS
|
# HOOKS
|
||||||
thread_view.run(hooks::unspam %2 %1)=M-s
|
thread_view.run(hooks::unspam %2 %1)=M-s
|
||||||
thread_view.run(hooks::delmail %2 %1)=M-d
|
thread_view.run(hooks::delmail %2 %1)=M-d
|
||||||
|
thread_view.run(hooks::move2inbox %2 %1)=M-i
|
||||||
|
|||||||
Reference in New Issue
Block a user