X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=f66a48dd46a6d4c831ecafe6f5160b466f9c51e8;hb=39d8fec290613cac87c2821b9f7b20fa94d319ca;hp=1e11f2ca1e8ffc8e63753aedc5060f81f3c2470c;hpb=fc816feb6d1b04e19dbcbab14c6bc590871f2b64;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index 1e11f2ca1e..f66a48dd46 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), @@ -335,7 +338,7 @@ function onepoll_run(&$argv, &$argc){ intval($r[0]['id']) ); } - /*switch ($mailconf[0]['action']) { + switch ($mailconf[0]['action']) { case 0: logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user'].". Doing nothing.", LOGGER_DEBUG); break; @@ -353,7 +356,7 @@ function onepoll_run(&$argv, &$argc){ if ($mailconf[0]['movetofolder'] != "") imap_mail_move($mbox, $msg_uid, $mailconf[0]['movetofolder'], FT_UID); break; - }*/ + } continue; } @@ -398,15 +401,17 @@ 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) ORDER BY `created` DESC LIMIT 1", - dbesc(protect_sprintf($datarray['title']))); + //$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)) $datarray['parent-uri'] = $r[0]['parent-uri']; } @@ -436,7 +441,29 @@ function onepoll_run(&$argv, &$argc){ else $fromdecoded .= $frompart->text; - $datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body']; + $fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname()); + + $frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host; + + if (isset($fromarr[0]->personal)) + $fromname = $fromarr[0]->personal; + else + $fromname = $frommail; + + //$datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body']; + + $datarray['author-name'] = $fromname; + $datarray['author-link'] = "mailto:".$frommail; + $datarray['author-avatar'] = $contact['photo']; + + $datarray['owner-name'] = $contact['name']; + $datarray['owner-link'] = "mailto:".$contact['addr']; + $datarray['owner-avatar'] = $contact['photo']; + + } else { + $datarray['author-name'] = $contact['name']; + $datarray['author-link'] = 'mailbox'; + $datarray['author-avatar'] = $contact['photo']; } $datarray['uid'] = $importer_uid; @@ -447,9 +474,6 @@ function onepoll_run(&$argv, &$argc){ $datarray['private'] = 1; $datarray['allow_cid'] = '<' . $contact['id'] . '>'; } - $datarray['author-name'] = $contact['name']; - $datarray['author-link'] = 'mailbox'; - $datarray['author-avatar'] = $contact['photo']; $stored_item = item_store($datarray); q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d",