# Preview functions # Preview email # If a thread identifier is given, then the last message in the thread is # shown. If the HTML flag is set, then the HTML message is parsed using pandoc. # This functions reverts to the HTML method if no HTML flag is set yet no # text/plain part is found. # # @argument $1: "id" or "thread" # @argument $2: message id or thread id # @argument #3: if set, then the HTML messages will be taken preview_message() { [ "$1" = "id" ] && messageid="$2" || messageid="$(nm_last_message_in_thread "$2")" echo "preview_message: messageid=$messageid" >> /tmp/foo parts="$(nm_message_parts "$messageid")" echo "preview_message: parts=$parts" >> /tmp/foo html="${3:-}" echo "preview_message: html=$html" >> /tmp/foo nr="$(nm_message_part_nr "$messageid" "$html")" echo "preview_message: nr=$nr" >> /tmp/foo [ ! "$nr" ] && [ ! "$html" ] && html="html" && nr="$(nm_message_part_nr "$messageid" "html")" echo "preview_message: nr=$nr" >> /tmp/foo [ "$html" ] && parser="$PANDOC" || parser="cat" nm_message_header "$messageid" | $CATEMAIL [ "$nr" ] && (nm_message_get_part "$messageid" "$nr" | $parser | $CATMD) }