From 44d5c90af446537ddd292caff0cd85370a7339ab Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 19 May 2011 17:25:41 -0700 Subject: [PATCH] better mailing list support, email addr can be either 'from' or 'to' --- boot.php | 2 +- include/Scrape.php | 8 ++++++-- include/email.php | 12 +++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/boot.php b/boot.php index 0eb1a36c8c..66a76f49d2 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.984' ); +define ( 'FRIENDIKA_VERSION', '2.2.985' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1054 ); diff --git a/include/Scrape.php b/include/Scrape.php index a6bb5f728c..21e6bd01ff 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -278,6 +278,7 @@ function probe_url($url) { $links = lrdd($url); if(count($links)) { + logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA); foreach($links as $link) { if($link['@attributes']['rel'] === NAMESPACE_DFRN) $dfrn = unamp($link['@attributes']['href']); @@ -345,8 +346,11 @@ function probe_url($url) { $poll = 'email ' . random_string(); $priority = 0; $x = email_msg_meta($mbox,$msgs[0]); - $adr = imap_rfc822_parse_adrlist($x->from,''); - if(strlen($adr[0]->personal)) + if(stristr($x->from,$orig_url)) + $adr = imap_rfc822_parse_adrlist($x->from,''); + elseif(stristr($x->to,$orig_url)) + $adr = imap_rfc822_parse_adrlist($x->to,''); + if(isset($adr) && strlen($adr[0]->personal)) $vcard['fn'] = notags($adr[0]->personal); } imap_close($mbox); diff --git a/include/email.php b/include/email.php index db10af2ee6..7e0351e946 100644 --- a/include/email.php +++ b/include/email.php @@ -15,7 +15,17 @@ function email_poll($mbox,$email_addr) { return array();; $search = imap_search($mbox,'FROM "' . $email_addr . '"', SE_UID); - return (($search) ? $search : array()); + + $search2 = imap_search($mbox,'TO "' . $email_addr . '"', SE_UID); + + if($search && $search2) + $res = array_merge($search,$search2); + elseif($search) + $res = $search; + else + $res = $search2; + + return (($res) ? $res : array()); }