Re: Fwd: New Version Notification for draft-bosch-sieve-duplicate-01.txt

Stephan Bosch <[email protected]>
Newsgroups gmane.ietf.mta-filters
Message-ID <[email protected]>
Hi Alexey,

On 3/10/2013 3:01 PM, Alexey Melnikov wrote:
> On 9 Mar 2013, at 11:08, Stephan Bosch <[email protected]> wrote:
>
>> I made a new version of the "duplicate" draft. It should address the comments by Ned and Alexey.
>> Any thoughts about this?
> This looks much better, thank you.
>
> One new issue is that I don't understand how :value works. Maybe it is a Sunday morning effect. Maybe you can show an example or two?

To detect duplicates, some more or less unique identifying string value 
must be extracted from the message and compared between deliveries. For 
most cases, the contents of the Message-ID header is the best choice; 
that is what it is meant for. However, to accommodate more complex uses, 
the duplicate test has the flexibility to choose a different string 
value for comparison. Using the :value argument, the string value can be 
set manually to an arbitrary string. Typically, one would compose this 
string using variable substitutions. One can for example compose it from 
parts of a header, the envelope, multiple headers, parts of the message 
body or even the current date; whatever is appropriate for the application.

There is one example of the use of :value in the draft (the second one). 
I should perhaps make the subject header structure a bit more complex to 
justify its use in this example (because :header would work here as well).

Another example would be the following scenario. A mail user receives 
XMPP notifications about new mail through Sieve. Sometimes a single 
contact sends many messages in a short period of time and the user wants 
to prevent being notified of all of those messages. He wants to be 
notified about messages from each person at most once per 30 minutes. He 
writes the following script:

require ["variables", "envelope","enotify", "duplicate"];

if envelope :matches "from" "*" { set "sender" "${1}"; }
if header :matches "subject" "*" { set "subject" "${1}"; }

if not duplicate :seconds 1800 :value "${sender}") {
     notify :message "[SIEVE] ${from}: ${subject}" 
"xmpp:[email protected]";
}

So this example uses the message envelope sender rather than the 
Message-ID header as an identifier for duplicate checking.

This example can be extended to allow multiple messages from the same 
sender in close succession as long as the discussed topic is different. 
This could be done as follows:

require ["variables", "envelope","enotify", "duplicate"];

if envelope :matches "from" "*" { set "sender" "${1}"; }
if header :matches "subject" "*" { set "subject" "${1}"; }

if string :comparator "i;ascii-casemap" :matches "${subject}" "Re:*" {
     set "topic" "${1}";
} else {
     set "topic" "${subject}";
}

if not duplicate :seconds 1800 :value "${sender} ${topic}") {
     notify :message "[SIEVE] ${from}: ${topic}" "xmpp:[email protected]";
}

Regards,

Stephan.





_______________________________________________
sieve mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/sieve
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.