[dev] [imp-patch] default mailbox for create folder
Francois Marier
francois at nit.ca
Wed Aug 4 12:54:22 PDT 2004
On Tue, Aug 03, 2004 at 11:03:16PM -0400, Chuck Hagenbuch wrote:
> Quoting Francois Marier <francois at nit.ca>:
> >On the other hand, you already get an error message for those
> >servers and it doesn't work.
>
> No. Plenty of servers support creation of top level folders. You'd be
> prefixing
> INBOX. to it, putting the folders in the wrong place.
I looked at the code again and thought about trying the prefix only if
the first createFolder() call fails. Can you think of any problems
with this approach ? (see attached patch)
Thanks for your comments Chuck, I hadn't thought about those problems.
Even if you choose not to include this hack in the code, I'd still
like to improve my patch so that it works better for the customers of
the company I work for (http://open.nit.ca).
Francois
-------------- next part --------------
--- ../build/imp/lib/Folder.php Sun Jun 13 22:55:04 2004
+++ imp/lib/Folder.php Wed Aug 4 15:40:52 2004
@@ -425,9 +425,14 @@ class IMP_Folder {
/* Attempt to create the mailbox */
if (!imap_createmailbox($stream, IMP::serverString($folder))) {
- $notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), IMP::displayFolder($folder)) .
- ': ' . imap_last_error(), 'horde.error');
- return false;
+ $oldfolder = $folder;
+ $folder = 'INBOX' . $imp['delimiter'] . $folder;
+ if (!imap_createmailbox($stream, IMP::serverString($folder))) {
+ $folder = $oldfolder;
+ $notification->push(sprintf(_("The folder \"%s\" was not created. This is what the server said"), IMP::displayFolder($folder)) .
+ ': ' . imap_last_error(), 'horde.error');
+ return false;
+ }
}
/* Reset the folder cache. */
More information about the dev
mailing list