summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-libs/c-client
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-libs/c-client')
-rw-r--r--net-libs/c-client/Manifest2
-rw-r--r--net-libs/c-client/c-client-2007f-r4.ebuild131
-rw-r--r--net-libs/c-client/files/c-client-2006k_GENTOO_Makefile.patch70
-rw-r--r--net-libs/c-client/files/c-client-2006k_GENTOO_amd64-so-fix.patch13
-rw-r--r--net-libs/c-client/files/c-client-2006k_KOLAB_Annotations.patch448
-rw-r--r--net-libs/c-client/files/c-client-2007f-ldflags.patch33
-rw-r--r--net-libs/c-client/files/c-client-2007f-topal.patch27
-rw-r--r--net-libs/c-client/metadata.xml12
8 files changed, 736 insertions, 0 deletions
diff --git a/net-libs/c-client/Manifest b/net-libs/c-client/Manifest
new file mode 100644
index 000000000000..6d91db7bfbf9
--- /dev/null
+++ b/net-libs/c-client/Manifest
@@ -0,0 +1,2 @@
+DIST c-client-2007f-chappa-115-all.patch.gz 30571 SHA256 ce7512e1b0d904d6429bb999bc0b159becc253088bbd89ef2185e6c948723cff SHA512 f44489ec38aa6a3dc682872a6857154254c23352db81ee380dfdfad39743234d97a8bcc07a74459f7532efe2fc073cf7d9c078433e11a95de19beeb387ff8b65 WHIRLPOOL 9fef9066c43df4c15f4f75bbad3634481e4cfce69c054682fe40193c30db6f9ceaed40138d00133c1bf1623dd45d251031562b2f16f1699ebcf0fbc8ce6c4653
+DIST imap-2007f.tar.Z 2793529 SHA256 870e95f6bd19265832a88fd89b77c54c841c59022fd21e69254050c8b1005e3c SHA512 2c728deaf66d23158c61ae55ff94f05d2a1cf0168002760321ca30c6ee1c58c0a4c7bc14ece0097ea662df6c7c49be3b91c8e5e943724c9e2736800fa9298dae WHIRLPOOL 655536d61a178940363241ad8c94a28be75e90abf3b8c585eb61364a6394ff49bb5fd5dc6de4bec5f992f03b592e583df04f0103e8f3c167aa68a476c574c4ec
diff --git a/net-libs/c-client/c-client-2007f-r4.ebuild b/net-libs/c-client/c-client-2007f-r4.ebuild
new file mode 100644
index 000000000000..ad79696a28bf
--- /dev/null
+++ b/net-libs/c-client/c-client-2007f-r4.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit flag-o-matic eutils libtool toolchain-funcs multilib
+
+MY_PN=imap
+MY_P="${MY_PN}-${PV}"
+S=${WORKDIR}/${MY_P}
+
+CHAPPA_PL=115
+DESCRIPTION="UW IMAP c-client library"
+HOMEPAGE="http://www.washington.edu/imap/"
+SRC_URI="ftp://ftp.cac.washington.edu/imap/${MY_P}.tar.Z
+ chappa? ( mirror://gentoo/${P}-chappa-${CHAPPA_PL}-all.patch.gz )"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="doc +ipv6 kerberos kernel_linux kernel_FreeBSD pam ssl static-libs topal chappa"
+
+RDEPEND="ssl? ( dev-libs/openssl )
+ !net-mail/uw-imap
+ kerberos? ( app-crypt/mit-krb5 )"
+DEPEND="${RDEPEND}
+ kernel_linux? ( pam? ( >=sys-libs/pam-0.72 ) )"
+
+src_prepare() {
+ # Tarball packed with bad file perms
+ chmod -R u+rwX,go-w .
+
+ # lots of things need -fPIC, including various platforms, and this library
+ # generally should be built with it anyway.
+ append-flags -fPIC
+
+ # 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"
+
+ # Make the build system more multilib aware
+ sed \
+ -e "s:^SSLLIB=\$(SSLDIR)/lib:SSLLIB=\$(SSLDIR)/$(get_libdir):" \
+ -e "s:^AFSLIB=\$(AFSDIR)/lib:AFSLIB=\$(AFSDIR)/$(get_libdir):" \
+ -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}-2006k_GENTOO_Makefile.patch
+
+ # Apply patch to add the compilation of a .so for PHP
+ # This was previously conditional, but is more widely useful.
+ epatch "${FILESDIR}"/${PN}-2006k_GENTOO_amd64-so-fix.patch
+
+ # Remove the pesky checks about SSL stuff
+ sed -e '/read.*exit/d' -i Makefile || die
+
+ # Respect LDFLAGS
+ epatch "${FILESDIR}"/${PN}-2007f-ldflags.patch
+ sed -e "s/CC=cc/CC=$(tc-getCC)/" \
+ -e "s/ARRC=ar/ARRC=$(tc-getAR)/" \
+ -e "s/RANLIB=ranlib/RANLIB=$(tc-getRANLIB)/" \
+ -i src/osdep/unix/Makefile || die "Respecting build flags"
+
+ use topal && epatch "${FILESDIR}/${P}-topal.patch"
+ use chappa && epatch "${DISTDIR}/${P}-chappa-${CHAPPA_PL}-all.patch.gz"
+
+ elibtoolize
+}
+
+src_compile() {
+ local mymake ipver ssltype target passwdtype
+ ipver='IP=4'
+ use ipv6 && ipver="IP=6" && touch ip6
+ use ssl && ssltype="unix" || ssltype="none"
+ if use kernel_linux ; then
+ use pam && target=lnp passwdtype=pam || target=lnx passwdtype=std
+ elif use kernel_FreeBSD ; then
+ target=bsf passwdtype=pam
+ fi
+ use kerberos \
+ && mymake="EXTRAAUTHENTICATORS=gss" \
+ && EXTRALIBS="-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
+ # no parallel builds supported!
+ emake -j1 SSLTYPE=${ssltype} $target \
+ PASSWDTYPE=${passwdtype} ${ipver} ${mymake} \
+ EXTRACFLAGS="${CFLAGS}" \
+ EXTRALDFLAGS="${LDFLAGS}" \
+ EXTRALIBS="${EXTRALIBS}" \
+ GSSDIR=/usr
+}
+
+src_install() {
+ if use static-libs; then
+ # Library binary
+ dolib.a c-client/c-client.a
+ dosym c-client.a /usr/$(get_libdir)/libc-client.a
+ fi
+
+ # Now the shared library
+ dolib.so c-client/libc-client.so.1.0.0
+
+ dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so
+ dosym libc-client.so.1.0.0 /usr/$(get_libdir)/libc-client.so.1
+
+ # Headers
+ insinto /usr/include/imap
+ doins src/osdep/unix/*.h
+ doins src/c-client/*.h
+ doins c-client/linkage.h
+ doins c-client/linkage.c
+ doins c-client/osdep.h
+ if use ssl; then
+ echo " ssl_onceonlyinit ();" >> "${D}"/usr/include/imap/linkage.c || die
+ fi
+ # Docs
+ dodoc README docs/*.txt docs/BUILD docs/CONFIG docs/RELNOTES docs/SSLBUILD
+ if use doc; then
+ docinto rfc
+ dodoc docs/rfc/*.txt
+ docinto draft
+ dodoc docs/draft/*
+ fi
+}
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
index 000000000000..50a57f0747db
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2006k_GENTOO_Makefile.patch
@@ -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
index 000000000000..79b067d21f94
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2006k_GENTOO_amd64-so-fix.patch
@@ -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
index 000000000000..8eec02d029c4
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2006k_KOLAB_Annotations.patch
@@ -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;
++}
+
+ /* 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;
++}
++
+
+ /* 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;
+ }
+
+ /* IMAP send atom-string
+@@ -4049,6 +4184,50 @@ void imap_parse_unsolicited (MAILSTREAM
+ }
+ }
+
++ 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;
+
++ 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
+
+ /* 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);
+
+ /* 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);
+
+ /* 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)
+
+ /* 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-2007f-ldflags.patch b/net-libs/c-client/files/c-client-2007f-ldflags.patch
new file mode 100644
index 000000000000..5c143b79bc7e
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2007f-ldflags.patch
@@ -0,0 +1,33 @@
+--- src/osdep/unix/Makefile~ 2011-06-07 16:04:29.000000000 +0300
++++ src/osdep/unix/Makefile 2011-06-07 15:55:31.000000000 +0300
+@@ -954,23 +954,24 @@
+
+ # Once-only environment setup
+
+-once: onceenv ckp$(PASSWDTYPE) ssl$(SSLTYPE) osdep.c
++once: ssl$(SSLTYPE) onceenv ckp$(PASSWDTYPE) osdep.c
+
+ onceenv:
+ @echo Once-only environment setup...
+ echo $(CC) > CCTYPE
+- echo $(BASECFLAGS) '$(EXTRACFLAGS)' -DCHUNKSIZE=$(CHUNKSIZE) > CFLAGS
+- echo -DCREATEPROTO=$(CREATEPROTO) -DEMPTYPROTO=$(EMPTYPROTO) \
++ echo `$(CAT) CFLAGS` $(BASECFLAGS) '$(EXTRACFLAGS)' -DCHUNKSIZE=$(CHUNKSIZE) > CFLAGS
++ echo `$(CAT) OSCFLAGS` -DCREATEPROTO=$(CREATEPROTO) -DEMPTYPROTO=$(EMPTYPROTO) \
+ -DMD5ENABLE=\"$(MD5PWD)\" -DMAILSPOOL=\"$(MAILSPOOL)\" \
+ -DANONYMOUSHOME=\"$(MAILSPOOL)/anonymous\" \
+ -DACTIVEFILE=\"$(ACTIVEFILE)\" -DNEWSSPOOL=\"$(NEWSSPOOL)\" \
+ -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" \
+ -DLOCKPGM1=\"$(LOCKPGM1)\" -DLOCKPGM2=\"$(LOCKPGM2)\" \
+ -DLOCKPGM3=\"$(LOCKPGM3)\" > OSCFLAGS
+- echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
++ echo $(EXTRALIBS) `$(CAT) LDFLAGS` > LIBS
++ echo $(EXTRALDFLAGS) `$(CAT) LDFLAGS` -lcrypt $(BASELDFLAGS) > 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)" \
++ echo "`$(CAT) CCTYPE` `$(CAT) CFLAGS` $(EXTRALDFLAGS) `$(CAT) OSFLAGS` -shared \
++ -Wl,-soname,libc-client.so.1 -o libc-client.so.1.0.0 $(BINARIES)" `$(CAT) LIBS` $(BASELDFLAGS) \
+ >> ARCHIVE
+ echo $(OS) > OSTYPE
+ ./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
diff --git a/net-libs/c-client/files/c-client-2007f-topal.patch b/net-libs/c-client/files/c-client-2007f-topal.patch
new file mode 100644
index 000000000000..2b5db04cace5
--- /dev/null
+++ b/net-libs/c-client/files/c-client-2007f-topal.patch
@@ -0,0 +1,27 @@
+diff -cr alpine-2.00.orig/imap/src/c-client/mail.h alpine-2.00.new/imap/src/c-client/mail.h
+*** src/c-client/mail.h 2008-08-08 18:34:22.000000000 +0100
+--- src/c-client/mail.h 2009-05-01 13:40:37.000000000 +0100
+***************
+*** 775,780 ****
+--- 775,781 ----
+ unsigned long bytes; /* size of text in octets */
+ } size;
+ char *md5; /* MD5 checksum */
++ unsigned short topal_hack; /* set to 1 if topal has wrecked the sending */
+ void *sparep; /* spare pointer reserved for main program */
+ };
+
+diff -cr alpine-2.00.orig/imap/src/c-client/mail.c alpine-2.00.new/imap/src/c-client/mail.c
+*** src/c-client/mail.c 2008-06-04 19:39:54.000000000 +0100
+--- src/c-client/mail.c 2009-04-30 22:34:13.000000000 +0100
+***************
+*** 2712,2717 ****
+--- 2712,2719 ----
+ BODY *b = NIL;
+ PART *pt;
+ unsigned long i;
++ /* Topal hack 2 */
++ mail_fetchstructure (stream,msgno,&b);
+ /* make sure have a body */
+ if (section && *section && mail_fetchstructure (stream,msgno,&b) && b)
+ while (*section) { /* find desired section */
diff --git a/net-libs/c-client/metadata.xml b/net-libs/c-client/metadata.xml
new file mode 100644
index 000000000000..20b32568dbd9
--- /dev/null
+++ b/net-libs/c-client/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>net-mail</herd>
+ <use>
+ <flag name="doc">Install RFCs related to IMAP</flag>
+ <flag name='topal'>Enable support for <pkg>net-mail/topal</pkg>
+ for use with <pkg>mail-client/alpine</pkg></flag>
+ <flag name='chappa'>Enable Eduardo Chappa's patches for use with
+ <pkg>mail-client/alpine</pkg> (mainly adds support for maildir)</flag>
+ </use>
+</pkgmetadata>