Hello,

please find attached a patch, that allows the configuration of custom 
annotations on mailboxes through cyradm.sh.

This patch had been pending submission for a while, as it depended on the 
annotation_definitions patch accepted in 2.3.16[1].

I hope you will find this patch applies to CVS HEAD cleanly.

[1] http://lists.andrew.cmu.edu/pipermail/cyrus-announce/2009-
December/000069.html

-- 
Jeroen van Meeuwen
Senior Engineer, Kolab Systems AG

e: vanmeeu...@kolabsys.com
t: +316 42 801 403
w: http://www.kolabsys.com

pgp: 9342 BF08
From bf3ed165f8bfdeb7585e89c059f94b36b4b5aeb9 Mon Sep 17 00:00:00 2001
From: Jeroen van Meeuwen (Ergo Project) <jeroen.van.meeu...@ergo-project.org>
Date: Mon, 2 Aug 2010 16:36:24 +0200
Subject: [PATCH] Allow configuration of custom annotations through cyradm

---
 perl/imap/IMAP/Admin.pm |    8 ++++----
 perl/imap/IMAP/Shell.pm |    6 +++---
 perl/imap/cyradm.sh     |    4 ++++
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/perl/imap/IMAP/Admin.pm b/perl/imap/IMAP/Admin.pm
index a33713e..c0a6670 100644
--- a/perl/imap/IMAP/Admin.pm
+++ b/perl/imap/IMAP/Admin.pm
@@ -797,12 +797,12 @@ sub mboxconfig {
     return undef;
   }
 
-  if(!exists($values{$entry})) {
-    $self->{error} = "Unknown parameter $entry";
+  if(exists($values{$entry})) {
+    $entry = $values{$entry};
+  } else {
+    $self->{error} = "Unknown parameter $entry" unless substr($entry,0,1) eq "/";
   }
 
-  $entry = $values{$entry};
-
   my ($rc, $msg);
 
   $value = undef if($value eq "none");
diff --git a/perl/imap/IMAP/Shell.pm b/perl/imap/IMAP/Shell.pm
index 7fed400..c605079 100644
--- a/perl/imap/IMAP/Shell.pm
+++ b/perl/imap/IMAP/Shell.pm
@@ -127,7 +127,7 @@ my %builtins = (exit =>
 		  [\&_sc_info, '[mailbox]',
 		   'display mailbox/server metadata'],
 		mboxcfg =>
-		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value',
+		  [\&_sc_mboxcfg, 'mailbox [comment|condstore|expire|news2mail|sieve|squat|/<explicit annotation>] value',
 		   'configure mailbox'],
 		mboxconfig => 'mboxcfg',
 		reconstruct =>
@@ -1437,7 +1437,7 @@ sub _sc_mboxcfg {
   while (defined ($opt = shift(@argv))) {
     last if $opt eq '--';
     if ($opt =~ /^-/) {
-      die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
+      die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
     }
     else {
       push(@nargv, $opt);
@@ -1446,7 +1446,7 @@ sub _sc_mboxcfg {
   }
   push(@nargv, @argv);
   if (@nargv < 2) {
-    die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat] value\n";
+    die "usage: mboxconfig mailbox [comment|condstore|expire|news2mail|sharedseen|sieve|squat|/<explicit annotation>] value\n";
   }
   if (!$cyrref || !$$cyrref) {
     die "mboxconfig: no connection to server\n";
diff --git a/perl/imap/cyradm.sh b/perl/imap/cyradm.sh
index 708aebc..5e2ecf9 100644
--- a/perl/imap/cyradm.sh
+++ b/perl/imap/cyradm.sh
@@ -241,6 +241,10 @@ mailboxes).
 
 Indicates that the mailbox should have a squat index created for it.
 
+=item C</explicit/annotation>
+
+Sets the annotation I</explicit/annotation> on I<mailbox> to I<value>. 
+
 =back 
 
 =item C<renamemailbox> [C<--partition> I<partition>] I<oldname> I<newname>
-- 
1.7.1.1

Reply via email to