Provide the ability to subscribe to our user from other federated sites.
This is a read-only relationship until the rest of the salmon magic-envelope stuff lands
This commit is contained in:
parent
f1977d420e
commit
3c440f70c6
8
boot.php
8
boot.php
|
@ -2,7 +2,8 @@
|
|||
|
||||
set_time_limit(0);
|
||||
|
||||
define ( 'BUILD_ID' , 1007 );
|
||||
define ( 'BUILD_ID', 1007 );
|
||||
define ( 'DFRN_PROTOCOL_VERSION', '2.0');
|
||||
|
||||
define ( 'EOL', "<br />\r\n");
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
|
@ -34,6 +35,7 @@ define ( 'NAMESPACE_TOMB' , 'http://purl.org/atompub/tombstones/1.0' )
|
|||
define ( 'NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/' );
|
||||
define ( 'NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/');
|
||||
define ( 'NAMESPACE_SALMON_ME', 'http://salmon-protocol.org/ns/magic-env');
|
||||
define ( 'NAMESPACE_OSTATUSSUB', 'http://ostatus.org/schema/1.0/subscribe');
|
||||
|
||||
define ( 'ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like' );
|
||||
define ( 'ACTIVITY_DISLIKE', NAMESPACE_DFRN . '/dislike' );
|
||||
|
@ -848,6 +850,10 @@ function webfinger_dfrn($s) {
|
|||
foreach($links as $link)
|
||||
if($link['@attributes']['rel'] === NAMESPACE_DFRN)
|
||||
return $link['@attributes']['href'];
|
||||
foreach($links as $link)
|
||||
if($link['@attributes']['rel'] === NAMESPACE_OSTATUSSUB)
|
||||
return 'stat:' . $link['@attributes']['template'];
|
||||
|
||||
}
|
||||
return '';
|
||||
}}
|
||||
|
|
|
@ -183,11 +183,21 @@ function dfrn_request_post(&$a) {
|
|||
|
||||
$url = webfinger_dfrn($url);
|
||||
|
||||
if(substr($url,0,5) === 'stat:') {
|
||||
$network = 'stat';
|
||||
$url = substr($url,5);
|
||||
}
|
||||
else {
|
||||
$network = 'dfrn';
|
||||
}
|
||||
|
||||
if(! strlen($url)) {
|
||||
notice( t("Unable to resolve your name at the provided location.") . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if($network == 'dfrn') {
|
||||
$ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' LIMIT 1",
|
||||
intval($uid),
|
||||
dbesc($url)
|
||||
|
@ -315,11 +325,33 @@ function dfrn_request_post(&$a) {
|
|||
$dfrn_url = bin2hex($a->get_baseurl() . '/profile/' . $nickname);
|
||||
$aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0);
|
||||
|
||||
goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url" . '&confirm_key=' . $hash . (($aes_allow) ? "&aes_allow=1" : ""));
|
||||
return; // NOTREACHED
|
||||
|
||||
goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"
|
||||
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
|
||||
. '&confirm_key=' . $hash
|
||||
. (($aes_allow) ? "&aes_allow=1" : "")
|
||||
);
|
||||
// NOTREACHED
|
||||
// END $network === 'dfrn'
|
||||
}
|
||||
return;
|
||||
elseif($network === 'stat') {
|
||||
|
||||
/**
|
||||
*
|
||||
* OStatus network
|
||||
* Check contact existence
|
||||
* Try and scrape together enough information to create a contact record, with us as REL_VIP
|
||||
* Substitute our user's feed URL into $url template
|
||||
* Send the subscriber home to subscribe
|
||||
*
|
||||
**/
|
||||
|
||||
$url = str_replace('{uri}', $a->get_baseurl() . '/dfrn_poll/' . $nickname, $url);
|
||||
goaway($url);
|
||||
// NOTREACHED
|
||||
// END $network === 'stat'
|
||||
}
|
||||
|
||||
} return;
|
||||
}}
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
<p id="dfrn-request-intro">
|
||||
You may request a connection with this member if you have a valid profile address<br />
|
||||
on one of the following social networks:<br />
|
||||
<ul id="dfrn-request-networks"><li><a href="http://dfrn.org">mistpark/DFRN</a></li></ul>
|
||||
<ul id="dfrn-request-networks">
|
||||
<li><a href="http://dfrn.org">Mistpark/DFRN</a> (fully supported)</li>
|
||||
<li><a href="http://ostatus.org">Federation/OStatus/Diaspora/GNU-social</a> (limited - experimental)</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<form action="dfrn_request/$nickname" method="post" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user