summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-03 13:13:44 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-03 13:13:44 +0000
commit71815d5dfee1bec2bf9ab93416065eaa82c63f12 (patch)
tree373597acd17d167b8ba1b59cf378b489f2ab77f8 /roundcubemail/program/steps
parentbeee9319df0feaedcf03414f0b637af1f1ff9962 (diff)
- Improved performance of draft saving by usage of APPENDUID response if available (skipped SEARCH call)
git-svn-id: https://svn.roundcube.net/trunk@5302 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
-rw-r--r--roundcubemail/program/steps/mail/sendmail.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc
index 9ea53ab29..deddb45e8 100644
--- a/roundcubemail/program/steps/mail/sendmail.inc
+++ b/roundcubemail/program/steps/mail/sendmail.inc
@@ -624,7 +624,7 @@ if (!$savedraft)
// save message sent time
if (!empty($CONFIG['sendmail_delay']))
$RCMAIL->user->save_prefs(array('last_message_time' => time()));
-
+
// set replied/forwarded flag
if ($_SESSION['compose']['reply_uid'])
$IMAP->set_flag($_SESSION['compose']['reply_uid'], 'ANSWERED', $_SESSION['compose']['mailbox']);
@@ -700,6 +700,7 @@ if ($store_target) {
if ($olddraftmessageid) {
// delete previous saved draft
+ // @TODO: use message UID (remember to check UIDVALIDITY) to skip this SEARCH
$a_deleteid = $IMAP->search_once($CONFIG['drafts_mbox'],
'HEADER Message-ID '.$olddraftmessageid, true);
@@ -723,9 +724,12 @@ else if ($mailbody_file) {
if ($savedraft) {
$msgid = strtr($message_id, array('>' => '', '<' => ''));
- // remember new draft-uid
- $draftuids = $IMAP->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid, true);
- $_SESSION['compose']['param']['draft_uid'] = $draftuids[0];
+ // remember new draft-uid ($saved could be an UID or TRUE here)
+ if (is_bool($saved)) {
+ $draftuids = $IMAP->search_once($CONFIG['drafts_mbox'], 'HEADER Message-ID '.$msgid, true);
+ $saved = $draftuids[0];
+ }
+ $_SESSION['compose']['param']['draft_uid'] = $saved;
// display success
$OUTPUT->show_message('messagesaved', 'confirmation');