Skip to Content.
Sympa Menu

en - Re: [sympa-users] scenario development

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Thomas Berry <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-users] scenario development
  • Date: Tue, 22 Sep 2009 16:48:00 -0700

I'm making some progress.  When sending a small email with a couple of lines in the body, the custom_condition scenario is now being used.  But, when I send a larger message with a small image file and HTML formatting, it doesn't look as if the scenario definition is being used.

here's what the current send.url_review scenario looks like:

CustomCondition::urlreview([listname],[sender],[msg_body]) smtp,smime,md5 -> reject(tt2='url_rejected')
true()         smtp,smime,md5 -> editorkey


And here's a sample of the CustomCondition::urlreview package that I've written (etc/custom_conditions/url_review.pm):


package CustomCondition::urlreview;

use strict;
...
sub verify
{
   my @args = @_;

   do_log('info', 'vars %s', "@args");
...
}
...
1;

Of course, this is just a small piece of the total code, but it should be enough to illustrate enough of the script that works with some messages, but not others.

When the simple message is received by Sympa, the logs (messages) shows data passed from the send.url_review scenario to the CustomCondition::urlreview::verify method.  But, when a more complex message is sent to the list, it appears to be bypassing the send.url_review scenario--I don't see any log entry from the verify method of the custom_condition.

Another method I've been using to test the script is from the command line:

/usr/local/jpl/msg/list/bin/perl -e 'require qw(/usr/local/jpl/msg/list/sympa/etc/custom_conditions/urlreview.pm); my $results = CustomCondition::urlreview::verify("testlist", "thomas.m.berry\@jpl.nasa.gov", "Hello World"); print ($results, "\n");'

Which returns a 0 (no invalid URLs found).

Then, adding a URL after "Hello World", I issue the following command:
/usr/local/jpl/msg/list/bin/perl -e 'require qw(/usr/local/jpl/msg/list/sympa/etc/custom_conditions/urlreview.pm); my $results = CustomCondition::urlreview::verify("testlist", "thomas.m.berry\@jpl.nasa.gov", "Hello World http://google.com"); print ($results, "\n");'

Which returns a 1 (invalid URL found).

So that seems to work for either condition.

I cannot figure out why a larger email message bypasses the urlreview filter.  Instead, the message is put right into the moderate queue.




On Sep 18, 2009, at 12:54 PM, Thomas Berry wrote:

I've determined that I can do what I want by passing msg_body as the var of the CustomCondition package.

Now, what I want to do is, set the message as moderated if the message content is valid.  Otherwise, I want to reject the message using a custom tt2 (reject_invalid_url) document.

I created send.url_review and applied it to the list configuration, but it is not working.  The messages are posting to the list even though they should be rejected (the test message contains invalid URLs).  Messages that are not rejected should be moderated.

send.url_review contents:
title.gettext Moderated with URL Review

is_editor([listname],[sender])            smtp,smime,md5 -> do_it
is_editor([listname],[header->X-sender])  smtp,smime,md5 -> do_it
CustomCondition::url_review([msg_body])   smtp,smime,md5 -> editorkey
true()                                    smtp,smime,md5 -> reject(tt2='reject_invalid_url')


On Sep 18, 2009, at 11:01 AM, Thomas Berry wrote:

Sympa 5.3 (mostly patched to 5.4).

I want to implement a scenario that uses a CustomCondition to analyze
the contents of the submitted message.  Is it possible to pass the
filename of the queued message to the CustomCondition package so that
the it can read the file's raw contents?

Thomas Berry
NASA Jet Propulsion Laboratory







Archive powered by MHonArc 2.6.19+.

Top of Page