put all the information returned from a select in the result
[squirrelmail.git] / src / draft_actions.php
index 2056b2bf3bda7b74fe02d8156ee576783e376b54..4bfe3659aaffb092c654bdea70b11b54f2260ed3 100644 (file)
@@ -125,7 +125,7 @@ function writeBodyForDraft ($fp, $passedBody, $session) {
         $body .= $passedBody . "\r\n\r\n";
         fputs ($fp, $body);
 
-        $attachmentlength = attachFiles($fp);
+        $attachmentlength = attachFiles($fp, $session);
 
         if (!isset($postbody)) $postbody = "";
         $postbody .= "\r\n--".mimeBoundary()."--\r\n\r\n";
@@ -141,12 +141,17 @@ function writeBodyForDraft ($fp, $passedBody, $session) {
 }
 
 
-function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $session) {
+function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $prio = 3, $session) {
     global $useSendmail, $msg_id, $is_reply, $mailbox, $onetimepad,
            $data_dir, $username, $domain, $key, $version, $sent_folder,
-           $imapServerAddress, $imapPort, $draft_folder, $attachment_dir;
+           $imapServerAddress, $imapPort, $draft_folder, $attachment_dir,
+           $default_use_priority;
     $more_headers = Array();
 
+    if ($default_use_priority) {
+        $more_headers = array_merge($more_headers, createPriorityHeaders($prio));
+    }
+
     $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
 
     $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
@@ -160,8 +165,8 @@ function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $session) {
     $fp = fopen($full_tmpDraftFile, 'w');
 
     $headerlength = write822HeaderForDraft
-        ($fp, $t, $c, $b, $subject, $more_headers, FALSE, $session);
-    $bodylength = writeBodyForDraft ($fp, $body, FALSE, $session);
+        ($fp, $t, $c, $b, $subject, $more_headers, $session);
+    $bodylength = writeBodyForDraft ($fp, $body, $session);
     fclose($fp);
 
     $length = ($headerlength + $bodylength);
@@ -169,8 +174,8 @@ function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $session) {
     if (sqimap_mailbox_exists ($imap_stream, $draft_folder)) {
         sqimap_append ($imap_stream, $draft_folder, $length);
         write822HeaderForDraft
-            ($imap_stream, $t, $c, $b, $subject, $more_headers, TRUE, $session);
-        writeBodyForDraft ($imap_stream, $body, TRUE, $session);
+            ($imap_stream, $t, $c, $b, $subject, $more_headers, $session);
+        writeBodyForDraft ($imap_stream, $body, $session);
         sqimap_append_done ($imap_stream);
     }
     sqimap_logout($imap_stream);
@@ -182,4 +187,5 @@ function saveMessageAsDraft($t, $c, $b, $subject, $body, $reply_id, $session) {
     }
     return $length;
 }
-?>
+
+?>
\ No newline at end of file