steffen: server/perl-kolab/Kolab-Cyrus Cyrus.pm,1.1,1.2
cvs at intevation.de
cvs at intevation.de
Fri Apr 23 02:03:51 CEST 2004
Author: steffen
Update of /kolabrepository/server/perl-kolab/Kolab-Cyrus
In directory doto:/tmp/cvs-serv16564/Kolab-Cyrus
Modified Files:
Cyrus.pm
Log Message:
handle unsetting quotas
Index: Cyrus.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/Kolab-Cyrus/Cyrus.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Cyrus.pm 31 Mar 2004 15:36:42 -0000 1.1
+++ Cyrus.pm 23 Apr 2004 00:03:49 -0000 1.2
@@ -103,15 +103,25 @@
my $sf = shift || 0;
my $cyruid = &createUid($uid, $sf);
- if ($quota > 0) {
- (my $root, my %quota) = $cyrus->quotaroot($cyruid);
- my $setquota = $quota{'STORAGE'}[1];
- if (!defined($setquota) || ($setquota != $quota)) {
- Kolab::log('Y', "Setting quota of mailbox `$cyruid' to $quota");
- if (!$cyrus->setquota($cyruid, 'STORAGE', $quota)) {
- Kolab::log('Y', "Unable to set quota for mailbox `$cyruid', Error = `" . $cyrus->error . "'", KOLAB_WARN);
- }
- }
+ if( $quota < 0 ) {
+ return;
+ }
+
+ (my $root, my %quota) = $cyrus->quotaroot($cyruid);
+ my $setquota = $quota{'STORAGE'}[1];
+
+ if (!defined($setquota) || ($setquota != $quota)) {
+ if( $quota == 0 ) {
+ Kolab::log('Y', "Removing quota from mailbox `$cyruid'");
+ if (!$cyrus->setquota($cyruid)) {
+ Kolab::log('Y', "Unable to remove quota for mailbox `$cyruid', Error = `" . $cyrus->error . "'", KOLAB_WARN);
+ }
+ } else {
+ Kolab::log('Y', "Setting quota of mailbox `$cyruid' to $quota");
+ if (!$cyrus->setquota($cyruid, 'STORAGE', $quota)) {
+ Kolab::log('Y', "Unable to set quota for mailbox `$cyruid', Error = `" . $cyrus->error . "'", KOLAB_WARN);
+ }
+ }
}
}
More information about the commits
mailing list