]> git.mxchange.org Git - friendica.git/blobdiff - include/poller.php
Merge branch 'pull'
[friendica.git] / include / poller.php
old mode 100755 (executable)
new mode 100644 (file)
index 8262c1d..499483d
@@ -25,10 +25,20 @@ function poller_run($argv, $argc){
        require_once('include/Contact.php');
        require_once('include/email.php');
        require_once('include/socgraph.php');
+       require_once('include/pidfile.php');
 
        load_config('config');
        load_config('system');
 
+       $lockpath = get_config('system','lockpath');
+       if ($lockpath != '') {
+               $pidfile = new pidfile($lockpath, 'poller.lck');
+               if($pidfile->is_already_running()) {
+                       logger("poller: Already running");
+                       exit;
+               }
+       }
+
        $a->set_baseurl(get_config('system','url'));
 
        load_hooks();
@@ -504,7 +514,12 @@ function poller_run($argv, $argc){
                                                        //$datarray['title'] = notags(trim($meta->subject));
                                                        $datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
 
-                                                       $r = email_get_msg($mbox,$msg_uid);
+                                                       // Is it  reply?
+                                                       $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
+                                                               (substr(strtolower($datarray['title']), 0, 3) == "re-") or
+                                                               (raw_refs != ""));
+
+                                                       $r = email_get_msg($mbox,$msg_uid, $reply);
                                                        if(! $r) {
                                                                logger("Mail: can't fetch msg ".$msg_uid);
                                                                continue;