Discussions of development and use of the Sup email client
 help / color / mirror / Atom feed
From: Iain Parris <ipv2.lst@parris.org>
To: Robert Winkler <robert.winkler.mail@gmail.com>
Cc: The Sup email client <supmua@googlegroups.com>
Subject: Re: [sup] SpamAssassin (Spam/Ham) support for Sup
Date: Tue, 07 Jul 2020 00:27:10 +0100	[thread overview]
Message-ID: <1594076857-sup-7295@ceres> (raw)
In-Reply-To: <7c75d917-b99e-4e95-af72-d308acfcb7ado@googlegroups.com>

Hi Robert,

Excerpts from Robert Winkler's message of 2020-07-06 11:36:45 -0700:
> However: How could I mark mails as Spam/ Ham and move them into a separate 
> IMAP Folder?
> 
> Ideally, I would just tag them with ",s" for Spam and ",h" as Ham, and when 
> synching, the mails are moved (or better copied?) for training.

I understand what you are aiming for. This is an interesting question.
:-)

Sup has hooks, and I believe these could be used to extend Sup with this
functionality. For a full list of hooks, launch sup with "--list-hooks".
(See <https://github.com/sup-heliotrope/sup/wiki/Hooks>.)

Are you looking to operate on threads (groups of messages) or individual
emails? For example, existing hook "mark-as-spam" operates on an entire
thread, not an individual message - which I suspect is probably not what
you're looking for

Instead, to operate on individual messages (which I think is what
SpamAssassin would prefer), I think creating a custom variant inspired
by the existing "pipe_message" method may succeed. This allows you to
pipe an entire email message to any arbitrary *nix command (e.g., could
be used to write the message contents to a new file in either a special
"ham" or "spam" directory, which in turn could be fed into sa-learn).

(For a demonstration of pipe_message, open a message in Sup, then type
"|" and enter, then: "wc -l" and enter. This calls "wc -l" with the
message contents, and returns a line count.)

So I think it would be possible to accomplish what you are looking for
with two hooks:

- "startup" hook: Extend Redwood::ThreadViewMode with new methods, e.g.,
  send_to_sa_ham and send_to_sa_spam. For inspiration, see
  Redwood::ThreadViewMode#pipe_message (in file
  lib/sup/modes/thread_view_mode.rb).

- "keybindings" hook: To bind keys to the new functions.

For inspiration from another user, see:
<https://christop.club/2014/01/19/sup/#hooks> - this shows an example of
extending Sup (Redwood) classes with new methods, and binding keys to
these new methods.

I know this is only a very rough outline of a possible solution - but
does this make sense, and sound like a path you may be interested in?

Kind regards,
Iain


  reply	other threads:[~2020-07-06 23:27 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 ` Iain Parris [this message]
2020-07-08 17:06   ` [sup] " Robert Winkler
2020-07-08 18:53     ` Iain Parris
2020-07-09 22:20       ` Robert Winkler
2020-07-10 20:26         ` Iain Parris
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=1594076857-sup-7295@ceres \
    --to=ipv2.lst@parris.org \
    --cc=robert.winkler.mail@gmail.com \
    --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