Remote-self is now working immediately

This commit is contained in:
Michael Vogel 2014-08-31 23:52:25 +02:00
parent ea0f75a315
commit c81df2c005

View file

@ -983,7 +983,7 @@ function encode_rel_links($links) {
function item_store($arr,$force_parent = false) { function item_store($arr,$force_parent = false, $notify = false) {
// If a Diaspora signature structure was passed in, pull it out of the // If a Diaspora signature structure was passed in, pull it out of the
// item array and set it aside for later storage. // item array and set it aside for later storage.
@ -1144,6 +1144,7 @@ function item_store($arr,$force_parent = false) {
$allow_gid = $arr['allow_gid']; $allow_gid = $arr['allow_gid'];
$deny_cid = $arr['deny_cid']; $deny_cid = $arr['deny_cid'];
$deny_gid = $arr['deny_gid']; $deny_gid = $arr['deny_gid'];
$notify_type = 'wall-new';
} }
else { else {
@ -1180,6 +1181,7 @@ function item_store($arr,$force_parent = false) {
$deny_cid = $r[0]['deny_cid']; $deny_cid = $r[0]['deny_cid'];
$deny_gid = $r[0]['deny_gid']; $deny_gid = $r[0]['deny_gid'];
$arr['wall'] = $r[0]['wall']; $arr['wall'] = $r[0]['wall'];
$notify_type = 'comment-new';
// if the parent is private, force privacy for the entire conversation // if the parent is private, force privacy for the entire conversation
// This differs from the above settings as it subtly allows comments from // This differs from the above settings as it subtly allows comments from
@ -1417,6 +1419,9 @@ function item_store($arr,$force_parent = false) {
create_tags_from_item($current_post); create_tags_from_item($current_post);
create_files_from_item($current_post); create_files_from_item($current_post);
if ($notify)
proc_run('php', "include/notifier.php", $notify_type, $current_post);
return $current_post; return $current_post;
} }
@ -2532,16 +2537,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
if($contact['network'] === NETWORK_FEED) if($contact['network'] === NETWORK_FEED)
$datarray['private'] = 2; $datarray['private'] = 2;
// This is my contact on another system, but it's really me.
// Turn this into a wall post.
if($contact['remote_self']) {
$datarray['wall'] = 1;
if($contact['network'] === NETWORK_FEED) {
$datarray['private'] = 0;
}
}
$datarray['parent-uri'] = $item_id; $datarray['parent-uri'] = $item_id;
$datarray['uid'] = $importer['uid']; $datarray['uid'] = $importer['uid'];
$datarray['contact-id'] = $contact['id']; $datarray['contact-id'] = $contact['id'];
@ -2557,6 +2552,24 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
$datarray['owner-avatar'] = $contact['thumb']; $datarray['owner-avatar'] = $contact['thumb'];
} }
// This is my contact on another system, but it's really me.
// Turn this into a wall post.
if($contact['remote_self']) {
$datarray['wall'] = 1;
// Test
$datarray['author-name'] = $datarray['owner-name'];
$datarray['author-link'] = $datarray['owner-link'];
$datarray['author-avatar'] = $datarray['owner-avatar'];
$notify = true;
if($contact['network'] === NETWORK_FEED) {
$datarray['private'] = 0;
}
} else
$notify = false;
// We've allowed "followers" to reach this point so we can decide if they are // We've allowed "followers" to reach this point so we can decide if they are
// posting an @-tag delivery, which followers are allowed to do for certain // posting an @-tag delivery, which followers are allowed to do for certain
// page types. Now that we've parsed the post, let's check if it is legit. Otherwise ignore it. // page types. Now that we've parsed the post, let's check if it is legit. Otherwise ignore it.
@ -2565,7 +2578,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
continue; continue;
$r = item_store($datarray); $r = item_store($datarray, false, $notify);
continue; continue;
} }
@ -3636,8 +3649,12 @@ function local_delivery($importer,$data) {
// This is my contact on another system, but it's really me. // This is my contact on another system, but it's really me.
// Turn this into a wall post. // Turn this into a wall post.
if($importer['remote_self']) if($importer['remote_self']) {
$datarray['wall'] = 1; $datarray['wall'] = 1;
$notify = true;
} else
$notify = false;
$datarray['parent-uri'] = $item_id; $datarray['parent-uri'] = $item_id;
$datarray['uid'] = $importer['importer_uid']; $datarray['uid'] = $importer['importer_uid'];
@ -3658,7 +3675,7 @@ function local_delivery($importer,$data) {
if(($importer['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['importer_uid'],$datarray))) if(($importer['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['importer_uid'],$datarray)))
continue; continue;
$posted_id = item_store($datarray); $posted_id = item_store($datarray, false, $notify);
if(stristr($datarray['verb'],ACTIVITY_POKE)) { if(stristr($datarray['verb'],ACTIVITY_POKE)) {
$verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1)); $verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1));