summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-03 06:41:57 +0000
committeralecpl <alec@alec.pl>2010-05-03 06:41:57 +0000
commit16378fe3a255943c7b2f374443158670a0eedf86 (patch)
tree8d6bf74481e477d6210002db0d929688685074e5 /program/steps/mail
parente0950945910b95f07b26a43575f8bad5938b7124 (diff)
- preformance fix: don't load full folders list when checking for folder
existance in sendmail.inc, use internal cache to make mailbox_exists() faster when called more than one time for the same folder
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/sendmail.inc19
1 files changed, 8 insertions, 11 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index e9d215003..aed7af9ac 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -566,17 +566,14 @@ else
if ($store_target)
{
- // check if mailbox exists
- if (!in_array($store_target, $IMAP->list_mailboxes()))
- {
- // folder may be existing but not subscribed (#1485241)
- if (!in_array($store_target, $IMAP->list_unsubscribed()))
- $store_folder = $IMAP->create_mailbox($store_target, TRUE);
- else if ($IMAP->subscribe($store_target))
- $store_folder = TRUE;
- }
- else
- $store_folder = TRUE;
+ // check if folder is subscribed
+ if ($IMAP->mailbox_exists($store_target, true))
+ $store_folder = true;
+ // folder may be existing but not subscribed (#1485241)
+ else if (!$IMAP->mailbox_exists($store_target))
+ $store_folder = $IMAP->create_mailbox($store_target, true);
+ else if ($IMAP->subscribe($store_target))
+ $store_folder = true;
// append message to sent box
if ($store_folder) {