do not return if delivery report could not bedecrypted
This commit is contained in:
parent
2e94e4cd67
commit
4450a01014
@ -1100,6 +1100,8 @@ function zot_process_response($hub, $arr, $outq) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$dreport = true;
|
||||||
|
|
||||||
$x = json_decode($arr['body'], true);
|
$x = json_decode($arr['body'], true);
|
||||||
|
|
||||||
if(! $x) {
|
if(! $x) {
|
||||||
@ -1116,31 +1118,44 @@ function zot_process_response($hub, $arr, $outq) {
|
|||||||
}
|
}
|
||||||
if(! (is_array($x['delivery_report']) && count($x['delivery_report']))) {
|
if(! (is_array($x['delivery_report']) && count($x['delivery_report']))) {
|
||||||
logger('encrypted delivery report could not be decrypted');
|
logger('encrypted delivery report could not be decrypted');
|
||||||
return;
|
$dreport = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($x['delivery_report'] as $xx) {
|
if($dreport) {
|
||||||
call_hooks('dreport_process',$xx);
|
foreach($x['delivery_report'] as $xx) {
|
||||||
if(is_array($xx) && array_key_exists('message_id',$xx) && DReport::is_storable($xx)) {
|
call_hooks('dreport_process',$xx);
|
||||||
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s','%s' ) ",
|
if(is_array($xx) && array_key_exists('message_id',$xx) && DReport::is_storable($xx)) {
|
||||||
dbesc($xx['message_id']),
|
|
||||||
dbesc($xx['location']),
|
// legacy zot recipients add a space and their name to the xchan. split those if true.
|
||||||
dbesc($xx['recipient']),
|
$legacy_recipient = strpos($xx['recipient'], ' ');
|
||||||
dbesc($xx['name']),
|
if($legacy_recipient !== false) {
|
||||||
dbesc($xx['status']),
|
$legacy_recipient_parts = explode(' ', $xx['recipient'], 2);
|
||||||
dbesc(datetime_convert('UTC','UTC',$xx['date'])),
|
$xx['recipient'] = $legacy_recipient_parts[0];
|
||||||
dbesc($xx['sender'])
|
$xx['name'] = $legacy_recipient_parts[1];
|
||||||
);
|
}
|
||||||
|
|
||||||
|
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s','%s' ) ",
|
||||||
|
dbesc($xx['message_id']),
|
||||||
|
dbesc($xx['location']),
|
||||||
|
dbesc($xx['recipient']),
|
||||||
|
dbesc($xx['name']),
|
||||||
|
dbesc($xx['status']),
|
||||||
|
dbesc(datetime_convert('UTC','UTC',$xx['date'])),
|
||||||
|
dbesc($xx['sender'])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have a more descriptive delivery report, so discard the per hub 'queued' report.
|
|
||||||
|
|
||||||
q("delete from dreport where dreport_queue = '%s' ",
|
if($dreport) {
|
||||||
dbesc($outq['outq_hash'])
|
// we have a more descriptive delivery report, so discard the per hub 'queued' report.
|
||||||
);
|
q("delete from dreport where dreport_queue = '%s' ",
|
||||||
|
dbesc($outq['outq_hash'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// update the timestamp for this site
|
// update the timestamp for this site
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user