Diaspora: Auto-adding users as friend who already sharing with us

This commit is contained in:
Michael - piratica.eu 2013-01-20 14:08:28 +01:00
parent 452ff19d73
commit 7ab335c9d6
6 changed files with 33 additions and 18 deletions

View File

@ -752,6 +752,20 @@ function diaspora_request($importer,$xml) {
} }
function diaspora_post_allow($importer,$contact) { function diaspora_post_allow($importer,$contact) {
// perhaps we were already sharing with this person. Now they're sharing with us.
// That makes us friends.
// Normally this should have handled by getting a request - but this could get lost
if($contact['rel'] == CONTACT_IS_FOLLOWER && $importer['page-flags'] != PAGE_COMMUNITY) {
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval(CONTACT_IS_FRIEND),
intval($contact['id']),
intval($importer['uid'])
);
$contact['rel'] = CONTACT_IS_FRIEND;
logger('diaspora_post_allow: defining user '.$contact["nick"].' as friend');
}
if(($contact['blocked']) || ($contact['readonly']) || ($contact['archive'])) if(($contact['blocked']) || ($contact['readonly']) || ($contact['archive']))
return false; return false;
if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND) if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND)

View File

@ -367,6 +367,7 @@ function lrdd($uri, $debug = false) {
logger('lrdd: constructed url: ' . $url); logger('lrdd: constructed url: ' . $url);
$xml = fetch_url($url); $xml = fetch_url($url);
$headers = $a->get_curl_headers(); $headers = $a->get_curl_headers();
if (! $xml) if (! $xml)

View File

@ -18,7 +18,7 @@
</ul> </ul>
</div> </div>
{{ else }} {{ else }}
<!-- <div class="profile-edit-side-div"><a class="profile-edit-side-link icon edit" title="$editprofile" href="profiles/$profid" ></a></div> --> <div class="profile-edit-side-div"><a class="profile-edit-side-link icon edit" title="$editprofile" href="profiles" ></a></div>
{{ endif }} {{ endif }}
</div> </div>