Discussions of development and use of the Sup email client
 help / color / mirror / Atom feed
From: Iain Parris <ipv2.lst@parris.org>
To: supmua <supmua@googlegroups.com>
Subject: Re: [sup] SpamAssassin (Spam/Ham) support for Sup
Date: Fri, 10 Jul 2020 21:26:12 +0100	[thread overview]
Message-ID: <1594412084-sup-1850@ceres> (raw)
In-Reply-To: <ae938a95-fe8e-4dfb-a2e6-1ca302fe63d1o@googlegroups.com>

Hi Robert,

Excerpts from Robert Winkler's message of 2020-07-09 15:20:12 -0700:
> 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). 

OK, sounds good.

> 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?

If we're acting on an entire thread, then we can't use pipe_to_process
directly. That would only work for an individual message.

However, I had a look, and I think I've found a better way to do this.

Assuming your source is also another Maildir, then we can find the full
path for the original message file. Then we can do a direct file copy of
this file into your SpamAssassin Spam Maildir.

Here's a demonstration of the concept:


=== ~/.sup/hooks/keybindings.rb ===

modes["inbox-mode"].keymap.add :label_spamassassin_spam, "Label as SpamAssassin Spam", 's'


=== ~/.sup/hooks/startup.rb ===

class Redwood::InboxMode
  def label_spamassassin_spam
    thread = cursor_thread or return
    spamassassin_maildir_path = "/home/youruser/Maildir/SpamAssassin/Spam/cur/"
    message_file = File.join(
      thread.latest_message.source.file_path,
      thread.latest_message.source_info
    )
    toggle_spam
    raise "Label 'spam' not set" unless thread.latest_message.labels.include? :spam
    FileUtils.cp(message_file, spamassassin_maildir_path)
    BufferManager.flash "Copied to SpamAssassin Spam file: #{File.basename message_file}"
  end
end


Kind regards,
Iain


  reply	other threads:[~2020-07-10 20:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 18:36 Robert Winkler
2020-07-06 23:27 ` [sup] " Iain Parris
2020-07-08 17:06   ` Robert Winkler
2020-07-08 18:53     ` Iain Parris
2020-07-09 22:20       ` Robert Winkler
2020-07-10 20:26         ` Iain Parris [this message]
2020-07-10 20:29           ` Iain Parris
2020-07-10 21:58             ` Robert Winkler
2020-07-11 13:48               ` Iain Parris
2020-07-24 10:38               ` Robert Winkler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1594412084-sup-1850@ceres \
    --to=ipv2.lst@parris.org \
    --cc=supmua@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox