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.
intval($item_id)
);
- if ((!count($r)) || (!intval($r[0]['parent']))) {
+ if ((!dbm::is_result($r)) || (!intval($r[0]['parent']))) {
continue;
}
$r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
`user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
- `user`.`page-flags`, `user`.`prvnets`
+ `user`.`page-flags`, `user`.`account-type`, `user`.`prvnets`
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
intval($uid)
);
- if (!count($r))
+ if (!dbm::is_result($r))
continue;
$owner = $r[0];
if ((strlen($parent['allow_cid']))
|| (strlen($parent['allow_gid']))
|| (strlen($parent['deny_cid']))
- || (strlen($parent['deny_gid']))) {
+ || (strlen($parent['deny_gid']))
+ || $parent["private"]) {
$public_message = false; // private recipients, not public
}
intval($contact_id)
);
- if (count($r))
+ if (dbm::is_result($r))
$contact = $r[0];
if ($contact['self'])
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:
intval($argv[2]),
intval($uid)
);
- if (count($r))
+ if (dbm::is_result($r))
$it = $r[0];
}
if (!$it)
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'];
}
}
if ($mail) {
diaspora::send_mail($item,$owner,$contact);
- //diaspora_send_mail($item,$owner,$contact);
break;
}
if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
// top-level retraction
- logger('delivery: diaspora retract: '.$loc);
-
+ logger('diaspora retract: '.$loc);
diaspora::send_retraction($target_item,$owner,$contact,$public_message);
- //diaspora_send_retraction($target_item,$owner,$contact,$public_message);
break;
} elseif ($followup) {
// send comments and likes to owner to relay
+ logger('diaspora followup: '.$loc);
diaspora::send_followup($target_item,$owner,$contact,$public_message);
- //diaspora_send_followup($target_item,$owner,$contact,$public_message);
break;
} elseif ($target_item['uri'] !== $target_item['parent-uri']) {
// we are the relay - send comments, likes and relayable_retractions to our conversants
- logger('delivery: diaspora relay: '.$loc);
+ logger('diaspora relay: '.$loc);
diaspora::send_relay($target_item,$owner,$contact,$public_message);
- //diaspora_send_relay($target_item,$owner,$contact,$public_message);
break;
} elseif ($top_level && !$walltowall) {
// currently no workable solution for sending walltowall
- logger('delivery: diaspora status: '.$loc);
+ logger('diaspora status: '.$loc);
diaspora::send_status($target_item,$owner,$contact,$public_message);
- //diaspora_send_status($target_item,$owner,$contact,$public_message);
break;
}