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

-- 
You received this message because you are subscribed to the Google Groups "The 
Sup email client" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/supmua/1594076857-sup-7295%40ceres.

Reply via email to