X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdelivery.php;h=db2f03c8f4a7c77c5fc25ed6ad9ea3d4e688bddc;hb=1f93024ed63492497c74d287007f1faa5a13084e;hp=7c0ba63a6b41b9649cf30e925df64cf089e6ccd8;hpb=d632d282cd000de420852404013dd2a4b4cc214c;p=friendica.git diff --git a/include/delivery.php b/include/delivery.php index 7c0ba63a6b..db2f03c8f4 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -53,11 +53,11 @@ function delivery_run(&$argv, &$argc){ dbesc($item_id), dbesc($contact_id) ); - if (!count($r)) { + if (!dbm::is_result($r)) { continue; } - if (App::maxload_reached()) + if ($a->maxload_reached()) return; // It's ours to deliver. Remove it from the queue. @@ -131,7 +131,7 @@ function delivery_run(&$argv, &$argc){ intval($item_id) ); - if ((!count($r)) || (!intval($r[0]['parent']))) { + if ((!dbm::is_result($r)) || (!intval($r[0]['parent']))) { continue; } @@ -184,7 +184,7 @@ function delivery_run(&$argv, &$argc){ intval($uid) ); - if (!count($r)) + if (!dbm::is_result($r)) continue; $owner = $r[0]; @@ -254,7 +254,7 @@ function delivery_run(&$argv, &$argc){ intval($contact_id) ); - if (count($r)) + if (dbm::is_result($r)) $contact = $r[0]; if ($contact['self']) @@ -323,7 +323,7 @@ function delivery_run(&$argv, &$argc){ // perform local delivery if we are on the same site - if (link_compare($basepath,$a->get_baseurl())) { + if (link_compare($basepath,App::get_baseurl())) { $nickname = basename($contact['url']); if ($contact['issued-id']) @@ -381,7 +381,14 @@ function delivery_run(&$argv, &$argc){ if ($deliver_status == (-1)) { logger('notifier: delivery failed: queuing message'); add_to_queue($contact['id'],NETWORK_DFRN,$atom); + + // The message could not be delivered. We mark the contact as "dead" + mark_for_death($contact); + } else { + // We successfully delivered a message, the contact is alive + unmark_for_death($contact); } + break; case NETWORK_OSTATUS: @@ -416,7 +423,7 @@ function delivery_run(&$argv, &$argc){ intval($argv[2]), intval($uid) ); - if (count($r)) + if (dbm::is_result($r)) $it = $r[0]; } if (!$it) @@ -471,14 +478,14 @@ function delivery_run(&$argv, &$argc){ dbesc($it['parent-uri']), intval($uid)); - if (count($r) AND ($r[0]['title'] != '')) + if (dbm::is_result($r) AND ($r[0]['title'] != '')) $subject = $r[0]['title']; else { $r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($it['parent-uri']), intval($uid)); - if (count($r) AND ($r[0]['title'] != '')) + if (dbm::is_result($r) AND ($r[0]['title'] != '')) $subject = $r[0]['title']; } }