Added Christmas theme.
[squirrelmail.git] / functions / imap_messages.php
index 4cef81eb67270c6d481b225aee68c9f3c3858b46..dbb59f4e31fab9f79970327175c8ae2a841bd715 100755 (executable)
@@ -1,20 +1,36 @@
 <?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);
    }
                $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++;
          }