Browse Source

sending messages takes you back to previous mailbox
, saves "Answered" flag

Luke Ehresman 25 years ago
parent
commit
09ebbb7fd0
3 changed files with 18 additions and 7 deletions
  1. 2 1
      functions/page_header.php
  2. 8 3
      functions/smtp.php
  3. 8 3
      src/compose.php

+ 2 - 1
functions/page_header.php

@@ -56,7 +56,8 @@
       echo "   </TR></TABLE>\n";
       echo "<TABLE BGCOLOR=\"$color[4]\" BORDER=0 COLS=2 WIDTH=100% CELLSPACING=0 CELLPADDING=2><TR>";
       echo "      <TD ALIGN=left WIDTH=70%>";
-      echo "         <A HREF=\"compose.php\">" . _("Compose") . "</A>&nbsp&nbsp";
+      $urlMailbox = $mailbox;
+      echo "         <A HREF=\"compose.php?mailbox=$urlMailbox\">" . _("Compose") . "</A>&nbsp&nbsp";
       echo "         <A HREF=\"addressbook.php\">" . _("Addresses") . "</A>&nbsp&nbsp";
       echo "         <A HREF=\"folders.php\">" . _("Folders") . "</A>&nbsp&nbsp";
       echo "         <A HREF=\"options.php\">" . _("Options") . "</A>&nbsp&nbsp";

+ 8 - 3
functions/smtp.php

@@ -427,17 +427,22 @@
       return $err_num;
    }
 
-   function sendMessage($t, $c, $b, $subject, $body) {
-      global $useSendmail, $msg_id, $is_reply;
+   function sendMessage($t, $c, $b, $subject, $body, $reply_id) {
+      global $useSendmail, $msg_id, $is_reply, $mailbox;
       global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress, $imapPort;
 
+      $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
+      if ($reply_id) {
+         sqimap_mailbox_select ($imap_stream, $mailbox);
+         sqimap_messages_flag ($imap_stream, $reply_id, $reply_id, "Answered");
+      }
+      
       if ($useSendmail==true) {  
          $length = sendSendmail($t, $c, $b, $subject, $body);
       } else {
          $length = sendSMTP($t, $c, $b, $subject, $body);
       }
 
-      $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
       if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
          sqimap_append ($imap_stream, $sent_folder, $length);
          write822Header ($imap_stream, $t, $c, $b, $subject);

+ 8 - 3
src/compose.php

@@ -145,7 +145,7 @@
       global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
          $passed_body, $color, $use_signature, $signature, $editor_size,
          $attachments, $subject, $newmail, $use_javascript_addr_book,
-         $send_to_bcc;
+         $send_to_bcc, $reply_id, $mailbox;
 
       $subject = decodeHeader($subject);
       $reply_subj = decodeHeader($reply_subj);
@@ -163,6 +163,10 @@
       }
 
       echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n";
+      if ($reply_id) {
+         echo "<input type=hidden name=reply_id value=$reply_id>\n";
+      }		 
+	  	echo "<input type=hidden name=mailbox value=$mailbox>\n";
       echo "<TABLE COLS=2 WIDTH=50 ALIGN=center CELLSPACING=0 BORDER=0>\n";
       echo "   <TR>\n";
       echo "      <TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
@@ -314,8 +318,9 @@
 
    if(isset($send)) {
       if (checkInput(false)) {
-         sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body);
-         header ("Location: right_main.php");
+         $urlMailbox = urlencode ($mailbox);
+         sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
+         header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
       } else {
          echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
          $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);