diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-01-15 22:36:01 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-01-15 22:36:01 +0100 |
commit | ad6eb15eac2297d3ad058a587ad39ce2957ee637 (patch) | |
tree | 2f9a67dbb4f42e41aefb5e5ce75fde1411f08240 | |
parent | 2e94e4cd67e9eb7dd5e42cbd38cc0c4b96d5af3c (diff) | |
download | volse-hubzilla-ad6eb15eac2297d3ad058a587ad39ce2957ee637.tar.gz volse-hubzilla-ad6eb15eac2297d3ad058a587ad39ce2957ee637.tar.bz2 volse-hubzilla-ad6eb15eac2297d3ad058a587ad39ce2957ee637.zip |
fix legacy zot dreport not passing the is_storable check
-rw-r--r-- | Zotlabs/Lib/DReport.php | 9 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 9 | ||||
-rw-r--r-- | include/zot.php | 9 |
3 files changed, 25 insertions, 2 deletions
diff --git a/Zotlabs/Lib/DReport.php b/Zotlabs/Lib/DReport.php index 21b320cac..2cda7ce5d 100644 --- a/Zotlabs/Lib/DReport.php +++ b/Zotlabs/Lib/DReport.php @@ -93,11 +93,16 @@ class DReport { if(! $c) return false; + // legacy zot recipients add a space and their name to the xchan. remove it if true. - // is the recipient one of our connections, or do we want to store every report? + $legacy_recipient = strpos($dr['recipient'], ' '); + if($legacy_recipient !== false) + $rxchan = substr($dr['recipient'], 0 , $legacy_recipient); + else + $rxchan = $dr['recipient']; + // is the recipient one of our connections, or do we want to store every report? - $rxchan = $dr['recipient']; $pcf = get_pconfig($c[0]['channel_id'],'system','dreport_store_all'); if($pcf) return true; diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 87a5126f4..268622430 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -998,6 +998,15 @@ logger('4'); 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 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']), diff --git a/include/zot.php b/include/zot.php index df54f2b27..1741c1616 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1123,6 +1123,15 @@ function zot_process_response($hub, $arr, $outq) { 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']), |