}
char *end_of_this_line = strstr(ptr, "\r\n");
- // remove whitespace at the end of the line
+ // replace all multiple whitespace runs with a single space
int replaced_something;
+ do {
+ replaced_something = 0;
+ char *double_space = strstr(ptr, " "); // space-space?
+ if (!double_space) {
+ double_space = strstr(ptr, " \t"); // space-tab?
+ }
+ if (!double_space) {
+ double_space = strstr(ptr, "\t "); // tab-space?
+ }
+ if (!double_space) {
+ double_space = strstr(ptr, "\t\t"); // tab-tab?
+ }
+ if (double_space) {
+ StrBufReplaceToken(headers, (long)(double_space-cheaders), 2, HKEY(" "));
+ ++replaced_something;
+ }
+ } while (replaced_something);
+
+ // remove whitespace at the end of the line
do {
replaced_something = 0;
char *trailing_space = strstr(ptr, " \r\n"); // line ends in a space?
s.TheMessage = CC->redirect_buffer;
CC->redirect_buffer = NULL;
-#if 0
// FIXME genericize this
char *pkey_in =
"-----BEGIN PRIVATE KEY-----\n"
"-----END PRIVATE KEY-----\n"
;
dkim_sign(s.TheMessage, pkey_in, "dev.citadel.org", "foo");
-#endif
// Prepare the buffer for transmittal
s.bytes_total = StrLength(s.TheMessage);
"From: Fred Bloggs <bloggs@dev.citadel.org>\r\n"
"X-irrelevant-header: wow mom 303\r\n"
"To: Bread Floggs <bf@example.com>\r\n"
- "Subject: The ultimate test message! \r\n"
+ "Subject: The ultimate test message\r\n"
"Message-ID: <73294856-8726543-473298@dev.citadel.org>\r\n"
"\r\n"
"Hi.\r\n"