Unnamed repository; edit this file 'description' to name the repository.
Author: brian (git@myr.sh)
Date: Sun Mar 24 17:17:40 2024 -0300
Added initial client
diff --git a/dovel-ssh b/dovel-ssh
new file mode 100755
index 0000000..0afe3d7
--- /dev/null
+++ b/dovel-ssh
@@ -0,0 +1,61 @@
+#!/usr/bin/sh
+
+. "${XDG_CONFIG_HOME:-$HOME/.config}/dovel/ssh.conf"
+
+lastseen="${lastseen:-0}"
+
+dirs="$(ssh "$SERVER" "ls -1t $MAILROOT/")"
+for dir in $dirs
+do
+ dec="$(printf "$dir" | base64 -d)"
+ printf "%d %s\n" "$((++i))" "$dec"
+done
+
+printf "Type dir number: "
+read -r num
+i=0
+for dir in $dirs
+do
+ [ $((++i)) = $num ] && break
+done
+echo "selected $dir"
+
+threads="$(ssh "$SERVER" "ls -1t $MAILROOT/$dir/")"
+i=0
+for thread in $threads
+do
+ dec="$(printf "$thread" | base64 -d)"
+ printf "%d %s\n" "$((++i))" "$dec"
+done
+
+printf "Select thread: "
+read -r num
+i=0
+for thread in $threads
+do
+ [ $((++i)) = $num ] && break
+done
+
+emails="$(ssh "$SERVER" "ls -1tr $MAILROOT/$dir/$thread/")"
+for email in $emails
+do
+ printf -- "------------------------------------------------------------\n"
+ ssh "$SERVER" "cat $MAILROOT/$dir/$thread/$email" | while read -r k v
+ do
+ case "$k" in
+ "From:") from="$v" ;;
+ "Date:") date="$v" ;;
+ "Content-Type:") ctype="$v" ;;
+ "Content-Transfer-Encoding:") tenc="$v" ;;
+ "")
+ printf "From: %s\nSent: %s\n\n" "$from" "$date"
+
+ [ ${ctype##text/plain*} ] && break
+ case "$tenc" in
+ "base64") base64 -d ;;
+ *) cat ;;
+ esac
+ esac
+ done
+done
+