From 31b6dcaff97aa44e91a9c9deafae7b64cf682e6d Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 20 Dec 1999 05:06:41 +0000 Subject: [PATCH] * More address parsing logic --- citadel/internet_addressing.c | 64 ++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index 80c7e05ae..043909343 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -49,6 +49,27 @@ int fuzzy_match(struct usersupp *us, char *matchstring) { } +/* + * Unfold a multi-line field into a single line, removing multi-whitespaces + */ +void unfold_rfc822_field(char *field) { + int i; + int quote = 0; + + striplt(field); /* remove leading/trailing whitespace */ + + /* convert non-space whitespace to spaces, and remove double blanks */ + for (i=0; icm_fields['M']; /* M field contains rfc822 text */ + strcpy(field, ""); + for (i = beg; i <= end; ++i) { + if ((rfc822[i] == ':') && ((i-beg) value=<%s>\n", field, fieldbuf); + phree(fieldbuf); +} + /* * Convert an RFC822 message (headers + body) to a CtdlMessage structure. @@ -268,8 +317,6 @@ struct CtdlMessage *convert_internet_message(char *rfc822) { int msglen; int done; char buf[256]; - char field[256]; - int i; msg = mallok(sizeof(struct CtdlMessage)); if (msg == NULL) return msg; @@ -307,23 +354,14 @@ struct CtdlMessage *convert_internet_message(char *rfc822) { } /* At this point we have a field. Are we interested in it? */ - strcpy(field, ""); - for (i = beg; i <= end; ++i) { - if ((rfc822[i] == ':') && ((i-beg)\n", - beg, end, field); - + convert_field(msg, beg, end); /* If we've hit the end of the message, bail out */ if (pos > strlen(rfc822)) done = 1; } - /* Follow-up sanity check. */ + /* Follow-up sanity checks... */ /* If there's no timestamp on this message, set it to now. */ if (msg->cm_fields['T'] == NULL) { -- 2.39.2