Out of curiosity I was looking around what IMAP extensions are out there that look useful to have and compared that to what Courier currently offers.
When I looked at the description page for SMAP on the web I found this paragraph: > An SMAP client does not need to download the entire index of folder's > contents when reopening a previously seen folder. When reopening a folder, > the client receives a much shorter list of changes to the folder's contents > since the last time the client had the folder opened. This is done by the > client and server saving an index of folder's contents. After reopening the > folder the server only needs to send a list of changes between the saved > folder index, and the current folder index. This sounds for me like what CONDSTORE and QRESYNC extensions are doing. Is there any hope that courier will get support for any or both of them by reusing some of the SMAP code? While further looking I noticed that there is an ID extension, which courier also doesn't support. Since this thing looked trivial enough I took some time and implemented support for that (patch attached, taken against svn r279). Since whatever is sent by the client shouldn't be used by the server for anything but log messages this should have minimal risk. The default setting also doesn't expose any information that is not already contained in the CAPABILITY response. Only the autohell patch to look for sys/utsname.h is missing. The main purpose of that is that the information sent by the client to show up in IMAPDEBUGFILE. So, what is the future direction that courier-imap is heading to? Which are the next features planned to be added? Greetings, Eike
Index: capability.c =================================================================== --- capability.c (Revision 283) +++ capability.c (Arbeitskopie) @@ -108,6 +108,10 @@ if ((p=getenv("IMAP_ACL")) && atoi(p)) writes(" ACL ACL2=UNION"); + p = getenv("IMAP_ID_FIELDS"); + if (!p || (atoi(p) >= 0)) + writes(" ID"); + if (have_starttls()) { writes(" STARTTLS"); Index: imapd.c =================================================================== --- imapd.c (Revision 283) +++ imapd.c (Arbeitskopie) @@ -49,6 +49,9 @@ #if HAVE_LOCALE_H #include <locale.h> #endif +#if HAVE_SYS_UTSNAME_H +#include <sys/utsname.h> +#endif #include <courierauth.h> #include "maildir/maildiraclt.h" @@ -1383,6 +1386,93 @@ /****************************************************************************/ +/* Do the ID stuff */ + +/****************************************************************************/ +static int doId() +{ + const char *ev = getenv("IMAP_ID_FIELDS"); + unsigned int flags; + struct imaptoken *curtoken; + + if (ev && *ev) + flags = atoi(ev); + else + flags = 0; + + if (flags == -1) + return -1; + + /* The data sent by the client isn't used for anything, but make sure + * it is syntactically correct. */ + curtoken = nexttoken(); + switch (curtoken->tokentype) { + case IT_NIL: + break; + case IT_LPAREN: + { + unsigned int k = 0; + + curtoken = nexttoken(); + + while ((k < 30) && (curtoken->tokentype != IT_RPAREN)) { + k++; + if (curtoken->tokentype != IT_QUOTED_STRING) + return -1; + curtoken = nexttoken(); + if ((curtoken->tokentype != IT_QUOTED_STRING) && + (curtoken->tokentype != IT_NIL)) + return -1; + curtoken = nexttoken(); + } + + /* no strings sent */ + if (k == 0) + return -1; + + /* at most 30 pairs allowed */ + if ((k >= 30) && (curtoken->tokentype != IT_RPAREN)) + return -1; + + break; + } + default: + return -1; + } + + writes("* ID (\"name\" \"Courier IMAP"); + + if (flags & 1) { + const char *sp = strchr(PROGRAMVERSION, ' ') + 1; + writes("\" \"version\" \""); + writemem(sp, strchr(sp, '/') - sp); + } + +#if HAVE_SYS_UTSNAME_H + if (flags & 6) { + struct utsname uts; + if (uname(&uts) == 0) + { + if (flags & 2) { + writes("\" \"os\" \""); + writeqs(uts.sysname); + } + if (flags & 4) { + writes("\" \"os-version\" \""); + writeqs(uts.release); + } + + } + } +#endif + + writes("\" \"vendor\" \"Double Precision, Inc.\")\r\n"); + + return 0; +} + +/****************************************************************************/ + /* Do the IDLE stuff */ /****************************************************************************/ @@ -4050,6 +4140,14 @@ writes(" OK NOOP completed\r\n"); return (0); } + if (strcmp(curtoken->tokenbuf, "ID") == 0) + { + if (doId() < 0) + return (-1); + writes(tag); + writes(" OK ID completed\r\n"); + return (0); + } if (strcmp(curtoken->tokenbuf, "IDLE") == 0) { const char *p;
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap