Source for file Message.class.php
Documentation is available at Message.class.php
* This file contains functions needed to handle mime messages.
* @copyright © 2003-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: Message.class.php,v 1.38 2006/07/15 12:00:44 tokul Exp $
* The object that contains a message.
* message is the object that contains messages. It is a recursive object in
* that through the $entities variable, it can contain more objects of type
* message. See documentation in mime.txt for a better description of how this
* Message \answered status
* Message \deleted status
* Message \flagged status
* for fetching body parts out of raw messages
* for fetching body parts out of raw messages
* Local attachment filename location where the tempory attachment is
* stored. For use in delivery class.
* @param string $ent entity id
* Add nested message part
* Get file name used for mime part
* @return string file name
$filename =
$header->disposition->getProperty('filename');
if (trim($filename) ==
'') {
$name =
decodeHeader($header->disposition->getProperty('name'));
$name =
$header->getParameter('name');
if (!trim( $header->id )) {
$filename =
'untitled-[' .
$this->entity_id .
']' ;
$filename =
'cid: ' .
$header->id;
$filename =
$header->getParameter('filename');
$filename =
$header->getParameter('name');
if (!trim( $header->id )) {
$filename =
'untitled-[' .
$this->entity_id .
']' ;
$filename =
'cid: ' .
$header->id;
* Add header object to message object.
* WARNING: Unfinished code. Don't expect it to work in older sm versions.
* @param mixed $read array or string with message headers
* @todo FIXME: rfc822header->parseHeader() does not return rfc822header object
* @return mixed (object or string?)
if (($cur_ent ==
'') ||
($cur_ent ==
'0')) {
for ($i =
0,$entCount =
count($ent_a) -
1; $i <
$entCount; ++
$i) {
if (isset
($cur_ent_a[$i]) &&
($cur_ent_a[$i] !=
$ent_a[$i])) {
$cur_ent_a =
explode('.', $msg->entity_id);
} else if (!isset
($cur_ent_a[$i])) {
if (isset
($msg->entities[($ent_a[$i]-
1)])) {
$msg =
$msg->entities[($ent_a[$i]-
1)];
$msg =
$msg->entities[0];
if (($msg->type0 ==
'message') &&
($msg->type1 ==
'rfc822')) {
/*this is a header for a message/rfc822 entity */
$msg =
$msg->entities[0];
if (($msg->type0 ==
'message') &&
($msg->type1 ==
'rfc822')) {
/*this is a header for a message/rfc822 entity */
$msg =
$msg->entities[0];
if (isset
($msg->entities[($ent_a[$entCount])-
1])) {
if (is_object($msg->entities[($ent_a[$entCount])-
1])) {
$msg =
$msg->entities[($ent_a[$entCount]-
1)];
* @param string $s message body
foreach ($msg->entities as $m) {
* Bodystructure parser, a recursive function for generating the
* entity-tree with all the mime-parts.
* It follows RFC2060 and stores all the described fields in the
* Ask for me (Marc Groot Koerkamp, stekkel@users.sourceforge.net)
* @return object Message object
* @todo define argument and return types
if($msg) $msg->setEntIds($msg,false,0);
$iCnt =
count($msg->entities);
if ($msg->parent->type0 ==
'message' &&
$msg->parent->type1 ==
'rfc822' &&
$msg->type0 ==
'multipart') {
$msg->entity_id =
"$init.$iEntSub";
$msg->entity_id =
$iEntSub;
for ($i=
0;$i<
$iCnt;++
$i) {
$msg->entities[$i]->parent =
& $msg;
if (strrchr($msg->entity_id, '.') !=
'.0') {
$msg->entities[$i]->setEntIds($msg->entities[$i],$msg->entity_id,$i);
$msg->entities[$i]->setEntIds($msg->entities[$i],$msg->parent->entity_id,$i);
* @return object Message object
* @since 1.4.0 (code was part of parseStructure() in 1.3.x)
for ($cnt =
strlen($read); $i <
$cnt; ++
$i) {
$hdr->encoding =
'us-ascii';
$msg->header->type0 =
'multipart';
$msg->type0 =
'multipart';
while ($read{$i} ==
'(') {
$msg->addEntity($msg->parseBodyStructure($read, $i, $msg));
/* multipart properties */
$arg_a[] =
$msg->parseProperties($read, $i);
if (isset
($msg->type0) &&
($msg->type0 ==
'multipart')) {
$arg_a[] =
$msg->parseDisposition($read, $i);
} else { /* properties */
$arg_a[] =
$msg->parseProperties($read, $i);
if (isset
($msg->type0) &&
($msg->type0 ==
'multipart')) {
$arg_a[]=
$msg->parseLanguage($read, $i);
if (($arg_a[0] ==
'message') &&
($arg_a[1] ==
'rfc822')) {
$msg->header->type0 =
$arg_a[0];
$msg->header->type1 =
$arg_a[1];
$msg->rfc822_header =
$msg->parseEnvelope($read, $i, $rfc822_hdr);
while (($i <
$cnt) &&
($read{$i} !=
'(')) {
$msg->addEntity($msg->parseBodyStructure($read, $i,$msg));
$arg_a[] =
$msg->parseDisposition($read, $i);
if (($arg_a[0] ==
'text') ||
(($arg_a[0] ==
'message') &&
($arg_a[1] ==
'rfc822'))) {
$arg_a[] =
$msg->parseDisposition($read, $i);
$arg_a[] =
$msg->parseLanguage($read, $i);
if (($arg_a[0] ==
'text') ||
(($arg_a[0] ==
'message') &&
($arg_a[1] ==
'rfc822'))) {
$arg_a[] =
$msg->parseLanguage($read, $i);
$i =
$msg->parseParenthesis($read, $i);
$arg_a[] =
''; /* not yet described in rfc2060 */
/* unknown argument, skip this part */
$i =
$msg->parseParenthesis($read, $i);
/* inside an entity -> start processing */
$arg_s =
$msg->parseQuote($read, $i);
$arg_s =
strtolower($arg_s); /* type0 and type1 */
/* probably NIL argument */
if ($tmpnil ==
'NIL ' ||
$tmpnil ==
'NIL)') {
/* process the literal value */
$arg_a[] =
$msg->parseLiteral($read, $i);
if ($read{$i} ==
' ') { break; }
- <