Don't try to check status of non-existant mailboxes.
authorJan Schneider <jan@horde.org>
Thu, 23 Sep 2010 11:13:26 +0000 (13:13 +0200)
committerJan Schneider <jan@horde.org>
Thu, 23 Sep 2010 11:13:26 +0000 (13:13 +0200)
imp/compose-mimp.php
imp/compose.php

index 432452c..0cd9fdc 100644 (file)
@@ -66,9 +66,11 @@ $sent_mail_folder = $identity->getValue('sent_mail_folder');
 $readonly_drafts = false;
 $imp_imap = $injector->getInstance('IMP_Imap')->getOb();
 if (!empty($draft)) {
-    $readonly_drafts = $imp_imap->isReadOnly(IMP::folderPref($draft, true));
+    $draft = IMP::folderPref($draft, true);
+    $readonly_drafts = $imp_folder->exists($draft) &&
+        $imp_imap->isReadOnly($draft);
 }
-$save_sent_mail = $imp_imap->isReadOnly($sent_mail_folder)
+$save_sent_mail = ($imp_folder->exists($sent_mail_folder) && $imp_imap->isReadOnly($sent_mail_folder))
     ? false
     : $prefs->getValue('save_sent_mail');
 
index bb948a7..328bd84 100644 (file)
@@ -97,13 +97,17 @@ if ($vars->compose_formToken) {
 $compose_disable = !IMP::canCompose();
 
 /* Determine if mailboxes are readonly. */
+$imp_folder = $injector->getInstance('IMP_Folder');
 $readonly_drafts = $readonly_sentmail = false;
 $draft = $prefs->getValue('drafts_folder');
 $imp_imap = $injector->getInstance('IMP_Imap')->getOb();
 if (!empty($draft)) {
-    $readonly_drafts = $imp_imap->isReadOnly(IMP::folderPref($draft, true));
+    $draft = IMP::folderPref($draft, true);
+    $readonly_drafts = $imp_folder->exists($draft) &&
+        $imp_imap->isReadOnly($draft);
 }
-$readonly_sentmail = $imp_imap->isReadOnly($sent_mail_folder);
+$readonly_sentmail = $imp_folder->exists($sent_mail_folder) &&
+    $imp_imap->isReadOnly($sent_mail_folder);
 if ($readonly_sentmail) {
     $save_sent_mail = false;
 }