From 28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 30 Oct 2014 19:15:03 -0700 Subject: What this checkin does is catch the case where a comment arrived and there's a missing top-level post to match it with. So we'll send a request back to the sender that you've never seen this thread and please send a fresh copy of the entire conversation to date. We could soon have posts in the matrix from different platforms from days gone by, which have been migrated into the modern world. We'll be polite and not deliver these to everybody. However, if someone comments on one of these antique threads we wouldn't be able to see it in our own matrix because we won't have a copy of the parent post. So this rectifies that situation. Be aware that item deletion may need to change to keep "hard deleted" items indefinitely so that they don't keep coming back. We'll have to null out the important data of the former item to accomplish the deletion aspect. --- mod/post.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index d62233ca1..8ffd3b5ad 100644 --- a/mod/post.php +++ b/mod/post.php @@ -507,6 +507,7 @@ function post_post(&$a) { json_return_and_die($ret); } + if($msgtype === 'pickup') { /** @@ -597,7 +598,14 @@ function post_post(&$a) { $ret['success'] = true; $ret['pickup'] = array(); foreach($r as $rr) { - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => json_decode($rr['outq_msg'],true)); + $x = json_decode($rr['outq_msg'],true); + + if(array_key_exists('message_list',$x)) { + foreach($x['message_list'] as $xx) + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); + } + else + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); $x = q("delete from outq where outq_hash = '%s' limit 1", dbesc($rr['outq_hash']) @@ -796,6 +804,12 @@ function post_post(&$a) { json_return_and_die($ret); } + if($msgtype === 'request') { + // request a particular post/conversation by message_id + $x = zot_process_message_request($data); + json_return_and_die($x); + } + if($msgtype === 'purge') { if($recipients) { -- cgit v1.2.3 From 50c16c394fe2d966c62d30930600212a4e33303e Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 1 Nov 2014 01:52:27 -0700 Subject: check that we have valid data --- mod/post.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index 8ffd3b5ad..c21af83e4 100644 --- a/mod/post.php +++ b/mod/post.php @@ -598,18 +598,24 @@ function post_post(&$a) { $ret['success'] = true; $ret['pickup'] = array(); foreach($r as $rr) { - $x = json_decode($rr['outq_msg'],true); + if($rr['outq_msg']) { + $x = json_decode($rr['outq_msg'],true); - if(array_key_exists('message_list',$x)) { - foreach($x['message_list'] as $xx) - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); - } - else - $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); + if(! $x) + continue; - $x = q("delete from outq where outq_hash = '%s' limit 1", - dbesc($rr['outq_hash']) - ); + if(array_key_exists('message_list',$x)) { + foreach($x['message_list'] as $xx) { + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $xx); + } + } + else + $ret['pickup'][] = array('notify' => json_decode($rr['outq_notify'],true),'message' => $x); + + $x = q("delete from outq where outq_hash = '%s' limit 1", + dbesc($rr['outq_hash']) + ); + } } } -- cgit v1.2.3