Opened 7 years ago

Closed 3 years ago

#1403507 closed Feature Requests (fixed)

Add support for shared folders - patch

Reported by: geeojr Owned by: thomasb
Priority: 1 - Highest Milestone: 0.5-beta
Component: Core functionality Version: 0.1-rc1
Severity: major Keywords:
Cc: Atrus, jahngordon@…, jb2@…, glen@…, bjoern@…, Jos.DeGraeve@…, pawelz@…

Description (last modified by thomasb)

I can't see shared folders with Courier. Courier-imap
makes shared folders available at the root level. Root
level contains: INBOX. & shared. -- need to check
for both.

Attachments (3)

patch-against-536-shared-folders.diff (371 bytes) - added by mbalex 6 years ago.
a quick hack to enable other namespaces inside ilohamail library
sharedpatch.txt (3.3 KB) - added by gordonjahn 3 years ago.
Patch against 0.3.1 stable adding shared folder support - see comment for use (updated)
shared.patch (16.3 KB) - added by alec 3 years ago.

Download all attachments as: .zip

Change History (49)

comment:1 Changed 7 years ago by harrinp1

  • Priority changed from 5 to 4
  • Severity set to normal
  • Version changed from None to 0.1-rc1

I also vote for this feature. Diffrent IMAP servers handle this diffrently so you need to check the namespace to find out the Public folder namespace.

comment:2 Changed 6 years ago by captainmish

  • Priority changed from 4 to 5

another vote here - there are a number of installations that rely heavily on shared folders, thus making roundcube a non-starter for them.

comment:3 Changed 6 years ago by thesubmitter

I also vote for this. For me this is a deal breaker for roundcube.

comment:4 Changed 6 years ago by zzamboni

Here's another vote - this would be tremendously useful.

Changed 6 years ago by mbalex

a quick hack to enable other namespaces inside ilohamail library

comment:5 Changed 6 years ago by jvale

Here here! This feature is essential so that I can deploy RoundCube at the site I'm adminning.

Eventough it's a bit of an ugly hack, the patch works like a charm with a Courier server.

comment:6 Changed 6 years ago by jvale

Correction: the hack doesn't work that well. I can see the shared folders, but 'special' folders like Drafts, Trash and Sent are no longer 'special'. Meaning, I can't delete messages and it fails when copying a message I just sent to the 'Sent' folder.

comment:7 Changed 6 years ago by mbalex

jvale is correct if you dont change anything else. since the default root dir is "INBOX" on courier all special folders are usally relative to "INBOX" defined. since this hack changes the default root dir to "", the special folders etc need to prefix "INBOX." .

$rcmail_configdrafts_mbox? = 'INBOX.Drafts';

$rcmail_configjunk_mbox? = 'INBOX.Junk';

$rcmail_configsent_mbox? = 'INBOX.Sent';

$rcmail_configtrash_mbox? = 'INBOX.Trash';

$rcmail_configdefault_imap_folders? = array('INBOX', 'INBOX.Drafts', 'INBOX.Sent', 'INBOX.Junk', 'INBOX.Trash');

comment:8 Changed 5 years ago by seansan

  • Summary changed from Add support for shared folders to Add support for shared folders - patch
  • Type changed from Feature Requests to Patches

comment:9 Changed 5 years ago by thomasb

  • Description modified (diff)
  • Milestone set to 0.4-beta

comment:10 Changed 5 years ago by Atrus

  • Cc Atrus added

comment:11 Changed 3 years ago by thomasb

  • Owner changed from roundcube to thomasb
  • Status changed from assigned to new

Marked #1484043 as a duplicate of this bug

comment:12 Changed 3 years ago by thomasb

  • Status changed from new to assigned

comment:13 Changed 3 years ago by alec

  • Type changed from Patches to Feature Requests

comment:14 Changed 3 years ago by gordonjahn

  • Cc jahngordon@… added

I've reviewed the patches and suggestions for getting shared folders working with RC but didn't like changing the Ilohamail library.

I've taken an alternative approach in the attached sharedpatch.txt patch -- the underlying library isn't modified as it works fine. Instead, imap_root is set in the config like this:

$rcmail_configimap_root? = array('INBOX', 'shared');

If this isn't set to an array('INBOX') by default, things stop working. I'm not sure if that should be handled in the config section though.

Anyway, after setting this and applying the patch, the mod_mailbox() function in rcube_imap.php is the main one that needs attention to ensure it doesn't mess with the folder names wrongly and the list_unsubscribed function is modified to check all the roots specified in the config file.

This seems to work for me, but wider testing might be nice, and this approach might be useful for others.

Changed 3 years ago by gordonjahn

Patch against 0.3.1 stable adding shared folder support - see comment for use (updated)

comment:15 Changed 3 years ago by gordonjahn

I've attached an updated version of my patch from earlier - moving messages into and out of shared folders wasn't working, which is resolved now, and the need to configure has been removed. With the patch added, RC will work as normal is imap_root is not set (as default) and if the imap_root setting is set as detailed above, shared folder support works too.

comment:16 Changed 3 years ago by alec

I think shared folders should be supported using NAMESPACE extension. Could you guys create a test IMAP account for me on server with shared folders configured? I would like to work on this but, have no testing environment.

comment:17 Changed 3 years ago by etiennesw

Hi gordonjahn,

I am trying to setup Roundcube with the courier-imap server we use.

Would you be kind enough to give me instructions on how to install your patch for shared folders?

Where do we apply the code found in your text file?

Thanks

Rgs
Etienne

comment:18 Changed 3 years ago by gordonjahn

Etienne..

The file is a unified patch file which you could apply the patch by using the patch utility inside a Bash shell - these programs should be on most Unix/Linux/Mac? systems already or, for Windows, install them using something like Cygwin. The process to enable would then be something like:

  • Downloading Roundcube 0.3.1 and unpack
  • Download the patch file attached here - put it in the same directory as RC 0.3.1
  • Run the patch whilst in the RC directory: cat sharedpatch.txt | patch -p 2
  • Configure RC for shared folders: $rcmail_config[imap_root] = array('INBOX', 'shared');
  • Configure other RC options as required

Having done this, shared folders should work if enabled on the mail server. The final configuration line above is for the Courier IMAP mail server which uses the shared namespace for shared folders. If you don't have this set up already, I configured Courier for shared folders using the (vague) instructions at http://www.courier-mta.org/imap/README.sharedfolders.html .

This has a lot of background info, but it come down to using the maildirmake command with different options to set up the shared folders and then to make them available for each user - see the docs for this command if you need to use it.

Hope that helps,
Gordon

comment:19 Changed 3 years ago by etiennesw

Hi Gordon,

I successfully applied the patch as you said and also set the imap_root = array('INBOX','#shared')
since our prefix is #shared. In roundcube the #shared folder appears, but is empty and cannot be subscribed to.

The shared folders on our courier-imap server were created via maildirmake and work well with Thunderbird and Horde webmail, however, Roundcube is proving to be problamatic with public shared folders.

Thanks anyway for your help.

Rgs
Etienne

comment:20 Changed 3 years ago by etiennesw

Hi Gordon,

I managed to get the shared folders to work in Roundcube. After applying your patch I had to define every shared folder in the main.inc.php file as part of the arrary.

$rcmail_configimap_root? = array('INBOX','#shared.folder1, #shared.folder2, #shared.folder3);

Thanks

Rgs
Etienne

comment:21 Changed 3 years ago by gordonjahn

That's really weird - I just did the prefix and then could configure them using the usual IMAP subscription configuration page.

That said, if it works, great!

comment:22 Changed 3 years ago by thomasb

  • Milestone changed from 0.4-stable to 0.5-beta

comment:23 Changed 3 years ago by brandond

Alec - do you still want a test server with namespace support? I've got Dovecot boxes coming out my ears, and would be glad to set one aside for you to bash on.

comment:24 Changed 3 years ago by alec

Yes, I need only an account with configured some namespaces. I'd like to connect to it from my box. Currently I'm a little busy, but I could do some tests later in this month. Write to alec at alec dot pl.

comment:25 Changed 3 years ago by combatwombat

  • Cc jb2@… added
  • Milestone changed from 0.5-beta to 0.4.1
  • Priority changed from 5 to 1 - Highest
  • Severity changed from normal to major

Hi .. not sure who ....

I can see that this functionality is planned/going to be put into the mainstream code in 0.5beta, however this lack of capability is the most important issue in RC, it is stopping me from converting 200 users off squirrelmail (cyrus backend). SM, Hastymail and everyone else supports it, but RC doesnt.. can it be bought forward, I think a lot of potential users are just waiting for this and they will throw the switch.

Rgds
John

comment:26 Changed 3 years ago by alec

  • Milestone changed from 0.4.1 to 0.5-beta

This is "lack of capability", not a bug. Please, don't change the milestone.

comment:27 Changed 3 years ago by kaz

Has anyone rediffed this patch against 0.4?

comment:28 Changed 3 years ago by glen

i've rediffed against 0.4, works for me:

$rcmail_config['imap_root'] = array('INBOX', 'shared');

using courier-imap 4.8.0

http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/roundcubemail/shared-folders.patch?rev=1.3

comment:29 Changed 3 years ago by glen

  • Cc glen@… added

comment:30 Changed 3 years ago by jesusch

  • Cc bjoern@… added

comment:31 Changed 3 years ago by josdg

  • Cc Jos.DeGraeve@… added

comment:32 Changed 3 years ago by alec

I've prepared a patch for svn-trunk. On servers with NAMESPACE support no configuration is required. On servers without NAMESPACE support you'll need to set imap_personal (old imap_root) and imap_shared options.

comment:33 Changed 3 years ago by pawelz

  • Cc pawelz@… added

It breaks my roundcube installation. I tested it on PLD Linux, version posted by glen (http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/roundcubemail/shared-folders.patch?rev=1.3).

Since I applied this patch I'm able to acces only inbox. All other, shared and private, folders are gone.

Also I don't understand what exactly this patch is supposed to do. Shared folders work perfectly for me without this patch.

Please, do not apply this patch.

My environment is:

  • roundcube 0.4.2, php-5.3.3, PLD Linux
  • dovecot 1:1.2.13-1~bpo50+1, Debian Lenny (accessed via imapproxy 1.2.6-5, also on Debian Lenny)

PS.: Feel free to contact me if you need additional information about my environemnt. I can test new versions of this patch or/and configuration changes.

comment:34 Changed 3 years ago by pawelz

I added the following line to the config file:

$rcmail_config['imap_root'] = array('');

and now it works again for me.

comment:35 Changed 3 years ago by alec

The patch is for svn-trunk version and with this patch applied imap_root option doesn't exist. Contact me (alec at alec.pl) if you can provide a test account that I could connect from my box.

comment:36 Changed 3 years ago by fraggy

Hi
the new patch works around 50% ;)
Now I can see all shared folders but I don't have access... the folder path is not correct.
"Server Error: STATUS: Mailbox doesn't exist:"

We are using dovecot mailserver. All shares are stored in Maildir/shared/from.user/....
like: shared/max.muster/.testshare or shared/max.muster/.testshare.sub1
the new patch is searching for: shared.max\2emuster.testshare or shared.max\2emuster.testshare.sub1

These search strings are correct for all "normal" folders but not for shared folders!
The normal folder hierarchy separator is a dot and a dot in the foldername has the string "\2e" as separator

So what I need is
shared/user.who.shares/.sharedfolders.maybewithsub instead of
shared.user\2ewho\2eshares.sharedfolders.maybewithsub

feel free to ask me, if you don't understand my confusing description :D

comment:37 Changed 3 years ago by alec

@fraggy: what do you have in imap_delimiter, imap_personal and imap_shared options? Does your server support NAMESPACE extension? Enable imap_debug and attach the log (or send it to me).

comment:38 Changed 3 years ago by fraggy

main.inc.php

$rcmail_config['imap_delimiter'] = '/';
$rcmail_config['imap_personal'] = NULL; 
$rcmail_config['imap_shared'] = NULL;

dovecot config

namespace private {
   separator = /
   prefix = INBOX/
   ....
}

namespace shared {
   separator = /
   # %%n, %%d and %%u are expanded to the destination user.
   prefix = shared/%%u/
   # List the shared/ namespace only if there are visible shared mailboxes.
   list = children
   ....
}

imap log

[02-Nov-2010 13:33:54 +0100]: C: A0023 STATUS INBOX/shared/adam.marsch (UNSEEN)
[02-Nov-2010 13:33:54 +0100]: S: A0023 NO Mailbox doesn't exist: shared.adam\2emarsch
[02-Nov-2010 13:33:54 +0100]: C: A0024 SELECT INBOX/shared/adam.marsch
[02-Nov-2010 13:33:54 +0100]: S: A0024 NO Mailbox doesn't exist: shared.adam\2emarsch
[02-Nov-2010 13:33:54 +0100]: C: A0025 STATUS INBOX/shared/adam.marsch/testshare (UNSEEN)
[02-Nov-2010 13:33:54 +0100]: S: A0025 NO Mailbox doesn't exist: shared.adam\2emarsch.testshare
[02-Nov-2010 13:33:54 +0100]: C: A0026 SELECT INBOX/shared/adam.marsch/testshare
[02-Nov-2010 13:33:54 +0100]: S: A0026 NO Mailbox doesn't exist: shared.adam\2emarsch.testshare
[02-Nov-2010 13:33:54 +0100]: C: A0027 STATUS INBOX/shared/adam.marsch/testshare/subfolder1 (UNSEEN)
[02-Nov-2010 13:33:54 +0100]: S: A0027 NO Mailbox doesn't exist: shared.adam\2emarsch.testshare.subfolder1
[02-Nov-2010 13:33:54 +0100]: C: A0028 SELECT INBOX/shared/adam.marsch/testshare/subfolder1
[02-Nov-2010 13:33:54 +0100]: S: A0028 NO Mailbox doesn't exist: shared.adam\2emarsch.testshare.subfolder1

correct values are shared/adam.marsch ; shared/adam.marsch/.testshare ; shared/adam.marsch/.testshare.subfolder1

comment:39 Changed 3 years ago by alec

I'd like to see, what is returned for NAMESPACE command.

comment:40 Changed 3 years ago by fraggy

something like this?

[02-Nov-2010 13:33:54 +0100]: S: * NAMESPACE (("INBOX/" "/")) (("shared/" "/")) NIL

I'll delete all privat log entries and send the log file to you

comment:41 Changed 3 years ago by alec

Here's the problem. My patch works only with personal and public namespaces. It doesn't work with shared (others). I'll work on this.

comment:42 Changed 3 years ago by alec

BTW, you could check with imap_shared="shared/" and imap_personal="INBOX/".

comment:43 Changed 3 years ago by fraggy

had no luck with imap_shared and imap_personal :/

comment:44 Changed 3 years ago by alec

Because namespace/delimiter settings are cached in session, you'll need to re-login after config changes. Write to alec at alec.pl, we'll continue there. Please, do logout, clear the log, and login. Sent me the complete log.

Changed 3 years ago by alec

comment:45 Changed 3 years ago by alec

I've fixed the patch. @fraggy confirmed it's working for him.

comment:46 Changed 3 years ago by alec

  • Resolution changed from None to fixed
  • Status changed from assigned to closed

Patch applied in [00290a60].

Note: See TracTickets for help on using tickets.