diff options
author | Friendika <info@friendika.com> | 2011-04-16 08:45:08 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-04-16 08:45:08 -0700 |
commit | 863ddf1676be3837da4219ed7883e61e4d493b1c (patch) | |
tree | facfdd413c2050259bd656d2f608e8449286f389 /include/Scrape.php | |
parent | c7bcdf0c186c8d5ce278a3710a5ba570d066be99 (diff) | |
download | volse-hubzilla-863ddf1676be3837da4219ed7883e61e4d493b1c.tar.gz volse-hubzilla-863ddf1676be3837da4219ed7883e61e4d493b1c.tar.bz2 volse-hubzilla-863ddf1676be3837da4219ed7883e61e4d493b1c.zip |
mail changes
Diffstat (limited to 'include/Scrape.php')
-rw-r--r-- | include/Scrape.php | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/include/Scrape.php b/include/Scrape.php index e5c10a9be..97e2fb7f1 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -264,6 +264,7 @@ function scrape_feed($url) { function probe_url($url) { + require_once('include/email.php'); $result = array(); @@ -313,8 +314,38 @@ function probe_url($url) { } } else { + + // Check email + + $orig_url = $url; if((strpos($orig_url,'@')) && validate_email($orig_url)) { - $email_conversant = true; + $x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", + intval(local_user()) + ); + $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", + intval(local_user()) + ); + if(count($x) && count($r)) { + $mailbox = construct_mailbox_name($r[0]); + $password = ''; + openssl_private_decrypt(hex2bin($r[0]['pass']),$password,$x[0]['prvkey']); + $mbox = email_connect($mailbox,$r[0]['user'],$password); + unset($password); + } + if($mbox) { + $msgs = email_poll($mbox,$orig_url); + if(count($msgs)) { + $addr = $orig_url; + $network = NETWORK_MAIL; + $name = substr($url,0,strpos($url,'@')); + // fix nick + $vcard = array('fn' => $name, 'nick' => $name, 'photo' => gravatar_img($url)); + $notify = 'smtp'; + $poll = 'email'; + $priority = 0; + } + imap_close($mbox); + } } } } @@ -330,7 +361,7 @@ function probe_url($url) { } } - if($network !== NETWORK_DFRN) { + if($network !== NETWORK_DFRN && $network !== NETWORK_MAIL) { $network = NETWORK_OSTATUS; $priority = 0; @@ -435,9 +466,11 @@ function probe_url($url) { $vcard['fn'] = notags($vcard['fn']); $vcard['nick'] = notags($vcard['nick']); + $result['name'] = $vcard['fn']; $result['nick'] = $vcard['nick']; $result['url'] = $profile; + $result['addr'] = $addr; $result['notify'] = $notify; $result['poll'] = $poll; $result['request'] = $request; |