]> git.mxchange.org Git - friendica.git/blobdiff - include/onepoll.php
Merge pull request #663 from fabrixxm/moveme
[friendica.git] / include / onepoll.php
index d819b7f421d9b9d1e7c620a669c2317d606952f6..bd20cfdb5300e5347f82170d4679d1650b9adc59 100644 (file)
@@ -18,7 +18,7 @@ function onepoll_run(&$argv, &$argc){
   
        if(is_null($db)) {
            @include(".htconfig.php");
-       require_once("dba.php");
+       require_once("include/dba.php");
            $db = new dba($db_host, $db_user, $db_pass, $db_data);
        unset($db_host, $db_user, $db_pass, $db_data);
        };
@@ -252,6 +252,9 @@ function onepoll_run(&$argv, &$argc){
 
                $stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
 
+               if($contact['network'] === NETWORK_OSTATUS && get_pconfig($importer_uid,'system','ostatus_autofriend'))
+                       $stat_writeable = 1;
+
                if($stat_writeable != $contact['writable']) {
                        q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
                                intval($stat_writeable),
@@ -328,13 +331,17 @@ function onepoll_run(&$argv, &$argc){
                                                );
 
                                                if(count($r)) {
-                                                       logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'],LOGGER_DEBUG);
-                                                       if($meta->deleted && ! $r[0]['deleted']) {
-                                                               q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
-                                                                       dbesc(datetime_convert()),
-                                                                       intval($r[0]['id'])
-                                                               );
-                                                       }
+                                                       logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
+
+                                                       // Only delete when mails aren't automatically moved or deleted
+                                                       if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
+                                                               if($meta->deleted && ! $r[0]['deleted']) {
+                                                                       q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1",
+                                                                               dbesc(datetime_convert()),
+                                                                               intval($r[0]['id'])
+                                                                       );
+                                                               }
+
                                                        switch ($mailconf[0]['action']) {
                                                                case 0:
                                                                        logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG);
@@ -423,6 +430,7 @@ function onepoll_run(&$argv, &$argc){
                                                        continue;
                                                }
                                                $datarray['body'] = escape_tags($r['body']);
+                                               $datarray['body'] = limit_body_size($datarray['body']);
 
                                                logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']);