aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-01 00:45:44 -0800
committerfriendica <info@friendica.com>2013-01-01 00:45:44 -0800
commit6accc190d4041c1dd859f36560f93a019ce197ee (patch)
tree2ccfdf7b5912593d4036dc0af2f5ab3e8dd19671 /include
parent3e5e8b420f17dbebb2f86c90e9ecbf68a8b69507 (diff)
downloadvolse-hubzilla-6accc190d4041c1dd859f36560f93a019ce197ee.tar.gz
volse-hubzilla-6accc190d4041c1dd859f36560f93a019ce197ee.tar.bz2
volse-hubzilla-6accc190d4041c1dd859f36560f93a019ce197ee.zip
ensure all delivery result possibilities are logged and communicated to the sender
Diffstat (limited to 'include')
-rw-r--r--include/zot.php26
1 files changed, 20 insertions, 6 deletions
diff --git a/include/zot.php b/include/zot.php
index 5e64e79da..3950d5f4b 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -678,11 +678,11 @@ function zot_fetch($arr) {
function zot_import($arr) {
- logger('zot_import: ' . print_r($arr,true), LOGGER_DATA);
+// logger('zot_import: ' . print_r($arr,true), LOGGER_DATA);
$data = json_decode($arr['body'],true);
- logger('zot_import: data1: ' . print_r($data,true));
+// logger('zot_import: data1: ' . print_r($data,true));
if(array_key_exists('iv',$data)) {
$data = json_decode(aes_unencapsulate($data,get_config('system','prvkey')),true);
@@ -691,8 +691,12 @@ function zot_import($arr) {
logger('zot_import: data' . print_r($data,true), LOGGER_DATA);
$incoming = $data['pickup'];
+
+ $return = array();
+
if(is_array($incoming)) {
foreach($incoming as $i) {
+ $result = null;
if(array_key_exists('iv',$i['notify'])) {
$i['notify'] = json_decode(aes_unencapsulate($i['notify'],get_config('system','prvkey')),true);
@@ -715,8 +719,10 @@ function zot_import($arr) {
$recips = implode(',',$recip_arr);
logger('recips: ' . $recips);
$r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) ");
- if(! $r)
+ if(! $r) {
+ logger('recips: no recipients on this site');
continue;
+ }
$deliveries = $r;
@@ -730,8 +736,10 @@ function zot_import($arr) {
// Public post. look for any site members who are accepting posts from this sender
$deliveries = public_recips($i);
}
- if(! $deliveries)
+ if(! $deliveries) {
+ logger('zot_import: no deliveries on this site');
continue;
+ }
if($i['message']) {
if($i['message']['type'] === 'activity') {
@@ -764,10 +772,12 @@ function zot_import($arr) {
}
}
+ if($result)
+ $return = array_merge($return,$result);
}
}
- return $result;
+ return $return;
}
@@ -830,7 +840,6 @@ function public_recips($msg) {
function process_delivery($sender,$arr,$deliveries,$relay) {
-
$result = array();
foreach($deliveries as $d) {
@@ -842,6 +851,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
$result[] = array($d['hash'],'not found');
continue;
}
+
$channel = $r[0];
$perm = (($arr['uri'] == $arr['parent_uri']) ? 'send_stream' : 'post_comments');
@@ -882,6 +892,10 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
$result[] = array($d['hash'],'relayed');
}
}
+
+ if(! $deliveries)
+ $result[] = array('','no recipients');
+
return $result;
}