summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-06-04 09:27:15 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-06-04 09:27:15 (GMT)
commit8d977402369f4ba6cc40beb4541f5810b853548a (patch)
tree2b0fe310d46eeb77221e67abed4a80ee6912e120
parent889a65478acda8fe3283603c221a489cfbabcdc6 (diff)
downloadperl-Kolab-8d977402369f4ba6cc40beb4541f5810b853548a.tar.gz
kolab/issue4237 (additional event.default folder created by kolabd (rt#6038))
-rw-r--r--ChangeLog5
-rw-r--r--lib/Kolab/Cyrus.pm33
-rw-r--r--lib/Kolab/LDAP.pm4
3 files changed, 39 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 081a8a0..1870e58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-04 Gunnar Wrobel <wrobel@pardus.de>
+
+ * lib/Kolab/Cyrus.pm: kolab/issue4237 (additional event.default
+ folder created by kolabd (rt#6038))
+
2009-12-16 Sascha Wilde <wilde@intevation.de>
* lib/Kolab/LDAP.pm (deleteObject): kolab/issue3940 (Deleting
diff --git a/lib/Kolab/Cyrus.pm b/lib/Kolab/Cyrus.pm
index 339f85c..2a9436d 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
@@ -109,6 +110,38 @@ 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'));
+ my $key = '/mailbox/{' . $u . '}/vendor/kolab/folder-type';
+ if (exists($info{$key}) && $info{$key} eq '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;
diff --git a/lib/Kolab/LDAP.pm b/lib/Kolab/LDAP.pm
index e554c16..7fcb16b 100644
--- a/lib/Kolab/LDAP.pm
+++ b/lib/Kolab/LDAP.pm
@@ -557,9 +557,7 @@ sub createObject
$domain = $Kolab::config{'postfix-mydomain'};
}
my $folder = $user . '/Calendar@' . $domain;
- Kolab::Cyrus::createMailbox($cyrus, $folder, 0);
- Kolab::Cyrus::setFolderType($cyrus, $folder, 0, 'event.default');
- Kolab::Cyrus::setACL($cyrus, $folder, 0, ["$uid all", 'calendar@' . $domain .' all']);
+ Kolab::Cyrus::createCalendar($cyrus, $user, $domain, $folder, ["$uid all", 'calendar@' . $domain .' all']);
}
}
}