scrape_url - use feed url if no name can be found
This commit is contained in:
parent
1d01b3a088
commit
260d652168
3 changed files with 30 additions and 6 deletions
|
@ -332,10 +332,12 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
if(! $url)
|
||||
return $result;
|
||||
|
||||
$network = null;
|
||||
$diaspora = false;
|
||||
$diaspora_base = '';
|
||||
$diaspora_guid = '';
|
||||
$diaspora_key = '';
|
||||
$has_lrdd = false;
|
||||
$email_conversant = false;
|
||||
|
||||
$twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
|
||||
|
@ -352,6 +354,8 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$links = lrdd($url);
|
||||
|
||||
if(count($links)) {
|
||||
$has_lrdd = true;
|
||||
|
||||
logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA);
|
||||
foreach($links as $link) {
|
||||
if($link['@attributes']['rel'] === NAMESPACE_ZOT)
|
||||
|
@ -493,7 +497,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
|
||||
if($diaspora)
|
||||
$network = NETWORK_DIASPORA;
|
||||
else
|
||||
elseif($has_lrdd)
|
||||
$network = NETWORK_OSTATUS;
|
||||
$priority = 0;
|
||||
|
||||
|
@ -637,7 +641,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
|
||||
}
|
||||
if(! $network)
|
||||
$network = 'feed';
|
||||
$network = NETWORK_FEED;
|
||||
if(! $priority)
|
||||
$priority = 2;
|
||||
}
|
||||
|
@ -651,10 +655,14 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
|||
if(! $profile)
|
||||
$profile = $url;
|
||||
|
||||
// No human could be associated with this link, use the URL as the contact name
|
||||
|
||||
if(($network === NETWORK_FEED) && ($poll) && (! x($vcard,'fn')))
|
||||
$vcard['fn'] = $url;
|
||||
|
||||
$vcard['fn'] = notags($vcard['fn']);
|
||||
$vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
|
||||
|
||||
|
||||
|
||||
$result['name'] = $vcard['fn'];
|
||||
$result['nick'] = $vcard['nick'];
|
||||
$result['url'] = $profile;
|
||||
|
|
|
@ -419,7 +419,8 @@ function delivery_run($argv, $argc){
|
|||
diaspora_send_relay($target_item,$owner,$contact);
|
||||
break;
|
||||
}
|
||||
elseif($top_level) {
|
||||
elseif(($top_level) && (! $walltowall)) {
|
||||
// currently no workable solution for sending walltowall
|
||||
logger('delivery: diaspora status: ' . $contact['name']);
|
||||
diaspora_send_status($target_item,$owner,$contact);
|
||||
break;
|
||||
|
|
|
@ -2,6 +2,20 @@
|
|||
|
||||
require_once("boot.php");
|
||||
|
||||
/*
|
||||
* This file was at one time responsible for doing all deliveries, but this caused
|
||||
* big problems on shared hosting systems, where the process might get killed by the
|
||||
* hosting provider and nothing would get delivered.
|
||||
* It now only delivers one message under certain cases, and invokes a queued
|
||||
* delivery mechanism (include/deliver.php) to deliver individual contacts at
|
||||
* controlled intervals.
|
||||
* This has a much better chance of surviving random processes getting killed
|
||||
* by the hosting provider.
|
||||
* A lot of this code is duplicated in include/deliver.php until we have time to go back
|
||||
* and re-structure the delivery procedure based on the obstacles that have been thrown at
|
||||
* us by hosting providers.
|
||||
*/
|
||||
|
||||
function notifier_run($argv, $argc){
|
||||
global $a, $db;
|
||||
|
||||
|
@ -594,7 +608,8 @@ function notifier_run($argv, $argc){
|
|||
diaspora_send_relay($target_item,$owner,$contact);
|
||||
break;
|
||||
}
|
||||
elseif($top_level) {
|
||||
elseif(($top_level) && (! $walltowall)) {
|
||||
// currently no workable solution for sending walltowall
|
||||
diaspora_send_status($target_item,$owner,$contact);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue