]>
Commit | Line | Data |
---|---|---|
00af3d9f ER |
1 | Message-ID header can appear as Message-Id in some cases |
2 | ||
3 | --- eventum-20060314/include/class.mail.php.orig 2006-03-15 16:09:19.000000000 +0200 | |
4 | +++ eventum-20060314/include/class.mail.php 2006-03-15 16:08:58.000000000 +0200 | |
5 | @@ -786,10 +786,10 @@ | |
6 | function getReferenceMessageID($text_headers) | |
7 | { | |
8 | $references = array(); | |
9 | - if (preg_match('/^In-Reply-To: (.*)/m', $text_headers, $matches)) { | |
10 | + if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) { | |
11 | return trim($matches[1]); | |
12 | } | |
13 | - if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/sm', $text_headers, $matches)) { | |
14 | + if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/smi', $text_headers, $matches)) { | |
15 | $references = explode(" ", Mail_API::unfold(trim($matches[1]))); | |
16 | $references = array_map('trim', $references); | |
17 | // return the first message-id in the list of references | |
18 | @@ -809,10 +809,10 @@ | |
19 | function getAllReferences($text_headers) | |
20 | { | |
21 | $references = array(); | |
22 | - if (preg_match('/^In-Reply-To: (.*)/m', $text_headers, $matches)) { | |
23 | + if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers, $matches)) { | |
24 | $references[] = trim($matches[1]); | |
25 | } | |
26 | - if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/sm', $text_headers, $matches)) { | |
27 | + if (preg_match('/^References: (.+?)(\r?\n\r?\n|\r?\n\r?\S)/smi', $text_headers, $matches)) { | |
28 | $references = array_merge($references, explode(" ", Mail_API::unfold(trim($matches[1])))); | |
29 | $references = array_map('trim', $references); | |
30 | $references = array_unique($references); | |
31 | @@ -863,20 +863,20 @@ | |
32 | $headers['message-id'] = $msg_id; | |
33 | } | |
34 | ||
35 | - if (preg_match('/^In-Reply-To: (.*)/m', $text_headers) > 0) { | |
36 | + if (preg_match('/^In-Reply-To: (.*)/mi', $text_headers) > 0) { | |
37 | // replace existing header | |
38 | - $text_headers = preg_replace('/^In-Reply-To: (.*)/m', 'In-Reply-To: ' . $reference_msg_id, $text_headers, 1); | |
39 | + $text_headers = preg_replace('/^In-Reply-To: (.*)/mi', 'In-Reply-To: ' . $reference_msg_id, $text_headers, 1); | |
40 | } else { | |
41 | // add new header after message ID | |
42 | - $text_headers = preg_replace('/^Message-ID: (.*)$/m', "Message-ID: $1\r\nIn-Reply-To: $reference_msg_id", $text_headers, 1); | |
43 | + $text_headers = preg_replace('/^Message-ID: (.*)$/mi', "Message-ID: $1\r\nIn-Reply-To: $reference_msg_id", $text_headers, 1); | |
44 | } | |
45 | $headers['in-reply-to'] = $reference_msg_id; | |
46 | - if (preg_match('/^References: (.*)/m', $text_headers) > 0) { | |
47 | + if (preg_match('/^References: (.*)/mi', $text_headers) > 0) { | |
48 | // replace existing header | |
49 | - $text_headers = preg_replace('/^References: (.*)/m', 'References: ' . Mail_API::fold(join(' ', $references)), $text_headers, 1); | |
50 | + $text_headers = preg_replace('/^References: (.*)/mi', 'References: ' . Mail_API::fold(join(' ', $references)), $text_headers, 1); | |
51 | } else { | |
52 | // add new header after In-Reply-To | |
53 | - $text_headers = preg_replace('/^In-Reply-To: (.*)$/m', "In-Reply-To: $1\r\nReferences: " . Mail_API::fold(join(' ', $references)), $text_headers, 1); | |
54 | + $text_headers = preg_replace('/^In-Reply-To: (.*)$/mi', "In-Reply-To: $1\r\nReferences: " . Mail_API::fold(join(' ', $references)), $text_headers, 1); | |
55 | } | |
56 | $headers['references'] = Mail_API::fold(join(' ', $references)); | |
57 | return array($text_headers . "\r\n\r\n" . $body, $headers); | |
58 | @@ -976,7 +976,7 @@ | |
59 | function getMessageID($headers, $body) | |
60 | { | |
61 | // try to parse out actual message-id header | |
62 | - if (preg_match('/^Message-ID: (.*)/m', $headers, $matches)) { | |
63 | + if (preg_match('/^Message-ID: (.*)/mi', $headers, $matches)) { | |
64 | return trim($matches[1]); | |
65 | } else { | |
66 | // no match, calculate hash to make fake message ID | |
67 | @@ -980,7 +980,6 @@ | |
68 | return trim($matches[1]); | |
69 | } else { | |
70 | // no match, calculate hash to make fake message ID | |
71 | - $md5 = md5($headers.$body); | |
72 | $first = base_convert(md5($headers), 10, 36); | |
73 | $second = base_convert(md5($body), 10, 36); | |
74 | return "<eventum.." . $first . "." . $second . "@" . APP_HOSTNAME . ">"; |