From 8c71c10b0a8066cf0dc6bc5e0c5583eaddbb5441 Mon Sep 17 00:00:00 2001
From: pierre <yonkou@tutanota.com>
Date: Tue, 25 May 2021 16:05:16 -0400
Subject: password store with multiple private keys fix

---
 bin/mw | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 54af276..92e539c 100755
--- a/bin/mw
+++ b/bin/mw
@@ -18,8 +18,7 @@ done || { echo "CA Certificate not found. Please install one or link it to /etc/
 
 checkbasics() { command -V gpg >/dev/null 2>&1 && GPG="gpg" || GPG="gpg2"
 	PASSWORD_STORE_DIR="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
-	[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] &&
-	"$GPG" --list-secret-keys "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" >/dev/null 2>&1 || {
+	[ -r "$PASSWORD_STORE_DIR/.gpg-id" ] || {
 	echo "First run \`pass init <yourgpgemail>\` to set up a password archive."
 	echo "(If you don't already have a GPG key pair, first run \`$GPG --full-generate-key\`.)"
        	exit 1 ;} ;}
@@ -204,7 +203,7 @@ askinfo() { \
 }
 
 createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$fulladdr"
-	"$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$fulladdr"
+  "$GPG" -qe $(printf -- " -r %s" $(cat "$PASSWORD_STORE_DIR/.gpg-id")) "$PASSWORD_STORE_DIR/$fulladdr"
 	rm -f "$PASSWORD_STORE_DIR/$fulladdr" ;}
 
 getpass() { while : ; do pass rm -f "$fulladdr" >/dev/null 2>&1
-- 
cgit v1.2.3


From f92000e5ed8d393de8f02093afebdb5ab69a1861 Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Mon, 28 Jun 2021 10:25:41 -0400
Subject: fix #730, sed only nl removal with error sup

---
 bin/mw | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 54af276..d960b7b 100755
--- a/bin/mw
+++ b/bin/mw
@@ -172,10 +172,8 @@ delete() { if [ -z "${fulladdr+x}" ]; then
 	pass rm -f "$fulladdr" >/dev/null 2>&1
 	[ -n "${purge+x}" ] && rm -rf "${maildir:?}/${fulladdr:?}"
 
-	# Get rid of those multiple newlines because I don't know awk well enough to do it by default lol.
 	for file in "$msmtprc" "$mbsyncrc" "$mpoprc"; do
- 		tr '\n' '|' 2>/dev/null  < "$file" | sed "s/||\+/||/g" | tr '|' '\n' >> "$file"bu
-		mv -f "$file"bu "$file"
+		sed -ibu 'N;/^\n$/D;P;D;' "$file" 2>/dev/null; rm -f "$file"bu
 	done
 }
 
-- 
cgit v1.2.3


From 8171e6327c2c1b4088da441ced4186d0934bc888 Mon Sep 17 00:00:00 2001
From: phire <me@phire.cc>
Date: Thu, 8 Jul 2021 01:38:41 +0200
Subject: Set hostname variable

---
 bin/mw | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index d960b7b..0fd01d8 100755
--- a/bin/mw
+++ b/bin/mw
@@ -91,6 +91,7 @@ set folder = \"$folder\"
 set header_cache = $cachedir/$fulladdr/headers
 set message_cachedir = $cachedir/$fulladdr/bodies
 set mbox_type = Maildir
+set hostname = \"$hostname\"
 $extra
 
 bind index,pager gg noop
@@ -193,6 +194,7 @@ askinfo() { \
 		read -r smtp
 	[ "$sport" = 465 ] && tlsline="tls_starttls off"
 	[ -z "$realname" ] && realname="${fulladdr%%@*}"
+	hostname="$(echo "$fulladdr" | cut -d @ -f 2)"
 	login="${login:-$fulladdr}"
 	if [ -n "${password+x}" ]; then
 		createpass
-- 
cgit v1.2.3


From 8e5bb8bd095aaf9cb42997c243c4d4dc47f588a9 Mon Sep 17 00:00:00 2001
From: ananthu <ask1234560@gmail.com>
Date: Sat, 7 Aug 2021 14:14:15 +0530
Subject: bug; argument getting splitted by space

---
 bin/mw | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 0fd01d8..2e38cde 100755
--- a/bin/mw
+++ b/bin/mw
@@ -228,6 +228,7 @@ getboxes() { if [ -n "${force+x}" ] ; then
 	[ "$type" = "pop" ] && mailboxes="INBOX"
 	getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done
 	toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )"
+	IFS=$'\n'
 	for x in $mailboxes; do
 		case "$x" in
 			*[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;;
@@ -239,6 +240,7 @@ getboxes() { if [ -n "${force+x}" ] ; then
 			*[Ii][Nn][Bb][Oo][Xx]) formatShortcut i inbox "$x"; setBox spoolfile "$x" inbox="$x" ;;
 		esac
 	done
+	unset IFS
 }
 
 finalize() { echo "$toappend" >> "$accdir/$idnum-$fulladdr.muttrc"
-- 
cgit v1.2.3


From 8239a7d5ca6807d395f787c8c940a08301eb61d7 Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Mon, 9 Aug 2021 20:52:19 -0400
Subject: remove bashism, fix #752

---
 bin/mw | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 2e38cde..41977b1 100755
--- a/bin/mw
+++ b/bin/mw
@@ -182,7 +182,7 @@ askinfo() { \
 	[ -z "$fulladdr" ] && echo "Give the full email address to add:" &&
 		read -r fulladdr
 	while ! echo "$fulladdr" | grep -qE "^.+@.+\.[A-Za-z]+$"; do
-		echo "\`$fulladdr\` is not a valid email address. Please retype the address:"
+		echo "$fulladdr is not a valid email address. Please retype the address:"
 		read -r fulladdr
 	done
 	getaccounts; echo "$accounts" | grep -q "\s$fulladdr$" 2>/dev/null &&
@@ -228,7 +228,8 @@ getboxes() { if [ -n "${force+x}" ] ; then
 	[ "$type" = "pop" ] && mailboxes="INBOX"
 	getaccounts; for x in $(seq 1 9); do echo "$accounts" | grep -q "^$x:" || { export idnum="$x"; break ;}; done
 	toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/" | paste -sd ' ' - )"
-	IFS=$'\n'
+	IFS='
+'
 	for x in $mailboxes; do
 		case "$x" in
 			*[Ss][Ee][Nn][Tt]*) setBox record "$x"; formatShortcut s sent "$x" ;;
-- 
cgit v1.2.3


From fb68f19846141df5ff5c6b8c4f15f589b0f5000f Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Sat, 14 Aug 2021 18:50:33 -0400
Subject: use soyterms if not slower distro

---
 bin/mw | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 41977b1..87ec79c 100755
--- a/bin/mw
+++ b/bin/mw
@@ -12,7 +12,18 @@ mbsyncrc="${MBSYNCRC:-$HOME/.mbsyncrc}"
 mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config"
 alias mbsync='mbsync -c "$mbsyncrc"'
 
-for x in "/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" "/etc/ssl/cert.pem" "/usr/local/share/ca-certificates/"; do
+# On Ubuntu/Debian, a link is needed since they use an older version.
+if command -V apt-get >/dev/null 2>&1; then
+	ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
+	master="Master"
+	slave="Slave"
+fi
+
+for x in "/etc/ssl/certs/ca-certificates.crt" \
+	"/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/cert.pem" \
+	"/etc/ssl/ca-bundle.pem" "/etc/pki/tls/cacert.pem" \
+	"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" \
+	"/usr/local/share/ca-certificates/"; do
 	[ -f "$x" ] && sslcert="$x" && break
 done || { echo "CA Certificate not found. Please install one or link it to /etc/ssl/certs/ca-certificates.crt" && exit 1 ;}
 
@@ -39,8 +50,6 @@ ${tlsline:-tls on}
 tls_trust_file	$sslcert
 logfile $msmtplog
 " >> "$msmtprc"
-	# On Ubuntu/Debian, a link is needed since they use an older version.
-	command -V apt-get >/dev/null 2>&1 && ln -s "$msmtprc" "$HOME/.msmtprc" 2>/dev/null
 }
 
 prepmbsync() { mkdir -p "${mbsyncrc%/*}"
@@ -61,8 +70,8 @@ Inbox ${XDG_DATA_HOME:-$HOME/.local/share}/mail/$fulladdr/${inbox:-INBOX}
 
 Channel $fulladdr
 Expunge Both
-Master :$fulladdr-remote:
-Slave :$fulladdr-local:
+${master:-Far} :$fulladdr-remote:
+${slave:-Near} :$fulladdr-local:
 Patterns * !\"[Gmail]/All Mail\"
 Create Both
 SyncState *
-- 
cgit v1.2.3


From bd8551163ead2720fd3d3579f64f8816521be11c Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Fri, 27 Aug 2021 19:05:55 -0400
Subject: fix for 465 starttls

---
 bin/mw | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 87ec79c..fbf2884 100755
--- a/bin/mw
+++ b/bin/mw
@@ -46,9 +46,10 @@ from $fulladdr
 user $login
 passwordeval \"pass $fulladdr\"
 auth ${auth:-on}
-${tlsline:-tls on}
+tls on
 tls_trust_file	$sslcert
 logfile $msmtplog
+$tlsline
 " >> "$msmtprc"
 }
 
-- 
cgit v1.2.3


From 2be8ea7871e6d07592d7b4ed85ace213774261f6 Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Sun, 29 Aug 2021 14:36:26 -0400
Subject: not necessary to create cachedir manually

---
 bin/mw | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'bin/mw')

diff --git a/bin/mw b/bin/mw
index 823730e..e63fff2 100755
--- a/bin/mw
+++ b/bin/mw
@@ -121,7 +121,7 @@ $synccmd
 }
 
 getprofiles() { \
-	mkdir -p "${muttrc%/*}" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp"
+	mkdir -p "${muttrc%/*}" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp"
 	unset msmtp_header msmtp_profile mutt_profile mbsync_profile
 	case "$iport" in
 		1143) imapssl=None ;;
-- 
cgit v1.2.3


From e8458ace20a1e553df1c6249b9ef27234dd2aafd Mon Sep 17 00:00:00 2001
From: Luke Smith <luke@lukesmith.xyz>
Date: Thu, 23 Sep 2021 13:06:17 -0400
Subject: fix #691, fix #689, fix #690

---
 Makefile            |  4 ++--
 bin/mw              | 10 +---------
 share/domains.csv   |  2 +-
 share/unbind.muttrc | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 12 deletions(-)
 create mode 100644 share/unbind.muttrc

(limited to 'bin/mw')

diff --git a/Makefile b/Makefile
index 5cd5bf2..64036d0 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ install:
 	chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/bin/openfile
 	mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
 	chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
-	cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
-	chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc
+	cp -f share/mailcap share/domains.csv share/mutt-wizard.muttrc share/unbind.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard
+	chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap $(DESTDIR)$(PREFIX)/share/mutt-wizard/domains.csv $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc $(DESTDIR)$(PREFIX)/share/mutt-wizard/unbind.muttrc
 	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
 	cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
 	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1
diff --git a/bin/mw b/bin/mw
index e63fff2..2b9a41a 100755
--- a/bin/mw
+++ b/bin/mw
@@ -101,16 +101,8 @@ set header_cache = $cachedir/$fulladdr/headers
 set message_cachedir = $cachedir/$fulladdr/bodies
 set mbox_type = Maildir
 set hostname = \"$hostname\"
+source $muttshare/unbind.muttrc
 $extra
-
-bind index,pager gg noop
-bind index,pager g noop
-bind index,pager M noop
-bind index,pager C noop
-bind index gg first-entry
-unmailboxes *
-unalternates *
-unset signature
 $synccmd
 " > "$accdir/$idnum-$fulladdr.muttrc"
 
diff --git a/share/domains.csv b/share/domains.csv
index 672a1c6..e307b22 100644
--- a/share/domains.csv
+++ b/share/domains.csv
@@ -50,7 +50,7 @@ canaglie.net,mail.autistici.org,993,smtp.autistici.org,465
 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465
 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587
 cash4u.com,imap.mail.com,993,smtp.mail.com,587
-cedars.xyz,imap.cedars.xyz,993,smtp.cedars.xyz,465
+cedars.xyz,mail.cedars.xyz,993,mail.cedars.xyz,465
 ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587
 cheerful.com,imap.mail.com,993,smtp.mail.com,587
 chef.net,imap.mail.com,993,smtp.mail.com,587
diff --git a/share/unbind.muttrc b/share/unbind.muttrc
new file mode 100644
index 0000000..330d823
--- /dev/null
+++ b/share/unbind.muttrc
@@ -0,0 +1,37 @@
+# vim: filetype=neomuttrc
+
+# This is an embarrassing and hacky file that unbinds a bunch of binds between
+# switching accounts. It is called each time an account is changed.
+
+bind index,pager gi noop
+bind index,pager gs noop
+bind index,pager gd noop
+bind index,pager ga noop
+bind index,pager gS noop
+bind index,pager gj noop
+bind index,pager gt noop
+bind index,pager Mi noop
+bind index,pager Ms noop
+bind index,pager Md noop
+bind index,pager Ma noop
+bind index,pager MS noop
+bind index,pager Mj noop
+bind index,pager Mt noop
+bind index,pager Ci noop
+bind index,pager Cs noop
+bind index,pager Cd noop
+bind index,pager Ca noop
+bind index,pager CS noop
+bind index,pager Cj noop
+bind index,pager Ct noop
+bind index,pager gg noop
+bind index,pager g noop
+bind index,pager M noop
+bind index,pager C noop
+unset hostname
+unmy_hdr Organization
+unmailboxes *
+unalternates *
+unset signature
+
+bind index gg first-entry
-- 
cgit v1.2.3