* [PR PATCH] Add Drafts profile key
@ 2023-06-22 17:31 thyssentishman
2023-06-22 17:46 ` leahneukirchen
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-22 17:31 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 457 bytes --]
There is a new pull request by thyssentishman against master on the mblaze repository
https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/241
Add Drafts profile key
Instead of saving drafts messages together with sent messages when the Outbox key is set in profile, allow the user to set a Drafts key to store them separately.
A patch file from https://github.com/leahneukirchen/mblaze/pull/241.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-241.patch --]
[-- Type: text/x-diff, Size: 2872 bytes --]
From 3f15d918fcee49e4de81b182ecee9171d27e8be9 Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 22 Jun 2023 19:26:39 +0200
Subject: [PATCH] Add Drafts profile key
Instead of saving drafts messages together with sent messages when the
Outbox key is set in profile, allow the user to set a Drafts key to
store them separately.
---
man/mblaze-profile.5 | 7 +++++--
mcom | 17 ++++++++++-------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index 65d1b3d..0e7b34a 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -52,8 +52,11 @@ generation in
.It Li Outbox\&:
If set,
.Xr mcom 1
-will create draft messages in this maildir,
-and save messages there after sending.
+will save messages in this maildir after sending.
+.It Li Drafts\&:
+If set,
+.Xr mcom 1
+will create draft messages in this maildir.
.It Li Reply-From\&:
A comma-separated list of display name and mail address pairs, formatted like this:
.Dl Li Primary Name <myname1@domain1>, Name v.2 <myname2@domain2>, \[dq]Name, My Third\[dq] <myname3@domain3>, ...
diff --git a/mcom b/mcom
index 397cb5f..f2fb708 100755
--- a/mcom
+++ b/mcom
@@ -235,8 +235,8 @@ esac
hdrs="$(printf '%s\n' "${hdrs#$NL}" | mhdr -)"
-outbox=$(mhdr -h outbox "$MBLAZE/profile" | sed "s:^~/:$HOME/:")
-if [ -z "$outbox" ]; then
+draftbox=$(mhdr -h drafts "$MBLAZE/profile" | sed "s:^~/:$HOME/:")
+if [ -z "$draftbox" ]; then
if [ -z "$resume" ]; then
i=0
while [ -f "snd.$i" ]; do
@@ -249,13 +249,13 @@ if [ -z "$outbox" ]; then
draftmime="$draft.mime"
else
if [ -z "$resume" ]; then
- draft="$(true | mdeliver -v -c -XD "$outbox")"
+ draft="$(true | mdeliver -v -c -XD "$draftbox")"
if [ -z "$draft" ]; then
- printf '%s\n' "$0: failed to create draft in outbox $outbox." 1>&2
+ printf '%s\n' "$0: failed to create draft in outbox $draftbox." 1>&2
exit 1
fi
elif [ -z "$draft" ]; then
- draft=$(mlist -D "$outbox" | msort -r -M | sed 1q)
+ draft=$(mlist -D "$draftbox" | msort -r -M | sed 1q)
fi
draftmime="$(printf '%s\n' "$draft" | sed 's,\(.*\)/cur/,\1/tmp/mime-,')"
fi
@@ -424,6 +424,7 @@ fi
automime=
c=$defaultc
+outbox=$(mhdr -h outbox "$MBLAZE/profile" | sed "s:^~/:$HOME/:")
while :; do
case "$c" in
s|send)
@@ -446,7 +447,8 @@ while :; do
if $sendmail <"$draftmime"; then
if [ "$outbox" ]; then
mv "$draftmime" "$draft"
- mflag -d -S "$draft"
+ mdeliver -c -XS "$outbox" < "$draft"
+ rm "$draft"
else
rm "$draft" "$draftmime"
fi
@@ -464,7 +466,8 @@ while :; do
stampdate "$draft"
if $sendmail <"$draft"; then
if [ "$outbox" ]; then
- mflag -d -S "$draft"
+ mdeliver -c -XS "$outbox" < "$draft"
+ rm "$draft"
else
rm "$draft"
fi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
@ 2023-06-22 17:46 ` leahneukirchen
2023-06-22 18:55 ` [PR PATCH] [Updated] " thyssentishman
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-06-22 17:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603076102
Comment:
The code should fallback to Outbox if Drafts isn't set.
I'd use mflag + mrefile to mark as sent and move it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PR PATCH] [Updated] Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
2023-06-22 17:46 ` leahneukirchen
@ 2023-06-22 18:55 ` thyssentishman
2023-06-22 19:03 ` thyssentishman
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-22 18:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
There is an updated pull request by thyssentishman against master on the mblaze repository
https://github.com/thyssentishman/mblaze master
https://github.com/leahneukirchen/mblaze/pull/241
Add Drafts profile key
Instead of saving drafts messages together with sent messages when the Outbox key is set in profile, allow the user to set a Drafts key to store them separately.
This commit closes #240
A patch file from https://github.com/leahneukirchen/mblaze/pull/241.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-241.patch --]
[-- Type: text/x-diff, Size: 2696 bytes --]
From 64cfabec997a9cf6374bd8c24bab374be8351be1 Mon Sep 17 00:00:00 2001
From: Johannes Thyssen Tishman <johannes@thyssentishman.com>
Date: Thu, 22 Jun 2023 19:26:39 +0200
Subject: [PATCH] Add Drafts profile key
Allow the user to set a Drafts key in profile to store draft messages
and sent messages separately if Outbox is set.
---
man/mblaze-profile.5 | 7 +++++--
mcom | 14 ++++++++------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/man/mblaze-profile.5 b/man/mblaze-profile.5
index 65d1b3d..fe58309 100644
--- a/man/mblaze-profile.5
+++ b/man/mblaze-profile.5
@@ -52,8 +52,11 @@ generation in
.It Li Outbox\&:
If set,
.Xr mcom 1
-will create draft messages in this maildir,
-and save messages there after sending.
+will save messages in this maildir after sending.
+.It Li Drafts\&:
+If set,
+.Xr mcom 1
+will create draft messages in this maildir (defaults to Outbox).
.It Li Reply-From\&:
A comma-separated list of display name and mail address pairs, formatted like this:
.Dl Li Primary Name <myname1@domain1>, Name v.2 <myname2@domain2>, \[dq]Name, My Third\[dq] <myname3@domain3>, ...
diff --git a/mcom b/mcom
index 397cb5f..2cc4df5 100755
--- a/mcom
+++ b/mcom
@@ -236,7 +236,9 @@ esac
hdrs="$(printf '%s\n' "${hdrs#$NL}" | mhdr -)"
outbox=$(mhdr -h outbox "$MBLAZE/profile" | sed "s:^~/:$HOME/:")
-if [ -z "$outbox" ]; then
+draftbox=$(mhdr -h drafts "$MBLAZE/profile" | sed "s:^~/:$HOME/:")
+draftbox="${draftbox:-$outbox}"
+if [ -z "$draftbox" ]; then
if [ -z "$resume" ]; then
i=0
while [ -f "snd.$i" ]; do
@@ -249,13 +251,13 @@ if [ -z "$outbox" ]; then
draftmime="$draft.mime"
else
if [ -z "$resume" ]; then
- draft="$(true | mdeliver -v -c -XD "$outbox")"
+ draft="$(true | mdeliver -v -c -XD "$draftbox")"
if [ -z "$draft" ]; then
- printf '%s\n' "$0: failed to create draft in outbox $outbox." 1>&2
+ printf '%s\n' "$0: failed to create draft in outbox $draftbox." 1>&2
exit 1
fi
elif [ -z "$draft" ]; then
- draft=$(mlist -D "$outbox" | msort -r -M | sed 1q)
+ draft=$(mlist -D "$draftbox" | msort -r -M | sed 1q)
fi
draftmime="$(printf '%s\n' "$draft" | sed 's,\(.*\)/cur/,\1/tmp/mime-,')"
fi
@@ -446,7 +448,7 @@ while :; do
if $sendmail <"$draftmime"; then
if [ "$outbox" ]; then
mv "$draftmime" "$draft"
- mflag -d -S "$draft"
+ mrefile $(mflag -d -S "$draft") "$outbox"
else
rm "$draft" "$draftmime"
fi
@@ -464,7 +466,7 @@ while :; do
stampdate "$draft"
if $sendmail <"$draft"; then
if [ "$outbox" ]; then
- mflag -d -S "$draft"
+ mrefile $(mflag -d -S "$draft") "$outbox"
else
rm "$draft"
fi
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
2023-06-22 17:46 ` leahneukirchen
2023-06-22 18:55 ` [PR PATCH] [Updated] " thyssentishman
@ 2023-06-22 19:03 ` thyssentishman
2023-06-22 19:37 ` leahneukirchen
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-22 19:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603174885
Comment:
> The code should fallback to Outbox if Drafts isn't set.
Done :)
> I'd use mflag + mrefile to mark as sent and move it.
For some reason neither
```sh
mflag -d -S "$draft" | mrefile - "$outbox"
```
nor
```sh
mrefile -v "$draft" "$outbox" | mflag -d -S -
```
worked for me. Both of these made a copy of the draft file in the destination directory without flags and changed the flag from 'D' to 'S' of the original file.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (2 preceding siblings ...)
2023-06-22 19:03 ` thyssentishman
@ 2023-06-22 19:37 ` leahneukirchen
2023-06-22 19:38 ` leahneukirchen
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-06-22 19:37 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 186 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603212698
Comment:
Oh, you need to do it in two steps, without pipe.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (3 preceding siblings ...)
2023-06-22 19:37 ` leahneukirchen
@ 2023-06-22 19:38 ` leahneukirchen
2023-06-22 20:15 ` [PR PATCH] [Merged]: " leahneukirchen
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-06-22 19:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603212698
Comment:
Oh, you need to do it in two steps, without pipe.
I guess with $() it works too.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PR PATCH] [Merged]: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (4 preceding siblings ...)
2023-06-22 19:38 ` leahneukirchen
@ 2023-06-22 20:15 ` leahneukirchen
2023-06-23 6:56 ` thyssentishman
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: leahneukirchen @ 2023-06-22 20:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
There's a merged pull request on the mblaze repository
Add Drafts profile key
https://github.com/leahneukirchen/mblaze/pull/241
Description:
Allow the user to set a Drafts key in profile to store draft messages and sent messages separately if Outbox is set.
This commit closes #240
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (5 preceding siblings ...)
2023-06-22 20:15 ` [PR PATCH] [Merged]: " leahneukirchen
@ 2023-06-23 6:56 ` thyssentishman
2023-06-23 6:58 ` thyssentishman
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-23 6:56 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603766732
Comment:
Should we perhaps quote the subshell "$()" to deal with maildir paths with spaces?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (6 preceding siblings ...)
2023-06-23 6:56 ` thyssentishman
@ 2023-06-23 6:58 ` thyssentishman
2023-06-23 8:00 ` thyssentishman
2023-06-23 8:00 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-23 6:58 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603766732
Comment:
Should we perhaps quote the subshell "$()" to deal with maildir paths with spaces?
A little late sorry, but just noticed it now.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (7 preceding siblings ...)
2023-06-23 6:58 ` thyssentishman
@ 2023-06-23 8:00 ` thyssentishman
2023-06-23 8:00 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-23 8:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603766732
Comment:
Should we perhaps quote the subshell "$()" to deal with maildir paths with spaces?
A little late sorry, but just noticed it now.
EDIT: just tested it with maildir paths with spaces and it does indeed need the quoting. Sorry. PR Sent.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Add Drafts profile key
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
` (8 preceding siblings ...)
2023-06-23 8:00 ` thyssentishman
@ 2023-06-23 8:00 ` thyssentishman
9 siblings, 0 replies; 11+ messages in thread
From: thyssentishman @ 2023-06-23 8:00 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
New comment by thyssentishman on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/241#issuecomment-1603766732
Comment:
Should we perhaps quote the subshell "$()" to deal with maildir paths with spaces?
A little late sorry, but just noticed it now.
EDIT: just tested it with maildir paths with spaces and it does indeed need the quoting, sorry. PR Sent.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-06-23 8:00 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22 17:31 [PR PATCH] Add Drafts profile key thyssentishman
2023-06-22 17:46 ` leahneukirchen
2023-06-22 18:55 ` [PR PATCH] [Updated] " thyssentishman
2023-06-22 19:03 ` thyssentishman
2023-06-22 19:37 ` leahneukirchen
2023-06-22 19:38 ` leahneukirchen
2023-06-22 20:15 ` [PR PATCH] [Merged]: " leahneukirchen
2023-06-23 6:56 ` thyssentishman
2023-06-23 6:58 ` thyssentishman
2023-06-23 8:00 ` thyssentishman
2023-06-23 8:00 ` thyssentishman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).