From 4b60fa3ab9c72f796a3db150b36cdb366a3aeed1 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 18 Dec 2008 12:03:55 -0500
Subject: [PATCH] #1485493: do not bypass sendmail_delay by relogin

---
 program/steps/mail/sendmail.inc |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 7ee6dd4..20f9079 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -36,18 +36,20 @@
   $OUTPUT->send('iframe');
 }
 
-if (!$savedraft && empty($_POST['_to']) && empty($_POST['_cc']) && empty($_POST['_bcc']) && empty($_POST['_subject']) && $_POST['_message']) {
-  $OUTPUT->show_message('sendingfailed', 'error');
-  $OUTPUT->send('iframe');
-}
-
-if(!$savedraft && !empty($CONFIG['sendmail_delay'])) {
-  $wait_sec = time() - intval($CONFIG['sendmail_delay']) - intval($_SESSION['last_message_time']);
-  if($wait_sec < 0)
-    {
-    $OUTPUT->show_message('senttooquickly', 'error', array('sec' => $wait_sec * -1));
+if (!$savedraft) {
+  if (empty($_POST['_to']) && empty($_POST['_cc']) && empty($_POST['_bcc'])
+    && empty($_POST['_subject']) && $_POST['_message']) {
+    $OUTPUT->show_message('sendingfailed', 'error');
     $OUTPUT->send('iframe');
+  }
+
+  if(!empty($CONFIG['sendmail_delay'])) {
+    $wait_sec = time() - intval($CONFIG['sendmail_delay']) - intval($CONFIG['last_message_time']);
+    if($wait_sec < 0) {
+      $OUTPUT->show_message('senttooquickly', 'error', array('sec' => $wait_sec * -1));
+      $OUTPUT->send('iframe');
     }
+  }
 }
 
 
@@ -372,7 +374,7 @@
 
   // save message sent time
   if (!empty($CONFIG['sendmail_delay']))
-    $_SESSION['last_message_time'] = time();
+    $RCMAIL->user->save_prefs(array('last_message_time' => time()));
   
   // set replied/forwarded flag
   if ($_SESSION['compose']['reply_uid'])

--
Gitblit v1.9.1