Added c-client-2004g-r1 and c-client-2006k, both with support for the Kolab
authorGunnar Wrobel <wrobel@gentoo.org>
Fri, 22 Feb 2008 07:18:17 +0000 (07:18 +0000)
committerGunnar Wrobel <wrobel@gentoo.org>
Fri, 22 Feb 2008 07:18:17 +0000 (07:18 +0000)
groupware server.
Package-Manager: portage-2.1.4_rc7

net-libs/c-client/ChangeLog
net-libs/c-client/Manifest
net-libs/c-client/c-client-2004g-r1.ebuild [new file with mode: 0644]
net-libs/c-client/c-client-2004g.ebuild
net-libs/c-client/c-client-2006k.ebuild [new file with mode: 0644]
net-libs/c-client/files/c-client-2004g_KOLAB_Annotations.patch [new file with mode: 0644]
net-libs/c-client/files/c-client-2006k_GENTOO_Makefile.patch [new file with mode: 0644]
net-libs/c-client/files/c-client-2006k_GENTOO_amd64-so-fix.patch [new file with mode: 0644]
net-libs/c-client/files/c-client-2006k_KOLAB_Annotations.patch [new file with mode: 0644]
net-libs/c-client/metadata.xml

index 6a4a8ed8aefc4057b94460d04fc3c07cac4aa54c..c5aff45c98f682a82d8a1b50f78729abcf99b13f 100644 (file)
@@ -1,6 +1,27 @@
 # ChangeLog for net-libs/c-client
 # Copyright 2000-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/ChangeLog,v 1.43 2008/02/21 23:32:05 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/ChangeLog,v 1.44 2008/02/22 07:18:16 wrobel Exp $
+
+  22 Feb 2008; Gunnar Wrobel <wrobel@gentoo.org>
+  +files/c-client-2004g_KOLAB_Annotations.patch,
+  +files/c-client-2006k_GENTOO_Makefile.patch,
+  +files/c-client-2006k_GENTOO_amd64-so-fix.patch,
+  +files/c-client-2006k_KOLAB_Annotations.patch, metadata.xml,
+  c-client-2004g.ebuild, +c-client-2004g-r1.ebuild, +c-client-2006k.ebuild:
+  Added c-client-2004g-r1 and c-client-2006k, both with support for the Kolab
+  groupware server.
+
+*c-client-2006k (22 Feb 2008)
+*c-client-2004g-r1 (22 Feb 2008)
+
+  22 Feb 2008; Gunnar Wrobel <wrobel@gentoo.org>
+  +files/c-client-2004g_KOLAB_Annotations.patch,
+  +files/c-client-2006k_GENTOO_Makefile.patch,
+  +files/c-client-2006k_GENTOO_amd64-so-fix.patch,
+  +files/c-client-2006k_KOLAB_Annotations.patch, metadata.xml,
+  c-client-2004g.ebuild, +c-client-2004g-r1.ebuild, +c-client-2006k.ebuild:
+  Added c-client-2004g-r1 and c-client-2006k, both with support for the Kolab
+  groupware server.
 
   21 Feb 2008; Robin H. Johnson <robbat2@gentoo.org> c-client-2004g.ebuild:
   Clean up all repoman warnings.
index 50f704dfc2277bff17b88671181d4ef82bcdadcf..5f30deb820a0a8e514302f8ade02448ef2e2f613 100644 (file)
@@ -1,6 +1,23 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
 AUX 2002d-Makefile.patch 2174 RMD160 ab95295b15a9f8cceb73a1b2431453ec1e137c0e SHA1 0e7949763126d7cb094048f187c11e249aaabddf SHA256 ff9102e5e3e1498269084ef803d73c0c21bff136b038f13ba648a4248981ca35
 AUX c-client-2004a-amd64-so-fix.patch 675 RMD160 f13adf21e7043175d2b2dd356b2ba48554e9e99f SHA1 fd6aad7b87d71795cb3e9bdee29b70ca72b289e9 SHA256 8f80dff390a5d87afd71ab07bbff0eed00acb14b3bfa2355f33ba22e833af202
+AUX c-client-2004g_KOLAB_Annotations.patch 14615 RMD160 a1df8b9ce77731476d6b045261a11d3cd150d504 SHA1 47f5257f0c0642e7f6f8c1ffeba1d2c2c746c7f8 SHA256 b0eee141a9b51356bbe1e480d9f1f216064c89527277240cab0d4dc22b61ab5b
+AUX c-client-2006k_GENTOO_Makefile.patch 2441 RMD160 4c1fbe17eadd6dac6aa0b615757cd95b4c688d75 SHA1 4d55c0eea05605a4d42e95f0284be90dbe20ff3c SHA256 6f7bf2d23f346f0f8eed4c4ae61e5b5c95d1a12e15e7fb4192a5a723754255f8
+AUX c-client-2006k_GENTOO_amd64-so-fix.patch 665 RMD160 a2a4747dea49279f4464b99234f338a5f7faf022 SHA1 a858f66db06625a102db0db4b503c64e9a8ad5c0 SHA256 77de7621946c69638295ac11275124d0c405a4c6ba284a068f9a96c4994f3184
+AUX c-client-2006k_KOLAB_Annotations.patch 14551 RMD160 932f866a70f709d980c92a37890fcc38a4f74c06 SHA1 8e92dbb7311430c45dbdcfb0b8b698f9048ec85a SHA256 cd8833d4eabd8fbad6a1588e3ee5375fced007964f1c6bcd016b34bee5d8eaf2
 DIST imap-2004g.tar.Z 2246713 RMD160 a016a06ba073e879d2574a6395ce1074ea74c687 SHA1 791a8bb247ca51ce0a4c32e814a2f736c2bcf066 SHA256 958ab8a6a8b5a1a53167793141fe5bf1fbafc012be1d3f70a21f5f2f493ffa6d
-EBUILD c-client-2004g.ebuild 2854 RMD160 e409b167f62c671335d1d24cf3b2e56d7bd7b4ed SHA1 bad19ad97aa90610412a7b6d1c14335296b44d10 SHA256 132a7d7ee34997a2cac902f1a6b57daabc4cac45d1581d6bcfe6a6cf8cbfa98b
-MISC ChangeLog 5425 RMD160 b15d8bf26f13ae2ca192ab1f4f9f9dc9d98bb4db SHA1 eae6f609784cce02275067ef1d1c0f5a9c8c1e70 SHA256 c05de58191bb627d29e13174a774269693e712f8753f65dfdb660d1f2bf1c4a4
-MISC metadata.xml 242 RMD160 37e66ced5442e4f5124ec706f45e78a5d4ba35f9 SHA1 db9f94a9f6e22a63f44b5bccc5b21e64d3c75afa SHA256 5b5ca3a79ffe6bf30c5b0193c7f2ecb75bfb99be916ba4d61462a7a276b2b0ba
+DIST imap-2006k.tar.Z 2723757 RMD160 4be6c46035f28bc5f2b710ce7b6c77e7929d285f SHA1 4b64e74d5928857a1c802ba6c9ab575205b342ce SHA256 e294a629d948defa09dfb7ee80c80a01390e896a1a3618a709019f17a0e57431
+EBUILD c-client-2004g-r1.ebuild 3062 RMD160 429128f7787d47195938bb04b09e00d81643e154 SHA1 b3b331f33a91ac4f12ae42b94569357b6dfac495 SHA256 37ecc454157f8d069a5ad76e8df1d9cedef94a8b4c8a61925a2d16474866c7cc
+EBUILD c-client-2004g.ebuild 2853 RMD160 521a7d422df11b54e6fe41a22e555a84f9b933ec SHA1 399cb51e13f4f33202c7f3d3985f246cf70d1092 SHA256 13c561735eb1e48272142f4a784582c38b3e94578b8f7754cd99f49e8a7103a0
+EBUILD c-client-2006k.ebuild 3202 RMD160 74436d68e318785168e2b409ad536eb64ff5c72a SHA1 04b6333bdb2ad94834eb5be82c0afcea0fb7db14 SHA256 d6fa832ac9e3125091bb0d322756550f30005c8d090afbc847c0748cd982e71e
+MISC ChangeLog 6356 RMD160 f483d487dc15267a601805b3ea4c956d55c87966 SHA1 5657fe8096440e84a6d31e2726ae249ae6adea7c SHA256 9f4c1edea3672060698b0e79e4ad9195647f1c80b9ff81808435e6bcfc72dc8e
+MISC metadata.xml 241 RMD160 85016d60a6e59c6b9e6bf88737c8f4c28e5df9a8 SHA1 20056b407d75406c5c0cb07132e08966aed63e38 SHA256 90fbfbe9c5a99cac3375be028f50abcfeebd8a9a5243106f6c6a38e4aa3adf5d
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.7 (GNU/Linux)
+
+iD8DBQFHvnc/EEcxCpcDQ74RAlqkAJwJ6II41nHibuqrPenhmgGNp7njtQCffja5
+dgJ4IWJzXL+sn/O8NTUtrKs=
+=yt4C
+-----END PGP SIGNATURE-----
diff --git a/net-libs/c-client/c-client-2004g-r1.ebuild b/net-libs/c-client/c-client-2004g-r1.ebuild
new file mode 100644 (file)
index 0000000..7e64995
--- /dev/null
@@ -0,0 +1,105 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/c-client-2004g-r1.ebuild,v 1.1 2008/02/22 07:18:16 wrobel Exp $
+
+inherit flag-o-matic eutils libtool
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+S=${WORKDIR}/${MY_P}
+
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_P}.tar.Z"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="kernel_linux kernel_FreeBSD kolab pam ssl"
+
+RDEPEND="ssl? ( dev-libs/openssl )
+       !virtual/imap-c-client"
+DEPEND="${RDEPEND}
+       kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )"
+PROVIDE="virtual/imap-c-client"
+
+src_unpack() {
+       unpack ${A}
+
+       # Tarball packed with bad file perms
+       chmod -R ug+w "${S}"
+
+       # lots of things need -fPIC, including various platforms, and this library
+       # generally should be built with it anyway.
+       append-flags -fPIC
+
+       cd "${S}"
+
+       # Modifications so we can build it optimally and correctly
+       sed \
+               -e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \
+               -e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \
+               -e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \
+               -i src/osdep/unix/Makefile || die "Makefile sed fixing failed"
+
+       # Targets should use the Gentoo (ie linux) fs
+       sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
+               -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD"
+
+       # Apply a patch to only build the stuff we need for c-client
+       epatch "${FILESDIR}"/2002d-Makefile.patch || die "epatch failed"
+
+       # Apply patch to add the compilation of a .so for PHP
+       # This was previously conditional, but is more widely useful.
+       epatch "${FILESDIR}"/${PN}-2004a-amd64-so-fix.patch
+
+       # Add kolab support.
+       # http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/imap/
+       if use kolab ; then
+               epatch "${FILESDIR}/${P}_KOLAB_Annotations.patch" || die "epatch failed"
+       fi
+
+       # Remove the pesky checks about SSL stuff
+       sed -e '/read.*exit/d' -i Makefile
+       elibtoolize
+}
+
+src_compile() {
+       local ssltype target
+       use ssl && ssltype="unix" || ssltype="none"
+       if use kernel_linux ; then
+               use pam && target=lnp || target=lnx
+       elif use kernel_FreeBSD ; then
+               target=bsf
+       fi
+       # no parallel builds supported!
+       emake -j1 $target SSLTYPE=${ssltype} EXTRACFLAGS="${CFLAGS}" || die "make failed"
+}
+
+src_install() {
+       into /usr
+
+       # Library binary
+       dolib.a c-client/c-client.a || die
+       dosym c-client.a /usr/$(get_libdir)/libc-client.a
+
+       # Now the shared library
+       dolib.so c-client/libc-client.so.1.0.0 || die
+       # these are created by ldconfig!
+       #cd ${D}/usr/$(get_libdir)
+       #ln -s libc-client.so.1.0.0 libc-client.so.1
+       #ln -s libc-client.so.1.0.0 libc-client.so
+
+       # Headers
+       insinto /usr/include/imap
+       doins c-client/*.h
+       doins c-client/linkage.c
+       #exclude these dupes (can't do it before now due to symlink hell)
+       rm "${D}"/usr/include/imap/os_*.h
+
+       # Docs
+       dodoc README docs/*.txt docs/CONFIG docs/RELNOTES
+
+       docinto rfc
+       dodoc docs/rfc/*.txt
+}
index 3d665219f73679c518883141b0d6f5fca020bab7..34acb7d8143b250314430b7c4385ebb4df0a00ff 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2008 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/c-client-2004g.ebuild,v 1.13 2008/02/21 23:32:05 robbat2 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/c-client-2004g.ebuild,v 1.14 2008/02/22 07:18:16 wrobel Exp $
 
 inherit flag-o-matic eutils libtool
 
@@ -44,7 +44,7 @@ src_unpack() {
 
        # Targets should use the Gentoo (ie linux) fs
        sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
-               -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD"
+               -i src/osdep/unix/Makefile || die "Makefile sed fixing failed for FreeBSD"
 
        # Apply a patch to only build the stuff we need for c-client
        epatch "${FILESDIR}"/2002d-Makefile.patch || die "epatch failed"
diff --git a/net-libs/c-client/c-client-2006k.ebuild b/net-libs/c-client/c-client-2006k.ebuild
new file mode 100644 (file)
index 0000000..1150477
--- /dev/null
@@ -0,0 +1,109 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-libs/c-client/c-client-2006k.ebuild,v 1.1 2008/02/22 07:18:16 wrobel Exp $
+
+inherit flag-o-matic eutils libtool
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+S=${WORKDIR}/${MY_P}
+
+MAKEFILE_PATCH_VER="2006k"
+SO_PATCH_VER="2006k"
+KOLAB_PATCH_VER="2006k"
+
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="ftp://ftp.cac.washington.edu/imap/old/${MY_P}.tar.Z"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="kernel_linux kernel_FreeBSD kolab pam ssl"
+
+RDEPEND="ssl? ( dev-libs/openssl )
+       !virtual/imap-c-client"
+DEPEND="${RDEPEND}
+       kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )"
+PROVIDE="virtual/imap-c-client"
+
+src_unpack() {
+       unpack ${A}
+
+       # Tarball packed with bad file perms
+       chmod -R ug+w "${S}"
+
+       # lots of things need -fPIC, including various platforms, and this library
+       # generally should be built with it anyway.
+       append-flags -fPIC
+
+       cd "${S}"
+
+       # Modifications so we can build it optimally and correctly
+       sed \
+               -e "s:BASECFLAGS=\".*\":BASECFLAGS=:g" \
+               -e 's:SSLDIR=/usr/local/ssl:SSLDIR=/usr:g' \
+               -e 's:SSLCERTS=$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:g' \
+               -i src/osdep/unix/Makefile || die "Makefile sed fixing failed"
+
+       # Targets should use the Gentoo (ie linux) fs
+       sed -e '/^bsf:/,/^$/ s:ACTIVEFILE=.*:ACTIVEFILE=/var/lib/news/active:g' \
+               -i src/osdep/unix/Makefile || die "Makefile sex fixing failed for FreeBSD"
+
+       # Apply a patch to only build the stuff we need for c-client
+       epatch "${FILESDIR}"/${PN}-${MAKEFILE_PATCH_VER}_GENTOO_Makefile.patch || die "epatch failed"
+
+       # Apply patch to add the compilation of a .so for PHP
+       # This was previously conditional, but is more widely useful.
+       epatch "${FILESDIR}"/${PN}-${SO_PATCH_VER}_GENTOO_amd64-so-fix.patch
+
+       # Add kolab support.
+       # http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/patches/imap/
+       if use kolab ; then
+               epatch "${FILESDIR}"/${PN}-${KOLAB_PATCH_VER}_KOLAB_Annotations.patch || die "epatch failed"
+       fi
+
+       # Remove the pesky checks about SSL stuff
+       sed -e '/read.*exit/d' -i Makefile
+       elibtoolize
+}
+
+src_compile() {
+       local ssltype target
+       use ssl && ssltype="unix" || ssltype="none"
+       if use kernel_linux ; then
+               use pam && target=lnp || target=lnx
+       elif use kernel_FreeBSD ; then
+               target=bsf
+       fi
+       # no parallel builds supported!
+       emake -j1 $target SSLTYPE=${ssltype} EXTRACFLAGS="${CFLAGS}" || die "make failed"
+}
+
+src_install() {
+       into /usr
+
+       # Library binary
+       dolib.a c-client/c-client.a || die
+       dosym c-client.a /usr/$(get_libdir)/libc-client.a
+
+       # Now the shared library
+       dolib.so c-client/libc-client.so.1.0.0 || die
+       # these are created by ldconfig!
+       #cd ${D}/usr/$(get_libdir)
+       #ln -s libc-client.so.1.0.0 libc-client.so.1
+       #ln -s libc-client.so.1.0.0 libc-client.so
+
+       # Headers
+       insinto /usr/include/imap
+       doins c-client/*.h
+       doins c-client/linkage.c
+       #exclude these dupes (can't do it before now due to symlink hell)
+       rm "${D}"/usr/include/imap/os_*.h
+
+       # Docs
+       dodoc README docs/*.txt docs/CONFIG docs/RELNOTES
+
+       docinto rfc
+       dodoc docs/rfc/*.txt
+}
diff --git a/net-libs/c-client/files/c-client-2004g_KOLAB_Annotations.patch b/net-libs/c-client/files/c-client-2004g_KOLAB_Annotations.patch
new file mode 100644 (file)
index 0000000..77bc818
--- /dev/null
@@ -0,0 +1,448 @@
+Provides get/set ANNOTATIONS support to the c-client library. [Version: 2004g]
+
+diff -r b9fd2c61d881 src/c-client/imap4r1.c
+--- a/src/c-client/imap4r1.c   Sat Sep 29 08:56:35 2007 +0200
++++ b/src/c-client/imap4r1.c   Sat Sep 29 10:40:13 2007 +0200
+@@ -125,7 +125,8 @@ typedef struct imap_argument {
+ #define MULTIAPPEND 13
+ #define SNLIST 14
+ #define MULTIAPPENDREDO 15
+-
++#define QLIST 16
++#define QSTRING 17
+ 
+ /* Append data */
+ 
+@@ -195,12 +196,15 @@ void imap_gc_body (BODY *body);
+ void imap_gc_body (BODY *body);
+ void imap_capability (MAILSTREAM *stream);
+ long imap_acl_work (MAILSTREAM *stream,char *command,IMAPARG *args[]);
++long imap_annotation_work (MAILSTREAM *stream,char *command,IMAPARG *args[]);
+ 
+ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]);
+ IMAPPARSEDREPLY *imap_sout (MAILSTREAM *stream,char *tag,char *base,char **s);
+ long imap_soutr (MAILSTREAM *stream,char *string);
+ IMAPPARSEDREPLY *imap_send_astring (MAILSTREAM *stream,char *tag,char **s,
+                                   SIZEDTEXT *as,long wildok,char *limit);
++IMAPPARSEDREPLY *imap_send_qstring (MAILSTREAM *stream,char *tag,char **s,
++                                  SIZEDTEXT *as,char *limit);
+ IMAPPARSEDREPLY *imap_send_literal (MAILSTREAM *stream,char *tag,char **s,
+                                   STRING *st);
+ IMAPPARSEDREPLY *imap_send_spgm (MAILSTREAM *stream,char *tag,char *base,
+@@ -2679,6 +2683,84 @@ long imap_getacl (MAILSTREAM *stream,cha
+     args[0] = &ambx; args[1] = NIL;
+   return imap_acl_work (stream,"GETACL",args);
+ }
++
++/* IMAP set annotation
++ * Accepts: mail stream
++ *          annotation struct
++ * Returns: T on success, NIL on failure
++ */
++
++long imap_setannotation (MAILSTREAM *stream,ANNOTATION *annotation)
++{
++  IMAPARG *args[4],ambx,apth,aval;
++  long ret;
++  
++  ambx.type = ASTRING;
++  ambx.text = (void *) annotation->mbox;
++  args[0] = &ambx;
++  
++  apth.type = QSTRING;
++  apth.text = (void *) annotation->entry;
++  args[1] = &apth;
++
++  STRINGLIST *st,*l;
++  ANNOTATION_VALUES *v;
++  
++  l = st = mail_newstringlist();
++  v = annotation->values;
++  while(v){
++    l->text.size = strlen((char *) (l->text.data = (unsigned char*)cpystr(v->attr)));
++    l->next = mail_newstringlist();
++    l = l->next;
++    l->text.size = strlen((char *) (l->text.data = (unsigned char*)cpystr(v->value)));
++    if(v->next){
++      l->next = mail_newstringlist();
++      l = l->next;
++    }
++    v = v->next;
++  }
++  
++  aval.type = QLIST;
++  aval.text = (void *)st;
++  args[2] = &aval;
++  args[3] = NIL;
++  
++  ret = imap_annotation_work(stream, "SETANNOTATION",args);
++  mail_free_stringlist(&st);
++  return ret;
++}
++  
++  
++  
++/* IMAP get annotation
++ * Accepts: mail stream
++ *          mailbox name
++ *          annotation entry list
++ *          annotation attribute list
++ * Returns: T on success with data returned via callback, NIL on failure
++ */
++
++long imap_getannotation (MAILSTREAM *stream,char *mailbox,STRINGLIST *entries, STRINGLIST *attributes)
++{
++  IMAPARG *args[4],ambx,apth,aattr;
++  long ret;
++  ambx.type = ASTRING;
++  ambx.text = (void*) mailbox;
++  args[0] = &ambx; 
++
++ 
++  apth.type = QLIST;
++  apth.text = (void*) entries;
++  args[1] = &apth;
++
++  aattr.type = QLIST;
++  aattr.text = (void*) attributes;
++  args[2] = &aattr;
++
++  args[3] = NIL;
++  ret = imap_annotation_work(stream, "GETANNOTATION",args);
++  return ret;
++}
+ \f
+ /* IMAP list rights
+  * Accepts: mail stream
+@@ -2731,6 +2813,16 @@ long imap_acl_work (MAILSTREAM *stream,c
+   else mm_log ("ACL not available on this IMAP server",ERROR);
+   return ret;
+ }
++ long imap_annotation_work(MAILSTREAM *stream, char *command,IMAPARG *args[])
++{
++  long ret = NIL;
++  IMAPPARSEDREPLY *reply;
++  if (imap_OK (stream,reply = imap_send (stream,command,args)))
++    ret = LONGT;
++  else mm_log (reply->text,ERROR);
++  return ret;
++}
++
+ \f
+ /* IMAP set quota
+  * Accepts: mail stream
+@@ -2863,6 +2955,11 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+       if (reply = imap_send_astring (stream,tag,&s,&st,NIL,CMDBASE+MAXCOMMAND))
+       return reply;
+       break;
++    case QSTRING:             /* atom or string, must be literal? */
++      st.size = strlen ((char *) (st.data = (unsigned char *) arg->text));
++      if (reply = imap_send_qstring (stream,tag,&s,&st,CMDBASE+MAXCOMMAND))
++      return reply;
++      break;
+     case LITERAL:             /* literal, as a stringstruct */
+       if (reply = imap_send_literal (stream,tag,&s,arg->text)) return reply;
+       break;
+@@ -2873,6 +2970,18 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+       do {                    /* for each list item */
+       *s++ = c;               /* write prefix character */
+       if (reply = imap_send_astring (stream,tag,&s,&list->text,NIL,
++                                     CMDBASE+MAXCOMMAND)) return reply;
++      c = ' ';                /* prefix character for subsequent strings */
++      }
++      while (list = list->next);
++      *s++ = ')';             /* close list */
++      break;
++    case QLIST:                       /* list of strings */
++      list = (STRINGLIST *) arg->text;
++      c = '(';                        /* open paren */
++      do {                    /* for each list item */
++      *s++ = c;               /* write prefix character */
++      if (reply = imap_send_qstring (stream,tag,&s,&list->text,
+                                      CMDBASE+MAXCOMMAND)) return reply;
+       c = ' ';                /* prefix character for subsequent strings */
+       }
+@@ -3045,6 +3154,32 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+   reply = imap_sout (stream,tag,CMDBASE,&s);
+   mail_unlock (stream);               /* unlock stream */
+   return reply;
++}
++
++/* IMAP send quoted-string
++ * Accepts: MAIL stream
++ *        reply tag
++ *        pointer to current position pointer of output bigbuf
++ *        atom-string to output
++ *        maximum to write as atom or qstring
++ * Returns: error reply or NIL if success
++ */
++
++IMAPPARSEDREPLY *imap_send_qstring (MAILSTREAM *stream,char *tag,char **s,
++                                  SIZEDTEXT *as,char *limit)
++{
++  unsigned long j;
++  char c;
++  STRING st;
++                              /* in case needed */
++  INIT (&st,mail_string,(void *) as->data,as->size);
++                              /* always write literal if no space */
++  if ((*s + as->size) > limit) return imap_send_literal (stream,tag,s,&st);
++
++  *(*s)++ = '"';      /* write open quote */
++  for (j = 0; j < as->size; j++) *(*s)++ = as->data[j];
++  *(*s)++ = '"';      /* write close quote */
++  return NIL;
+ }
+ \f
+ /* IMAP send atom-string
+@@ -3948,6 +4083,50 @@ void imap_parse_unsolicited (MAILSTREAM 
+     }
+   }
+ \f
++  else if (!strcmp (reply->key,"ANNOTATION") && (s = reply->text)){
++    char * mbox;    
++    /* response looks like ANNOTATION "mailbox" "entry" ("attr" "value" ["attr" "value"]) ["entry" ("attr "value" ["attr" "value"] )]*/
++    getannotation_t an = (getannotation_t) mail_parameters (NIL,GET_ANNOTATION,NIL);
++    
++    mbox = imap_parse_astring (stream, &s, reply,NIL);
++    
++    while(*s){
++      ANNOTATION * al = mail_newannotation();    
++      al->mbox = cpystr(mbox);
++      t = imap_parse_astring (stream, &s, reply,NIL);
++      al->entry = t;
++      STRINGLIST *strlist;
++      if (s){while (*s == ' ')s++;}
++      
++      strlist = imap_parse_stringlist(stream, &s,reply);
++
++      ANNOTATION_VALUES *vlIter, *vlBegin;
++      vlIter = vlBegin = NIL;
++      if (strlist) {
++        while(strlist){       
++          if(vlIter){
++            vlIter->next = mail_newannotationvalue();
++            vlIter = vlIter->next;
++          }else{
++            vlIter = mail_newannotationvalue();
++            vlBegin = vlIter;
++          }
++          if ( strlist->text.size )
++            vlIter->attr = cpystr (strlist->text.data);        
++          strlist = strlist->next;        
++          if(!strlist) continue;
++          if ( strlist->text.size )
++            vlIter->value = cpystr (strlist->text.data);
++          strlist = strlist->next;
++        }
++      }
++      al->values = vlBegin;
++      if (an) 
++        (*an) (stream,al);
++      mail_free_annotation(&al);
++    }
++    fs_give ((void **)&mbox);
++  }
+   else if (!strcmp (reply->key,"ACL") && (s = reply->text) &&
+          (t = imap_parse_astring (stream,&s,reply,NIL))) {
+     getacl_t ar = (getacl_t) mail_parameters (NIL,GET_ACL,NIL);
+diff -r b9fd2c61d881 src/c-client/imap4r1.h
+--- a/src/c-client/imap4r1.h   Sat Sep 29 08:56:35 2007 +0200
++++ b/src/c-client/imap4r1.h   Sat Sep 29 10:40:13 2007 +0200
+@@ -232,3 +232,5 @@ long imap_setquota (MAILSTREAM *stream,c
+ long imap_setquota (MAILSTREAM *stream,char *qroot,STRINGLIST *limits);
+ long imap_getquota (MAILSTREAM *stream,char *qroot);
+ long imap_getquotaroot (MAILSTREAM *stream,char *mailbox);
++long imap_getannotation (MAILSTREAM *stream,char *mailbox,STRINGLIST *entries,STRINGLIST *attributes);
++long imap_setannotation (MAILSTREAM *stream,ANNOTATION *annotation); 
+diff -r b9fd2c61d881 src/c-client/mail.c
+--- a/src/c-client/mail.c      Sat Sep 29 08:56:35 2007 +0200
++++ b/src/c-client/mail.c      Sat Sep 29 10:40:13 2007 +0200
+@@ -60,6 +60,7 @@ static newsrcquery_t mailnewsrcquery = N
+ static newsrcquery_t mailnewsrcquery = NIL;
+                               /* ACL results callback */
+ static getacl_t mailaclresults = NIL;
++static getannotation_t mailannotationresults = NIL;
+                               /* list rights results callback */
+ static listrights_t maillistrightsresults = NIL;
+                               /* my rights results callback */
+@@ -516,6 +517,11 @@ void *mail_parameters (MAILSTREAM *strea
+     ret = (void *) (debugsensitive ? VOIDT : NIL);
+     break;
+ \f
++  case SET_ANNOTATION:
++    mailannotationresults = (getannotation_t) value;
++  case GET_ANNOTATION:
++    ret = (void *) mailannotationresults;
++    break;
+   case SET_ACL:
+     mailaclresults = (getacl_t) value;
+   case GET_ACL:
+@@ -5489,7 +5495,15 @@ ACLLIST *mail_newacllist (void)
+   return (ACLLIST *) memset (fs_get (sizeof (ACLLIST)),0,sizeof (ACLLIST));
+ }
+ 
+-
++ANNOTATION *mail_newannotation (void)
++{
++  return (ANNOTATION *) memset (fs_get (sizeof (ANNOTATION)),0,sizeof(ANNOTATION));
++}
++
++ANNOTATION_VALUES *mail_newannotationvalue (void)
++{
++  return (ANNOTATION_VALUES *) memset (fs_get (sizeof (ANNOTATION_VALUES)),0,sizeof(ANNOTATION_VALUES));
++}
+ /* Mail instantiate new quotalist
+  * Returns: new quotalist
+  */
+@@ -5812,6 +5826,25 @@ void mail_free_acllist (ACLLIST **al)
+   }
+ }
+ 
++static void mail_free_annotation_values(ANNOTATION_VALUES **val)
++{
++  if (*val) {
++    if ((*val)->attr) fs_give ((void**) &(*val)->attr);
++    if ((*val)->value) fs_give ((void**) &(*val)->value);
++    mail_free_annotation_values (&(*val)->next);
++    fs_give ((void **) val);
++  }
++}                             
++void mail_free_annotation(ANNOTATION **al)
++{
++  if (*al) {
++    if((*al)->mbox) fs_give ((void**) &(*al)->mbox);
++    if((*al)->entry) fs_give ((void**) &(*al)->entry);
++    if((*al)->values)
++      mail_free_annotation_values(&(*al)->values);
++    fs_give ((void **) al);
++  }
++}
+ 
+ /* Mail garbage collect quotalist
+  * Accepts: pointer to quotalist pointer
+diff -r b9fd2c61d881 src/c-client/mail.h
+--- a/src/c-client/mail.h      Sat Sep 29 08:56:35 2007 +0200
++++ b/src/c-client/mail.h      Sat Sep 29 10:40:13 2007 +0200
+@@ -311,6 +311,8 @@
+ #define SET_SNARFPRESERVE (long) 567
+ #define GET_INBOXPATH (long) 568
+ #define SET_INBOXPATH (long) 569
++#define GET_ANNOTATION (long) 570
++#define SET_ANNOTATION (long) 571
+ \f
+ /* Driver flags */
+ 
+@@ -976,6 +978,24 @@ ACLLIST {
+   char *identifier;           /* authentication identifier */
+   char *rights;                       /* access rights */
+   ACLLIST *next;
++};
++
++/* ANNOTATION Response */
++
++#define ANNOTATION_VALUES struct annotation_value_list
++
++ANNOTATION_VALUES {
++      char *attr;
++      char *value;
++      ANNOTATION_VALUES *next;
++};
++
++#define ANNOTATION struct annotation
++
++ANNOTATION {
++      char *mbox;
++      char *entry;
++      ANNOTATION_VALUES * values;
+ };
+ 
+ /* Quota resource list */
+@@ -1262,6 +1282,7 @@ typedef long (*sslcertificatequery_t) (c
+ typedef long (*sslcertificatequery_t) (char *reason,char *host,char *cert);
+ typedef void (*sslfailure_t) (char *host,char *reason,unsigned long flags);
+ typedef void (*logouthook_t) (void *data);
++typedef void (*getannotation_t) (MAILSTREAM *stream,ANNOTATION* annot);
+ \f
+ /* Globals */
+ 
+@@ -1671,7 +1692,10 @@ SORTPGM *mail_newsortpgm (void);
+ SORTPGM *mail_newsortpgm (void);
+ THREADNODE *mail_newthreadnode (SORTCACHE *sc);
+ ACLLIST *mail_newacllist (void);
++ANNOTATION* mail_newannotation(void);
++ANNOTATION_VALUES* mail_newannotationvalue(void);
+ QUOTALIST *mail_newquotalist (void);
++void mail_free_annotation(ANNOTATION **a);
+ void mail_free_body (BODY **body);
+ void mail_free_body_data (BODY *body);
+ void mail_free_body_parameter (PARAMETER **parameter);
+diff -r b9fd2c61d881 src/mtest/mtest.c
+--- a/src/mtest/mtest.c        Sat Sep 29 08:56:35 2007 +0200
++++ b/src/mtest/mtest.c        Sat Sep 29 10:40:13 2007 +0200
+@@ -137,6 +137,8 @@ int main ()
+ #endif
+   return NIL;
+ }
++
++void mm_annotation (MAILSTREAM *stream, ANNOTATION *a);
+ \f
+ /* MM command loop
+  * Accepts: MAIL stream
+@@ -187,6 +189,28 @@ void mm (MAILSTREAM *stream,long debug)
+       mail_setflag (stream,arg,"\\DELETED");
+       else puts ("?Bad message number");
+       break;
++    case 'A':
++      {
++        char parms[MAILTMPLEN];
++        prompt("Annotation: ",parms);
++        if (parms) {
++          mail_parameters(stream,SET_ANNOTATION,mm_annotation);
++          STRINGLIST *entries = mail_newstringlist();
++          STRINGLIST *cur = entries;
++          cur->text.size = strlen((char *) (cur->text.data = (unsigned char*)cpystr (parms)));
++          cur->next = NIL;
++          
++          STRINGLIST *attributes = mail_newstringlist();
++          cur = attributes;
++          cur->text.size = strlen((char *) (cur->text.data = (unsigned char*)cpystr ("*")));
++          cur->next = NIL;
++          
++          imap_getannotation(stream,"INBOX",entries,attributes);
++          mail_free_stringlist(&entries);
++          mail_free_stringlist(&attributes);
++        }
++      }
++      break;  
+     case 'E':                 /* Expunge command */
+       mail_expunge (stream);
+       last = 0;
+@@ -339,7 +363,7 @@ void mm (MAILSTREAM *stream,long debug)
+     case '?':                 /* ? command */
+       puts ("Body, Check, Delete, Expunge, Find, GC, Headers, Literal,");
+       puts (" MailboxStatus, New Mailbox, Overview, Ping, Quit, Send, Type,");
+-      puts ("Undelete, Xit, +, -, or <RETURN> for next message");
++      puts ("Undelete, Xit,Annotation, +, -, or <RETURN> for next message");
+       break;
+     default:                  /* bogus command */
+       printf ("?Unrecognized command: %s\n",cmd);
+@@ -587,6 +611,18 @@ void prompt (char *msg,char *txt)
+ \f
+ /* Interfaces to C-client */
+ 
++void mm_annotation (MAILSTREAM *stream, ANNOTATION *a)
++{
++  if(a){
++    fprintf(stderr,"mailbox: %s\nentry: %s\n",a->mbox,a->entry);
++    ANNOTATION_VALUES * v = a->values;
++    while(v){
++      fprintf(stderr,"attr: %s, value: %s\n",v->attr,v->value);
++      v = v->next;
++    }
++  }
++}
++
+ 
+ void mm_searched (MAILSTREAM *stream,unsigned long number)
+ {
diff --git a/net-libs/c-client/files/c-client-2006k_GENTOO_Makefile.patch b/net-libs/c-client/files/c-client-2006k_GENTOO_Makefile.patch
new file mode 100644 (file)
index 0000000..50a57f0
--- /dev/null
@@ -0,0 +1,70 @@
+Fix the Makefile for building on Gentoo.
+
+diff -r b15554ece4d6 Makefile
+--- a/Makefile Thu Feb 21 17:49:39 2008 +0100
++++ b/Makefile Thu Feb 21 18:51:31 2008 +0100
+@@ -295,7 +295,7 @@ BUILD=$(MAKE) build EXTRACFLAGS='$(EXTRA
+ 
+ # Make the IMAP Toolkit
+ 
+-all:  c-client SPECIALS rebuild bundled
++all:  c-client SPECIALS rebuild
+ 
+ c-client:
+       @echo Not processed yet.  In a first-time build, you must specify
+@@ -665,16 +665,9 @@ an ua:
+       $(TOOLS)/$@ "$(LN)" src/ansilib c-client
+       $(TOOLS)/$@ "$(LN)" src/charset c-client
+       $(TOOLS)/$@ "$(LN)" src/osdep/$(SYSTEM) c-client
+-      $(TOOLS)/$@ "$(LN)" src/mtest mtest
+-      $(TOOLS)/$@ "$(LN)" src/ipopd ipopd
+-      $(TOOLS)/$@ "$(LN)" src/imapd imapd
+-      $(TOOLS)/$@ "$(LN)" src/mailutil mailutil
+-      $(TOOLS)/$@ "$(LN)" src/mlock mlock
+-      $(TOOLS)/$@ "$(LN)" src/dmail dmail
+-      $(TOOLS)/$@ "$(LN)" src/tmail tmail
+       $(LN) $(TOOLS)/$@ .
+ 
+-build:        OSTYPE rebuild rebuildclean bundled
++build:        OSTYPE rebuild rebuildclean
+ 
+ OSTYPE:
+       @$(MAKE) ip$(IP)
+@@ -690,8 +683,6 @@ OSTYPE:
+       echo $(BUILDTYPE) > OSTYPE
+       $(TOUCH) rebuild
+ 
+-rebuild:
+-      @$(SH) -c '(test $(BUILDTYPE) = rebuild -o $(BUILDTYPE) = `$(CAT) OSTYPE`) || (echo Already built for `$(CAT) OSTYPE` -- you must do \"make clean\" first && exit 1)'
+       @echo Rebuilding c-client for `$(CAT) OSTYPE`...
+       @$(TOUCH) SPECIALS
+       $(CD) c-client;$(MAKE) all CC=`$(CAT) CCTYPE` \
+@@ -700,28 +691,6 @@ rebuildclean:
+ rebuildclean:
+       $(SH) -c '$(RM) rebuild || true'
+ 
+-bundled:
+-      @echo Building bundled tools...
+-      $(CD) mtest;$(MAKE)
+-      $(CD) ipopd;$(MAKE)
+-      $(CD) imapd;$(MAKE)
+-      $(CD) mailutil;$(MAKE)
+-      @$(SH) -c '(test -f /usr/include/sysexits.h ) || make sysexitwarn'
+-      $(CD) mlock;$(MAKE) || true
+-      $(CD) dmail;$(MAKE) || true
+-      $(CD) tmail;$(MAKE) || true
+-
+-
+-sysexitwarn:
+-      @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-      @echo + Hmm...it does not look like /usr/include/sysexits.h exists.
+-      @echo + Either your system is too ancient to have the sysexits.h
+-      @echo + include, or your C compiler gets it from some other location
+-      @echo + than /usr/include.  If your system is too old to have the
+-      @echo + sysexits.h include, you will not be able to build the
+-      @echo + following programs.
+-      @echo +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-
+ clean:
+       @echo Removing old processed sources and binaries...
+       $(SH) -c '$(RM) an ua OSTYPE SPECIALS c-client mtest imapd ipopd mailutil mlock dmail tmail || true'
diff --git a/net-libs/c-client/files/c-client-2006k_GENTOO_amd64-so-fix.patch b/net-libs/c-client/files/c-client-2006k_GENTOO_amd64-so-fix.patch
new file mode 100644 (file)
index 0000000..79b067d
--- /dev/null
@@ -0,0 +1,13 @@
+diff -r 7c3e6c6ef2ba src/osdep/unix/Makefile
+--- a/src/osdep/unix/Makefile  Thu Feb 21 18:51:32 2008 +0100
++++ b/src/osdep/unix/Makefile  Thu Feb 21 18:53:15 2008 +0100
+@@ -962,6 +962,9 @@ onceenv:
+        -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" > OSCFLAGS
+       echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
+       echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE
++      echo "`$(CAT) CCTYPE` `$(CAT) CFLAGS` `$(CAT) OSFLAGS` -shared \
++       -Wl,-soname,libc-client.so.1 -o libc-client.so.1.0.0 $(BINARIES)" \
++       >> ARCHIVE
+       echo $(OS) > OSTYPE
+       ./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
+       ./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS)
diff --git a/net-libs/c-client/files/c-client-2006k_KOLAB_Annotations.patch b/net-libs/c-client/files/c-client-2006k_KOLAB_Annotations.patch
new file mode 100644 (file)
index 0000000..8eec02d
--- /dev/null
@@ -0,0 +1,448 @@
+Provides get/set ANNOTATIONS support to the c-client library. [Version: 2006k]
+
+diff -r 217555555c77 src/c-client/imap4r1.c
+--- a/src/c-client/imap4r1.c   Thu Feb 21 17:37:37 2008 +0100
++++ b/src/c-client/imap4r1.c   Thu Feb 21 17:38:15 2008 +0100
+@@ -135,7 +135,8 @@ typedef struct imap_argument {
+ #define MULTIAPPEND 13
+ #define SNLIST 14
+ #define MULTIAPPENDREDO 15
+-
++#define QLIST 16
++#define QSTRING 17
+ 
+ /* Append data */
+ 
+@@ -205,12 +206,15 @@ void imap_gc_body (BODY *body);
+ void imap_gc_body (BODY *body);
+ void imap_capability (MAILSTREAM *stream);
+ long imap_acl_work (MAILSTREAM *stream,char *command,IMAPARG *args[]);
++long imap_annotation_work (MAILSTREAM *stream,char *command,IMAPARG *args[]);
+ 
+ IMAPPARSEDREPLY *imap_send (MAILSTREAM *stream,char *cmd,IMAPARG *args[]);
+ IMAPPARSEDREPLY *imap_sout (MAILSTREAM *stream,char *tag,char *base,char **s);
+ long imap_soutr (MAILSTREAM *stream,char *string);
+ IMAPPARSEDREPLY *imap_send_astring (MAILSTREAM *stream,char *tag,char **s,
+                                   SIZEDTEXT *as,long wildok,char *limit);
++IMAPPARSEDREPLY *imap_send_qstring (MAILSTREAM *stream,char *tag,char **s,
++                                  SIZEDTEXT *as,char *limit);
+ IMAPPARSEDREPLY *imap_send_literal (MAILSTREAM *stream,char *tag,char **s,
+                                   STRING *st);
+ IMAPPARSEDREPLY *imap_send_spgm (MAILSTREAM *stream,char *tag,char *base,
+@@ -2753,6 +2757,84 @@ long imap_getacl (MAILSTREAM *stream,cha
+     args[0] = &ambx; args[1] = NIL;
+   return imap_acl_work (stream,"GETACL",args);
+ }
++
++/* IMAP set annotation
++ * Accepts: mail stream
++ *          annotation struct
++ * Returns: T on success, NIL on failure
++ */
++
++long imap_setannotation (MAILSTREAM *stream,ANNOTATION *annotation)
++{
++  IMAPARG *args[4],ambx,apth,aval;
++  long ret;
++  
++  ambx.type = ASTRING;
++  ambx.text = (void *) annotation->mbox;
++  args[0] = &ambx;
++  
++  apth.type = QSTRING;
++  apth.text = (void *) annotation->entry;
++  args[1] = &apth;
++
++  STRINGLIST *st,*l;
++  ANNOTATION_VALUES *v;
++  
++  l = st = mail_newstringlist();
++  v = annotation->values;
++  while(v){
++    l->text.size = strlen((char *) (l->text.data = (unsigned char*)cpystr(v->attr)));
++    l->next = mail_newstringlist();
++    l = l->next;
++    l->text.size = strlen((char *) (l->text.data = (unsigned char*)cpystr(v->value)));
++    if(v->next){
++      l->next = mail_newstringlist();
++      l = l->next;
++    }
++    v = v->next;
++  }
++  
++  aval.type = QLIST;
++  aval.text = (void *)st;
++  args[2] = &aval;
++  args[3] = NIL;
++  
++  ret = imap_annotation_work(stream, "SETANNOTATION",args);
++  mail_free_stringlist(&st);
++  return ret;
++}
++  
++  
++  
++/* IMAP get annotation
++ * Accepts: mail stream
++ *          mailbox name
++ *          annotation entry list
++ *          annotation attribute list
++ * Returns: T on success with data returned via callback, NIL on failure
++ */
++
++long imap_getannotation (MAILSTREAM *stream,char *mailbox,STRINGLIST *entries, STRINGLIST *attributes)
++{
++  IMAPARG *args[4],ambx,apth,aattr;
++  long ret;
++  ambx.type = ASTRING;
++  ambx.text = (void*) mailbox;
++  args[0] = &ambx; 
++
++ 
++  apth.type = QLIST;
++  apth.text = (void*) entries;
++  args[1] = &apth;
++
++  aattr.type = QLIST;
++  aattr.text = (void*) attributes;
++  args[2] = &aattr;
++
++  args[3] = NIL;
++  ret = imap_annotation_work(stream, "GETANNOTATION",args);
++  return ret;
++}
+ \f
+ /* IMAP list rights
+  * Accepts: mail stream
+@@ -2805,6 +2887,16 @@ long imap_acl_work (MAILSTREAM *stream,c
+   else mm_log ("ACL not available on this IMAP server",ERROR);
+   return ret;
+ }
++ long imap_annotation_work(MAILSTREAM *stream, char *command,IMAPARG *args[])
++{
++  long ret = NIL;
++  IMAPPARSEDREPLY *reply;
++  if (imap_OK (stream,reply = imap_send (stream,command,args)))
++    ret = LONGT;
++  else mm_log (reply->text,ERROR);
++  return ret;
++}
++
+ \f
+ /* IMAP set quota
+  * Accepts: mail stream
+@@ -2937,6 +3029,11 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+       if (reply = imap_send_astring (stream,tag,&s,&st,NIL,CMDBASE+MAXCOMMAND))
+       return reply;
+       break;
++    case QSTRING:             /* atom or string, must be literal? */
++      st.size = strlen ((char *) (st.data = (unsigned char *) arg->text));
++      if (reply = imap_send_qstring (stream,tag,&s,&st,CMDBASE+MAXCOMMAND))
++      return reply;
++      break;
+     case LITERAL:             /* literal, as a stringstruct */
+       if (reply = imap_send_literal (stream,tag,&s,arg->text)) return reply;
+       break;
+@@ -2947,6 +3044,18 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+       do {                    /* for each list item */
+       *s++ = c;               /* write prefix character */
+       if (reply = imap_send_astring (stream,tag,&s,&list->text,NIL,
++                                     CMDBASE+MAXCOMMAND)) return reply;
++      c = ' ';                /* prefix character for subsequent strings */
++      }
++      while (list = list->next);
++      *s++ = ')';             /* close list */
++      break;
++    case QLIST:                       /* list of strings */
++      list = (STRINGLIST *) arg->text;
++      c = '(';                        /* open paren */
++      do {                    /* for each list item */
++      *s++ = c;               /* write prefix character */
++      if (reply = imap_send_qstring (stream,tag,&s,&list->text,
+                                      CMDBASE+MAXCOMMAND)) return reply;
+       c = ' ';                /* prefix character for subsequent strings */
+       }
+@@ -3119,6 +3228,32 @@ IMAPPARSEDREPLY *imap_send (MAILSTREAM *
+   reply = imap_sout (stream,tag,CMDBASE,&s);
+   mail_unlock (stream);               /* unlock stream */
+   return reply;
++}
++
++/* IMAP send quoted-string
++ * Accepts: MAIL stream
++ *        reply tag
++ *        pointer to current position pointer of output bigbuf
++ *        atom-string to output
++ *        maximum to write as atom or qstring
++ * Returns: error reply or NIL if success
++ */
++
++IMAPPARSEDREPLY *imap_send_qstring (MAILSTREAM *stream,char *tag,char **s,
++                                  SIZEDTEXT *as,char *limit)
++{
++  unsigned long j;
++  char c;
++  STRING st;
++                              /* in case needed */
++  INIT (&st,mail_string,(void *) as->data,as->size);
++                              /* always write literal if no space */
++  if ((*s + as->size) > limit) return imap_send_literal (stream,tag,s,&st);
++
++  *(*s)++ = '"';      /* write open quote */
++  for (j = 0; j < as->size; j++) *(*s)++ = as->data[j];
++  *(*s)++ = '"';      /* write close quote */
++  return NIL;
+ }
+ \f
+ /* IMAP send atom-string
+@@ -4049,6 +4184,50 @@ void imap_parse_unsolicited (MAILSTREAM 
+     }
+   }
+ \f
++  else if (!strcmp (reply->key,"ANNOTATION") && (s = reply->text)){
++    char * mbox;    
++    /* response looks like ANNOTATION "mailbox" "entry" ("attr" "value" ["attr" "value"]) ["entry" ("attr "value" ["attr" "value"] )]*/
++    getannotation_t an = (getannotation_t) mail_parameters (NIL,GET_ANNOTATION,NIL);
++    
++    mbox = imap_parse_astring (stream, &s, reply,NIL);
++    
++    while(*s){
++      ANNOTATION * al = mail_newannotation();    
++      al->mbox = cpystr(mbox);
++      t = imap_parse_astring (stream, &s, reply,NIL);
++      al->entry = t;
++      STRINGLIST *strlist;
++      if (s){while (*s == ' ')s++;}
++      
++      strlist = imap_parse_stringlist(stream, &s,reply);
++
++      ANNOTATION_VALUES *vlIter, *vlBegin;
++      vlIter = vlBegin = NIL;
++      if (strlist) {
++        while(strlist){       
++          if(vlIter){
++            vlIter->next = mail_newannotationvalue();
++            vlIter = vlIter->next;
++          }else{
++            vlIter = mail_newannotationvalue();
++            vlBegin = vlIter;
++          }
++          if ( strlist->text.size )
++            vlIter->attr = cpystr (strlist->text.data);        
++          strlist = strlist->next;        
++          if(!strlist) continue;
++          if ( strlist->text.size )
++            vlIter->value = cpystr (strlist->text.data);
++          strlist = strlist->next;
++        }
++      }
++      al->values = vlBegin;
++      if (an) 
++        (*an) (stream,al);
++      mail_free_annotation(&al);
++    }
++    fs_give ((void **)&mbox);
++  }
+   else if (!strcmp (reply->key,"ACL") && (s = reply->text) &&
+          (t = imap_parse_astring (stream,&s,reply,NIL))) {
+     getacl_t ar = (getacl_t) mail_parameters (NIL,GET_ACL,NIL);
+diff -r 217555555c77 src/c-client/imap4r1.h
+--- a/src/c-client/imap4r1.h   Thu Feb 21 17:37:37 2008 +0100
++++ b/src/c-client/imap4r1.h   Thu Feb 21 17:38:15 2008 +0100
+@@ -279,3 +279,5 @@ long imap_setquota (MAILSTREAM *stream,c
+ long imap_setquota (MAILSTREAM *stream,char *qroot,STRINGLIST *limits);
+ long imap_getquota (MAILSTREAM *stream,char *qroot);
+ long imap_getquotaroot (MAILSTREAM *stream,char *mailbox);
++long imap_getannotation (MAILSTREAM *stream,char *mailbox,STRINGLIST *entries,STRINGLIST *attributes);
++long imap_setannotation (MAILSTREAM *stream,ANNOTATION *annotation); 
+diff -r 217555555c77 src/c-client/mail.c
+--- a/src/c-client/mail.c      Thu Feb 21 17:37:37 2008 +0100
++++ b/src/c-client/mail.c      Thu Feb 21 17:38:15 2008 +0100
+@@ -69,6 +69,7 @@ static newsrcquery_t mailnewsrcquery = N
+ static newsrcquery_t mailnewsrcquery = NIL;
+                               /* ACL results callback */
+ static getacl_t mailaclresults = NIL;
++static getannotation_t mailannotationresults = NIL;
+                               /* list rights results callback */
+ static listrights_t maillistrightsresults = NIL;
+                               /* my rights results callback */
+@@ -598,6 +599,11 @@ void *mail_parameters (MAILSTREAM *strea
+     ret = (void *) (debugsensitive ? VOIDT : NIL);
+     break;
+ \f
++  case SET_ANNOTATION:
++    mailannotationresults = (getannotation_t) value;
++  case GET_ANNOTATION:
++    ret = (void *) mailannotationresults;
++    break;
+   case SET_ACL:
+     mailaclresults = (getacl_t) value;
+   case GET_ACL:
+@@ -5701,7 +5707,15 @@ ACLLIST *mail_newacllist (void)
+   return (ACLLIST *) memset (fs_get (sizeof (ACLLIST)),0,sizeof (ACLLIST));
+ }
+ 
+-
++ANNOTATION *mail_newannotation (void)
++{
++  return (ANNOTATION *) memset (fs_get (sizeof (ANNOTATION)),0,sizeof(ANNOTATION));
++}
++
++ANNOTATION_VALUES *mail_newannotationvalue (void)
++{
++  return (ANNOTATION_VALUES *) memset (fs_get (sizeof (ANNOTATION_VALUES)),0,sizeof(ANNOTATION_VALUES));
++}
+ /* Mail instantiate new quotalist
+  * Returns: new quotalist
+  */
+@@ -6024,6 +6038,25 @@ void mail_free_acllist (ACLLIST **al)
+   }
+ }
+ 
++static void mail_free_annotation_values(ANNOTATION_VALUES **val)
++{
++  if (*val) {
++    if ((*val)->attr) fs_give ((void**) &(*val)->attr);
++    if ((*val)->value) fs_give ((void**) &(*val)->value);
++    mail_free_annotation_values (&(*val)->next);
++    fs_give ((void **) val);
++  }
++}                             
++void mail_free_annotation(ANNOTATION **al)
++{
++  if (*al) {
++    if((*al)->mbox) fs_give ((void**) &(*al)->mbox);
++    if((*al)->entry) fs_give ((void**) &(*al)->entry);
++    if((*al)->values)
++      mail_free_annotation_values(&(*al)->values);
++    fs_give ((void **) al);
++  }
++}
+ 
+ /* Mail garbage collect quotalist
+  * Accepts: pointer to quotalist pointer
+diff -r 217555555c77 src/c-client/mail.h
+--- a/src/c-client/mail.h      Thu Feb 21 17:37:37 2008 +0100
++++ b/src/c-client/mail.h      Thu Feb 21 17:38:15 2008 +0100
+@@ -351,6 +351,8 @@
+ #define SET_SCANCONTENTS (long) 573
+ #define GET_MHALLOWINBOX (long) 574
+ #define SET_MHALLOWINBOX (long) 575
++#define GET_ANNOTATION (long) 576
++#define SET_ANNOTATION (long) 577
+ \f
+ /* Driver flags */
+ 
+@@ -1043,6 +1045,24 @@ ACLLIST {
+   char *identifier;           /* authentication identifier */
+   char *rights;                       /* access rights */
+   ACLLIST *next;
++};
++
++/* ANNOTATION Response */
++
++#define ANNOTATION_VALUES struct annotation_value_list
++
++ANNOTATION_VALUES {
++      char *attr;
++      char *value;
++      ANNOTATION_VALUES *next;
++};
++
++#define ANNOTATION struct annotation
++
++ANNOTATION {
++      char *mbox;
++      char *entry;
++      ANNOTATION_VALUES * values;
+ };
+ 
+ /* Quota resource list */
+@@ -1353,6 +1373,7 @@ typedef void (*logouthook_t) (void *data
+ typedef void (*logouthook_t) (void *data);
+ typedef char *(*sslclientcert_t) (void);
+ typedef char *(*sslclientkey_t) (void);
++typedef void (*getannotation_t) (MAILSTREAM *stream,ANNOTATION* annot);
+ \f
+ /* Globals */
+ 
+@@ -1771,7 +1792,10 @@ SORTPGM *mail_newsortpgm (void);
+ SORTPGM *mail_newsortpgm (void);
+ THREADNODE *mail_newthreadnode (SORTCACHE *sc);
+ ACLLIST *mail_newacllist (void);
++ANNOTATION* mail_newannotation(void);
++ANNOTATION_VALUES* mail_newannotationvalue(void);
+ QUOTALIST *mail_newquotalist (void);
++void mail_free_annotation(ANNOTATION **a);
+ void mail_free_body (BODY **body);
+ void mail_free_body_data (BODY *body);
+ void mail_free_body_parameter (PARAMETER **parameter);
+diff -r 217555555c77 src/mtest/mtest.c
+--- a/src/mtest/mtest.c        Thu Feb 21 17:37:37 2008 +0100
++++ b/src/mtest/mtest.c        Thu Feb 21 17:38:15 2008 +0100
+@@ -145,6 +145,8 @@ int main ()
+ #endif
+   return NIL;
+ }
++
++void mm_annotation (MAILSTREAM *stream, ANNOTATION *a);
+ \f
+ /* MM command loop
+  * Accepts: MAIL stream
+@@ -195,6 +197,28 @@ void mm (MAILSTREAM *stream,long debug)
+       mail_setflag (stream,arg,"\\DELETED");
+       else puts ("?Bad message number");
+       break;
++    case 'A':
++      {
++        char parms[MAILTMPLEN];
++        prompt("Annotation: ",parms);
++        if (parms) {
++          mail_parameters(stream,SET_ANNOTATION,mm_annotation);
++          STRINGLIST *entries = mail_newstringlist();
++          STRINGLIST *cur = entries;
++          cur->text.size = strlen((char *) (cur->text.data = (unsigned char*)cpystr (parms)));
++          cur->next = NIL;
++          
++          STRINGLIST *attributes = mail_newstringlist();
++          cur = attributes;
++          cur->text.size = strlen((char *) (cur->text.data = (unsigned char*)cpystr ("*")));
++          cur->next = NIL;
++          
++          imap_getannotation(stream,"INBOX",entries,attributes);
++          mail_free_stringlist(&entries);
++          mail_free_stringlist(&attributes);
++        }
++      }
++      break;  
+     case 'E':                 /* Expunge command */
+       mail_expunge (stream);
+       last = 0;
+@@ -347,7 +371,7 @@ void mm (MAILSTREAM *stream,long debug)
+     case '?':                 /* ? command */
+       puts ("Body, Check, Delete, Expunge, Find, GC, Headers, Literal,");
+       puts (" MailboxStatus, New Mailbox, Overview, Ping, Quit, Send, Type,");
+-      puts ("Undelete, Xit, +, -, or <RETURN> for next message");
++      puts ("Undelete, Xit,Annotation, +, -, or <RETURN> for next message");
+       break;
+     default:                  /* bogus command */
+       printf ("?Unrecognized command: %s\n",cmd);
+@@ -600,6 +624,18 @@ void prompt (char *msg,char *txt)
+ \f
+ /* Interfaces to C-client */
+ 
++void mm_annotation (MAILSTREAM *stream, ANNOTATION *a)
++{
++  if(a){
++    fprintf(stderr,"mailbox: %s\nentry: %s\n",a->mbox,a->entry);
++    ANNOTATION_VALUES * v = a->values;
++    while(v){
++      fprintf(stderr,"attr: %s, value: %s\n",v->attr,v->value);
++      v = v->next;
++    }
++  }
++}
++
+ 
+ void mm_searched (MAILSTREAM *stream,unsigned long number)
+ {
index 7772825cfdbecb0f27400c2125c04c41caa7deca..7bc17545a9711a1330bff4aa18f653d971b0ccea 100644 (file)
@@ -3,6 +3,6 @@
 <pkgmetadata>
     <herd>net-mail</herd>
     <maintainer>
-        <email>robbat2@gentoo.org</email>
+        <email>wrobel@gentoo.org</email>
     </maintainer>
 </pkgmetadata>