X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=bd20cfdb5300e5347f82170d4679d1650b9adc59;hb=d905f0a3e3001496df120b685b6f2d42cc8598d2;hp=c493aff76270e12a96e9ce1569e4a9a54c979aa9;hpb=0a29927e6d15fe77786b9f6e9dbb4b8ac8b83ab2;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index c493aff762..bd20cfdb53 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -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); @@ -398,14 +405,15 @@ function onepoll_run(&$argv, &$argc){ // Is it a reply? $reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or (substr(strtolower($datarray['title']), 0, 3) == "re-") or - (raw_refs != "")); + ($raw_refs != "")); // Remove Reply-signs in the subject $datarray['title'] = RemoveReply($datarray['title']); // If it seems to be a reply but a header couldn't be found take the last message with matching subject if(!x($datarray,'parent-uri') and $reply) { - $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1", + //$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE MATCH (`title`) AGAINST ('".'"%s"'."' IN BOOLEAN MODE) AND `uid` = %d ORDER BY `created` DESC LIMIT 1", + $r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d ORDER BY `created` DESC LIMIT 1", dbesc(protect_sprintf($datarray['title'])), intval($importer_uid)); if(count($r)) @@ -422,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']);