aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/items.php3
-rw-r--r--mod/dfrn_request.php63
2 files changed, 57 insertions, 9 deletions
diff --git a/include/items.php b/include/items.php
index ee6960534..3a931b68c 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1856,6 +1856,8 @@ function local_delivery($importer,$data) {
$feed->enable_order_by_date(false);
$feed->init();
+/*
+ // Currently unsupported - needs a lot of work
$reloc = $feed->get_feed_tags( NAMESPACE_DFRN, 'relocate' );
if(isset($reloc[0]['child'][NAMESPACE_DFRN])) {
$base = $reloc[0]['child'][NAMESPACE_DFRN];
@@ -1880,6 +1882,7 @@ function local_delivery($importer,$data) {
// schedule a scan?
}
+*/
// handle friend suggestion notification
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 80d27ac30..77a3124f7 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -261,7 +261,7 @@ function dfrn_request_post(&$a) {
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` != '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
- dbesc(NETWORK_MAIL)
+ dbesc(NETWORK_MAIL2)
);
if(count($r)) {
foreach($r as $rr) {
@@ -286,7 +286,7 @@ function dfrn_request_post(&$a) {
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` = '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
- dbesc(NETWORK_MAIL)
+ dbesc(NETWORK_MAIL2)
);
if(count($r)) {
foreach($r as $rr) {
@@ -301,6 +301,8 @@ function dfrn_request_post(&$a) {
}
}
+ $email_follow = (x($_POST,'email_follow') ? intval($_POST['email_follow']) : 0);
+ $real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
$url = trim($_POST['dfrn_url']);
if(! strlen($url)) {
@@ -308,17 +310,60 @@ function dfrn_request_post(&$a) {
return;
}
- // Canonicalise email-style profile locator
-
$hcard = '';
- $url = webfinger_dfrn($url,$hcard);
- if(substr($url,0,5) === 'stat:') {
- $network = NETWORK_OSTATUS;
- $url = substr($url,5);
+ if($email_follow) {
+
+ if(! strpos($url,'@')) {
+ notice( t('Invalid email address.') . EOL);
+ return;
+ }
+
+ $addr = $url;
+ $name = ($realname) ? $realname : $addr;
+ $nick = substr($addr,0,strpos($addr,'@'));
+ $url = 'http://' . substr($addr,strpos($addr,'@') + 1);
+ $nurl = normalise_url($host);
+ $poll = 'email ' . random_string();
+ $notify = 'smtp ' . random_string();
+ $blocked = 1;
+ $pending = 1;
+ $network = NETWORK_MAIL2;
+ $rel = CONTACT_IS_FOLLOWER;
+
+ $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+ if(get_config('system','dfrn_only'))
+ $mail_disabled = 1;
+
+ if(! $mail_disabled) {
+ $failed = false;
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+ intval($uid)
+ );
+ if(! count($r)) {
+ notice( t('This account has not been configured for email. Request failed.') . EOL);
+ return;
+ }
+ }
+
+
+
+
+
}
else {
- $network = NETWORK_DFRN;
+
+ // Canonicalise email-style profile locator
+
+ $url = webfinger_dfrn($url,$hcard);
+
+ if(substr($url,0,5) === 'stat:') {
+ $network = NETWORK_OSTATUS;
+ $url = substr($url,5);
+ }
+ else {
+ $network = NETWORK_DFRN;
+ }
}
logger('dfrn_request: url: ' . $url);