diff options
author | thomascube <thomas@roundcube.net> | 2007-12-10 15:27:19 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-12-10 15:27:19 +0000 |
commit | fba1f5ab813f2eb4bedc5d9c4a75e77bbaa90131 (patch) | |
tree | cebde4edb06ac3a87eb2306b0c0125610a1bd5ce /program/lib | |
parent | d39eecad6db1caee97624b80634587d98a75e701 (diff) |
New class rcube_user + send message disposition notification
Diffstat (limited to 'program/lib')
-rw-r--r-- | program/lib/imap.inc | 82 | ||||
-rw-r--r-- | program/lib/rc_mail_mime.inc | 28 |
2 files changed, 80 insertions, 30 deletions
diff --git a/program/lib/imap.inc b/program/lib/imap.inc index fef0b8b5d..c5940773d 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -1255,6 +1255,7 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ $result[$id]=new iilBasicHeader; $result[$id]->id = $id; $result[$id]->subject = ""; + $result[$id]->messageID = "mid:".$id; /* Start parsing headers. The problem is, some header "lines" take up multiple lines. So, we'll read ahead, and if the one we're reading now is a valid header, we'll @@ -1293,38 +1294,63 @@ function iil_C_FetchHeaders(&$conn, $mailbox, $message_set, $uidfetch=false){ } // create array with header field:data - $headers = array(); while ( list($lines_key, $str) = each($lines) ){ list($field, $string) = iil_SplitHeaderLine($str); $field = strtolower($field); - $headers[$field] = $string; - } - $result[$id]->date = $headers["date"]; - $result[$id]->timestamp = iil_StrToTime($headers["date"]); - $result[$id]->from = $headers["from"]; - $result[$id]->to = str_replace("\n", " ", $headers["to"]); - $result[$id]->subject = str_replace("\n", "", $headers["subject"]); - $result[$id]->replyto = str_replace("\n", " ", $headers["reply-to"]); - $result[$id]->cc = str_replace("\n", " ", $headers["cc"]); - $result[$id]->bcc = str_replace("\n", " ", $headers["bcc"]); - $result[$id]->encoding = str_replace("\n", " ", $headers["content-transfer-encoding"]); - $result[$id]->ctype = str_replace("\n", " ", $headers["content-type"]); - $result[$id]->in_reply_to = ereg_replace("[\n<>]",'', $headers['in-reply-to']); - $result[$id]->references = $headers["references"]; - $result[$id]->mdn_to = $headers["disposition-notification-to"]; - - list($result[$id]->ctype, $ctype_add) = explode(";", $headers["content-type"]); - - if (preg_match('/charset="?([a-z0-9\-]+)"?/i', $ctype_add, $regs)) - $result[$id]->charset = $regs[1]; - - $messageID = $headers["message-id"]; - if (!$messageID) "mid:".$id; - $result[$id]->messageID = $messageID; + + switch ($field){ + case 'date'; + $result[$id]->date = $string; + $result[$id]->timestamp = iil_StrToTime($string); + break; + case 'from': + $result[$id]->from = $string; + break; + case 'to': + $result[$id]->to = str_replace("\n", " ", $string); + break; + case 'subject': + $result[$id]->subject = str_replace("\n", "", $string); + break; + case 'reply-to': + $result[$id]->replyto = str_replace("\n", " ", $string); + break; + case 'cc': + $result[$id]->cc = str_replace("\n", " ", $string); + break; + case 'bcc': + $result[$id]->bcc = str_replace("\n", " ", $string); + break; + case 'content-transfer-encoding': + $result[$id]->encoding = str_replace("\n", " ", $string); + break; + case 'content-type': + $ctype_parts = explode(";", $string); + $result[$id]->ctype = array_shift($ctype_parts); + foreach ($ctype_parts as $ctype_add) + if (preg_match('/charset="?([a-z0-9\-]+)"?/i', $ctype_add, $regs)) + $result[$id]->charset = $regs[1]; + break; + case 'in-reply-to': + $result[$id]->in_reply_to = ereg_replace("[\n<>]", '', $string); + break; + case 'references': + $result[$id]->references = $string; + break; + case 'return-receipt-to': + case 'disposition-notification-to': + case 'x-confirm-reading-to': + $result[$id]->mdn_to = str_replace("\n", " ", $string); + break; + case 'message-id': + $result[$id]->messageID = $string; + break; + } } - else { - $a=explode(" ", $line); - } + } + else { + $a=explode(" ", $line); + } } }while(strcmp($a[0], $key)!=0); diff --git a/program/lib/rc_mail_mime.inc b/program/lib/rc_mail_mime.inc index 12d80bbfb..ca4d0bf93 100644 --- a/program/lib/rc_mail_mime.inc +++ b/program/lib/rc_mail_mime.inc @@ -25,6 +25,14 @@ require_once('Mail/mime.php'); class rc_mail_mime extends Mail_mime { + /** + * Set build parameters + */ + function setParam($param) + { + if (is_array($param)) + $this->_build_params = array_merge($this->_build_params, $param); + } /** * Adds an image to the list of embedded images. @@ -63,7 +71,7 @@ class rc_mail_mime extends Mail_mime return true; } - + /** * returns the HTML body portion of the message @@ -77,6 +85,22 @@ class rc_mail_mime extends Mail_mime /** + * Creates a new mimePart object, using multipart/mixed as + * the initial content-type and returns it during the + * build process. + * + * @return object The multipart/mixed mimePart object + * @access private + */ + function &_addMixedPart() + { + $params['content_type'] = $this->_headers['Content-Type'] ? $this->_headers['Content-Type'] : 'multipart/mixed'; + $ret = new Mail_mimePart('', $params); + return $ret; + } + + + /** * Encodes a header as per RFC2047 * * @param array $input The header data to encode @@ -138,7 +162,7 @@ class rc_mail_mime extends Mail_mime // add chunk to output string by regarding the header maxlen $len = strlen($value); - if ($line_len + $len < $maxlen) + if ($i == 0 || $line_len + $len < $maxlen) { $hdr_value .= ($i>0?', ':'') . $value; $line_len += $len + ($i>0?2:0); |