diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-09-22 02:32:04 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-09-22 02:32:04 -0700 |
commit | 0b1b11ea53ee3fd466eb338ac5ce67e62af87413 (patch) | |
tree | 7bdda0d64e1bf27f860af620dcab160c470664cc /include/deliver.php | |
parent | 146ff6f70308647b27374a1bba386c156498bd2e (diff) | |
download | volse-hubzilla-0b1b11ea53ee3fd466eb338ac5ce67e62af87413.tar.gz volse-hubzilla-0b1b11ea53ee3fd466eb338ac5ce67e62af87413.tar.bz2 volse-hubzilla-0b1b11ea53ee3fd466eb338ac5ce67e62af87413.zip |
heavy lifting for delivery reports
Diffstat (limited to 'include/deliver.php')
-rw-r--r-- | include/deliver.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/deliver.php b/include/deliver.php index 26739fb06..7a43e3d47 100644 --- a/include/deliver.php +++ b/include/deliver.php @@ -15,7 +15,10 @@ function deliver_run($argv, $argc) { logger('deliver: invoked: ' . print_r($argv,true), LOGGER_DATA); + for($x = 1; $x < $argc; $x ++) { + + $dresult = null; $r = q("select * from outq where outq_hash = '%s' limit 1", dbesc($argv[$x]) ); @@ -98,11 +101,29 @@ function deliver_run($argv, $argc) { } else { $msg = array('body' => json_encode(array('success' => true, 'pickup' => array(array('notify' => $notify,'message' => $m))))); - zot_import($msg,z_root()); + $dresult = zot_import($msg,z_root()); } $r = q("delete from outq where outq_hash = '%s'", dbesc($argv[$x]) ); + if($dresult && is_array($dresult)) { + foreach($dresult as $xx) { + if(is_array($xx) && array_key_exists('message_id',$xx)) { + q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_result, dreport_time, dreport_xchan ) values ( '%s', '%s','%s','%s','%s','%s' ) ", + dbesc($xx['message_id']), + dbesc($xx['location']), + dbesc($xx['recipient']), + dbesc($xx['status']), + dbesc(datetime_convert($xx['date'])), + dbesc($xx['sender']) + ); + } + } + } + + q("delete from dreport where dreport_queue = '%s' limit 1", + dbesc($argv[$x]) + ); } } else { |