From 233394bd9a179623be96ac0ee49f9f018b3e378b Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:58:46 +0900 Subject: modified Makefile, modified bin/mw --- Makefile | 30 +++++++++++++++++++++++++++++- bin/mw | 11 ++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 27620f9..a0c2bf1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man -DEPENDENCIES = neomutt curl isync msmtp pass ca-certificates gettext +DEPENDENCIES = neomutt curl msmtp pass gettext +NON_EXEC_DEPS = isync ca-certificates check-dependencies: @for dep in $(DEPENDENCIES); do \ @@ -11,6 +12,33 @@ check-dependencies: exit 1; \ fi; \ done + @for dep in $(NON_EXEC_DEPS); do \ + if command -v pacman >/dev/null 2>&1; then \ + if ! pacman -Q $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v dpkg >/dev/null 2>&1; then \ + if ! dpkg -s $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v rpm >/dev/null 2>&1; then \ + if ! rpm -q $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + elif command -v zypper >/dev/null 2>&1; then \ + if ! zypper se -i $$dep >/dev/null 2>&1; then \ + echo "Error: $$dep is not installed."; \ + exit 1; \ + fi; \ + else \ + echo "Error: Unsupported package manager. Cannot verify installation of $$dep."; \ + exit 1; \ + fi; \ + done + @echo "All dependencies are installed." install-dependencies: @if command -v apt-get >/dev/null 2>&1; then \ diff --git a/bin/mw b/bin/mw index 6012c21..21b7bfe 100755 --- a/bin/mw +++ b/bin/mw @@ -219,7 +219,16 @@ getboxes() { else info="$(curl --location-trusted -s -m 5 --user "$login:$(pass "$passprefix$fulladdr")" --url "${protocol:-imaps}://$imap:${iport:-993}")" [ -z "$info" ] && errorexit - mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" + unsorted_mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')" + desired_order="Archive INBOX Drafts Sent Junk Trash" + mailboxes="" + for desired in $desired_order; do + if echo "$unsorted_mailboxes" | grep -qx "$desired"; then + mailboxes="${mailboxes}${desired} +" + fi + done + mailboxes="$(printf "%s" "$mailboxes" | sed '/^$/d')" fi [ "$type" = "pop" ] && mailboxes="INBOX" for x in $( -- cgit v1.2.3