fill in framework for d* outgoing

This commit is contained in:
Friendika 2011-08-16 20:43:34 -07:00
parent b28b468b21
commit fafcab70e1
2 changed files with 32 additions and 10 deletions

View file

@ -536,10 +536,12 @@ function fetch_xrd_links($url) {
$aliases = array($alias); $aliases = array($alias);
else else
$aliases = $alias; $aliases = $alias;
if(count($aliases)) {
foreach($aliases as $alias) { foreach($aliases as $alias) {
$links[]['@attributes'] = array('rel' => 'alias' , 'href' => $alias); $links[]['@attributes'] = array('rel' => 'alias' , 'href' => $alias);
} }
} }
}
logger('fetch_xrd_links: ' . print_r($links,true), LOGGER_DATA); logger('fetch_xrd_links: ' . print_r($links,true), LOGGER_DATA);

View file

@ -50,8 +50,10 @@ function notifier_run($argv, $argc){
$recipients = array(); $recipients = array();
$url_recipients = array(); $url_recipients = array();
if($cmd === 'mail') { $normal_mode = true;
if($cmd === 'mail') {
$normal_mode = false;
$message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
intval($item_id) intval($item_id)
); );
@ -64,6 +66,7 @@ function notifier_run($argv, $argc){
} }
elseif($cmd === 'expire') { elseif($cmd === 'expire') {
$normal_mode = false;
$expire = true; $expire = true;
$items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1 $items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1
AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP - INTERVAL 10 MINUTE", AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP - INTERVAL 10 MINUTE",
@ -75,6 +78,7 @@ function notifier_run($argv, $argc){
return; return;
} }
elseif($cmd === 'suggest') { elseif($cmd === 'suggest') {
$normal_mode = false;
$suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1", $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
intval($item_id) intval($item_id)
); );
@ -95,7 +99,7 @@ function notifier_run($argv, $argc){
return; return;
} }
$parent_item = $r[0]; $target_item = $r[0];
$parent_id = intval($r[0]['parent']); $parent_id = intval($r[0]['parent']);
$uid = $r[0]['uid']; $uid = $r[0]['uid'];
$updated = $r[0]['edited']; $updated = $r[0]['edited'];
@ -317,9 +321,9 @@ function notifier_run($argv, $argc){
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled) { if(! $mail_disabled) {
if((! strlen($parent_item['allow_cid'])) && (! strlen($parent_item['allow_gid'])) if((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid']))
&& (! strlen($parent_item['deny_cid'])) && (! strlen($parent_item['deny_gid'])) && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid']))
&& (intval($parent_item['pubmail']))) { && (intval($target_item['pubmail']))) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
intval($uid), intval($uid),
dbesc(NETWORK_MAIL) dbesc(NETWORK_MAIL)
@ -498,10 +502,26 @@ function notifier_run($argv, $argc){
} }
break; break;
case NETWORK_DIASPORA: case NETWORK_DIASPORA:
if(get_config('system','dfrn_only') || (! get_config('diaspora_enabled'))) if(get_config('system','dfrn_only') || (! get_config('diaspora_enabled')) || (! $normal_mode))
break; break;
if($top_level) {
diaspora_send_status($parent_item,$owner,$contact); if($target_item['deleted']) {
// diaspora delete, (check for like)
break;
}
elseif($followup) {
// send to owner to relay
break;
}
elseif($target_item['parent'] != $target_item['id']) {
// we are the relay
break;
}
elseif($top_level) {
diaspora_send_status($target_item,$owner,$contact);
break; break;
} }