Bug 4573 - Request: plugin to warn if message containing keyword is sent
Summary: Request: plugin to warn if message containing keyword is sent
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail
Classification: Unclassified
Component: Plugins (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: P3 enhancement
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2022-03-07 17:18 UTC by Paul (mmxx)
Modified: 2022-03-08 20:35 UTC (History)
1 user (show)

See Also:


Attachments

Description Paul (mmxx) 2022-03-07 17:18:34 UTC
A plugin (very similar to AttachWarner) would be great that warns if mails containing certain (configurable) keywords are queued for sending.

I am using lots of templates with [TODO] to highlight sections I need to fill in, and I don't want to miss any of them.

AttachWarner can not be (ab)used, because it depends on attachments.
Comment 1 Paul 2022-03-07 17:34:43 UTC
The AttachWarner plugin can be configured to match any keywords. Use that.
Comment 2 Paul (mmxx) 2022-03-07 17:40:02 UTC
But the attach warner depends on attachments - if there are attachments, there will be no warning no matter how many [TODO] there are.
Comment 3 Milan 2022-03-07 19:46:14 UTC
This condition is easy to check by a scripting plugin, maybe Python (in official sources, I am not sure necessary hook is built in there, probably yes), Lua for sure (not in official sources, building from source required for now).
Comment 4 Milan 2022-03-08 09:24:38 UTC
(In reply to Milan from comment #3)
I am just correcting myself - in Python plugin, hook necessary for this task is not used. It could be added, but I prefer my Lua plugin, which handles this already.
Comment 5 Milan 2022-03-08 09:39:58 UTC
(In reply to Paul (mmxx) from comment #2)
Even worse - in default state, there is just one line containing word attach present. If I understand what it should do, then it does not work for me - I forwarded some mail, wrote 'attach' somewhere in the middle (just one word on a line), and sent it. No warning produced.

Note: I did it twice, first one was mail with HTML part, second time I did it after deleting the part. This is still not enough, internal structure got from original mail is interpreted as text of mail being the attachment.

Trying to send *newly created* text only mail produced warning as expected. So it is possible for OP to use AttachWarner for the task intended, however, adding single attachment (if required by template used or as part of task being solved) effectively disables the check for him, so he need to check just visually again.
Comment 6 Ricardo Mones 2022-03-08 18:50:54 UTC
(In reply to Milan from comment #4)
> (In reply to Milan from comment #3)
> I am just correcting myself - in Python plugin, hook necessary for this task
> is not used. It could be added, but I prefer my Lua plugin, which handles
> this already.

Well, despite your preferences, I believe adding the hook to the python plugin is a much better option because:

 a) we already have the source in git (^_^)
 b) allows to implement this RFE too
 c) could make possible to get rid of the AttachWarner plugin itself (less source code to maintain, yay!)

Perhaps c) can also be done with the Lua plugin, don't really know (is it possible to show some GTK window with it?), but without a) is way hackish for the common user, IMO

Said that, removing the code for checking the presence of attachments in AttachWarner code should be somewhat easy, me thinks. s/Attach/Word/;s/attach/word/ on every file could do the rest (almost).
Comment 7 Milan 2022-03-08 19:10:09 UTC
(In reply to Ricardo Mones from comment #6)

OK, our views differ. That's normal. Just some comments:

a) You have already some git diff's for integrating the Lua plugin. Not perfect, but working for those who tried. At least that's feedback I got from them. Requires work to integrate properly and clean up, for sure.
b) could be done this way as is. Checked in past.
c) could be done Lua way as well.

Adding the hook into Python plugin is hackish as well (for common user), but doable if well documented.

Modifying (possibly renaming) AttachWarner is possible way to go as well, I must admit.

Anyway, I am just testing what you proposed and offering my view. Original requestor must decide the route he takes if he wants solve original request, off course.
Comment 8 Paul 2022-03-08 19:57:05 UTC
I added the new keyword_warner plugin to the gtk3 branch of git.
Comment 9 Paul (mmxx) 2022-03-08 20:35:06 UTC
Thanks, much appreciated!

Note You need to log in before you can comment on or make changes to this bug.