diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-06-14 14:44:27 (GMT) |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2011-06-14 14:44:27 (GMT) |
commit | 99a792d34a770723f28e6c0fe057adc34de3cad9 (patch) | |
tree | fbd54eaee124ac5b2057fea94dfd05d86f0ca208 | |
parent | ec207a8b391813e225f6d4fb68dfeb90f0ca29ec (diff) | |
download | perl-Kolab-99a792d34a770723f28e6c0fe057adc34de3cad9.tar.gz |
Add sample scripts for the new API calls
-rwxr-xr-x | bin/create_mailbox.pl | 23 | ||||
-rwxr-xr-x | bin/delete_mailbox.pl | 16 | ||||
-rw-r--r-- | bin/reconstruct.pl | 0 | ||||
-rwxr-xr-x | bin/rename_mailbox.pl | 20 | ||||
-rwxr-xr-x | bin/setquota.pl | 17 | ||||
-rwxr-xr-x | bin/transfer_mailbox.pl | 18 | ||||
-rwxr-xr-x | bin/transfer_mailbox_folder.pl | 16 | ||||
-rw-r--r-- | bin/undelete_mailbox.pl | 0 |
8 files changed, 110 insertions, 0 deletions
diff --git a/bin/create_mailbox.pl b/bin/create_mailbox.pl new file mode 100755 index 0000000..efe28a0 --- /dev/null +++ b/bin/create_mailbox.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl + +# Create a new mailbox without a preference as to which server the mailbox is +# created on. To give the preferred mailbox server, set $mailboxPreferredServer +# to the server's Fully Qualified Domain Name. +use Kolab; +use Kolab::Cyrus; + +my ($mailboxName, $mailboxPreferredServer, $mailboxType) = @ARGV; + +Kolab::reloadConfig('/etc/kolab/kolab-shc.conf'); + +if ( !$mailboxType ) { + $mailboxType = 'user'; +} + +if ( !$mailboxPreferredServer ) { + $mailboxPreferredServer = 0; +} + +my $mailboxServer = Kolab::cyrusMurderCreateMailbox($mailboxName, $mailboxPreferredServer, $mailboxType); + +print $mailboxServer . "\n"; diff --git a/bin/delete_mailbox.pl b/bin/delete_mailbox.pl new file mode 100755 index 0000000..c0992f6 --- /dev/null +++ b/bin/delete_mailbox.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +# Delete an existing mailbox. +use Kolab; +use Kolab::Cyrus; + +# John Doe's contract is terminated +my ($mailboxName, $mailboxType) = @ARGV; + +if ( !$mailboxType ) { + $mailboxType = 'user'; +} + +Kolab::reloadConfig('/etc/kolab/kolab-shc.conf'); + +Kolab::cyrusMurderDeleteMailbox($mailboxName, $mailboxType); diff --git a/bin/reconstruct.pl b/bin/reconstruct.pl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bin/reconstruct.pl diff --git a/bin/rename_mailbox.pl b/bin/rename_mailbox.pl new file mode 100755 index 0000000..796a726 --- /dev/null +++ b/bin/rename_mailbox.pl @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +# Rename a mailbox. +use Kolab; +use Kolab::Cyrus; + +# Jane Gi marries John Doe +my ($mailboxName, $newMailboxName, $mailboxType) = @ARGV; + +if ( ! $mailboxType ) { + $mailboxType = 'user'; +} + +if ( ! $newMailboxName ) { + die("Require the new mailbox name in a rename."); +} + +Kolab::reloadConfig('/etc/kolab/kolab.conf'); + +Kolab::cyrusMurderRenameMailbox($mailboxName, $newMailboxName, $mailboxType); diff --git a/bin/setquota.pl b/bin/setquota.pl new file mode 100755 index 0000000..c5b9bee --- /dev/null +++ b/bin/setquota.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +# Create a new mailbox without a preference as to which server the mailbox is +# created on. To give the preferred mailbox server, set $mailboxPreferredServer +# to the server's Fully Qualified Domain Name. +use Kolab; +use Kolab::Cyrus; + +my ($mailboxName, $mailboxType) = @ARGV; + +Kolab::reloadConfig('/etc/kolab/kolab-shc.conf'); + +if ( !$mailboxType ) { + $mailboxType = 'user'; +} + +Kolab::cyrusMurderSetQuota($mailboxName, $mailboxType); diff --git a/bin/transfer_mailbox.pl b/bin/transfer_mailbox.pl new file mode 100755 index 0000000..0c3aedb --- /dev/null +++ b/bin/transfer_mailbox.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +# Transfer a mailbox from one server to another. +use Kolab; +use Kolab::Cyrus; + +my $mailboxName = $ARGV[0]; +my $mailboxPreferredServer = $ARGV[1]; + +if ( !$mailboxPreferredServer ) { + die("No target server specified"); +} + +Kolab::reloadConfig('/etc/kolab/kolab-shc.conf'); + +my $rc = Kolab::cyrusMurderTransferMailbox($mailboxName, $mailboxPreferredServer); + +exit !$rc; diff --git a/bin/transfer_mailbox_folder.pl b/bin/transfer_mailbox_folder.pl new file mode 100755 index 0000000..7871da7 --- /dev/null +++ b/bin/transfer_mailbox_folder.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl + +# John Doe's Archive folder is so large, it needs to be on a different server +# with slower, cheaper storage. Or something like that. +use Kolab; +use Kolab::Cyrus; + +my ($mailboxName, $mailboxFolder, $mailboxPreferredServer) = @ARGV; + +if ( !$mailboxPreferredServer ) { + die("No target server specified"); +} + +Kolab::reloadConfig('/etc/kolab/kolab-shc.conf'); + +Kolab::cyrusMurderTransferMailboxFolder($mailboxName, $mailboxFolder, $mailboxPrefferedServer); diff --git a/bin/undelete_mailbox.pl b/bin/undelete_mailbox.pl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/bin/undelete_mailbox.pl |