diff options
Diffstat (limited to 'pigeonhole/tests/extensions/enotify/execute')
6 files changed, 99 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex1.sieve b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex1.sieve new file mode 100644 index 0000000..6747d7b --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex1.sieve @@ -0,0 +1,26 @@ +require ["enotify", "fileinto", "variables"]; + +if header :contains "from" "boss@example.org" { + notify :importance "1" + :message "This is probably very important" + "mailto:alm@example.com"; + # Don't send any further notifications + stop; +} + +if header :contains "to" "sievemailinglist@example.org" { + # :matches is used to get the value of the Subject header + if header :matches "Subject" "*" { + set "subject" "${1}"; + } + + # :matches is used to get the value of the From header + if header :matches "From" "*" { + set "from" "${1}"; + } + + notify :importance "3" + :message "[SIEVE] ${from}: ${subject}" + "mailto:alm@example.com"; + fileinto "INBOX.sieve"; +} diff --git a/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex2.sieve b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex2.sieve new file mode 100644 index 0000000..a5c6a26 --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex2.sieve @@ -0,0 +1,22 @@ +require ["enotify", "fileinto", "variables", "envelope"]; + +if header :matches "from" "*@*.example.org" { + # :matches is used to get the MAIL FROM address + if envelope :all :matches "from" "*" { + set "env_from" " [really: ${1}]"; + } + + # :matches is used to get the value of the Subject header + if header :matches "Subject" "*" { + set "subject" "${1}"; + } + + # :matches is used to get the address from the From header + if address :matches :all "from" "*" { + set "from_addr" "${1}"; + } + + notify :message "${from_addr}${env_from}: ${subject}" + "mailto:alm@example.com"; +} + diff --git a/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex3.sieve b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex3.sieve new file mode 100644 index 0000000..a7b4a64 --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex3.sieve @@ -0,0 +1,31 @@ +require ["enotify", "variables"]; + +set "notif_method" + "xmpp:tim@example.com?message;subject=SIEVE;body=You%20got%20mail"; + +if header :contains "subject" "Your dog" { + set "notif_method" "tel:+14085551212"; +} + +if header :contains "to" "sievemailinglist@example.org" { + set "notif_method" ""; +} + +if not string :is "${notif_method}" "" { + notify "${notif_method}"; +} + +if header :contains "from" "boss@example.org" { + # :matches is used to get the value of the Subject header + if header :matches "Subject" "*" { + set "subject" "${1}"; + } + + # don't need high importance notification for + # a 'for your information' + if not header :contains "subject" "FYI:" { + notify :importance "1" :message "BOSS: ${subject}" + "tel:+14085551212"; + } +} + diff --git a/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex5.sieve b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex5.sieve new file mode 100644 index 0000000..c6b7dc6 --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex5.sieve @@ -0,0 +1,11 @@ +require ["enotify"]; + +if notify_method_capability + "xmpp:tim@example.com?message;subject=SIEVE" + "Online" + "yes" { + notify :importance "1" :message "You got mail" + "xmpp:tim@example.com?message;subject=SIEVE"; +} else { + notify :message "You got mail" "tel:+14085551212"; +} diff --git a/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex6.sieve b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex6.sieve new file mode 100644 index 0000000..6a65c64 --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/draft-rfc-ex6.sieve @@ -0,0 +1,5 @@ +require ["enotify", "variables"]; + +set :encodeurl "body_param" "Safe body&evil=evilbody"; + +notify "mailto:tim@example.com?body=${body_param}"; diff --git a/pigeonhole/tests/extensions/enotify/execute/duplicates.sieve b/pigeonhole/tests/extensions/enotify/execute/duplicates.sieve new file mode 100644 index 0000000..17f2388 --- /dev/null +++ b/pigeonhole/tests/extensions/enotify/execute/duplicates.sieve @@ -0,0 +1,4 @@ +require "enotify"; + +notify :message "Incoming stupidity." "mailto:stephan@example.org%2cstephan@friep.example.com%2cidiot@example.org"; +notify :message "There it is." "mailto:tss@example.net%2cstephan@example.org%2cidiot@example.org%2cnico@frop.example.org%2cstephan@friep.example.com"; |