From 2869ccfe39cbda4974a82c303eeeb4e38966b126 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 22 Sep 2015 04:04:51 -0700 Subject: delivery reports - crude but mostly functional at least for zot deliveries --- include/ItemObject.php | 2 ++ include/zot.php | 7 ++++--- mod/dreport.php | 13 ++++++++++++- view/tpl/conv_item.tpl | 5 +++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/ItemObject.php b/include/ItemObject.php index d23c1c658..5296a1cf0 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -286,6 +286,7 @@ class Item extends BaseObject { 'body' => $body, 'text' => strip_tags($body), 'id' => $this->get_id(), + 'mid' => $item['mid'], 'isevent' => $isevent, 'attend' => $attend, 'consensus' => $consensus, @@ -301,6 +302,7 @@ class Item extends BaseObject { 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), + 'dreport' => t('Delivery Report'), 'name' => $profile_name, 'thumb' => $profile_avatar, 'osparkle' => $osparkle, diff --git a/include/zot.php b/include/zot.php index 942998b98..fb55da0fa 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1579,15 +1579,16 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ continue; } + $channel = $r[0]; + $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + + if($d['hash'] === $sender['hash']) { $DR->update('self delivery ignored'); $result[] = $DR->get(); continue; } - $channel = $r[0]; - $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); - // allow public postings to the sys channel regardless of permissions, but not // for comments travelling upstream. Wait and catch them on the way down. diff --git a/mod/dreport.php b/mod/dreport.php index 7e245fbe0..3c74a9e33 100644 --- a/mod/dreport.php +++ b/mod/dreport.php @@ -26,7 +26,18 @@ function dreport_content(&$a) { return; } - return print_r($r,true); + + $o .= '

' . sprintf( t('Delivery report for %1$s'),substr($mid,0,32)) . '...' . '

'; + $o .= ''; + + foreach($r as $rr) { + $name = escape_tags(substr($rr['dreport_recip'],strpos($rr['dreport_recip'],' '))); + $o .= ''; + } + $o .= '
' . $name . '' . $rr['dreport_result'] . '' . $rr['dreport_time'] . '
'; + + return $o; + } \ No newline at end of file diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 30a007bd6..dc8064f1a 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -123,6 +123,11 @@ {{if $item.item_photo_menu}} {{$item.item_photo_menu}} + + {{if $item.edpost}} +
  • {{$item.dreport}}
  • + {{/if}} + {{/if}} -- cgit v1.2.3