From 69ed15343f169ea62085845cc36d3775d9452407 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 13 Jun 2007 02:46:31 +0000 Subject: [PATCH] Checked in a skeleton of the IMAP METADATA extension (draft-daboo-imap-annotatemore-11). This will not be a full implementation of the extension. We are only going to implement enough of it to handle folder types in the Outlook connector. --- citadel/Makefile.in | 17 +++++++-- citadel/imap_metadata.c | 81 +++++++++++++++++++++++++++++++++++++++++ citadel/imap_metadata.h | 7 ++++ citadel/serv_imap.c | 13 +++++++ 4 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 citadel/imap_metadata.c create mode 100644 citadel/imap_metadata.h diff --git a/citadel/Makefile.in b/citadel/Makefile.in index e5a756c40..c3d1c901e 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -36,9 +36,18 @@ SERV_MODULES=serv_chat.o \ serv_pop3.o \ serv_vcard.o vcard.o \ serv_mrtg.o \ - serv_imap.o imap_fetch.o imap_misc.o imap_search.o \ - imap_store.o imap_acl.o imap_tools.o imap_list.o \ - serv_fulltext.o ft_wordbreaker.o crc16.o \ + serv_imap.o \ + imap_fetch.o \ + imap_misc.o \ + imap_search.o \ + imap_store.o \ + imap_acl.o \ + imap_metadata.o \ + imap_tools.o \ + imap_list.o \ + serv_fulltext.o \ + ft_wordbreaker.o \ + crc16.o \ serv_network.o \ serv_listsub.o \ serv_netfilter.o \ @@ -109,7 +118,7 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c citadel.c citadel_ipc.c \ serv_sieve.c serv_funambol.c setup.c snprintf.c imap_acl.c \ stress.c support.c sysdep.c tools.c user_ops.c userlist.c \ whobbs.c vcard.c serv_notes.c serv_fulltext.c ft_wordbreaker.c \ - crc16.c journaling.c citadel_dirs.c imap_list.c + crc16.c journaling.c citadel_dirs.c imap_list.c imap_metadata.c DEP_FILES=$(SOURCES:.c=.d) diff --git a/citadel/imap_metadata.c b/citadel/imap_metadata.c new file mode 100644 index 000000000..f767d413d --- /dev/null +++ b/citadel/imap_metadata.c @@ -0,0 +1,81 @@ +/* + * $Id: $ + * + * IMAP METADATA extension (yet another ugly disaster) + * + */ + + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include +#include +#include +#include +#include "citadel.h" +#include "server.h" +#include "sysdep_decls.h" +#include "citserver.h" +#include "support.h" +#include "config.h" +#include "serv_extensions.h" +#include "room_ops.h" +#include "user_ops.h" +#include "policy.h" +#include "database.h" +#include "msgbase.h" +#include "tools.h" +#include "internet_addressing.h" +#include "serv_imap.h" +#include "imap_tools.h" +#include "imap_fetch.h" +#include "imap_misc.h" +#include "genstamp.h" + + + +/* + * Implements the GETMETADATA command. + ( + ( This is currently a stub which returns no data, because we are not yet + * using any server annotations. + */ +void imap_getmetadata(int num_parms, char *parms[]) { + + cprintf("%s OK GETMETADATA complete\r\n", parms[0]); + return; +} + + +/* + * Implements the SETMETADATA command. + * + * This is currently a stub which fools the client into thinking that there + * is no remaining space available to store annotations. + */ +void imap_setmetadata(int num_parms, char *parms[]) { + + cprintf("%s NO [METADATA TOOMANY] SETMETADATA failed\r\n", parms[0]); + return; +} + + diff --git a/citadel/imap_metadata.h b/citadel/imap_metadata.h new file mode 100644 index 000000000..2ce656b4e --- /dev/null +++ b/citadel/imap_metadata.h @@ -0,0 +1,7 @@ +/* + * $Id: imap_acl.h 5148 2007-05-08 15:40:16Z ajc $ + * + */ + +void imap_getmetadata(int num_parms, char *parms[]); +void imap_setmetadata(int num_parms, char *parms[]); diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index bb28d45eb..8a7b713eb 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -56,6 +56,7 @@ #include "imap_search.h" #include "imap_store.h" #include "imap_acl.h" +#include "imap_metadata.h" #include "imap_misc.h" #ifdef HAVE_OPENSSL @@ -437,9 +438,13 @@ void imap_cleanup_function(void) */ void imap_output_capability_string(void) { cprintf("CAPABILITY IMAP4REV1 NAMESPACE ID ACL AUTH=LOGIN"); + #ifdef HAVE_OPENSSL if (!CC->redirect_ssl) cprintf(" STARTTLS"); #endif + + /* Comment this out if its unfinished state is choking your client */ + cprintf(" METADATA LIST-EXTENDED"); } /* @@ -1450,6 +1455,14 @@ void imap_command_loop(void) imap_myrights(num_parms, parms); } + else if (!strcasecmp(parms[1], "GETMETADATA")) { + imap_getmetadata(num_parms, parms); + } + + else if (!strcasecmp(parms[1], "SETMETADATA")) { + imap_setmetadata(num_parms, parms); + } + else if (IMAP->selected == 0) { cprintf("%s BAD no folder selected\r\n", parms[0]); } -- 2.39.2