On Wed, 22 Sep 2010, Torsten Schlabach wrote:
Dear list!
We are running a Cyrus Murder configuration.
In the mailboxlist (which I can get using ctl_mboxlist, I can see on
which backend each mailbox resides physically.
Is there any way to extract that information through the IMAP protocol?
What I mean is, I can issue a command:
list Mail *
but the output will not list the backend that the mailbox / folder sits
on.
Are there any options I could use for that?
Or am I on the wrong path and I should achieve this in a different way.
I hope ctl_mboxlist is not the only way to access this information.
Here is a chunk of perl code which uses IMAP to get the mailbox
location/backend:
##
# Locate which backend a mailbox is on
##
sub locatemailbox {
my ($server, $authuser, $authpw, $mailbox) = @_;
my $location = ;
use Mail::IMAPClient;
my $imap = Mail::IMAPClient-new(
Server = $server,
User = $authuser,
Password = $authpw,
Ssl = 1,
);
if (! $imap) {
die(Cannot connect to mail server '$server' to locate mailbox
- $!);
}
my @results = $imap-tag_and_run(qq/GETANNOTATION $mailbox *
value.shared/);
$imap-logout;
foreach my $r (@results) {
$r =~ s/\r//g;
$r =~ s/\n//g;
if ($r =~ /\/vendor\/cmu\/cyrus-imapd\/server
\(value.shared(.*)\)$/) {
$location = $1;
}
}
if ($location eq '') {
die(Cannot locate mailbox '$mailbox'.\n);
}
return $location;
}
$mailbox is something like user.morgan. Basically, you need to look at
the mailbox annotations to get this. There are other interesting things
in the annotations. Here are the annotations on my own mailbox:
condstore: false
duplicatedeliver: false
lastpop:
lastupdate: 22-Sep-2010 10:01:36 -0700
partition: p4
pop3newuidl: true
server: cyrus-be3.onid.oregonstate.edu
sharedseen: false
size: 67386044
Andy
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/