summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip Hazel <ph10@hermes.cam.ac.uk>2006-03-08 11:13:07 +0000
committerPhilip Hazel <ph10@hermes.cam.ac.uk>2006-03-08 11:13:07 +0000
commit462182534289f0484d05688616f39943abd2f9a4 (patch)
tree8a686066b5409a5d86f29a940f9216ae446c8000 /src
parent898d150f9aa9c796bb01117bc438b24ddb2e7435 (diff)
Allow for linefold when generating more than one RFC 2047 encoded-word.
Sieve uses this.
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c4
-rw-r--r--src/src/functions.h4
-rw-r--r--src/src/parse.c9
-rw-r--r--src/src/sieve.c4
4 files changed, 12 insertions, 9 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 5d63cb191..3b5036345 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/expand.c,v 1.56 2006/03/01 11:40:51 ph10 Exp $ */
+/* $Cambridge: exim/src/src/expand.c,v 1.57 2006/03/08 11:13:07 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -4737,7 +4737,7 @@ while (*s != 0)
{
uschar buffer[2048];
uschar *string = parse_quote_2047(sub, Ustrlen(sub), headers_charset,
- buffer, sizeof(buffer));
+ buffer, sizeof(buffer), FALSE);
yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
continue;
}
diff --git a/src/src/functions.h b/src/src/functions.h
index 9b8bfacf2..2728d79f1 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/functions.h,v 1.23 2006/02/28 11:25:40 ph10 Exp $ */
+/* $Cambridge: exim/src/src/functions.h,v 1.24 2006/03/08 11:13:07 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -176,7 +176,7 @@ extern uschar *parse_find_address_end(uschar *, BOOL);
extern uschar *parse_find_at(uschar *);
extern uschar *parse_fix_phrase(uschar *, int, uschar *, int);
extern uschar *parse_message_id(uschar *, uschar **, uschar **);
-extern uschar *parse_quote_2047(uschar *, int, uschar *, uschar *, int);
+extern uschar *parse_quote_2047(uschar *, int, uschar *, uschar *, int, BOOL);
extern BOOL queue_action(uschar *, int, uschar **, int, int);
extern void queue_check_only(void);
diff --git a/src/src/parse.c b/src/src/parse.c
index 182df8026..a0366431e 100644
--- a/src/src/parse.c
+++ b/src/src/parse.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/parse.c,v 1.8 2006/02/28 11:25:40 ph10 Exp $ */
+/* $Cambridge: exim/src/src/parse.c,v 1.9 2006/03/08 11:13:07 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -854,6 +854,8 @@ Arguments:
charset the name of the character set; NULL => iso-8859-1
buffer the buffer to put the answer in
buffer_size the size of the buffer
+ fold if TRUE, a newline is inserted before the separating space when
+ more than one encoded-word is generated
Returns: pointer to the original string, if no quoting needed, or
pointer to buffer containing the quoted string, or
@@ -863,7 +865,7 @@ Returns: pointer to the original string, if no quoting needed, or
uschar *
parse_quote_2047(uschar *string, int len, uschar *charset, uschar *buffer,
- int buffer_size)
+ int buffer_size, BOOL fold)
{
uschar *s = string;
uschar *p, *t;
@@ -890,6 +892,7 @@ for (; len > 0; len--)
{
*t++ = '?';
*t++ = '=';
+ if (fold) *t++ = '\n';
*t++ = ' ';
p = t;
Ustrncpy(p, buffer, hlen);
@@ -989,7 +992,7 @@ for (i = 0, s = phrase; i < len; i++, s++)
if ((*s < 32 && *s != '\t') || *s > 126) break;
if (i < len) return parse_quote_2047(phrase, len, headers_charset, buffer,
- buffer_size);
+ buffer_size, FALSE);
/* No non-printers; use the RFC 822 quoting rules */
diff --git a/src/src/sieve.c b/src/src/sieve.c
index 8b89a0ea9..3b0199d49 100644
--- a/src/src/sieve.c
+++ b/src/src/sieve.c
@@ -1,4 +1,4 @@
-/* $Cambridge: exim/src/src/sieve.c,v 1.18 2006/03/01 10:40:03 ph10 Exp $ */
+/* $Cambridge: exim/src/src/sieve.c,v 1.19 2006/03/08 11:13:07 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
@@ -2854,7 +2854,7 @@ while (*filter->pc)
/* Allocation is larger than neccessary, but enough even for split MIME words */
buffer_capacity=32+4*subject.length;
buffer=store_get(buffer_capacity);
- addr->reply->subject=parse_quote_2047(subject.character, subject.length, US"utf-8", buffer, buffer_capacity);
+ addr->reply->subject=parse_quote_2047(subject.character, subject.length, US"utf-8", buffer, buffer_capacity, TRUE);
addr->reply->oncelog=once;
addr->reply->once_repeat=days*86400;