]> git.mxchange.org Git - friendica.git/commitdiff
stuff to make connecting to diaspora profiles easier
authorFriendika <info@friendika.com>
Sat, 19 Mar 2011 08:19:11 +0000 (01:19 -0700)
committerFriendika <info@friendika.com>
Sat, 19 Mar 2011 08:19:11 +0000 (01:19 -0700)
boot.php
include/items.php
mod/follow.php

index aa40c17111a161571db4ecb88c8dd4e77b3261d9..66d4bc124b40f7201e3b15367d720c62ea923793 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -1603,9 +1603,15 @@ function lrdd($uri) {
 if(! function_exists('fetch_lrdd_template')) {
 function fetch_lrdd_template($host) {
        $tpl = '';
-       $url = 'http://' . $host . '/.well-known/host-meta' ;
-       $links = fetch_xrd_links($url);
-logger('template: ' . print_r($links,true));
+
+       $url1 = 'https://' . $host . '/.well-known/host-meta' ;
+       $url2 = 'http://' . $host . '/.well-known/host-meta' ;
+       $links = fetch_xrd_links($url1);
+       logger('template (https): ' . print_r($links,true));
+       if(! count($links)) {
+               $links = fetch_xrd_links($url2);
+               logger('template (http): ' . print_r($links,true));
+       }
        if(count($links)) {
                foreach($links as $link)
                        if($link['@attributes']['rel'] && $link['@attributes']['rel'] === 'lrdd')
index 05165932183b8871bee966462d1f9794185bc326..6900c5920b0240458dc49785e9035d34521804d8 100644 (file)
@@ -905,6 +905,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0) {
 
        require_once('simplepie/simplepie.inc');
 
+       if(! $contact)
+               logger('consume feed: anonymous');
        $feed = new SimplePie();
        $feed->set_raw_data($xml);
        if($datedir)
index 689ae823291410d09840a8f1b8c8c9d2cc4953c5..4ce3ccb82c0188440191fb0df60ee6d4b8dc64b0 100644 (file)
@@ -11,7 +11,7 @@ function follow_post(&$a) {
        }
 
        $url = $orig_url = notags(trim($_POST['url']));
-       
+       $diaspora = false;      
        $email_conversant = false;
 
        if($url) {
@@ -28,6 +28,9 @@ function follow_post(&$a) {
                                        $hcard = unamp($link['@attributes']['href']);
                                if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
                                        $profile = unamp($link['@attributes']['href']);
+                               if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location')
+                                       $diaspora = true;
+
 
                        }
 
@@ -90,9 +93,12 @@ function follow_post(&$a) {
                }
        }
 
-       if(! $profile)
-               $profile = $url;
-
+       if(! $profile) {
+               if($diaspora)
+                       $profile = $hcard;
+               else
+                       $profile = $url;
+       }
 
        if(! x($vcard,'fn'))
                if(x($vcard,'nick'))