<?php
- /**
- ** imap_messages.php
- **
- ** This implements functions that manipulate messages
- **
- ** $Id$
- **/
-
- if (defined ('imap_messages_php'))
- return;
- define ('imap_messages_php', true);
- /******************************************************************************
- ** Copies specified messages to specified folder
- ******************************************************************************/
- function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
+/**
+ * imap_messages.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * This implements functions that manipulate messages
+ *
+ * $Id$
+ */
+
+/*****************************************************************/
+/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
+/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
+/*** + Base level indent should begin at left margin, as ***/
+/*** the function definition starts below. ***/
+/*** + All identation should consist of four space blocks ***/
+/*** + Tab characters are evil. ***/
+/*** + all comments should use "slash-star ... star-slash" ***/
+/*** style -- no pound characters, no slash-slash style ***/
+/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
+/*** ALWAYS USE { AND } CHARACTERS!!! ***/
+/*** + Please use ' instead of ", when possible. Note " ***/
+/*** should always be used in _( ) function calls. ***/
+/*** Thank you for your help making the SM code more readable. ***/
+/*****************************************************************/
+
+/****************************************************
+ ** Copies specified messages to specified folder **
+ ****************************************************/
+function sqimap_messages_copy ($imap_stream, $start, $end, $mailbox) {
fputs ($imap_stream, sqimap_session_id() . " COPY $start:$end \"$mailbox\"\r\n");
$read = sqimap_read_data ($imap_stream, sqimap_session_id(), true, $response, $message);
}
$read_list = array();
$sizes_list = array();
- /* We need to return the data in the same order as the caller supplied
- in $msg_list, but IMAP servers are free to return responses in
- whatever order they wish... So we need to re-sort manually */
-
+ /**
+ * We need to return the data in the same order as the caller supplied
+ * in $msg_list, but IMAP servers are free to return responses in
+ * whatever order they wish... So we need to re-sort manually
+ */
for ($i = 0; $i < sizeof($msg_list); $i++) {
$id2index[$msg_list[$i]] = $i;
}
fputs ($imap_stream, $query);
$readin_list = sqimap_read_data_list($imap_stream, $sid, true, $response, $message);
-
foreach ($readin_list as $r) {
if (!eregi("^\\* ([0-9]+) FETCH", $r[0], $regs)) {
set_up_language($squirrelmail_language);
$size = $regs[1];
$header = new small_header;
- if ($issent == true)
- $header->from = (trim($to) != '')? $to : _("(only Cc/Bcc)");
- else
+ if ($issent == true) {
+ $header->from = (trim($to) != '' ? $to : '(' ._("No To Address") . ')');
+ } else {
$header->from = $from;
+ }
$header->date = $date;
$header->subject = $subject;
$i++;
}
}
+ /** BCC **/
+ else if (strtolower(substr($read[$i], 0, 4)) == "bcc:") {
+ $pos = 0;
+ $hdr->bcc[$pos] = trim(substr($read[$i], 5));
+ $i++;
+ while (((substr($read[$i], 0, 1) == " ") || (substr($read[$i], 0, 1) == "\t")) && (trim($read[$i]) != "")){
+ $pos++;
+ $hdr->bcc[$pos] = trim($read[$i]);
+ $i++;
+ }
+ }
/** TO **/
else if (strtolower(substr($read[$i], 0, 3)) == "to:") {
$pos = 0;
$hdr->date = time();
$i++;
}
+ /** X-PRIORITY **/
+ else if (strtolower(substr($read[$i], 0, 11)) == "x-priority:") {
+ $hdr->priority = trim(substr($read[$i], 11));
+ $i++;
+ }
else {
$i++;
}