do 'cyrus-lib.pl';
$cyrus = &cyrus_connect();
#@list=$cyrus->list('user'); $entry=$list[0]; $sep=$entry->[2];

# useradmin_create_user(&details)
# Create a new mailbox if sync is enabled
sub useradmin_create_user
{
if ($config{'sync_mbox'})
    {
    %imapParams=();
    get_config();
    my $mbox='user'.$SEP.$_[0]->{'user'};
    $cyrus->create($mbox);
    $cyrus->setacl($mbox, $config{admin_user}=>"all");
    $cyrus->setquota($mbox, 'STORAGE', trim($imapParams{autocreatequota})) if $imapParams{autocreatequota};
    $err=$cyrus->error;
#    print $err if $err;
    }
}	

# useradmin_delete_user(&details)
# Delete an user mailbox if sync is enabled
sub useradmin_delete_user
{
if ($config{'sync_mbox'})
    {
    $cyrus->delete('user'.$SEP.$_[0]->{'user'}); 
    $err=$cyrus->error;
#    print $err if $err;
    }
}

1;