aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-11-15 11:02:21 +0000
committerMario <mario@mariovavti.com>2020-11-15 11:02:21 +0000
commitad91ab68cefcccb90dd9222f27bacbc184cd7cdc (patch)
tree8a4f1eb36338e97459d89a0fc5879a1ba486804a /Zotlabs
parente74c52094f218686c59ddb5f6c186f02158cf89a (diff)
downloadvolse-hubzilla-ad91ab68cefcccb90dd9222f27bacbc184cd7cdc.tar.gz
volse-hubzilla-ad91ab68cefcccb90dd9222f27bacbc184cd7cdc.tar.bz2
volse-hubzilla-ad91ab68cefcccb90dd9222f27bacbc184cd7cdc.zip
cleanup
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Deliver.php68
1 files changed, 4 insertions, 64 deletions
diff --git a/Zotlabs/Daemon/Deliver.php b/Zotlabs/Daemon/Deliver.php
index 43f426eb7..7d053fb87 100644
--- a/Zotlabs/Daemon/Deliver.php
+++ b/Zotlabs/Daemon/Deliver.php
@@ -2,12 +2,8 @@
namespace Zotlabs\Daemon;
-use Zotlabs\Lib\DReport;
-
-require_once('include/zot.php');
require_once('include/queue_fn.php');
-
class Deliver {
static public function run($argc,$argv) {
@@ -22,72 +18,16 @@ class Deliver {
if(! $argv[$x])
continue;
- $dresult = null;
$r = q("select * from outq where outq_hash = '%s' limit 1",
dbesc($argv[$x])
);
- if($r) {
-
- $notify = json_decode($r[0]['outq_notify'],true);
-
- // Messages without an outq_msg will need to go via the web, even if it's a
- // local delivery. This includes conversation requests and refresh packets.
-
- if(($r[0]['outq_posturl'] === z_root() . '/post') && ($r[0]['outq_msg'])) {
- logger('deliver: local delivery', LOGGER_DEBUG);
-
- // local delivery
- // we should probably batch these and save a few delivery processes
-
- if($r[0]['outq_msg']) {
- $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('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $mm)))));
- zot_import($msg,z_root());
- }
- }
- else {
- $msg = array('body' => json_encode(array('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $m)))));
- $dresult = zot_import($msg,z_root());
- }
-
- remove_queue_item($r[0]['outq_hash']);
-
- if($dresult && is_array($dresult)) {
-
- // delivery reports for local deliveries do not require encryption
-
- foreach($dresult as $xx) {
- if(is_array($xx) && array_key_exists('message_id',$xx)) {
- if(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']) ? $xx['name'] : EMPTY_STR),
- dbesc($xx['status']),
- dbesc(datetime_convert($xx['date'])),
- dbesc($xx['sender'])
- );
- }
- }
- }
- }
-
- q("delete from dreport where dreport_queue = '%s'",
- dbesc($argv[$x])
- );
-
- continue;
- }
- }
-
- // otherwise it's a remote delivery - call queue_deliver() with the $immediate flag
+ if($r) {
queue_deliver($r[0],true);
-
}
+
}
+
}
+
}