[Users] Adding a header to incoming/outgoing mail

Milan Obuch claws-mail-users at dino.sk
Sun Feb 7 08:43:08 UTC 2021


On Sat, 6 Feb 2021 17:52:42 +0100, Ricardo Mones <ricardo at mones.org>
wrote:

> On Tue, Feb 02, 2021 at 12:22:35PM +0100, Milan Obuch wrote:
> > On Tue, 2 Feb 2021 13:34:57 +0300, Ivan Krylov
> > <krylov.r00t at gmail.com> wrote:
> >   
> > > Milan Obuch <claws-mail-users at dino.sk> wrote:  
> [...]
> > > > I sent a mail to mailing list some time ago why I was not able
> > > > to usePython plugin. If others are interested, I can share my
> > > > work.    
> > > 
> > > A Lua plugin sounds very interesting. Can we have a look at it?
> > >   
> > 
> > Yes. Two pre-requisites - you need to be able to build Claws Mail
> > from sources on your platform to use it (basically my plugin is
> > just set of some files in plugin's subdirectory and a patch to
> > configure) and some development skill are necessary as well.
> > 
> > I am using it routinely on my work station (read: every day). There
> > are still unsolved issues, mainly for building (my autotools
> > knowledge is somehow limited).
> > 
> > Otherwise, I'd be happy to work with you or anybody else in order to
> > enable others to use Lua plugin for Claws Mail. I'd like to get
> > feedback and oppinions so we can proceed.  
> 
> So, perhaps I overlooked the URL, but, is it published somewhere?
> 

Not yet, sorry. I am a FreeBSD user, and it was developed as FreeBSD
port. It is not yet generic enough for various systems with different
system directories layout. I am currently verifying it still builds
(there are some unrelated issues when building in clean environment due
some dependency) and works (when rebuilt just plugin on my work
station).

What needs some work is mainly patch to configure.ac in order to enable
Lua plugin build to find necessary bits for Lua build and Makefile.am
in src/plugins/lua directory, where I have some paths hardwired for a
moment. Using tons of debug printf's which needs cleanup is only minor
issue.

That's the reason it is not yet published, but if there is anybody able
to help with these issues I am more than happy to share my work - I
think this is critical for any progress.

For and illustration, one target with hardwired values in Makefile.am:

lua_la_LIBADD = $(cygwin_export_lib) \
	$(GTK_LIBS) \
	-L/usr/local/lib -llua-5.2

I think it should be using something like $(LUA_LIBS) as the last line,
but I have no idea how this could be achieved (I think this should be
somehow detected in configure run, but I did not find the way to do so.
My autotools/configure skills are rather limited).

As a response for OP, I created simple script doing what I believe is
what he requests:

local compose_window = ...
local addressed_to_1 = false
local addressed_to_2 = false
local lh = compose_window.headers
for lk, lv in pairs(lh)
 do
  print(string.format("header: key %s, header %s, text %s",tostring(lk),lv.header,lv.text))
  if (lv.header == 'To:' and lv.text == 'address at to.check')
   then addressed_to_1 = true end
  if (lv.header == 'To:' and lv.text == 'address at to.add')
   then addressed_to_2 = true end
 end
if (addressed_to_1 and not addressed_to_2)
 then compose_window:add_to('address at to.add') end

This is just an illustration how the check could be done, print is for
debug, just to see some values. Also, important thing, this script is
registered in COMPOSE_CHECK_BEFORE_SEND_HOOKLIST. There are other ways
how the same or similar effect could be achieved, naturally.

Regards,
Milan


More information about the Users mailing list