]> git.mxchange.org Git - friendica.git/blobdiff - include/onepoll.php
Merge branch 'master' of https://github.com/friendica/friendica
[friendica.git] / include / onepoll.php
index 722ebe846b56e4496bce873e9f9e0d69651100aa..a64922aa323e808576df96416335eaec910622ca 100644 (file)
@@ -25,6 +25,7 @@ function onepoll_run($argv, $argc){
        require_once('include/email.php');
        require_once('include/socgraph.php');
        require_once('include/pidfile.php');
+       require_once('include/queue_fn.php');
 
        load_config('config');
        load_config('system');
@@ -54,6 +55,9 @@ function onepoll_run($argv, $argc){
                return;
        }
 
+       if(was_recently_delayed($contact_id))
+               return;
+
        $d = datetime_convert();
 
        // Only poll from those with suitable relationships,
@@ -152,7 +156,7 @@ function onepoll_run($argv, $argc){
                                intval($contact['id'])
                        );
 
-                       continue;
+                       return;
                }
 
                if(! strstr($handshake_xml,'<?xml')) {
@@ -161,7 +165,7 @@ function onepoll_run($argv, $argc){
                                dbesc(datetime_convert()),
                                intval($contact['id'])
                        );
-                       continue;
+                       return;
                }
 
 
@@ -188,7 +192,7 @@ function onepoll_run($argv, $argc){
                }
 
                if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
-                       continue;
+                       return;
 
                if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
                        q("update contact set poco = '%s' where id = %d limit 1",
@@ -221,7 +225,7 @@ function onepoll_run($argv, $argc){
                if($final_dfrn_id != $orig_id) {
                        logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);    
                        // did not decode properly - cannot trust this site 
-                       continue;
+                       return;
                }
 
                $postvars['dfrn_id'] = $idtosend;
@@ -251,7 +255,7 @@ function onepoll_run($argv, $argc){
                // Are we allowed to import from this person?
 
                if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly'])
-                       continue;
+                       return;
 
                $xml = fetch_url($contact['poll']);
        }
@@ -261,7 +265,7 @@ function onepoll_run($argv, $argc){
 
                $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
                if($mail_disabled)
-                       continue;
+                       return;
 
                logger("onepoll: Mail: Enabled", LOGGER_DEBUG);
 
@@ -452,13 +456,13 @@ function onepoll_run($argv, $argc){
 
        if($xml) {
                logger('poller: received xml : ' . $xml, LOGGER_DATA);
-                       if(! strstr($xml,'<?xml')) {
+                       if((! strstr($xml,'<?xml')) && (! strstr($xml,'<rss'))) {
                        logger('poller: post_handshake: response from ' . $url . ' did not contain XML.');
                        $r = q("UPDATE `contact` SET `last-update` = '%s' WHERE `id` = %d LIMIT 1",
                                dbesc(datetime_convert()),
                                intval($contact['id'])
                        );
-                       continue;
+                       return;
                }
 
 
@@ -506,7 +510,7 @@ function onepoll_run($argv, $argc){
        }
        if(count($r)) {
                if(! $r[0]['total']) {
-                       poco_load($contact['id'],$importer_uid,$contact['poco']);
+                       poco_load($contact['id'],$importer_uid,0,$contact['poco']);
                }
        }