-/* $Cambridge: exim/src/src/sieve.c,v 1.24 2007/02/07 14:41:13 ph10 Exp $ */
+/* $Cambridge: exim/src/src/sieve.c,v 1.26 2007/03/21 15:15:12 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
/* Undefine it for UNIX-style \n end-of-line terminators (default). */
#undef RFC_EOL
+/* Define this for development of the Sieve extension "encoded-character". */
+#undef ENCODED_CHARACTER
+
/* Define this for development of the Sieve extension "envelope-auth". */
#undef ENVELOPE_AUTH
int keep;
int require_envelope;
int require_fileinto;
+#ifdef ENCODED_CHARACTER
+ int require_encoded_character;
+#endif
#ifdef ENVELOPE_AUTH
int require_envelope_auth;
#endif
static const struct String str_fileinto={ str_fileinto_c, 8 };
static uschar str_envelope_c[]="envelope";
static const struct String str_envelope={ str_envelope_c, 8 };
+#ifdef ENCODED_CHARACTER
+static uschar str_encoded_character_c[]="encoded-character";
+static const struct String str_encoded_character={ str_encoded_character_c, 17 };
+#endif
#ifdef ENVELOPE_AUTH
static uschar str_envelope_auth_c[]="envelope-auth";
static const struct String str_envelope_auth={ str_envelope_auth_c, 13 };
debug_printf("Notification to `%s'.\n",method.character);
}
#ifndef COMPILE_SYNTAX_CHECKER
- if (exec)
+ if (exec && filter_test == FTEST_NONE)
{
string_item *p;
header_line *h;
if ((pid = child_open_exim2(&fd,envelope_to,envelope_to))>=1)
{
FILE *f;
+ uschar *buffer;
+ int buffer_capacity;
f = fdopen(fd, "wb");
for (h = header_list; h != NULL; h = h->next)
fprintf(f,"From: %s\n",from.length==-1 ? envelope_to : from.character);
for (p=recipient; p; p=p->next) fprintf(f,"To: %s\n",p->text);
if (header.length>0) fprintf(f,"%s",header.character);
- fprintf(f,"Subject: %s\n",message.length==-1 ? CUS "notification" : message.character);
- fprintf(f,"\n");
+ if (message.length==-1)
+ {
+ message.character=US"Notification";
+ message.length=Ustrlen(message.character);
+ }
+ /* Allocation is larger than neccessary, but enough even for split MIME words */
+ buffer_capacity=32+4*message.length;
+ buffer=store_get(buffer_capacity);
+ fprintf(f,"Subject: %s\n\n",parse_quote_2047(message.character, message.length, US"utf-8", buffer, buffer_capacity, TRUE));
if (body.length>0) fprintf(f,"%s\n",body.character);
fflush(f);
(void)fclose(f);
filter->keep=1;
filter->require_envelope=0;
filter->require_fileinto=0;
+#ifdef ENCODED_CHARACTER
+filter->require_encoded_character=0;
+#endif
#ifdef ENVELOPE_AUTH
filter->require_envelope_auth=0;
#endif
{
if (eq_octet(check,&str_envelope,0)) filter->require_envelope=1;
else if (eq_octet(check,&str_fileinto,0)) filter->require_fileinto=1;
+#ifdef ENCODED_CHARACTER
+ else if (eq_octet(check,&str_encoded_character,0)) filter->require_encoded_character=1;
+#endif
#ifdef ENVELOPE_AUTH
else if (eq_octet(check,&str_envelope_auth,0)) filter->require_envelope_auth=1;
#endif