Skip to content
Snippets Groups Projects
Commit 10eac673 authored by Michael Hamann's avatar Michael Hamann
Browse files

Add threading headers to change notification mails as proposed in PR #120

parent dfbe4adf
No related branches found
No related tags found
No related merge requests found
......@@ -424,9 +424,14 @@ class Subscription {
$trep['DIFF'] = $tdiff;
$hrep['DIFF'] = $hdiff;
$headers = array('Message-Id' => $this->getMessageID($id));
if ($rev) {
$headers['In-Reply-To'] = $this->getMessageID($id, $rev);
}
return $this->send(
$subscriber_mail, $subject, $id,
$template, $trep, $hrep
$template, $trep, $hrep, $headers
);
}
......@@ -542,9 +547,10 @@ class Subscription {
* template (in text format)
* @param array $hrep Predefined parameters used to parse the
* template (in HTML format), null to default to $trep
* @param array $headers Additional mail headers in the form 'name' => 'value'
* @return bool
*/
protected function send($subscriber_mail, $subject, $context, $template, $trep, $hrep = null) {
protected function send($subscriber_mail, $subject, $context, $template, $trep, $hrep = null, $headers = array()) {
global $lang;
global $conf;
......@@ -560,9 +566,36 @@ class Subscription {
if(isset($trep['SUBSCRIBE'])) {
$mail->setHeader('List-Unsubscribe', '<'.$trep['SUBSCRIBE'].'>', false);
}
foreach ($headers as $header => $value) {
$mail->setHeader($header, $value);
}
return $mail->send();
}
/**
* Get a valid message id for a certain $id and revision (or the current revision)
* @param string $id The id of the page (or media file) the message id should be for
* @param string $rev The revision of the page, set to the current revision of the page $id if not set
* @return string
*/
protected function getMessageID($id, $rev = NULL) {
static $listid = null;
if (is_null($listid)) {
$server = parse_url(DOKU_URL, PHP_URL_HOST);
$listid = join('.', array_reverse(explode('/', DOKU_BASE))).$server;
$listid = urlencode($listid);
$listid = strtolower(trim($listid, '.'));
}
if (is_null($rev)) {
$rev = @filemtime(wikiFN($id));
}
return "<$id?rev=$rev@$listid>";
}
/**
* Default callback for COMMON_NOTIFY_ADDRESSLIST
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment