aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/include/zot.php b/include/zot.php
index e9132b7a5..2f04cca1b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -11,6 +11,7 @@
require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/hubloc.php');
+require_once('include/DReport.php');
/**
@@ -1556,7 +1557,6 @@ function allowed_public_recips($msg) {
function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) {
$result = array();
- require_once('include/DReport.php');
$result['site'] = z_root();
@@ -1569,7 +1569,6 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
}
}
-logger('sender: ' . print_r($sender,true));
foreach($deliveries as $d) {
$local_public = $public;
@@ -2043,20 +2042,26 @@ function process_mail_delivery($sender, $arr, $deliveries) {
}
foreach($deliveries as $d) {
+
+ $DR = new DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']);
+
$r = q("select * from channel where channel_hash = '%s' limit 1",
dbesc($d['hash'])
);
if(! $r) {
- $result[] = array($d['hash'],'not found');
+ $DR->update('recipient not found');
+ $result[] = $DR->get();
continue;
}
$channel = $r[0];
+ $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>');
if(! perm_is_allowed($channel['channel_id'],$sender['hash'],'post_mail')) {
logger("permission denied for mail delivery {$channel['channel_id']}");
- $result[] = array($d['hash'],'permission denied',$channel['channel_name'],$arr['mid']);
+ $DR->update('permission denied');
+ $result[] = $DR->get();
continue;
}
@@ -2070,11 +2075,13 @@ function process_mail_delivery($sender, $arr, $deliveries) {
intval($r[0]['id']),
intval($channel['channel_id'])
);
- $result[] = array($d['hash'],'mail recalled',$channel['channel_name'],$arr['mid']);
+ $DR->update('mail recalled');
+ $result[] = $DR->get();
logger('mail_recalled');
}
else {
- $result[] = array($d['hash'],'duplicate mail received',$channel['channel_name'],$arr['mid']);
+ $DR->update('duplicate mail received');
+ $result[] = $DR->get();
logger('duplicate mail received');
}
continue;
@@ -2083,7 +2090,8 @@ function process_mail_delivery($sender, $arr, $deliveries) {
$arr['account_id'] = $channel['channel_account_id'];
$arr['channel_id'] = $channel['channel_id'];
$item_id = mail_store($arr);
- $result[] = array($d['hash'],'mail delivered',$channel['channel_name'],$arr['mid']);
+ $DR->update('mail delivered');
+ $result[] = $DR->get();
}
}