+ $u = q("SELECT `user`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`
+ FROM `user` WHERE `uid` = %d LIMIT 1",
+ intval($c[0]['uid'])
+ );
+ if (!dbm::is_result($u)) {
+ remove_queue_item($q_item['id']);
+ return;
+ }
+
+ $data = $q_item['content'];
+ $public = $q_item['batch'];
+ $contact = $c[0];
+ $owner = $u[0];
+
+ $deliver_status = 0;
+
+ switch ($contact['network']) {
+ case NETWORK_DFRN:
+ logger('queue: dfrndelivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
+ $deliver_status = dfrn::deliver($owner, $contact, $data);
+
+ if ($deliver_status == (-1)) {
+ update_queue_time($q_item['id']);
+ Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
+ } else {
+ remove_queue_item($q_item['id']);
+ }
+ break;
+ case NETWORK_OSTATUS:
+ if ($contact['notify']) {
+ logger('queue: slapdelivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
+ $deliver_status = slapper($owner, $contact['notify'], $data);
+
+ if ($deliver_status == (-1)) {
+ update_queue_time($q_item['id']);
+ Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
+ } else {
+ remove_queue_item($q_item['id']);
+ }
+ }
+ break;
+ case NETWORK_DIASPORA:
+ if ($contact['notify']) {
+ logger('queue: diaspora_delivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
+ $deliver_status = Diaspora::transmit($owner, $contact, $data, $public, true);
+
+ if ($deliver_status == (-1)) {
+ update_queue_time($q_item['id']);
+ Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
+ } else {
+ remove_queue_item($q_item['id']);
+ }
+ }
+ break;
+
+ default:
+ $params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
+ call_hooks('queue_deliver', $a, $params);