From 2172fc769d925a471a2fafecf734a7ca3ca640a3 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 11 Sep 2014 11:52:58 +0000 Subject: [PATCH] * Mail: support the propagation of Thread-Topic, Thread-Index and List-Id on reply too --- .../inc/class.emailadmin_imapbase.inc.php | 3 +++ mail/inc/class.mail_compose.inc.php | 27 ++++++++++++++++++- mail/templates/default/compose.xet | 5 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/emailadmin/inc/class.emailadmin_imapbase.inc.php b/emailadmin/inc/class.emailadmin_imapbase.inc.php index 183342a23d..01a2ae5c13 100644 --- a/emailadmin/inc/class.emailadmin_imapbase.inc.php +++ b/emailadmin/inc/class.emailadmin_imapbase.inc.php @@ -4626,6 +4626,9 @@ class emailadmin_imapbase ); if (isset($headers['IN-REPLY-TO'])) $newData['IN-REPLY-TO'] = $headers['IN-REPLY-TO']; if (isset($headers['REFERENCES'])) $newData['REFERENCES'] = $headers['REFERENCES']; + if (isset($headers['THREAD-TOPIC'])) $newData['THREAD-TOPIC'] = $headers['THREAD-TOPIC']; + if (isset($headers['THREAD-INDEX'])) $newData['THREAD-INDEX'] = $headers['THREAD-INDEX']; + if (isset($headers['LIST-ID'])) $newData['LIST-ID'] = $headers['LIST-ID']; //_debug_array($newData); $recepientList = array('FROM', 'TO', 'CC', 'BCC', 'SENDER', 'REPLY-TO'); foreach($recepientList as $recepientType) { diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 0fb8fcb52b..2af91db312 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -1310,6 +1310,9 @@ class mail_compose $preserv['processedmail_id'] = $content['processedmail_id']; $preserv['references'] = $content['references']; $preserv['in-reply-to'] = $content['in-reply-to']; + $preserv['thread-topic'] = $content['thread-topic']; + $preserv['thread-index'] = $content['thread-index']; + $preserv['list-id'] = $content['list-id']; $preserv['mode'] = $content['mode']; // convert it back to checkbox expectations if($content['mimeType'] == 'html') { @@ -1952,6 +1955,9 @@ class mail_compose $this->sessionData['messageFolder'] = $_folder; $this->sessionData['in-reply-to'] = ($headers['IN-REPLY-TO']?$headers['IN-REPLY-TO']:$headers['MESSAGE_ID']); $this->sessionData['references'] = ($headers['REFERENCES']?$headers['REFERENCES']:$headers['MESSAGE_ID']); + if ($headers['THREAD-TOPIC']) $this->sessionData['thread-topic'] = $headers['THREAD-TOPIC']; + if ($headers['THREAD-INDEX']) $this->sessionData['thread-index'] = $headers['THREAD-INDEX']; + if ($headers['LIST-ID']) $this->sessionData['list-id'] = $headers['LIST-ID']; //error_log(__METHOD__.__LINE__.' Mode:'.$_mode.':'.array2string($headers)); // check for Reply-To: header and use if available if(!empty($headers['REPLY-TO']) && ($headers['REPLY-TO'] != $headers['FROM'])) { @@ -2169,9 +2175,28 @@ class mail_compose $_mailObject->Priority = $_formData['priority']; $_mailObject->Encoding = 'quoted-printable'; $_mailObject->AddCustomHeader('X-Mailer: EGroupware-Mail'); - if(isset($_formData['in-reply-to'])) { + if(isset($_formData['in-reply-to']) && !empty($_formData['in-reply-to'])) { + if (stripos($_formData['in-reply-to'],'<')===false) $_formData['in-reply-to']='<'.trim($_formData['in-reply-to']).'>'; + //error_log(__METHOD__.__LINE__.'$_mailObject->AddCustomHeader(In-Reply-To: '. $_formData['in-reply-to'].")"); $_mailObject->AddCustomHeader('In-Reply-To: '. $_formData['in-reply-to']); } + if(isset($_formData['references']) && !empty($_formData['references'])) { + if (stripos($_formData['references'],'<')===false) $_formData['references']='<'.trim($_formData['references']).'>'; + //error_log(__METHOD__.__LINE__.'$_mailObject->AddCustomHeader(References: '. $_formData['references'].")"); + $_mailObject->AddCustomHeader('References: '. $_formData['references']); + } + if(isset($_formData['thread-topic']) && !empty($_formData['thread-topic'])) { + //error_log(__METHOD__.__LINE__.'$_mailObject->AddCustomHeader(Tread-Topic: '. $_formData['thread-topic'].")"); + $_mailObject->AddCustomHeader('Thread-Topic: '. $_formData['thread-topic']); + } + if(isset($_formData['thread-index']) && !empty($_formData['thread-index'])) { + //error_log(__METHOD__.__LINE__.'$_mailObject->AddCustomHeader(Tread-Index: '. $_formData['thread-index'].")"); + $_mailObject->AddCustomHeader('Thread-Index: '. $_formData['thread-index']); + } + if(isset($_formData['list-id']) && !empty($_formData['list-id'])) { + //error_log(__METHOD__.__LINE__.'$_mailObject->AddCustomHeader(List-Id: '. $_formData['list-id'].")"); + $_mailObject->AddCustomHeader('List-Id: '. $_formData['list-id']); + } if($_formData['disposition']) { $_mailObject->AddCustomHeader('Disposition-Notification-To: '. $_identity['ident_email']); } diff --git a/mail/templates/default/compose.xet b/mail/templates/default/compose.xet index 67775f580e..e650cf044a 100644 --- a/mail/templates/default/compose.xet +++ b/mail/templates/default/compose.xet @@ -57,6 +57,11 @@ + + + + +