From 146ff6f70308647b27374a1bba386c156498bd2e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 21 Sep 2015 22:30:28 -0700 Subject: more progress on delivery reports. Store the remote results from zot sites locally. --- include/zot.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index 767abae38..f728d8fb9 100644 --- a/include/zot.php +++ b/include/zot.php @@ -957,6 +957,21 @@ function zot_process_response($hub, $arr, $outq) { logger('zot_process_response: headers: ' . print_r($arr['header'],true), LOGGER_DATA); } + if(array_key_exists('delivery_report',$x)) { + foreach($x['delivery_report'] as $xx) { + if(is_array($xx) && array_key_exists('message_id',$xx)) { + q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s' ) ", + dbesc($xx['message_id']), + dbesc($xx['location']), + dbesc($xx['recipient']), + dbesc($xx['status']), + dbesc(datetime_convert($xx['date'])), + dbesc($xx['sender']) + ); + } + } + } + // update the timestamp for this site q("update site set site_dead = 0, site_update = '%s' where site_url = '%s'", -- cgit v1.2.3 From 0b1b11ea53ee3fd466eb338ac5ce67e62af87413 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 22 Sep 2015 02:32:04 -0700 Subject: heavy lifting for delivery reports --- include/zot.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index f728d8fb9..942998b98 100644 --- a/include/zot.php +++ b/include/zot.php @@ -971,7 +971,11 @@ function zot_process_response($hub, $arr, $outq) { } } } - + + q("delete from dreport where dreport_queue = '%s' limit 1", + dbesc($outq['outq_hash']) + ); + // update the timestamp for this site q("update site set site_dead = 0, site_update = '%s' where site_url = '%s'", @@ -1575,6 +1579,12 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ continue; } + 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() . '>'); -- cgit v1.2.3 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/zot.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/zot.php') 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. -- cgit v1.2.3