aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-30 19:27:53 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-30 19:27:53 -0700
commit9bdb7bef5dadb3cfb8e3ff661f68b5cc7a70c5cd (patch)
treec8e629199c5fe3e0e3ace04b410a2988d684271e /include
parent54e7d5d260bcec0132939bdb6a3e14780d46a27c (diff)
downloadvolse-hubzilla-9bdb7bef5dadb3cfb8e3ff661f68b5cc7a70c5cd.tar.gz
volse-hubzilla-9bdb7bef5dadb3cfb8e3ff661f68b5cc7a70c5cd.tar.bz2
volse-hubzilla-9bdb7bef5dadb3cfb8e3ff661f68b5cc7a70c5cd.zip
add delivery reports to mail (not backported to redmatrix)
Diffstat (limited to 'include')
-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();
}
}