* [PR PATCH] Ignore fake message IDs set by Protonmail
@ 2023-07-31 18:17 intr-cx
2024-10-30 11:51 ` [PR PATCH] [Updated] " intr-cx
2025-03-31 23:06 ` intr-cx
0 siblings, 2 replies; 3+ messages in thread
From: intr-cx @ 2023-07-31 18:17 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 765 bytes --]
There is a new pull request by intr-cx against master on the mblaze repository
https://github.com/intr-cx/mblaze master
https://github.com/leahneukirchen/mblaze/pull/246
Ignore fake message IDs set by Protonmail
Proton-bridge injects fake message IDs suffixed by `protonmail.internalid` into References headers. This causes mthread to mess up and introduce a bunch of noise from supposedly missing emails.
I know this isn't the cleanest solution and it is a bit of a niche problem, but I dug around a bit and [mu](https://github.com/djcb/mu/blob/5409c2cd8760fa9909feffd51159fecaee8fb04e/lib/message/mu-mime-object.cc#L432) for example works around it in a similar fashion.
A patch file from https://github.com/leahneukirchen/mblaze/pull/246.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-246.patch --]
[-- Type: text/x-diff, Size: 1702 bytes --]
From b48458da700a172d105f043e6f552566691d20e1 Mon Sep 17 00:00:00 2001
From: intr <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 10:42:44 +0200
Subject: [PATCH 1/2] ignore fake Protonmail message ids
---
mthread.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mthread.c b/mthread.c
index d200879..42f044f 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,6 +159,12 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
+ //protonmail.internalid
+ if (mid && strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
me = midcont(mid);
if (me == c)
From 659ca8bf9fc84b21e5734be3e9e514a9f57faf5f Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:31:36 +0200
Subject: [PATCH 2/2] fixup
---
mthread.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mthread.c b/mthread.c
index 42f044f..16affac 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,17 +159,18 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
- //protonmail.internalid
- if (mid && strlen(mid) >= 22) {
- const char *pi = "@protonmail.internalid";
- if (strcmp(mid + strlen(mid) - 22, pi))
- continue;
- }
me = midcont(mid);
if (me == c)
continue;
+ // ugly, skip fake Protonmail mids
+ if (strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
+
if (parent && !me->parent &&
!reachable(me, parent) && !reachable(parent, me)) {
me->parent = parent;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PR PATCH] [Updated] Ignore fake message IDs set by Protonmail
2023-07-31 18:17 [PR PATCH] Ignore fake message IDs set by Protonmail intr-cx
@ 2024-10-30 11:51 ` intr-cx
2025-03-31 23:06 ` intr-cx
1 sibling, 0 replies; 3+ messages in thread
From: intr-cx @ 2024-10-30 11:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
There is an updated pull request by intr-cx against master on the mblaze repository
https://github.com/intr-cx/mblaze master
https://github.com/leahneukirchen/mblaze/pull/246
Ignore fake message IDs set by Protonmail
Proton-bridge injects fake message IDs suffixed by `protonmail.internalid` into References headers. This causes mthread to mess up and introduce a bunch of noise from supposedly missing emails.
I know this isn't the cleanest solution and it is a bit of a niche problem, but I dug around a bit and [mu](https://github.com/djcb/mu/blob/5409c2cd8760fa9909feffd51159fecaee8fb04e/lib/message/mu-mime-object.cc#L432) for example works around it in a similar fashion.
A patch file from https://github.com/leahneukirchen/mblaze/pull/246.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-246.patch --]
[-- Type: text/x-diff, Size: 4746 bytes --]
From b48458da700a172d105f043e6f552566691d20e1 Mon Sep 17 00:00:00 2001
From: intr <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 10:42:44 +0200
Subject: [PATCH 1/5] ignore fake Protonmail message ids
---
mthread.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mthread.c b/mthread.c
index d2008790..42f044f4 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,6 +159,12 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
+ //protonmail.internalid
+ if (mid && strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
me = midcont(mid);
if (me == c)
From 659ca8bf9fc84b21e5734be3e9e514a9f57faf5f Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:31:36 +0200
Subject: [PATCH 2/5] fixup
---
mthread.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mthread.c b/mthread.c
index 42f044f4..16affac1 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,17 +159,18 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
- //protonmail.internalid
- if (mid && strlen(mid) >= 22) {
- const char *pi = "@protonmail.internalid";
- if (strcmp(mid + strlen(mid) - 22, pi))
- continue;
- }
me = midcont(mid);
if (me == c)
continue;
+ // ugly, skip fake Protonmail mids
+ if (strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
+
if (parent && !me->parent &&
!reachable(me, parent) && !reachable(parent, me)) {
me->parent = parent;
From 2cbed193bf9db9c814f95553990256ee6b8ce61c Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Thu, 9 Nov 2023 16:22:12 +0100
Subject: [PATCH 3/5] add url viewer
---
mless | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mless b/mless
index ddead987..cd307676 100755
--- a/mless
+++ b/mless
@@ -89,7 +89,8 @@ while :; do
LESSOPEN="|$0 --filter %s" \
less -Ps"mless %f?m (message %i of %m).." -R \
"+:e $(mscan -n .)$nl" //scan $(mscan -n :)
- case "$?" in
+ _c="$?"
+ case "$_c" in
0|1) exit $?;;
36) # $ goto end
mseq -C '$' 2>/dev/null
@@ -105,6 +106,10 @@ while :; do
mseq -f : | mseq -S
mseq -C +
;;
+ 117) # u extract URLs
+ _url="$(mshow -N -h ''| extract_url -l -c "$XDG_CONFIG_HOME"/urlview/config 2>&- | fzf)"
+ [ "$_url" != "" ] && handle-url "$_url"
+ ;;
82) # R toggle raw mode
MLESS_RAW=$((1-$MLESS_RAW))
;;
From 6ad2128ca5bdaa10b25962cfd9647cc6babd76e2 Mon Sep 17 00:00:00 2001
From: Silvan Jegen <s.jegen@gmail.com>
Date: Sat, 18 May 2024 11:30:24 +0200
Subject: [PATCH 4/5] Fix calloc argument order
These were found through gcc warnings.
---
mflag.c | 2 +-
msort.c | 2 +-
mthread.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mflag.c b/mflag.c
index ddf633cd..9ee87471 100644
--- a/mflag.c
+++ b/mflag.c
@@ -145,7 +145,7 @@ main(int argc, char *argv[])
return 0;
}
- args = calloc(sizeof (char *), argsalloc);
+ args = calloc(argsalloc, sizeof (char *));
if (!args)
exit(-1);
diff --git a/msort.c b/msort.c
index 5d2d88d4..02d1e42c 100644
--- a/msort.c
+++ b/msort.c
@@ -319,7 +319,7 @@ main(int argc, char *argv[])
xpledge("stdio rpath", "");
- mails = calloc(sizeof (struct mail), mailalloc);
+ mails = calloc(mailalloc, sizeof (struct mail));
if (!mails)
exit(-1);
diff --git a/mthread.c b/mthread.c
index 16affac1..b0a741a1 100644
--- a/mthread.c
+++ b/mthread.c
@@ -372,7 +372,7 @@ sort_tree(struct container *c, int depth)
if (i == 1) // no sort needed
return;
- struct container **a = calloc(sizeof (struct container *), i);
+ struct container **a = calloc(i, sizeof (struct container *));
if (!a)
return;
From bda938824d2a001e34ac0c2c1f8169833284d4e0 Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 30 Oct 2024 12:50:06 +0100
Subject: [PATCH 5/5] Redo logic & add protonmail.conversationid
---
mthread.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mthread.c b/mthread.c
index b0a741a1..5ee9245d 100644
--- a/mthread.c
+++ b/mthread.c
@@ -165,9 +165,11 @@ thread(char *file)
continue;
// ugly, skip fake Protonmail mids
- if (strlen(mid) >= 22) {
+ char *at = strchr(mid, '@');
+ if (at != NULL) {
const char *pi = "@protonmail.internalid";
- if (strcmp(mid + strlen(mid) - 22, pi))
+ const char *pc = "@protonmail.conversationid";
+ if (strcmp(at, pi) == 0 || strcmp(at, pc) == 0)
continue;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PR PATCH] [Updated] Ignore fake message IDs set by Protonmail
2023-07-31 18:17 [PR PATCH] Ignore fake message IDs set by Protonmail intr-cx
2024-10-30 11:51 ` [PR PATCH] [Updated] " intr-cx
@ 2025-03-31 23:06 ` intr-cx
1 sibling, 0 replies; 3+ messages in thread
From: intr-cx @ 2025-03-31 23:06 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
There is an updated pull request by intr-cx against master on the mblaze repository
https://github.com/intr-cx/mblaze master
https://github.com/leahneukirchen/mblaze/pull/246
Ignore fake message IDs set by Protonmail
Proton-bridge injects fake message IDs suffixed by `protonmail.internalid` into References headers. This causes mthread to mess up and introduce a bunch of noise from supposedly missing emails.
I know this isn't the cleanest solution and it is a bit of a niche problem, but I dug around a bit and [mu](https://github.com/djcb/mu/blob/5409c2cd8760fa9909feffd51159fecaee8fb04e/lib/message/mu-mime-object.cc#L432) for example works around it in a similar fashion.
A patch file from https://github.com/leahneukirchen/mblaze/pull/246.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-246.patch --]
[-- Type: text/x-diff, Size: 18146 bytes --]
From b48458da700a172d105f043e6f552566691d20e1 Mon Sep 17 00:00:00 2001
From: intr <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 10:42:44 +0200
Subject: [PATCH 01/10] ignore fake Protonmail message ids
---
mthread.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/mthread.c b/mthread.c
index d2008790..42f044f4 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,6 +159,12 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
+ //protonmail.internalid
+ if (mid && strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
me = midcont(mid);
if (me == c)
From 659ca8bf9fc84b21e5734be3e9e514a9f57faf5f Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Mon, 31 Jul 2023 18:31:36 +0200
Subject: [PATCH 02/10] fixup
---
mthread.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mthread.c b/mthread.c
index 42f044f4..16affac1 100644
--- a/mthread.c
+++ b/mthread.c
@@ -159,17 +159,18 @@ thread(char *file)
mid = strndup(m+1, v-m-1);
// XXX free?
- //protonmail.internalid
- if (mid && strlen(mid) >= 22) {
- const char *pi = "@protonmail.internalid";
- if (strcmp(mid + strlen(mid) - 22, pi))
- continue;
- }
me = midcont(mid);
if (me == c)
continue;
+ // ugly, skip fake Protonmail mids
+ if (strlen(mid) >= 22) {
+ const char *pi = "@protonmail.internalid";
+ if (strcmp(mid + strlen(mid) - 22, pi))
+ continue;
+ }
+
if (parent && !me->parent &&
!reachable(me, parent) && !reachable(parent, me)) {
me->parent = parent;
From 2cbed193bf9db9c814f95553990256ee6b8ce61c Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Thu, 9 Nov 2023 16:22:12 +0100
Subject: [PATCH 03/10] add url viewer
---
mless | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mless b/mless
index ddead987..cd307676 100755
--- a/mless
+++ b/mless
@@ -89,7 +89,8 @@ while :; do
LESSOPEN="|$0 --filter %s" \
less -Ps"mless %f?m (message %i of %m).." -R \
"+:e $(mscan -n .)$nl" //scan $(mscan -n :)
- case "$?" in
+ _c="$?"
+ case "$_c" in
0|1) exit $?;;
36) # $ goto end
mseq -C '$' 2>/dev/null
@@ -105,6 +106,10 @@ while :; do
mseq -f : | mseq -S
mseq -C +
;;
+ 117) # u extract URLs
+ _url="$(mshow -N -h ''| extract_url -l -c "$XDG_CONFIG_HOME"/urlview/config 2>&- | fzf)"
+ [ "$_url" != "" ] && handle-url "$_url"
+ ;;
82) # R toggle raw mode
MLESS_RAW=$((1-$MLESS_RAW))
;;
From 6ad2128ca5bdaa10b25962cfd9647cc6babd76e2 Mon Sep 17 00:00:00 2001
From: Silvan Jegen <s.jegen@gmail.com>
Date: Sat, 18 May 2024 11:30:24 +0200
Subject: [PATCH 04/10] Fix calloc argument order
These were found through gcc warnings.
---
mflag.c | 2 +-
msort.c | 2 +-
mthread.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mflag.c b/mflag.c
index ddf633cd..9ee87471 100644
--- a/mflag.c
+++ b/mflag.c
@@ -145,7 +145,7 @@ main(int argc, char *argv[])
return 0;
}
- args = calloc(sizeof (char *), argsalloc);
+ args = calloc(argsalloc, sizeof (char *));
if (!args)
exit(-1);
diff --git a/msort.c b/msort.c
index 5d2d88d4..02d1e42c 100644
--- a/msort.c
+++ b/msort.c
@@ -319,7 +319,7 @@ main(int argc, char *argv[])
xpledge("stdio rpath", "");
- mails = calloc(sizeof (struct mail), mailalloc);
+ mails = calloc(mailalloc, sizeof (struct mail));
if (!mails)
exit(-1);
diff --git a/mthread.c b/mthread.c
index 16affac1..b0a741a1 100644
--- a/mthread.c
+++ b/mthread.c
@@ -372,7 +372,7 @@ sort_tree(struct container *c, int depth)
if (i == 1) // no sort needed
return;
- struct container **a = calloc(sizeof (struct container *), i);
+ struct container **a = calloc(i, sizeof (struct container *));
if (!a)
return;
From bda938824d2a001e34ac0c2c1f8169833284d4e0 Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 30 Oct 2024 12:50:06 +0100
Subject: [PATCH 05/10] Redo logic & add protonmail.conversationid
---
mthread.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mthread.c b/mthread.c
index b0a741a1..5ee9245d 100644
--- a/mthread.c
+++ b/mthread.c
@@ -165,9 +165,11 @@ thread(char *file)
continue;
// ugly, skip fake Protonmail mids
- if (strlen(mid) >= 22) {
+ char *at = strchr(mid, '@');
+ if (at != NULL) {
const char *pi = "@protonmail.internalid";
- if (strcmp(mid + strlen(mid) - 22, pi))
+ const char *pc = "@protonmail.conversationid";
+ if (strcmp(at, pi) == 0 || strcmp(at, pc) == 0)
continue;
}
From 6c7adbcd1c21b66bae96c2d78cdc05390bc3f75f Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:49:32 +0100
Subject: [PATCH 06/10] Patch mcom to support profile setup
---
mcom | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/mcom b/mcom
index 420ba155..226fe632 100755
--- a/mcom
+++ b/mcom
@@ -16,9 +16,15 @@ notmine() {
}
replyfrom() {
- addrs="$(maddr -a -h reply-from: "$MBLAZE/profile")"
- [ -z "$addrs" ] && addrs="$(maddr -a -h alternate-mailboxes: "$MBLAZE/profile")"
- grep -F -e "$addrs"
+ read -r addr
+ for f in "$MBLAZE"/*.profile; do
+ addrs="$(maddr -a -h reply-from: "$f")"
+ [ -z "$addrs" ] && addrs="$(maddr -a -h alternate-mailboxes: "$f")"
+ if echo "$addr" | grep -F -e "$addrs"; then
+ mprofile "$(basename "$f" .profile)" 1>&2
+ break
+ fi
+ done
}
ouniq() {
@@ -40,7 +46,7 @@ stampdate() {
{
printf 'Date: '
mdate
- cat "$1"
+ cat "$1"
} >"$tmp" &&
mv "$tmp" "$1"
fi
@@ -100,6 +106,7 @@ do_mime() {
MBLAZE=${MBLAZE:-$HOME/.mblaze}
+addr=$(maddr -a -h delivered-to:to:cc:bcc: "$MBLAZE/profile" | replyfrom | head -n1)
sendmail=$(mhdr -h sendmail "$MBLAZE/profile")
sendmail_args=$(mhdr -h sendmail-args "$MBLAZE/profile")
sendmail="${sendmail:-sendmail} ${sendmail_args:--t}"
@@ -145,7 +152,14 @@ case "$0" in
hdr=${1#-}
shift;;
[!-]*)
- hdrs="$hdrs$NL$(printf '%s: %s\n' "${hdr}" "$1")"
+ __addr="$1"
+ if [ ! "" = "$__addr" ]; then
+ __addr="$(notmuch-addrlookup "$__addr")"
+ fi
+ if [ "" = "$__addr" ]; then
+ __addr="$1"
+ fi
+ hdrs="$hdrs$NL$(printf '%s: %s\n' "${hdr}" "$__addr")"
shift;;
*)
printf 'mcom: invalid argument %s\n' "$1" 1>&2
@@ -376,6 +390,7 @@ fi
if [ "$ng" ]; then
printf 'Newsgroups: %s\n' "$ng"
else
+ maddr -a -h delivered-to:to:cc:bcc: "$1" | replyfrom >/dev/null
to=$(mhdr -d -h reply-to "$1")
[ -z "$to" ] && to=$(mhdr -d -A -h from "$1")
printf 'To: %s\n' "$to"
@@ -457,7 +472,7 @@ while :; do
esac
if [ -e "$draftmime" ]; then
- if [ "$draft" -ot "$draftmime" ] || [ "$automime" = 1 ]; then
+ if [ -n "$(find "$draftmime" -newer "$draft")" ] || [ "$automime" = 1 ]; then
stampdate "$draftmime"
if $sendmail <"$draftmime"; then
if [ "$senthook" ]; then
@@ -522,8 +537,12 @@ while :; do
c=
;;
e|edit)
+ if printf '%s' "$VISUAL:$EDITOR" | grep -q '\(vi\|vim\|nvim\|gvim\|nvi\)'; then
+ VISUAL="${VISUAL:+$VISUAL -c ft=mail}"
+ EDITOR="${EDITOR:+$EDITOR -c ft=mail}"
+ fi
c=
- if ! ${VISUAL:-${EDITOR:-vi}} "$draft"; then
+ if ! ${VISUAL:-${EDITOR:-nvim -c ft=mail}} "$draft"; then
c=d
else
if checksensible "$draft"; then
From 67609c9310f77db0060faecfeae93b31c742d865 Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:52:46 +0100
Subject: [PATCH 07/10] Patch mless for added functionality mlesskey file
included; move to $MBlAZE dir
---
mless | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
mlesskey | 29 +++++++++++++++++++++++++
2 files changed, 89 insertions(+), 5 deletions(-)
create mode 100644 mlesskey
diff --git a/mless b/mless
index cd307676..8992de51 100755
--- a/mless
+++ b/mless
@@ -98,23 +98,78 @@ while :; do
78) # N go to next unseen message
nu=$(magrep -v -m1 :S .:) && mseq -C "$nu"
;;
+ 118) # v rdrview?
+ mshow -F -O . "$(mshow -t | awk '/text\/html/{print substr($1,1,length($1)-1)}')" | \
+ rdrview -H | tidy | webdump -r8 -w"$_PREFWIDTH" | less
+ ;;
+ 119) # w open as pdf
+ mshow -t | sed -n '1d;s/^ \([[:digit:]]\+\).*$/mshow -O \1/p' | sh | \
+ tidy | hpdf 2>/dev/null
+ ;;
+ 68) # D delete
+ mscan . | cat
+ {
+ rm -i "$(mseq .)" && mseq -C .- && mseq -f | mseq -S
+ }
+ ;;
+ 82) # R
+ mrep
+ ;;
107) # k next thread
mseq -C "$(mseq .+1: | sed -n '/^[^ <]/{p;q;}')"
;;
- 100) # d mark read
+ 70) # F mark flaged
+ if printf '%s' "$(mseq)" | grep -q ',\w*F\w*$'; then
+ mflag -f .
+ else
+ mflag -F .
+ fi
+ mseq -f | mseq -S
+ ;;
+ 114) # r mark read
mflag -S .
mseq -f : | mseq -S
mseq -C +
;;
- 117) # u extract URLs
+ 111) # o view attachment
+ names="$(mshow -t . | sed '/name=/!d')"
+ if [ ! "$names" = "" ]; then
+ printf %s "$names" | dmenu | sed 's/^\s\+\([[:digit:]]\+\):\s\([a-z\/]\+\).\+name="\(.\+\)"/mshow -O . \1 > \/tmp\/"\3" \&\& xdg-open \/tmp\/"\3"/' | sh >/dev/null 2>&1 &
+ else
+ notify-send "mless" "No attachments" &
+ fi
+ ;;
+ 115) # s save attachment
+ names="$(mshow -t . | sed '/name=/!d')"
+ if [ ! "$names" = "" ]; then
+ _dir="$(find Documents Downloads Pictures Sync -maxdepth 2 -type d -printf "%d %p\n"|sort -n | cut -d' ' -f2 | dmenu)"
+ if [ ! "$_dir" = "" ]; then
+ printf %s "$names" | dmenu | sed 's/^\s\+\([[:digit:]]\+\):\s\([a-z\/]\+\).\+name="\(.\+\)"/mshow -O . \1 > \$HOME\/'"$_dir"'\/"\3"/' | sh >/dev/null 2>&1 && notify-send "mless" "Saved to $_dir" &
+ fi
+ else
+ notify-send "mless" "No attachments to save" &
+ fi
+ ;;
+ 38) # & extract URLs
+ _url="$(munsub)"
+ if [ "$_url" != "" ]; then
+ handle-url "$_url"
+ else
+ clear
+ printf '%s' "No unsubscribe URLs found"
+ # wait for char press
+ o=$(stty -g); stty raw -echo ; head -c 1 ; stty "$o"
+ fi
+ ;;
+ 98) # b extract URLs
_url="$(mshow -N -h ''| extract_url -l -c "$XDG_CONFIG_HOME"/urlview/config 2>&- | fzf)"
[ "$_url" != "" ] && handle-url "$_url"
;;
- 82) # R toggle raw mode
- MLESS_RAW=$((1-$MLESS_RAW))
+ 84) # T toggle raw mode
+ MLESS_RAW=$((1-MLESS_RAW))
;;
72) # H toggle HTML mode
- MLESS_HTML=$((1-$MLESS_HTML))
+ MLESS_HTML=$((1-MLESS_HTML))
;;
94) # ^ goto parent
mseq -C '.^' 2>/dev/null
diff --git a/mlesskey b/mlesskey
new file mode 100644
index 00000000..22f0fbfb
--- /dev/null
+++ b/mlesskey
@@ -0,0 +1,29 @@
+# mless(1) keybindings
+# When using less <590:
+# compile with lesskey -o .mless mlesskey and install as ~/.mless
+# When using less >=590: copy this file to ~/.mlesskey
+Q quit \1
+:q quit \1
+K prev-file
+J next-file
+{ noaction E1\n
+0 noaction E1\n
+} quit $
+$ quit $
+S noaction E//scan\n
+` noaction E\#\n
+w quit w
+D quit D
+H quit H
+N quit N
+F quit F
+T quit T
+b quit b
+& quit &
+T quit k
+r quit r
+R quit R
+v quit v
+o quit o
+s quit s
+\^ quit \^
From 3764c99d8fdb9a0680fb836ae2649c6b2c0cfb77 Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:55:58 +0100
Subject: [PATCH 08/10] Patch mmailto to include st (and mprofile)
---
contrib/mmailto | 4 ++++
contrib/mprofile | 12 ++++++++++++
2 files changed, 16 insertions(+)
create mode 100755 contrib/mprofile
diff --git a/contrib/mmailto b/contrib/mmailto
index 7feabb40..29dc9fdb 100755
--- a/contrib/mmailto
+++ b/contrib/mmailto
@@ -7,6 +7,8 @@ tryterm() {
fi
}
+tryterm st
+tryterm st-256color
tryterm x-terminal-emulator
tryterm urxvt
tryterm xterm
@@ -16,6 +18,8 @@ if [ -z "$TERMINAL" ]; then
exit 1
fi
+mprofile
+
IFS='
'
diff --git a/contrib/mprofile b/contrib/mprofile
new file mode 100755
index 00000000..45ed9b65
--- /dev/null
+++ b/contrib/mprofile
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+test -z "$1" && {
+ for f in "$MBLAZE"/*.profile; do
+ basename "$f" .profile
+ done | dmenu | xe mprofile && exit
+}
+
+ln -sf "$MBLAZE/$1".profile "$MBLAZE"/profile
+ln -sf "$MAILDIR/$1"/.signature "$XDG_CONFIG_HOME"/mblaze/signature
+printf 'profile = '\''%s'\''\n' "$1"
+
From 1a50a7428e653541346c619a9960aea41d0038c2 Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:57:24 +0100
Subject: [PATCH 09/10] Include mblows and msucks (wrapped in TLS)
---
contrib/mblows | 65 ++++++++++++++++++++
contrib/msucks | 161 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 226 insertions(+)
create mode 100755 contrib/mblows
create mode 100755 contrib/msucks
diff --git a/contrib/mblows b/contrib/mblows
new file mode 100755
index 00000000..acae68af
--- /dev/null
+++ b/contrib/mblows
@@ -0,0 +1,65 @@
+#!/usr/bin/ruby
+# mblow - post an article via NNTP
+
+require 'socket'
+require 'optparse'
+
+params = ARGV.getopts("s:u:p:")
+
+port = 563
+if params["s"] =~ /(.*):(.*)/
+ params["s"] = $1
+ port = Integer($2)
+end
+
+user = params["u"] || nil
+pass = params["p"] || nil
+SERVER = params["s"] || ENV["NNTPSERVER"] || "news"
+
+nntp = TCPSocket.new SERVER, port
+
+
+ssl = OpenSSL::SSL::SSLContext.new
+sslc = OpenSSL::SSL::SSLSocket.new(nntp, ssl)
+
+sslc.connect
+
+print sslc.state
+
+msg = sslc.gets
+abort msg unless msg =~ /^200 /
+
+if user != nil
+ printf "%s %s", user, pass
+ sslc.write("AUTHINFO USER #{user}\r\n")
+ msg = sslc.gets
+ if msg =~ /^381 / and pass != nil
+ sslc.write("AUTHINFO PASS #{pass}\r\n")
+ else
+ abort msg
+ end
+ msg = sslc.gets
+ if msg !~ /^281 /
+ abort msg
+ end
+end
+
+sslc.write "POST\r\n"
+msg = sslc.gets
+
+abort msg unless msg =~ /^340 /
+
+while line = gets
+ line.chomp!
+ line.sub!(/\A\./, '..')
+ sslc.write(line + "\r\n")
+end
+
+sslc.write(".\r\n")
+msg = sslc.gets
+
+sslc.puts "NOOP"
+puts sslc.gets
+
+abort msg unless msg =~ /^240 /
+puts msg
diff --git a/contrib/msucks b/contrib/msucks
new file mode 100755
index 00000000..dc44e8a9
--- /dev/null
+++ b/contrib/msucks
@@ -0,0 +1,161 @@
+#!/usr/bin/ruby
+# msuck - suck NNTP groups into Maildirs
+#
+# msuck [-s NNTPSERVER[:PORT]] [-d BASEDIR] [-l LIMIT] GROUPS... to fetch GROUPS
+# msuck [-s NNTPSERVER[:PORT]] -L to list all groups
+
+require 'socket'
+require 'fileutils'
+require 'openssl'
+require 'optparse'
+
+$delivery = 0
+HOST = Socket.gethostname
+def genname(id)
+ $delivery += 1
+ t = Time.now
+ "%d.M%06dP%05dQ%d.%s,N=%d" % [t.tv_sec, t.tv_usec, $$, $delivery, HOST, id]
+end
+
+params = ARGV.getopts("u:p:d:fl:s:L")
+dir = params["d"] || '.'
+user = params["u"] || nil
+pass = params["p"] || nil
+LIMIT = if params["l"]
+ Integer(params["l"])
+ else
+ 1001
+ end
+
+port = 563
+if params["s"] =~ /(.*):(.*)/
+ params["s"] = $1
+ port = Integer($2)
+end
+
+SERVER = params["s"] || ENV["NNTPSERVER"] || "news"
+
+nntp = TCPSocket.new SERVER, port
+
+ssl = OpenSSL::SSL::SSLContext.new
+sslc = OpenSSL::SSL::SSLSocket.new(nntp, ssl)
+
+sslc.connect
+
+msg = sslc.gets
+abort msg unless msg =~ /^20[01] /
+
+if user != nil
+ sslc.write("AUTHINFO USER #{user}\r\n")
+ msg = sslc.gets
+ if msg =~ /^381 / and pass != nil
+ sslc.write("AUTHINFO PASS #{pass}\r\n")
+ else
+ abort msg
+ end
+ msg = sslc.gets
+ if msg !~ /^281 /
+ abort msg
+ end
+end
+if params["L"] # list all groups
+ sslc.write("LIST NEWSGROUPS\r\n")
+ msg = sslc.gets
+ if msg !~ /^215 /
+ abort msg
+ end
+
+ loop {
+ msg = sslc.gets
+ break if msg == ".\r\n"
+ puts msg
+ }
+
+ exit
+end
+
+STDOUT.sync = true
+
+ARGV.each { |group|
+
+ sslc.write("GROUP #{group}\r\n")
+
+ msg = sslc.gets
+ unless msg =~ /^211 /
+ STDERR.puts msg
+ $exit = 69
+ next
+ end
+
+ _, number, low, high, _ = msg.split(" ", 5)
+
+ number = number.to_i
+ low = low.to_i
+ high = high.to_i
+
+ low = high - LIMIT + 1 if number > LIMIT - 1
+ low = 1 if low <= 0
+
+ FileUtils.mkdir_p(File.join(dir, group, "cur"))
+ FileUtils.mkdir_p(File.join(dir, group, "new"))
+ FileUtils.mkdir_p(File.join(dir, group, "tmp"))
+
+ have = Dir.entries(File.join(dir, group, "cur")).
+ map { |f| $1.to_i if f =~ /N=(\d+)/ }.compact
+
+ ourhigh = have.max
+ if ourhigh && low < ourhigh && !params["f"]
+ low = ourhigh + 1
+ end
+
+ next if low > high
+
+ printf "%s %d-%d ", group, low, high
+
+ sslc.write("STAT #{low}\r\n")
+ msg = sslc.gets
+ _, num, mid, _ = msg.split(" ", 4)
+
+ loop {
+ unless have.include? num.to_i
+ sslc.write("ARTICLE\r\n")
+ msg = sslc.gets
+
+ if msg =~ /^220 /
+ _, num, mid, _ = msg.split(" ", 4)
+
+ text = ["X-Msuck: nntp://#{SERVER}/#{group}/#{num}\n"]
+ loop {
+ msg = sslc.gets
+ break if msg == ".\r\n"
+ msg.sub!(/\A\./, "")
+ msg.sub!(/\r\n\z/, "\n")
+ text << msg
+ }
+ text = text.join
+
+ name = genname(num)
+
+ File.write(File.join(dir, group, "tmp", name), text)
+ File.rename(File.join(dir, group, "tmp", name),
+ File.join(dir, group, "cur", name + ":2,"))
+ print "."
+ else
+ STDERR.puts msg
+ end
+ else
+ print "="
+ end
+
+ sslc.write("NEXT\r\n")
+ msg = sslc.gets
+ if msg !~ /^223 /
+ break
+ end
+ _, num, mid, _ = msg.split(" ", 4)
+ }
+
+ puts
+}
+
+exit $exit || 0
From f6cd7df5958a83c536cac18a6944ef60b2a4f5ea Mon Sep 17 00:00:00 2001
From: interloper <15019654+intr-cx@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:58:22 +0100
Subject: [PATCH 10/10] Add munsub (returns list-unsubscribe link)
---
contrib/munsub | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100755 contrib/munsub
diff --git a/contrib/munsub b/contrib/munsub
new file mode 100755
index 00000000..df92425f
--- /dev/null
+++ b/contrib/munsub
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ "$1" = "-m" ]; then
+ p=mailto
+ shift
+else
+ p=http
+fi
+
+mhdr -hlist-unsubscribe | grep -o "\(${p}[^>]*\)"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-31 23:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-31 18:17 [PR PATCH] Ignore fake message IDs set by Protonmail intr-cx
2024-10-30 11:51 ` [PR PATCH] [Updated] " intr-cx
2025-03-31 23:06 ` intr-cx
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).