From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6846438166349479936 Date: Thu, 9 Jul 2020 15:20:12 -0700 (PDT) From: Robert Winkler To: The Sup email client Message-Id: In-Reply-To: <1594233819-sup-5407@ceres> References: <7c75d917-b99e-4e95-af72-d308acfcb7ado@googlegroups.com> <1594076857-sup-7295@ceres> <5048bacc-c026-45c3-b145-52226916491co@googlegroups.com> <1594233819-sup-5407@ceres> Subject: Re: [sup] SpamAssassin (Spam/Ham) support for Sup MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_6_321624637.1594333212648" X-Google-Token: EJywnvgFy2FCmgqsdgY0 X-Google-IP: 177.248.130.232 ------=_Part_6_321624637.1594333212648 Content-Type: multipart/alternative; boundary="----=_Part_7_1198859319.1594333212649" ------=_Part_7_1198859319.1594333212649 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Iain, Yes, this is a good option. I modified my workflow a bit (Spam/Ham are not watched by Sup anymore. The mails should be copied to the Spam/Ham IMAP server for learning and are automatically deleted after 5 days). Moving the mail from the | pipe in the thread view with cat > ~/Maildir/SpamAssassin/Spam/cur/$(cat /proc/sys/kernel/random/uuid) works; The mail is synced to the IMAP server with OfflineIMAP. However, how can I pass the mail below the cursor directly to a pipe command? The following code causes an error: class Redwood::InboxMode def label_spamassassin_spam t = cursor_thread or return t.apply_label :spam t.remove_label :inbox multi_toggle_new [t] hide_thread t pipe_to_process('cat > ~/Maildir/SpamAssassin/Spam/cur/$(cat /proc/sys/kernel/random/uuid)') regen_text Index.save_thread t flush_index end end --- LocalJumpError from thread: main no block given (yield) /usr/local/sup/lib/sup/mode.rb:125:in `block in pipe_to_process' /usr/lib/ruby/2.5.0/open3.rb:205:in `popen_run' /usr/lib/ruby/2.5.0/open3.rb:95:in `popen3' /usr/local/sup/lib/sup/mode.rb:107:in `pipe_to_process' /home/rob/.sup/hooks/startup.rb:8:in `label_spamassassin_spam' /usr/local/sup/lib/sup/mode.rb:59:in `handle_input' /usr/local/sup/lib/sup/buffer.rb:222:in `handle_input' /usr/local/sup/bin/sup:257:in `' /usr/local/sup/bin/sup:76:in `
' Best regards, Robert On Wednesday, 8 July 2020 13:53:23 UTC-5, Iain Parris wrote: > > Hi Robert, > > Excerpts from Robert Winkler's message of 2020-07-08 10:06:55 -0700: > > Thanks, Good hint, Iain! > > Thank you! > > > I want to move the mails in a second step (yet to be resolved). > > > > Any hints on possible external programs/ scripts for moving mails with a > > particular label to a special /Maildir folder (e.g. > > ~/Maildir/SpamAssassin/Spam)? > > Question: do the mails need to be moved, or can they be copied? > > (Side note: Sup should de-duplicate copies of mails that appear in more > than one source, i.e., should recognise that it is a duplicate of the > same message, and not show it twice. Or for simplicity, don't tell Sup > to index the SpamAssassin Maildirs!) > > If making a copy is sufficient, then you can write the email to a new > file in the appropriate Maildir (since a Maildir is just a collection of > files, with each file being one email). All you need is a random > filename. For example, you could pipe to cat to create with a random > filename (a UUID), using something like: > > cat >~/Maildir/SpamAssassin/Spam/$(cat /proc/sys/kernel/random/uuid) > > Kind regards, > Iain > ------=_Part_7_1198859319.1594333212649 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Iain,

Yes, this is a good option. I = modified my workflow a bit (Spam/Ham are not watched by Sup anymore. The ma= ils should be copied to the Spam/Ham IMAP server for learning and are autom= atically deleted after 5 days).=C2=A0

Moving the m= ail from the | pipe in the thread view with
=C2=A0 cat > ~/Maildir/SpamAssassin/Spam/cur/$(cat /proc/sys/k= ernel/random<= span style=3D"color: #660;" class=3D"styled-by-prettify">/uuid)
works;= The mail is synced to the IMAP server with OfflineIMAP. However, how can I= pass the mail below the cursor directly to a pipe command?

<= /div>
The following code causes an error:

= class Redwood::InboxMode
=C2=A0
def label_spamassassin_spam
=C2=A0 =C2=A0t
=3D cursor_thread <= span style=3D"color: #008;" class=3D"styled-by-prettify">or return
=C2=A0 =C2=A0t
.apply_label :spam
=C2=A0 =C2=A0t
.remove_label :inbox
=C2=A0 =C2=A0multi_toggle_new
[t]
=C2=A0 =C2=A0hide_thread t
=C2=A0 =C2= =A0pipe_to_process
(&= #39;cat > ~/Maildir/SpamAssassin/Spam/cur/$(cat /proc/sys/kernel/random/= uuid)'= )
=C2= =A0 =C2=A0regen_text
=C2=A0 =C2=A0
Index.save_thread t
=C2=A0 =C2=A0flush_index
=C2=A0
<= span style=3D"color: #008;" class=3D"styled-by-prettify">end
end


---= LocalJumpError from thread: main
no block given (yield)
= /usr/local/sup/lib/sup/mode.rb:125:in `block in pipe_to_process'
/usr/lib/ruby/2.5.0/open3.rb:205:in `popen_run
'
/usr= /lib/ruby/2.5.0/open3.rb:95:in `popen3'

/usr/local/sup/lib/sup/mode.= rb:= 107:in `pipe_to_process'
/home/rob/.sup/hooks/star= tup.rb:8:in `
label_spamassassin_spam'
/usr/local/sup/lib/sup/mode.rb:59:in `handle_input= '

<= /span>/usr
/local/sup/lib/sup/buffer.rb:222:in= `handle_i= nput'
/usr/local/sup/bin/sup:257:in `
<module:Redwood>'
/usr/local/sup/bin/sup:76:in `<main>'
=

Best regards,=C2=A0
Robert




On Wedn= esday, 8 July 2020 13:53:23 UTC-5, Iain Parris wrote:
Hi Robert,

Excerpts from Robert Winkler's message of 2020-07-08 10:06:55 -0700= :
> Thanks, Good hint, Iain!

Thank you!

> I want to move the mails in a second step (yet to be resolved).
>=20
> Any hints on possible external programs/ scripts for moving mails = with a=20
> particular label to a special /Maildir folder (e.g.=20
> ~/Maildir/SpamAssassin/Spam)?

Question: do the mails need to be moved, or can they be copied?

(Side note: Sup should de-duplicate copies of mails that appear in more
than one source, i.e., should recognise that it is a duplicate of the
same message, and not show it twice. Or for simplicity, don't tell = Sup
to index the SpamAssassin Maildirs!)

If making a copy is sufficient, then you can write the email to a new
file in the appropriate Maildir (since a Maildir is just a collection o= f
files, with each file being one email). All you need is a random
filename. For example, you could pipe to cat to create with a random
filename (a UUID), using something like:

=C2=A0 =C2=A0 cat >~/Maildir/SpamAssassin/Spam/$(cat /proc/sys/= kernel/random/uuid)

Kind regards,
Iain
------=_Part_7_1198859319.1594333212649-- ------=_Part_6_321624637.1594333212648--