[ingo] Filtering on the message contents, not a header
Ben Chavet
ben at horde.org
Tue Jun 13 09:59:16 PDT 2006
Please make a patch against cvs HEAD, and put it in a ticket at
bugs.horde.org so it doesn't get lost. (The patch looks good, btw,
other than being against the wrong version)
--Ben
Quoting JM Coursimault <Horde at coursimault.com>:
>>> ingo/lib/Script/procmail.php is the backend driver file. You should
>>> just have to add INGO_STORAGE_TYPE_BODY to the $_types array, and
>>> implement the test as necessary in the driver.
>
> OK, done. Now it's possible, with the procmail backend, to filter on
> the body as well as on the headers.
>
> I've also cleaned up a bug on the Procmail flags which caused the
> "case sensitive" flag to appear only for the first condition, as well
> as putting it as many times as there were case-sensitive conditions.
> Perhaps it was already corrected in newer versions.
>
> Here is the diff -u against ingo 1.1.1. I guess that it can be applied
> on newer versions as well. I'm not an experienced patcher, so if
> something's wrong, just tell me.
>
> Cheers
> -- JM
>
> --- procmail.php.orig 2006-06-13 16:21:27.000000000 +0200
> +++ procmail.php 2006-06-13 17:11:05.000000000 +0200
> @@ -50,6 +50,7 @@
> */
> var $_types = array(
> INGO_STORAGE_TYPE_HEADER,
> + INGO_STORAGE_TYPE_BODY
> );
>
> /**
> @@ -500,10 +501,6 @@
> function addCondition($condition = array())
> {
> $flag = (!empty($condition['case'])) ? 'D' : '';
> - if (empty($this->_conditions)) {
> - $this->addFlag($flag);
> - }
> -
> $match = (isset($condition['match'])) ? $condition['match'] : null;
>
> switch ($condition['field']) {
> @@ -512,6 +509,12 @@
> $prefix = '';
> break;
>
> + case 'Body':
> + $flag.='B';
> + $string='* ';
> + $prefix='';
> + break;
> +
> default:
> $string = '* ^' . $condition['field'] . ':';
> $prefix = ' ';
> @@ -557,7 +560,7 @@
> if (!$this->_valid) {
> return '';
> }
> -
> + /* Set the global flags for the whole rule, each condition
> will add its own (such as Body or Case Sensitive) */
> $text[] = ':0 ' . $this->_flags;
> foreach ($this->_conditions as $condition) {
> if ($nest > 0) {
> @@ -565,6 +568,7 @@
> $text[] = str_repeat(' ', $nest) . ':0 ' .
> $condition['flags'];
> $text[] = str_repeat(' ', $nest) . $condition['condition'];
> } else {
> + $text[0].= $condition['flags'];
> $text[] = $condition['condition'];
> }
> $nest++;
>
> --
> Ingo mailing list - Join the hunt: http://horde.org/bounties/#ingo
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: ingo-unsubscribe at lists.horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: PGP Digital Signature
Url : http://lists.horde.org/archives/ingo/attachments/20060613/4d908afc/attachment-0001.bin
More information about the ingo
mailing list