Diaspora: Auto-adding users as friend who already sharing with us
This commit is contained in:
parent
452ff19d73
commit
7ab335c9d6
|
@ -346,7 +346,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$network = null;
|
||||
$diaspora = false;
|
||||
$diaspora_base = '';
|
||||
$diaspora_guid = '';
|
||||
$diaspora_guid = '';
|
||||
$diaspora_key = '';
|
||||
$has_lrdd = false;
|
||||
$email_conversant = false;
|
||||
|
@ -485,7 +485,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($mode == PROBE_NORMAL) {
|
||||
if(strlen($zot)) {
|
||||
|
@ -531,7 +531,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
}
|
||||
if(strpos($url,'@'))
|
||||
$addr = str_replace('acct:', '', $url);
|
||||
}
|
||||
}
|
||||
|
||||
if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
|
||||
if($diaspora)
|
||||
|
@ -544,13 +544,13 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$vcard = scrape_vcard($hcard);
|
||||
|
||||
// Google doesn't use absolute url in profile photos
|
||||
|
||||
|
||||
if((x($vcard,'photo')) && substr($vcard['photo'],0,1) == '/') {
|
||||
$h = @parse_url($hcard);
|
||||
if($h)
|
||||
$vcard['photo'] = $h['scheme'] . '://' . $h['host'] . $vcard['photo'];
|
||||
}
|
||||
|
||||
|
||||
logger('probe_url: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$vcard['nick'] = $addr_parts[0];
|
||||
}
|
||||
|
||||
if($twitter) {
|
||||
if($twitter) {
|
||||
logger('twitter: setup');
|
||||
$tid = basename($url);
|
||||
$tapi = 'https://api.twitter.com/1/statuses/user_timeline.rss';
|
||||
|
|
|
@ -557,7 +557,7 @@ function diaspora_decode($importer,$xml) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function diaspora_request($importer,$xml) {
|
||||
|
||||
$a = get_app();
|
||||
|
@ -567,7 +567,7 @@ function diaspora_request($importer,$xml) {
|
|||
|
||||
if(! $sender_handle || ! $recipient_handle)
|
||||
return;
|
||||
|
||||
|
||||
$contact = diaspora_get_contact_by_handle($importer['uid'],$sender_handle);
|
||||
|
||||
if($contact) {
|
||||
|
@ -752,6 +752,20 @@ function diaspora_request($importer,$xml) {
|
|||
}
|
||||
|
||||
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']))
|
||||
return false;
|
||||
if($contact['rel'] == CONTACT_IS_SHARING || $contact['rel'] == CONTACT_IS_FRIEND)
|
||||
|
|
|
@ -48,9 +48,9 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
$myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']);
|
||||
else
|
||||
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
||||
|
||||
|
||||
goaway($ret['request'] . "&addr=$myaddr");
|
||||
|
||||
|
||||
// NOTREACHED
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ function new_contact($uid,$url,$interactive = false) {
|
|||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -367,6 +367,7 @@ function lrdd($uri, $debug = false) {
|
|||
logger('lrdd: constructed url: ' . $url);
|
||||
|
||||
$xml = fetch_url($url);
|
||||
|
||||
$headers = $a->get_curl_headers();
|
||||
|
||||
if (! $xml)
|
||||
|
|
|
@ -9,7 +9,7 @@ function poller_run(&$argv, &$argc){
|
|||
if(is_null($a)) {
|
||||
$a = new App;
|
||||
}
|
||||
|
||||
|
||||
if(is_null($db)) {
|
||||
@include(".htconfig.php");
|
||||
require_once("include/dba.php");
|
||||
|
@ -57,17 +57,17 @@ function poller_run(&$argv, &$argc){
|
|||
load_hooks();
|
||||
|
||||
logger('poller: start');
|
||||
|
||||
|
||||
// run queue delivery process in the background
|
||||
|
||||
proc_run('php',"include/queue.php");
|
||||
|
||||
|
||||
// expire any expired accounts
|
||||
|
||||
q("UPDATE user SET `account_expired` = 1 where `account_expired` = 0
|
||||
AND `account_expires_on` != '0000-00-00 00:00:00'
|
||||
AND `account_expires_on` < UTC_TIMESTAMP() ");
|
||||
|
||||
|
||||
// delete user and contact records for recently removed accounts
|
||||
|
||||
$r = q("SELECT * FROM `user` WHERE `account_removed` = 1 AND `account_expires_on` < UTC_TIMESTAMP() - INTERVAL 3 DAY");
|
||||
|
@ -77,12 +77,12 @@ function poller_run(&$argv, &$argc){
|
|||
q("DELETE FROM `user` WHERE `uid` = %d", intval($user['uid']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$abandon_days = intval(get_config('system','account_abandon_days'));
|
||||
if($abandon_days < 1)
|
||||
$abandon_days = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
// once daily run birthday_updates and then expire in background
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
{{ 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 }}
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue