Re[2]: Cyrus managment from php..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 26 Jun 2007, Kristaps Armanis wrote:

JV> Anyone could share or point to some simple Cyrus managment
JV> function list/class writenn in PHP based on sockets?
JV> I guess pecl.php.net/cyrus  is pretty out of date?

Is there any way to query cyrus from admin user over imap
connection to get back users partition?

The "info" command in cyradm reports the partition. Here is some perl code we use to determine which murder backend a mailbox is stored on. You could modify this easily to look at the partition instead.

--------------------------------------
sub locatemailbox {
        my ($server, $authuser, $authpw, $mailbox) = @_;
        my $location = "";

        use Mail::IMAPClient;

        my $imap = Mail::IMAPClient->new(
                                Server => $server,
                                User => $authuser,
                                Password => $authpw
                        );
        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;
}
--------------------------------------


	Andy
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux