Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-create mailbox for $default_imap_folders #653

Closed
rcubetrac opened this issue Apr 17, 2006 · 6 comments
Closed

auto-create mailbox for $default_imap_folders #653

rcubetrac opened this issue Apr 17, 2006 · 6 comments

Comments

@rcubetrac
Copy link

@rcubetrac rcubetrac commented Apr 17, 2006

Reported by oslad on 17 Apr 2006 07:21 UTC as Trac ticket #1471594

In main.inc.php defined:
$rcmail_config['default_imap_folders'] = array('INBOX',
'Drafts', 'Sent', 'Junk', 'Trash');

Auto-create these mailbox if some of these mailbox
doesn't existed, just like Squirrelmail, it would be
perfect!

Migrated-From: http://trac.roundcube.net/ticket/1471594

@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 3, 2006

Comment by fidojones on 3 Jun 2006 19:32 UTC

and ugly and fastest mini patch :D rcube_imap.inc

// create INBOX if it does not exist
if (!in_array_nocase('INBOX', $a_folders))
  {
  $this->create_mailbox('INBOX', TRUE);
  array_unshift($a_folders, 'INBOX');
  }

// create TRASH if it does not exist
$this->create_mailbox('Trash', TRUE);
$this->create_mailbox('Sent', TRUE);
@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 3, 2006

Severity changed by fidojones on 3 Jun 2006 19:32 UTC

=> critical

@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 12, 2006

Comment by botum on 12 Jun 2006 22:56 UTC

This patch fixed my error.

I'm working with postfix-mysql (don't know if has something to do) and before the patch I couldn't delete messages in new accounts.

@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 19, 2006

Comment by elfrink on 19 Jun 2006 12:29 UTC

Here's the patch that I use. It creates all folders in 'default_imap_folders', subscribes to them, and updates the folder list cache.

--- program/include/rcube_imap.inc      (revision 260)
+++ program/include/rcube_imap.inc      (working copy)
@@ -362,13 +362,18 @@
     if (!is_array($a_folders) || !sizeof($a_folders))
       $a_folders = array();

-    // create INBOX if it does not exist
-    if (!in_array_nocase('INBOX', $a_folders))
+    // create Default folders if they do not exist
+    global $CONFIG;
+    foreach ($CONFIG['default_imap_folders'] as $folder)
       {
-      $this->create_mailbox('INBOX', TRUE);
-      array_unshift($a_folders, 'INBOX');
+      if (!in_array_nocase($folder, $a_folders))
+        {
+        $this->create_mailbox($folder, TRUE);
+        $this->subscribe($folder);
+        }
       }

+    $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter);
     $a_mailbox_cache = array();

     // write mailboxlist to cache

@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 29, 2006

Comment by richs on 29 Jun 2006 20:37 UTC

Added to SVN today. Thank you for the patch!

@rcubetrac
Copy link
Author

@rcubetrac rcubetrac commented Jun 29, 2006

Status changed by richs on 29 Jun 2006 20:37 UTC

assigned => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.