From 68d7a3ae0153d59813e7a62bc0b846dc16929076 Mon Sep 17 00:00:00 2001 From: friendica <info@friendica.com> Date: Wed, 15 Aug 2012 17:14:29 -0700 Subject: [PATCH] put a variant of the parent_uri into email notification message-ids. Current message-ids aren't completel legal. More work to do. --- include/diaspora.php | 2 +- include/enotify.php | 6 ++++-- include/items.php | 9 ++++++--- mod/item.php | 1 + 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 3e9f20a471..baee0420ba 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1350,7 +1350,7 @@ function diaspora_comment($importer,$xml,$msg) { 'verb' => ACTIVITY_POST, 'otype' => 'item', 'parent' => $conv_parent, - + 'parent_uri' => $parent_uri )); // only send one notification diff --git a/include/enotify.php b/include/enotify.php index 07e091d3a9..b4331f0926 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -1,5 +1,7 @@ <?php +require_once('include/email.php'); + function notification($params) { logger('notification: entry', LOGGER_DEBUG); @@ -324,7 +326,7 @@ function notification($params) { // If so, create the record of it and use a message-id smtp header. if(!$r) { - logger("norify_id:" . intval($notify_id). ", parent: " . intval($params['parent']) . "uid: " . + logger("notify_id:" . intval($notify_id). ", parent: " . intval($params['parent']) . "uid: " . intval($params['uid']), LOGGER_DEBUG); $r = q("insert into `notify-threads` (`notify-id`, `master-parent-item`, `receiver-uid`, `parent-item`) values(%d,%d,%d,%d)", @@ -495,7 +497,7 @@ class enotify { $multipartMessageBody, // message body $messageHeader // message headers ); - logger("notification: enotify::send header " . $header, LOGGER_DEBUG); + logger("notification: enotify::send header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG); logger("notification: enotify::send returns " . $res, LOGGER_DEBUG); } } diff --git a/include/items.php b/include/items.php index ff7da286e2..8de6f7cc8e 100755 --- a/include/items.php +++ b/include/items.php @@ -2778,12 +2778,14 @@ function local_delivery($importer,$data) { $parent = 0; if($posted_id) { - $r = q("SELECT `parent` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $r = q("SELECT `parent`, `parent-uri` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($posted_id), intval($importer['importer_uid']) ); - if(count($r)) + if(count($r)) { $parent = $r[0]['parent']; + $parent_uri = $r[0]['parent-uri']; + } if(! $is_like) { $r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d", @@ -2823,7 +2825,7 @@ function local_delivery($importer,$data) { 'verb' => ACTIVITY_POST, 'otype' => 'item', 'parent' => $parent, - + 'parent_uri' => $parent_uri, )); } @@ -2972,6 +2974,7 @@ function local_delivery($importer,$data) { 'verb' => ACTIVITY_POST, 'otype' => 'item', 'parent' => $conv_parent, + 'parent_uri' => $parent_uri )); diff --git a/mod/item.php b/mod/item.php index c7b755eaed..6c1c06f99a 100644 --- a/mod/item.php +++ b/mod/item.php @@ -748,6 +748,7 @@ function item_post(&$a) { 'verb' => ACTIVITY_POST, 'otype' => 'item', 'parent' => $parent, + 'parent_uri' => $parent_item['uri'] )); } -- 2.39.5