Using Pipe to Program Filter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Pipe to Program Filter

Gnome Evolution - General mailing list
Hello everyone,

I have come with yet more question on filters :-)

I am doing some experiments with the "Pipe to Program" filters, and I have to say, there is not much documentation on the internet besides this wiki page, and states the following:
Sends the message to an application of your choice. No return value is 
expected. This feature can be used to create automatic Web postings from
 email messages or to perform additional message post processing not 
supported by Evolution.

So what I undertand from this is that the program will be called like.

echo "mail-contents" | /path/to/my/bash/script.sh

And I am trying to figure out what its actually piped though the script, so I wrote a script to actually try and find it out:

#!/usr/bin/env bash

while IFS= read -r line; do
  printf '%s\n' "$line" | tee -a /tmp/email.out
done

echo $var | tee -a /tmp/email-test.out

/usr/bin/env > /tmp/env.out

And the scipt reads multiline when invoked like so:
# echo "lol" | evolution-pipe-check.sh
lol
and also appears on the files.

But on evolution the files gets created with an empty line, why I have no idea.
Here is the description of the filter:
Pipe To Program test (enabled, for any account)
   If all the following conditions are met
      Sender contains [hidden email]
   Then
      Pipe to Program /home/masterkorp/bin/evolution-pipe-check.sh

Also the filter is called on the filter logs:
Reported 1 recent messages in [hidden email] : INBOX'
2020-07-24 16:49:18 - Applied filter "Pipe To Program test" to message from [hidden email] - "Testing Scripting"
   Header 'From' value ' [hidden email]' does match [hidden email]'
   Finished test of message uid:44388 subject:'Testing Scripting' from [hidden email] : INBOX' as MATCHED
   Filter 'Pipe To Program test' matched

Action: Piping message to /bin/sh

Can anyone please give me any insights on this ?

_______________________________________________
evolution-list mailing list
[hidden email]
To change your list options or unsubscribe, visit ...
https://mail.gnome.org/mailman/listinfo/evolution-list
Reply | Threaded
Open this post in threaded view
|

Re: Using Pipe to Program Filter

Gnome Evolution - General mailing list
On Fri, 2020-07-24 at 17:53 +0100, Alfredo Palhares via evolution-list
wrote:
> Can anyone please give me any insights on this ?

        Hi,
the related code is here:
https://gitlab.gnome.org/GNOME/evolution-data-server/-/blob/master/src/camel/camel-filter-driver.c#L1069
and I do not see any problem with it, after a brief look. If I read the
documentation for g_spawn_async_with_pipes() properly, then the message
is written to stdin of the script and it's read back from the script's
stdout.
        Bye,
        Milan

_______________________________________________
evolution-list mailing list
[hidden email]
To change your list options or unsubscribe, visit ...
https://mail.gnome.org/mailman/listinfo/evolution-list