summaryrefslogtreecommitdiff
path: root/lib/Kolab/Cyrus.pm
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-06-14 14:45:46 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-06-14 14:45:46 (GMT)
commit381f418a1f6cd0ac1aae4da79f1ca4e33dad0a04 (patch)
tree242a0c7312f2bbac5b097ecee8d7cd5742a2fbc6 /lib/Kolab/Cyrus.pm
parent99a792d34a770723f28e6c0fe057adc34de3cad9 (diff)
downloadperl-Kolab-381f418a1f6cd0ac1aae4da79f1ca4e33dad0a04.tar.gz
Provide new API calls to set quota, find a mailbox, etc.
Diffstat (limited to 'lib/Kolab/Cyrus.pm')
-rw-r--r--lib/Kolab/Cyrus.pm36
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/Kolab/Cyrus.pm b/lib/Kolab/Cyrus.pm
index 17b1adf..1cabab1 100644
--- a/lib/Kolab/Cyrus.pm
+++ b/lib/Kolab/Cyrus.pm
@@ -42,6 +42,7 @@ our %EXPORT_TAGS = (
&createMailbox
&createCalendar
&deleteMailbox
+ &transferMailbox
&renameMailbox
&setQuota
&setACL
@@ -106,14 +107,25 @@ sub createMailbox
my $cyruid = &createUid($uid, $sf);
my $mailbox = ($cyrus->list($cyruid))[0];
- if ($uid && ($uid ne $Kolab::config{'cyrus_admin'}) && ($uid ne "freebusy") && ($uid ne "nobody") && !defined($mailbox)) {
- Kolab::log('Y', "Creating mailbox `$cyruid' on ".($partition?"partition `$partition'":"default partition"));
- if (!$cyrus->create($cyruid, $partition)) {
- Kolab::log('Y', "Unable to create mailbox `$cyruid', Error = `" . $cyrus->error . "'", KOLAB_WARN);
+ if ($uid && ($uid ne $Kolab::config{'cyrus_admin'}) && ($uid ne "freebusy") && ($uid ne "nobody")) {
+ if ( !defined($mailbox) ) {
+ Kolab::log('Y', "Creating mailbox `$cyruid' on ".($partition?"partition `$partition'":"default partition"));
+ if (!$cyrus->create($cyruid, $partition)) {
+ Kolab::log('Y', "Unable to create mailbox `$cyruid', Error = `" . $cyrus->error . "'", KOLAB_WARN);
+ return 0;
+ } else {
+ return 1;
+ }
+ } else {
+ Kolab::log('Y', "Unable to create mailbox `$cyruid', mailbox already exists", KOLAB_WARN);
+ return 10036;
}
} else {
Kolab::log('Y', "Skipping mailbox creation for $uid (cyruid='$cyruid', mailbox='".join(',',@{$mailbox})."'", KOLAB_DEBUG);
+ return 0;
}
+
+ return 1;
}
sub createCalendar
@@ -210,6 +222,22 @@ sub renameMailbox
}
}
+sub transferMailbox
+{
+ my $cyrus = shift;
+ my $mailboxPath = shift;
+ my $mailHost = shift;
+
+ Kolab::log('Y', "Transferring mailbox `$mailboxPath' to `$mailHost`");
+
+ if (!$cyrus->xfermailbox($mailboxPath, $mailHost)) {
+ Kolab::log('Y', "Unable to transfer mailbox `$mailboxPath' to `$mailHost', Error = `" . $cyrus->error . "'", KOLAB_WARN);
+ return 0;
+ }
+
+ return 1;
+}
+
sub setACL
{
my $cyrus = shift;