aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2019-01-16 15:58:13 +0100
committerM. Dent <dentm42@gmail.com>2019-01-16 15:58:13 +0100
commite6ccdc23781c7a70f17b97ab701d832d4719b624 (patch)
tree1d89b7ddfc49a6e06a5b281ee529d39038b6ab5b
parent2e94e4cd67e9eb7dd5e42cbd38cc0c4b96d5af3c (diff)
parent4450a01014c15a77c2e086c7d964a578b135cfba (diff)
downloadvolse-hubzilla-e6ccdc23781c7a70f17b97ab701d832d4719b624.tar.gz
volse-hubzilla-e6ccdc23781c7a70f17b97ab701d832d4719b624.tar.bz2
volse-hubzilla-e6ccdc23781c7a70f17b97ab701d832d4719b624.zip
Merge branch 'queue_fixes_1' into 'dev'
do not return if delivery report could not bedecrypted See merge request hubzilla/core!1475
-rw-r--r--include/zot.php49
1 files changed, 32 insertions, 17 deletions
diff --git a/include/zot.php b/include/zot.php
index df54f2b27..bc2187f91 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1100,6 +1100,8 @@ function zot_process_response($hub, $arr, $outq) {
return;
}
+ $dreport = true;
+
$x = json_decode($arr['body'], true);
if(! $x) {
@@ -1116,31 +1118,44 @@ function zot_process_response($hub, $arr, $outq) {
}
if(! (is_array($x['delivery_report']) && count($x['delivery_report']))) {
logger('encrypted delivery report could not be decrypted');
- return;
+ $dreport = false;
}
}
- foreach($x['delivery_report'] as $xx) {
- call_hooks('dreport_process',$xx);
- if(is_array($xx) && array_key_exists('message_id',$xx) && DReport::is_storable($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' ) ",
- 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'])
- );
+ if($dreport) {
+ foreach($x['delivery_report'] as $xx) {
+ call_hooks('dreport_process',$xx);
+ if(is_array($xx) && array_key_exists('message_id',$xx) && DReport::is_storable($xx)) {
+
+ // legacy zot recipients add a space and their name to the xchan. split those if true.
+ $legacy_recipient = strpos($xx['recipient'], ' ');
+ if($legacy_recipient !== false) {
+ $legacy_recipient_parts = explode(' ', $xx['recipient'], 2);
+ $xx['recipient'] = $legacy_recipient_parts[0];
+ $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' ",
- dbesc($outq['outq_hash'])
- );
+ if($dreport) {
+ // 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