X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FEmail.php;h=35f5fdfdd40eed482afacbf7ac08419df4f4e11a;hb=0ec7991a20eafe673e4e8bf77bd32c0f6d047a19;hp=a6bd28f8db66ab1dee80ffb76b61107f02e6f7f8;hpb=ba45e593138badbdfadd500e320ee2cbbc7b1837;p=friendica.git diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index a6bd28f8db..35f5fdfdd4 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -1,6 +1,6 @@ $errors]); + Logger::notice('IMAP Errors occurred', ['errors' => $errors]); } $alerts = imap_alerts(); if (!empty($alerts)) { - Logger::notice('IMAP Alerts occured: ', ['alerts' => $alerts]); + Logger::notice('IMAP Alerts occurred: ', ['alerts' => $alerts]); } return $mbox; @@ -78,21 +78,21 @@ class Email if (!$search1) { $search1 = []; } else { - Logger::notice("Found mails from ".$email_addr); + Logger::debug("Found mails from ".$email_addr); } $search2 = @imap_search($mbox, 'UNDELETED TO "' . $email_addr . '"', SE_UID); if (!$search2) { $search2 = []; } else { - Logger::notice("Found mails to ".$email_addr); + Logger::debug("Found mails to ".$email_addr); } $search3 = @imap_search($mbox, 'UNDELETED CC "' . $email_addr . '"', SE_UID); if (!$search3) { $search3 = []; } else { - Logger::notice("Found mails cc ".$email_addr); + Logger::debug("Found mails cc ".$email_addr); } $res = array_unique(array_merge($search1, $search2, $search3)); @@ -115,13 +115,13 @@ class Email } /** - * @param Connection|resource $mbox mailbox - * @param integer $uid user id + * @param Connection|resource $mbox mailbox + * @param string $sequence * @return mixed */ - public static function messageMeta($mbox, int $uid) + public static function messageMeta($mbox, string $sequence) { - $ret = (($mbox && $uid) ? @imap_fetch_overview($mbox, $uid, FT_UID) : [[]]); // POSSIBLE CLEANUP --> array(array()) is probably redundant now + $ret = (($mbox && $sequence) ? @imap_fetch_overview($mbox, $sequence, FT_UID) : [[]]); // POSSIBLE CLEANUP --> array(array()) is probably redundant now return (count($ret)) ? $ret : []; } @@ -221,7 +221,7 @@ class Email * @param string $subtype sub type * @return string */ - private static function messageGetPart($mbox, int $uid, $p, in $partno, string $subtype): string + private static function messageGetPart($mbox, int $uid, $p, int $partno, string $subtype): string { // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple global $htmlmsg,$plainmsg,$charset,$attachments; @@ -296,6 +296,7 @@ class Email } return $x; } + return ''; } /** @@ -321,7 +322,7 @@ class Email } if ($out_str && $charset) { - // define start delimimter, end delimiter and spacer + // define start delimiter, end delimiter and spacer $end = "?="; $start = "=?" . $charset . "?B?"; $spacer = $end . "\r\n " . $start; @@ -406,37 +407,37 @@ class Email } /** - * Convert iri (?) to message id + * Convert item URI to message id * - * @param string $iri Iri string - * @return string Message it + * @param string $itemUri Item URI + * @return string Message id */ - public static function iri2msgid(string $iri): string + public static function iri2msgid(string $itemUri): string { - $msgid = $iri; + $msgid = $itemUri; - if (!strpos($iri, '@')) { - $msgid = preg_replace("/urn:(\S+):(\S+)\.(\S+):(\d+):(\S+)/i", "urn!$1!$4!$5@$2.$3", $iri); + if (!strpos($itemUri, '@')) { + $msgid = preg_replace("/urn:(\S+):(\S+)\.(\S+):(\d+):(\S+)/i", "urn!$1!$4!$5@$2.$3", $itemUri); } return $msgid; } /** - * Converts message id to iri + * Converts message id to item URI * * @param string $msgid Message id - * @return string Iri + * @return string Item URI */ public static function msgid2iri(string $msgid): string { - $iri = $msgid; + $itemUri = $msgid; if (strpos($msgid, '@')) { - $iri = preg_replace("/urn!(\S+)!(\d+)!(\S+)@(\S+)\.(\S+)/i", "urn:$1:$4.$5:$2:$3", $msgid); + $itemUri = preg_replace("/urn!(\S+)!(\d+)!(\S+)@(\S+)\.(\S+)/i", "urn:$1:$4.$5:$2:$3", $msgid); } - return $iri; + return $itemUri; } /** @@ -569,9 +570,9 @@ class Email * Removes signature from message * * @param string $message Unfiltered message - * @return string Message with no signature + * @return array Message array with no signature (elements "body" and "sig") */ - private static function removeSig(string $message): string + private static function removeSig(string $message): array { $sigpos = strrpos($message, "\n-- \n"); $quotepos = strrpos($message, "[/quote]"); @@ -662,7 +663,7 @@ class Email return implode("\n", $lines); } - private static function convertQuote(strng $body, string $reply): string + private static function convertQuote(string $body, string $reply): string { // Convert Quotes $arrbody = explode("\n", trim($body));