diff options
author | friendica <info@friendica.com> | 2011-12-18 00:50:17 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2011-12-18 00:50:17 -0800 |
commit | e6b538c0466fb73bc3bf781266f85f45f8b39ea3 (patch) | |
tree | 642f13a9accfc4fd3049ab72053073c642b15631 /include/socgraph.php | |
parent | c4a5fcaf278947782e4d600a3d6bdfe14eeb7fab (diff) | |
download | volse-hubzilla-e6b538c0466fb73bc3bf781266f85f45f8b39ea3.tar.gz volse-hubzilla-e6b538c0466fb73bc3bf781266f85f45f8b39ea3.tar.bz2 volse-hubzilla-e6b538c0466fb73bc3bf781266f85f45f8b39ea3.zip |
add webfinger addr to gcontact for friend "connect" links
Diffstat (limited to 'include/socgraph.php')
-rw-r--r-- | include/socgraph.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/include/socgraph.php b/include/socgraph.php index ffd3fd5df..78a5514a0 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -52,6 +52,7 @@ function poco_load($cid,$uid = 0,$url = null) { $profile_url = ''; $profile_photo = ''; + $connect_url = ''; $name = ''; $name = $entry->displayName; @@ -59,13 +60,18 @@ function poco_load($cid,$uid = 0,$url = null) { foreach($entry->urls as $url) { if($url->type == 'profile') { $profile_url = $url->value; - break; + continue; } + if($url->type == 'webfinger') { + $connect_url = str_replace('acct:' , '', $url->value); + continue; + } + } foreach($entry->photos as $photo) { if($photo->type == 'profile') { $profile_photo = $photo->value; - break; + continue; } } @@ -80,21 +86,23 @@ function poco_load($cid,$uid = 0,$url = null) { $gcid = $x[0]['id']; if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo) { - q("update gcontact set `name` = '%s', `photo` = '%s' where - `nurl` = '%s' limit 1", + q("update gcontact set `name` = '%s', `photo` = '%s', `connect` = '%s' + where `nurl` = '%s' limit 1", dbesc($name), dbesc($profile_photo), + dbesc($connect_url), dbesc(normalise_link($profile_url)) ); } } else { - q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`) - values ( '%s', '%s', '%s', '%s') ", + q("insert into `gcontact` (`name`,`url`,`nurl`,`photo`,`connect`) + values ( '%s', '%s', '%s', '%s','%s') ", dbesc($name), dbesc($profile_url), dbesc(normalise_link($profile_url)), - dbesc($profile_photo) + dbesc($profile_photo), + dbesc($connect_url) ); $x = q("select * from `gcontact` where `nurl` = '%s' limit 1", dbesc(normalise_link($profile_url)) |