summaryrefslogtreecommitdiff
path: root/lib/Kolab/Cyrus.pm
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-03-23 18:02:11 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-03-23 18:02:11 (GMT)
commita3e6cedc9867833cd2ca6bfb4e75a14b5879447f (patch)
tree43819eae1662335ee44ea4c58c127bc83b1b08ef /lib/Kolab/Cyrus.pm
parentd6c7a513dde893bba0b5057c29ce58c5218960aa (diff)
downloadperl-Kolab-a3e6cedc9867833cd2ca6bfb4e75a14b5879447f.tar.gz
kolab/issue4237 (additional event.default folder created by kolabd (rt#6038))
Diffstat (limited to 'lib/Kolab/Cyrus.pm')
-rw-r--r--lib/Kolab/Cyrus.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Kolab/Cyrus.pm b/lib/Kolab/Cyrus.pm
index 647ba98..99d51af 100644
--- a/lib/Kolab/Cyrus.pm
+++ b/lib/Kolab/Cyrus.pm
@@ -40,6 +40,7 @@ our %EXPORT_TAGS = (
&create
&createUid
&createMailbox
+ &createCalendar
&deleteMailbox
&setQuota
&setACL
@@ -110,6 +111,37 @@ sub createMailbox
}
}
+sub createCalendar
+{
+ my $cyrus = shift;
+ my $user = shift;
+ my $domain = shift;
+ my $folder = shift;
+ my $acl = shift;
+
+ my $calendar = 0;
+
+ my @mailboxes = $cyrus->list("user/$user/*\@$domain");
+ my %info;
+ foreach my $mailbox (@mailboxes) {
+ my $u = @{$mailbox}[0];
+ %info = $cyrus->info($u, ('/vendor/kolab/folder-type'));
+ if ($info{'/vendor/kolab/folder-type'} == 'event.default') {
+ $calendar = $u;
+ }
+ }
+
+ if ($calendar) {
+ Kolab::log('Y', "Skipping calendar creation for $user\@$domain as $calendar is a default calendar.", KOLAB_DEBUG);
+ } else {
+ Kolab::log('Y', "Creating default calendar for $user\@$domain.", KOLAB_DEBUG);
+ createMailbox($cyrus, $folder, 0);
+ setFolderType($cyrus, $folder, 0, 'event.default');
+ setACL($cyrus, $folder, 0, $acl);
+ Kolab::log('Y', "Successfully created default calendar for $user\@$domain.", KOLAB_DEBUG);
+ }
+}
+
sub setQuota
{
my $cyrus = shift;