Checked in a skeleton of the IMAP METADATA extension
authorArt Cancro <ajc@citadel.org>
Wed, 13 Jun 2007 02:46:31 +0000 (02:46 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 13 Jun 2007 02:46:31 +0000 (02:46 +0000)
(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
citadel/imap_metadata.c [new file with mode: 0644]
citadel/imap_metadata.h [new file with mode: 0644]
citadel/serv_imap.c

index e5a756c409da88a12b1df947e373745f0052290e..c3d1c901e43c857dd7f2bff7d62b090f78694b20 100644 (file)
@@ -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 (file)
index 0000000..f767d41
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * $Id:  $
+ *
+ * IMAP METADATA extension (yet another ugly disaster)
+ *
+ */
+
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <sys/wait.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+#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 (file)
index 0000000..2ce656b
--- /dev/null
@@ -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[]);
index bb28d45eb4cfb7daa29cd545a5abcab86a91bd46..8a7b713ebc3cd3482fac3b3617928cc8f98490a8 100644 (file)
@@ -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]);
        }