aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-04-10 19:15:52 -0700
committerfriendica <info@friendica.com>2012-04-10 19:15:52 -0700
commit19b636e7e8b4abdf7a53421f90db42419044879e (patch)
tree5c746e997c82feda03f99a26845188982efabb43 /mod
parented608694cec2ea901f474f432d99b33821b276aa (diff)
downloadvolse-hubzilla-19b636e7e8b4abdf7a53421f90db42419044879e.tar.gz
volse-hubzilla-19b636e7e8b4abdf7a53421f90db42419044879e.tar.bz2
volse-hubzilla-19b636e7e8b4abdf7a53421f90db42419044879e.zip
more backend work on mail2 followers
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_request.php63
1 files changed, 54 insertions, 9 deletions
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);