From 98bee887eade1c9e1cfeed5f1385b5f8b0762f10 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 15 Dec 2008 23:03:11 -0700 Subject: [PATCH] Fixes to IMP_Folder::. Re-add notifications. Subscribe to folder after creating if requested. --- imp/lib/Folder.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/imp/lib/Folder.php b/imp/lib/Folder.php index 56a3b2e3f..bbd412125 100644 --- a/imp/lib/Folder.php +++ b/imp/lib/Folder.php @@ -195,7 +195,7 @@ class IMP_Folder $notification->push(sprintf(_("The folder \"%s\" was successfully deleted."), IMP::displayFolder($folder)), 'horde.success'); $deleted[] = $folder; } catch (Horde_Imap_Client_Exception $e) { - //$notification->push(sprintf(_("The folder \"%s\" was not deleted. This is what the server said"), IMP::displayFolder($folder)) . ': ' . imap_last_error(), 'horde.error'); + $notification->push(sprintf(_("The folder \"%s\" was not deleted. This is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error'); } } @@ -269,14 +269,21 @@ class IMP_Folder return false; } - /* Attempt to create the mailbox */ + /* Attempt to create the mailbox. */ try { $GLOBALS['imp_imap']->ob->createMailbox($folder); } catch (Horde_Imap_Client_Exception $e) { - //$notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), $display_folder) . ': ' . imap_last_error(), 'horde.error'); + $notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error'); return false; } + $GLOBALS['notification']->push(sprintf(_("The folder \"%s\" was successfully created."), IMP::displayFolder($folder)), 'horde.success'); + + /* Subscribe, if requested. */ + if ($subscribe) { + $this->subscribe(array($folder)); + } + /* Reset the folder cache. */ $this->clearFlistCache(); @@ -349,7 +356,7 @@ class IMP_Folder try { $GLOBALS['imp_imap']->ob->renameMailbox($old, $new); } catch (Horde_Imap_Client_Exception $e) { - //$GLOBALS['notification']->push(sprintf(_("Renaming \"%s\" to \"%s\" failed. This is what the server said"), IMP::displayFolder($old), IMP::displayFolder($new)) . ': ' . imap_last_error(), 'horde.error'); + $GLOBALS['notification']->push(sprintf(_("Renaming \"%s\" to \"%s\" failed. This is what the server said"), IMP::displayFolder($old), IMP::displayFolder($new)) . ': ' . $e->getMessage(), 'horde.error'); return false; } @@ -395,7 +402,7 @@ class IMP_Folder $notification->push(sprintf(_("You were successfully subscribed to \"%s\""), IMP::displayFolder($folder)), 'horde.success'); $subscribed[] = $folder; } catch (Horde_Imap_Client_Exception $e) { - //$notification->push(sprintf(_("You were not subscribed to \"%s\". Here is what the server said"), IMP::displayFolder($folder)) . ': ' . imap_last_error(), 'horde.error'); + $notification->push(sprintf(_("You were not subscribed to \"%s\". Here is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error'); $return_value = false; } } @@ -440,7 +447,7 @@ class IMP_Folder $notification->push(sprintf(_("You were successfully unsubscribed from \"%s\""), IMP::displayFolder($folder)), 'horde.success'); $unsubscribed[] = $folder; } catch (Horde_Imap_Client_Exception $e) { - //$notification->push(sprintf(_("You were not unsubscribed from \"%s\". Here is what the server said"), IMP::displayFolder($folder)) . ': ' . imap_last_error(), 'horde.error'); + $notification->push(sprintf(_("You were not unsubscribed from \"%s\". Here is what the server said"), IMP::displayFolder($folder)) . ': ' . $e->getMessage(), 'horde.error'); $return_value = false; } } -- 2.11.0