diff options
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/follow.php | 5 | ||||
-rwxr-xr-x | include/items.php | 2 | ||||
-rw-r--r-- | include/onepoll.php | 17 | ||||
-rw-r--r-- | include/poller.php | 15 |
5 files changed, 33 insertions, 8 deletions
@@ -304,7 +304,7 @@ define ( 'ABOOK_FLAG_ARCHIVED' , 0x0008); define ( 'ABOOK_FLAG_PENDING' , 0x0010); define ( 'ABOOK_FLAG_UNCONNECTED', 0x0020); define ( 'ABOOK_FLAG_SELF' , 0x0080); - +define ( 'ABOOK_FLAG_FEED' , 0x0100); define ( 'MAIL_DELETED', 0x0001); diff --git a/include/follow.php b/include/follow.php index 8f14a5062..102d84605 100644 --- a/include/follow.php +++ b/include/follow.php @@ -204,11 +204,12 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) ); } else { - $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_their_perms, abook_my_perms, abook_created, abook_updated ) - values( %d, %d, '%s', %d, %d, '%s', '%s' ) ", + $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_flags, abook_their_perms, abook_my_perms, abook_created, abook_updated ) + values( %d, %d, '%s', %d, %d, %d, '%s', '%s' ) ", intval($aid), intval($uid), dbesc($xchan_hash), + intval(($is_http) ? ABOOK_FLAG_FEED : 0), intval($their_perms), intval($my_perms), dbesc(datetime_convert()), diff --git a/include/items.php b/include/items.php index f489eeb0a..7764d2f62 100755 --- a/include/items.php +++ b/include/items.php @@ -1558,7 +1558,7 @@ function get_atom_elements($feed,$item,&$author) { $termurl = unxmlify(substr($scheme,9)); } else { - $termtype = TERM_UNKNOWN; + $termtype = TERM_CATEGORY; } $termterm = notags(trim(unxmlify($term))); diff --git a/include/onepoll.php b/include/onepoll.php index 947e936ac..d64785f92 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -38,7 +38,7 @@ function onepoll_run($argv, $argc){ AND NOT ( abook_flags & %d ) AND (( account_flags = %d ) OR ( account_flags = %d )) limit 1", intval($contact_id), - intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED), + intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED|ABOOK_FLAG_FEED), intval(0), intval(ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_BLOCKED|ABOOK_FLAG_IGNORED), intval(ACCOUNT_OK), @@ -72,6 +72,19 @@ function onepoll_run($argv, $argc){ : datetime_convert('UTC','UTC',$contact['abook_updated'] . ' - 2 days') ); + if($contact['xchan_network'] === 'rss') { + logger('onepoll: processing feed ' . $contact['xchan_name'], LOGGER_DEBUG); + handle_feed($importer['channel_id'],$contact_id,$contact['xchan_hash']); + q("update abook set abook_connected = '%s' where abook_id = %d limit 1", + dbesc(datetime_convert()), + intval($contact['abook_id']) + ); + return; + } + + if($contact['xchan_network'] !== 'zot') + return; + // update permissions $x = zot_refresh($contact,$importer); @@ -130,11 +143,9 @@ function onepoll_run($argv, $argc){ } } - // fetch some items // set last updated timestamp - if($contact['xchan_connurl']) { $r = q("SELECT xlink_id from xlink where xlink_xchan = '%s' and xlink_updated > UTC_TIMESTAMP() - INTERVAL 1 DAY limit 1", diff --git a/include/poller.php b/include/poller.php index 546a2d6d1..52ca98c97 100644 --- a/include/poller.php +++ b/include/poller.php @@ -244,7 +244,7 @@ function poller_run($argv, $argc){ $sql_extra AND (( abook_flags & %d ) OR ( abook_flags = %d )) AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY RAND()", - intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED), + intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED|ABOOK_FLAG_FEED), intval(0), intval(ACCOUNT_OK), intval(ACCOUNT_UNVERIFIED) // FIXME @@ -260,6 +260,19 @@ function poller_run($argv, $argc){ $t = $contact['abook_updated']; $c = $contact['abook_connected']; + if($contact['abook_flags'] & ABOOK_FLAG_FEED) { + $min = intval(get_config('system','minimum_feedcheck_minutes')); + if(! $min) + $min = 60; + $x = datetime_convert('UTC','UTC',"now - $min minutes"); + if($c < $x) { + proc_run('php','include/onepoll.php',$contact['abook_id']); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); + } + continue; + } + if($c == $t) { if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) |