aboutsummaryrefslogtreecommitdiffstats
path: root/include/deliver.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-10-30 19:15:03 -0700
committerfriendica <info@friendica.com>2014-10-30 19:15:03 -0700
commit28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a (patch)
treeae912b6d5a5963bd5cbbdc29329ec542ba6c5e7c /include/deliver.php
parente219268a6e968d4024bb72c7990b3f00639d73b7 (diff)
downloadvolse-hubzilla-28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a.tar.gz
volse-hubzilla-28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a.tar.bz2
volse-hubzilla-28a35261dbc8c21e27ca4a449ff5cd6cb0501c8a.zip
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.
Diffstat (limited to 'include/deliver.php')
-rw-r--r--include/deliver.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/include/deliver.php b/include/deliver.php
index f4fae6061..8f6ba543d 100644
--- a/include/deliver.php
+++ b/include/deliver.php
@@ -38,15 +38,30 @@ function deliver_run($argv, $argc) {
continue;
}
- if($r[0]['outq_posturl'] === z_root() . '/post') {
+ $notify = json_decode($r[0]['outq_notify'],true);
+
+ $sendtoweb = false;
+ if(array_key_exists('iv',$notify) && (! $r[0]['outq_msg']))
+ $sendtoweb = true;
+
+ if(($r[0]['outq_posturl'] === z_root() . '/post') && (! $sendtoweb)) {
logger('deliver: local delivery', LOGGER_DEBUG);
// local delivery
// we should probably batch these and save a few delivery processes
// If there is no outq_msg, this is a refresh_all message which does not require local handling
+ // also send 'request' packets to the webservice so it can decode the packet
if($r[0]['outq_msg']) {
- $msg = array('body' => json_encode(array('pickup' => array(array('notify' => json_decode($r[0]['outq_notify'],true),'message' => json_decode($r[0]['outq_msg'],true))))));
-
- zot_import($msg,z_root());
+ $m = json_decode($r[0]['outq_msg'],true);
+ if(array_key_exists('message_list',$m)) {
+ foreach($m['message_list'] as $mm) {
+ $msg = array('body' => json_encode(array('pickup' => array(array('notify' => $notify,'message' => $mm)))));
+ zot_import($msg,z_root());
+ }
+ }
+ else {
+ $msg = array('body' => json_encode(array('pickup' => array(array('notify' => $notify,'message' => $m)))));
+ zot_import($msg,z_root());
+ }
$r = q("delete from outq where outq_hash = '%s' limit 1",
dbesc($argv[$x])
);