6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * This implements functions that manipulate messages
14 /* Copies specified messages to specified folder */
15 function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
16 $read = sqimap_run_command ($imap_stream, "COPY $start:$end \"$mailbox\"", true, $response, $message);
19 /* Deletes specified messages and moves them to trash if possible */
20 function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
21 global $move_to_trash, $trash_folder, $auto_expunge;
23 if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
24 sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
26 sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
29 /* Sets the specified messages with specified flag */
30 function sqimap_messages_flag ($imap_stream, $start, $end, $flag) {
31 $read = sqimap_run_command ($imap_stream, "STORE $start:$end +FLAGS (\\$flag)", true, $response, $message);
34 /* Remove specified flag from specified messages */
35 function sqimap_messages_remove_flag ($imap_stream, $start, $end, $flag) {
36 $read = sqimap_run_command ($imap_stream, "STORE $start:$end -FLAGS (\\$flag)", true, $response, $message);
39 /* Returns some general header information -- FROM, DATE, and SUBJECT */
41 var $from = '', $subject = '', $date = '', $to = '',
42 $priority = 0, $message_id = 0, $cc = '';
45 function sqimap_get_small_header ($imap_stream, $id, $sent) {
46 $res = sqimap_get_small_header_list($imap_stream, array($id), $sent);
51 * Sort the message list and crunch to be as small as possible
52 * (overflow could happen, so make it small if possible)
54 function sqimap_message_list_squisher($messages_array) {
55 if( !is_array( $messages_array ) ) {
58 sort($messages_array, SORT_NUMERIC
);
60 while ($messages_array) {
61 $start = array_shift($messages_array);
63 while (isset($messages_array[0]) && $messages_array[0] == $end +
1) {
64 $end = array_shift($messages_array);
66 if ($msgs_str != '') {
71 $msgs_str .= ':' . $end;
78 /* returns the references header lines */
79 function get_reference_header ($imap_stream, $message) {
80 $responses = array ();
81 $sid = sqimap_session_id();
84 $query = "$sid FETCH $message BODY[HEADER.FIELDS (References)]\r\n";
85 fputs ($imap_stream, $query);
86 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
87 if (!eregi("^\\* ([0-9]+) FETCH", $responses[0][0], $regs)) {
88 $responses = array ();
94 /* get sort order from server and
95 * return it as the $id array for
99 function sqimap_get_sort_order ($imap_stream, $sort) {
100 global $default_charset, $thread_sort_messages,
101 $internal_date_sort, $server_sort_array,
102 $sent_folder, $mailbox;
104 if (session_is_registered('server_sort_array')) {
105 session_unregister('server_sort_array');
108 $qty = sqimap_get_num_messages ($imap_stream, $mailbox);
109 $server_sort_array = range(1, $qty);
110 session_register('server_sort_array');
111 return $server_sort_array;
113 $sid = sqimap_session_id();
116 $server_sort_array = array();
117 $sort_test = array();
119 $sort_on = array (0=> 'DATE',
125 if ($internal_date_sort == true) {
126 $sort_on[0] = 'ARRIVAL';
127 $sort_on[1] = 'ARRIVAL';
129 if ($sent_folder == $mailbox) {
133 if (!empty($sort_on[$sort])) {
134 $sort_query = "$sid SORT ($sort_on[$sort]) ".strtoupper($default_charset)." ALL\r\n";
135 fputs($imap_stream, $sort_query);
136 $sort_test = sqimap_read_data($imap_stream, $sid, false, $response, $message);
138 if (isset($sort_test[0])) {
139 if (preg_match("/^\* SORT (.+)$/", $sort_test[0], $regs)) {
140 $server_sort_array = preg_split("/ /", trim($regs[1]));
143 if ($sort == 0 ||
$sort == 2 ||
$sort == 4) {
144 $server_sort_array = array_reverse($server_sort_array);
146 if (!preg_match("/OK/", $response)) {
147 $server_sort_array = 'no';
149 session_register('server_sort_array');
150 return $server_sort_array;
153 /* returns an indent array for printMessageinfo()
154 this represents the amount of indent needed (value)
155 for this message number (key)
158 function get_parent_level ($imap_stream) {
159 global $sort_by_ref, $default_charset, $thread_new;
164 /* loop through the threads and take unwanted characters out
165 of the thread string then chop it up
167 for ($i=0;$i<count($thread_new);$i++
) {
168 $thread_new[$i] = preg_replace("/\s\(/", "(", $thread_new[$i]);
169 $thread_new[$i] = preg_replace("/(\d+)/", "$1|", $thread_new[$i]);
170 $thread_new[$i] = preg_split("/\|/", $thread_new[$i], -1, PREG_SPLIT_NO_EMPTY
);
172 $indent_array = array();
174 $thread_new = array();
176 /* looping through the parts of one message thread */
178 for ($i=0;$i<count($thread_new);$i++
) {
179 /* first grab the parent, it does not indent */
181 if (isset($thread_new[$i][0])) {
182 if (preg_match("/(\d+)/", $thread_new[$i][0], $regs)) {
186 $indent_array[$parent] = 0;
188 /* now the children, checking each thread portion for
189 ),(, and space, adjusting the level and space values
190 to get the indent level
197 for ($k=1;$k<(count($thread_new[$i]))-1;$k++
) {
198 $chars = count_chars($thread_new[$i][$k], 1);
199 if (isset($chars['40'])) { /* testing for ( */
200 $level = $level +
$chars['40'];
202 if (isset($chars['41'])) { /* testing for ) */
203 $level = $level - $chars['41'];
205 /* if we were faking lets stop, this portion
206 of the thread is over
208 if ($level == $cutoff) {
212 if (isset($chars['32'])) { /* testing for space */
213 if (!isset($spaces[$level])) {
216 $spaces[$level] = $spaces[$level] +
$chars['32'];
218 for ($x=0;$x<=$level;$x++
) {
219 if (isset($spaces[$x])) {
220 $spaces_total = $spaces_total +
$spaces[$x];
223 $indent = $level +
$spaces_total;
224 /* must have run into a message that broke the thread
225 so we are adjusting for that portion
228 $indent = $indent +
1;
230 if (preg_match("/(\d+)/", $thread_new[$i][$k], $regs)) {
233 /* the thread must be broken if $indent == 0
234 so indent the message once and start faking it
241 /* dont need abs but if indent was negative
244 $indent_array[$child] = abs($indent);
248 return $indent_array;
252 /* returns an array with each element as a string
253 representing one message thread as returned by
257 function get_thread_sort ($imap_stream) {
258 global $thread_new, $sort_by_ref, $default_charset, $server_sort_array;
259 if (session_is_registered('thread_new')) {
260 session_unregister('thread_new');
262 if (session_is_registered('server_sort_array')) {
263 session_unregister('server_srot_array');
265 $sid = sqimap_session_id();
266 $thread_temp = array ();
267 if ($sort_by_ref == 1) {
268 $sort_type = 'REFERENCES';
271 $sort_type = 'ORDEREDSUBJECT';
273 $thread_query = "$sid THREAD $sort_type ".strtoupper($default_charset)." ALL\r\n";
274 fputs($imap_stream, $thread_query);
275 $thread_test = sqimap_read_data($imap_stream, $sid, false, $response, $message);
276 if (isset($thread_test[0])) {
277 if (preg_match("/^\* THREAD (.+)$/", $thread_test[0], $regs)) {
278 $thread_list = trim($regs[1]);
284 if (!preg_match("/OK/", $response)) {
285 $server_sort_array = 'no';
286 return $server_sort_array;
288 if (isset($thread_list)) {
289 $thread_temp = preg_split("//", $thread_list, -1, PREG_SPLIT_NO_EMPTY
);
291 $char_count = count($thread_temp);
293 $thread_new = array();
296 for ($i=0;$i<$char_count;$i++
) {
297 if ($thread_temp[$i] != ')' && $thread_temp[$i] != '(') {
298 $thread_new[$k] = $thread_new[$k] . $thread_temp[$i];
300 elseif ($thread_temp[$i] == '(') {
301 $thread_new[$k] .= $thread_temp[$i];
304 elseif ($thread_temp[$i] == ')') {
306 $thread_new[$k] .= $thread_temp[$i];
307 $counter = $counter - 1;
310 $thread_new[$k] .= $thread_temp[$i];
312 $thread_new[$k] = "";
313 $counter = $counter - 1;
317 session_register('thread_new');
318 $thread_new = array_reverse($thread_new);
319 $thread_list = implode(" ", $thread_new);
320 $thread_list = str_replace("(", " ", $thread_list);
321 $thread_list = str_replace(")", " ", $thread_list);
322 $thread_list = preg_split("/\s/", $thread_list, -1, PREG_SPLIT_NO_EMPTY
);
323 $server_sort_array = $thread_list;
324 session_register('server_sort_array');
328 function elapsedTime($start) {
329 $stop = gettimeofday();
330 $timepassed = 1000000 * ($stop['sec'] - $start['sec']) +
$stop['usec'] - $start['usec'];
335 function sqimap_get_small_header_list ($imap_stream, $msg_list, $issent) {
336 global $squirrelmail_language, $color, $data_dir, $username;
337 $start = gettimeofday();
338 /* Get the small headers for each message in $msg_list */
339 $sid = sqimap_session_id();
340 $maxmsg = sizeof($msg_list);
341 $msgs_str = sqimap_message_list_squisher($msg_list);
343 $read_list = array();
345 * We need to return the data in the same order as the caller supplied
346 * in $msg_list, but IMAP servers are free to return responses in
347 * whatever order they wish... So we need to re-sort manually
349 for ($i = 0; $i < sizeof($msg_list); $i++
) {
350 $id2index[$msg_list[$i]] = $i;
353 $internaldate = getPref($data_dir, $username, 'internal_date_sort');
355 $query = "$sid FETCH $msgs_str (FLAGS RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject X-Priority Content-Type)])\r\n";
357 $query = "$sid FETCH $msgs_str (FLAGS RFC822.SIZE BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject X-Priority Content-Type)])\r\n";
359 fputs ($imap_stream, $query);
360 $readin_list = sqimap_read_data_list($imap_stream, $sid, true, $response, $message);
362 foreach ($readin_list as $r) {
363 if (!preg_match("/^\\*\s+([0-9]+)\s+FETCH/iAU",$r[0], $regs)) {
364 set_up_language($squirrelmail_language);
365 echo '<br><b><font color=$color[2]>' .
366 _("ERROR : Could not complete request.") .
368 _("Unknown response from IMAP server: ") . ' 1.' .
369 $r[0] . "</font><br>\n";
371 } else if (! isset($id2index[$regs[1]]) ||
!count($id2index[$regs[1]])) {
372 set_up_language($squirrelmail_language);
373 echo '<br><b><font color=$color[2]>' .
374 _("ERROR : Could not complete request.") .
376 _("Unknown message number in reply from server: ") .
377 $regs[1] . "</font><br>\n";
379 $read_list[$id2index[$regs[1]]] = $r;
387 "/^X-Priority:(.*)\$/AU",
390 "/^Subject:(.*)\$/AU",
391 "/^Content-Type:(.*)\$/AU"
395 for ($msgi = 0; $msgi < $maxmsg; $msgi++
) {
396 $subject = _("(no subject)");
397 $from = _("Unknown Sender");
407 $flag_answered = false;
408 $flag_deleted = false;
409 $flag_flagged = false;
410 $read = $read_list[$msgi];
413 foreach ($read as $read_part) {
414 //unfold multi-line headers
415 while ($prevline && strspn($read_part, "\t ") > 0) {
416 $read_part = substr($prevline, 0, -2) . ' ' . ltrim($read_part);
418 $prev_line = $read_part;
420 if ($read_part{0} == '*') {
422 if (preg_match ("/^.+INTERNALDATE\s+\"(.+)\".+/iUA",$read_part, $reg)) {
426 if (preg_match ("/^.+RFC822.SIZE\s+(\d+).+/iA",$read_part, $reg)) {
429 if (preg_match("/^.+FLAGS\s+\((.*)\).+/iUA", $read_part, $regs)) {
430 $flags = explode(' ',trim($regs[1]));
431 foreach ($flags as $flag) {
432 $flag = strtolower($flag);
433 if ($flag == '\\seen') {
435 } else if ($flag == '\\answered') {
436 $flag_answered = true;
437 } else if ($flag == '\\deleted') {
438 $flag_deleted = true;
439 } else if ($flag == '\\flagged') {
440 $flag_flagged = true;
445 $firstchar = $read_part{0};
446 if ($firstchar == 'T') {
447 $regpattern = $patterns[0];
449 } else if ($firstchar == 'F') {
450 $regpattern = $patterns[1];
452 } else if ($firstchar == 'X') {
453 $regpattern = $patterns[2];
455 } else if ($firstchar == 'C') {
456 if (strtolower($read_part{1}) == 'c') {
457 $regpattern = $patterns[3];
459 } else if (strtolower($read_part{1}) == 'o') {
460 $regpattern = $patterns[6];
463 } else if ($firstchar == 'D' && !$internaldate ) {
464 $regpattern = $patterns[4];
466 } else if ($firstchar == 'S') {
467 $regpattern = $patterns[5];
469 } else $regpattern = '';
472 if (preg_match ($regpattern, $read_part, $regs)) {
481 $priority = $regs[1];
490 $subject = htmlspecialchars(trim($regs[1]));
491 if ($subject == "") {
492 $subject = _("(no subject)");
496 $type = strtolower(trim($regs[1]));
497 if ($pos = strpos($type, ";")) {
498 $type = substr($type, 0, $pos);
500 $type = explode("/", $type);
501 if (!isset($type[1])) {
513 $header = new small_header
;
515 $header->from
= (trim($to) != '' ?
$to : '(' ._("No To Address") . ')');
517 $header->from
= $from;
520 $header->date
= $date;
521 $header->subject
= $subject;
523 $header->priority
= $priority;
524 $header->message_id
= $messageid;
526 $header->size
= $size;
527 $header->type0
= $type[0];
528 $header->type1
= $type[1];
529 $header->flag_seen
= $flag_seen;
530 $header->flag_answered
= $flag_answered;
531 $header->flag_deleted
= $flag_deleted;
532 $header->flag_flagged
= $flag_flagged;
533 $header->inrepto
= $inrepto;
536 // echo 'processtime (us): ' . elapsedtime($start) .'<BR>';
543 /* Returns the flags for the specified messages */
544 function sqimap_get_flags ($imap_stream, $i) {
545 $read = sqimap_run_command ($imap_stream, "FETCH $i:$i FLAGS", true, $response, $message);
546 if (ereg('FLAGS(.*)', $read[0], $regs)) {
547 return explode(' ', trim(ereg_replace('[\\(\\)\\\\]', '', $regs[1])));
549 return array('None');
552 function sqimap_get_flags_list ($imap_stream, $msg_list) {
553 $msgs_str = sqimap_message_list_squisher($msg_list);
554 for ($i = 0; $i < sizeof($msg_list); $i++
) {
555 $id2index[$msg_list[$i]] = $i;
557 $result_list = sqimap_run_command_list ($imap_stream, "FETCH $msgs_str FLAGS", true, $response, $message);
558 $result_flags = array();
560 for ($i = 0; $i < sizeof($result_list); $i++
) {
561 if (eregi('^\* ([0-9]+).*FETCH.*FLAGS(.*)', $result_list[$i][0], $regs)
562 && isset($id2index[$regs[1]]) && count($id2index[$regs[1]])) {
563 $result_flags[$id2index[$regs[1]]] = explode(" ", trim(ereg_replace('[\\(\\)\\\\]', '', $regs[2])));
565 set_up_language($squirrelmail_language);
566 echo "<br><b><font color=$color[2]>\n" .
567 _("ERROR : Could not complete request.") .
569 _("Unknown response from IMAP server: ") .
570 $result_list[$i][0] . "</font><br>\n";
574 arsort($result_flags);
575 return $result_flags;
579 * Returns a message array with all the information about a message.
580 * See the documentation folder for more information about this array.
582 function sqimap_get_message ($imap_stream, $id, $mailbox) {
583 $header = sqimap_get_message_header($imap_stream, $id, $mailbox);
584 return sqimap_get_message_body($imap_stream, $header);
587 /* Wrapper function that reformats the header information. */
588 function sqimap_get_message_header ($imap_stream, $id, $mailbox) {
589 $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[HEADER]", true, $response, $message);
590 $header = sqimap_get_header($imap_stream, $read);
592 $header->mailbox
= $mailbox;
596 /* Wrapper function that reformats the entity header information. */
597 function sqimap_get_ent_header ($imap_stream, $id, $mailbox, $ent) {
598 $read = sqimap_run_command ($imap_stream, "FETCH $id:$id BODY[$ent.HEADER]", true, $response, $message);
599 $header = sqimap_get_header($imap_stream, $read);
601 $header->mailbox
= $mailbox;
606 /* Wrapper function that returns entity headers for use by decodeMime */
608 function sqimap_get_entity_header ($imap_stream, &$read, &$type0, &$type1, &$bound, &$encoding, &$charset, &$filename) {
609 $header = sqimap_get_header($imap_stream, $read);
610 $type0 = $header["TYPE0"];
611 $type1 = $header["TYPE1"];
612 $bound = $header["BOUNDARY"];
613 $encoding = $header["ENCODING"];
614 $charset = $header["CHARSET"];
615 $filename = $header["FILENAME"];
618 /* Queries the IMAP server and gets all header information. */
619 function sqimap_get_header ($imap_stream, $read) {
620 global $where, $what;
622 $hdr = new msg_header();
625 /* Set up some defaults */
626 $hdr->type0
= "text";
627 $hdr->type1
= "plain";
628 $hdr->charset
= "us-ascii";
630 $read_fold = array();
632 while ($i < count($read)) {
633 /* unfold multi-line headers */
634 /* remember line for to, cc and bcc */
635 $read_fold[] = $read[$i];
637 while (($i +
1 < count($read)) && (strspn($read[$i +
1], "\t ") > 0) ) {
638 if ($read[$i+
1] != '') $read_fold[] = $read[$i+
1];
639 $read[$i +
1] = substr($read[$i], 0, -2) . ' ' . ltrim($read[$i+
1]);
640 array_splice($read, $i, 1);
644 $read_fold = array();
647 if (substr($read[$i], 0, 17) == "MIME-Version: 1.0") {
652 else if (substr(strtolower($read[$i]), 0, 26) == "content-transfer-encoding:") {
653 $hdr->encoding
= strtolower(trim(substr($read[$i], 26)));
657 else if (strtolower(substr($read[$i], 0, 13)) == "content-type:") {
658 $cont = strtolower(trim(substr($read[$i], 13)));
659 if (strpos($cont, ";")) {
660 $cont = substr($cont, 0, strpos($cont, ";"));
663 if (strpos($cont, "/")) {
664 $hdr->type0
= substr($cont, 0, strpos($cont, "/"));
665 $hdr->type1
= substr($cont, strpos($cont, "/")+
1);
672 while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
673 str_replace("\n", "", $line);
674 str_replace("\n", "", $read[$i]);
675 $line = "$line $read[$i]";
679 /* Detect the boundary of a multipart message */
680 if (eregi('boundary="([^"]+)"', $line, $regs)) {
681 $hdr->boundary
= $regs[1];
684 /* Detect the charset */
685 if (strpos(strtolower(trim($line)), "charset=")) {
686 $pos = strpos($line, "charset=") +
8;
687 $charset = trim($line);
688 if (strpos($line, ";", $pos) > 0) {
689 $charset = substr($charset, $pos, strpos($line, ";", $pos)-$pos);
691 $charset = substr($charset, $pos);
693 $charset = str_replace("\"", "", $charset);
694 $hdr->charset
= $charset;
696 $hdr->charset
= "us-ascii";
698 /* Detect type in case of multipart/related */
699 if (strpos(strtolower(trim($line)), "type=")) {
700 $pos = strpos($line, "type=") +
6;
702 if (strpos($line, ";", $pos) > 0) {
703 $type = substr($type, $pos, strpos($line, ";", $pos)-$pos);
705 $type = substr($type, $pos);
710 else if (strtolower(substr($read[$i], 0, 20)) == "content-disposition:") {
711 /* Add better content-disposition support */
714 while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) {
715 str_replace("\n", "", $line);
716 str_replace("\n", "", $read[$i]);
717 $line = "$line $read[$i]";
721 /* Detects filename if any */
722 if (strpos(strtolower(trim($line)), "filename=")) {
723 $pos = strpos($line, "filename=") +
9;
725 if (strpos($line, " ", $pos) > 0) {
726 $name = substr($name, $pos, strpos($line, " ", $pos));
728 $name = substr($name, $pos);
730 $name = str_replace("\"", "", $name);
731 $hdr->filename
= $name;
735 else if (strtolower(substr($read[$i], 0, 9)) == "reply-to:") {
736 $hdr->replyto
= trim(substr($read[$i], 9, strlen($read[$i])));
740 else if (strtolower(substr($read[$i], 0, 5)) == "from:") {
741 $hdr->from
= trim(substr($read[$i], 5, strlen($read[$i]) - 6));
742 if (! isset($hdr->replyto
) ||
$hdr->replyto
== "") {
743 $hdr->replyto
= $hdr->from
;
748 else if (strtolower(substr($read[$i], 0, 5)) == "date:") {
749 $d = substr($read[$i], 5);
751 $d = strtr($d, array(' ' => ' '));
752 $d = explode(' ', $d);
753 $hdr->date
= getTimeStamp($d);
757 else if (strtolower(substr($read[$i], 0, 8)) == "subject:") {
758 $hdr->subject
= trim(substr($read[$i], 8, strlen($read[$i]) - 9));
759 if (strlen(Chop($hdr->subject
)) == 0) {
760 $hdr->subject
= _("(no subject)");
763 if ($where == 'SUBJECT') {
764 $hdr->subject = $what;
765 // $hdr->subject = eregi_replace($what, "<b>\\0</b>", $hdr->subject);
771 else if (strtolower(substr($read[$i], 0, 3)) == "cc:") {
773 if (isset($read_fold[0])) {
774 $hdr->cc
[$pos] = trim(substr($read_fold[0], 4));
776 while ($pos < count($read_fold)) {
777 $hdr->cc
[$pos] = trim($read_fold[$pos]);
781 $hdr->cc
[$pos] = trim(substr($read[$i], 4));
786 else if (strtolower(substr($read[$i], 0, 4)) == "bcc:") {
788 if (isset($read_fold[0])) {
789 $hdr->bcc
[$pos] = trim(substr($read_fold[0], 5));
791 while ($pos < count($read_fold)) {
792 $hdr->bcc
[$pos] = trim($read_fold[$pos]);
796 $hdr->bcc
[$pos] = trim(substr($read[$i], 5));
801 else if (strtolower(substr($read[$i], 0, 3)) == "to:") {
803 if (isset($read_fold[0])) {
804 $hdr->to
[$pos] = trim(substr($read_fold[0], 4));
806 while ($pos < count($read_fold)) {
807 $hdr->to
[$pos] = trim($read_fold[$pos]);
811 $hdr->to
[$pos] = trim(substr($read[$i], 4));
817 else if (strtolower(substr($read[$i], 0, 11)) == "message-id:") {
818 $hdr->message_id
= trim(substr($read[$i], 11));
821 /* ERROR CORRECTION */
822 else if (substr($read[$i], 0, 1) == ")") {
823 if (strlen(trim($hdr->subject
)) == 0) {
824 $hdr->subject
= _("(no subject)");
826 if (strlen(trim($hdr->from
)) == 0) {
827 $hdr->from
= _("(unknown sender)");
829 if (strlen(trim($hdr->date
)) == 0) {
835 else if (strtolower(substr($read[$i], 0, 11)) == "x-priority:") {
836 $hdr->priority
= trim(substr($read[$i], 11));
847 /* Returns the body of a message. */
848 function sqimap_get_message_body ($imap_stream, &$header) {
850 return decodeMime($imap_stream, $header);