From 0a29927e6d15fe77786b9f6e9dbb4b8ac8b83ab2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 19 Dec 2012 16:31:06 +0100 Subject: [PATCH] Mail: real threading now works with outgoing mails. --- include/delivery.php | 8 +++++++- include/notifier.php | 8 +++++++- include/onepoll.php | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/delivery.php b/include/delivery.php index e8bf338a8f..fcb0ee47b9 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -481,7 +481,13 @@ function delivery_run(&$argv, &$argc){ //logger("Mail: Data: ".print_r($it, true), LOGGER_DATA); if($it['uri'] !== $it['parent-uri']) { - $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; + $headers .= "References: <".iri2msgid($it["parent-uri"]).">"; + + // If Threading is enabled, write down the correct parent + if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"])) + $headers .= " <".iri2msgid($it["thr-parent"]).">"; + $headers .= "\n"; + if(!$it['title']) { $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($it['parent-uri']), diff --git a/include/notifier.php b/include/notifier.php index c522bcb6bc..b5a92ff252 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -790,7 +790,13 @@ function notifier_run(&$argv, &$argc){ $headers .= 'Message-Id: <' . iri2msgid($it['uri']) . '>' . "\n"; if($it['uri'] !== $it['parent-uri']) { - $headers .= 'References: <' . iri2msgid($it['parent-uri']) . '>' . "\n"; + $headers .= "References: <".iri2msgid($it["parent-uri"]).">"; + + // If Threading is enabled, write down the correct parent + if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"])) + $headers .= " <".iri2msgid($it["thr-parent"]).">"; + $headers .= "\n"; + if(!$it['title']) { $r = q("SELECT `title` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($it['parent-uri']), diff --git a/include/onepoll.php b/include/onepoll.php index 2abd41b789..c493aff762 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -335,7 +335,7 @@ function onepoll_run(&$argv, &$argc){ intval($r[0]['id']) ); } - /*switch ($mailconf[0]['action']) { + switch ($mailconf[0]['action']) { case 0: logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG); break; @@ -353,7 +353,7 @@ function onepoll_run(&$argv, &$argc){ if ($mailconf[0]['movetofolder'] != "") imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID); break; - }*/ + } continue; }