From 0ba1c6afa0e2079ecaf9109bcc73cd7054557a5f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 9 Mar 2009 04:00:43 +0000 Subject: [PATCH] * Removed the defunct METADATA parameters to our unfinished LIST-EXTENDED implementation. * Rewrote any comments in the IMAP module sources that may have been copied directly out of various RFC's, in order to satisfy the license police. --- citadel/modules/imap/imap_fetch.c | 15 ++++---- citadel/modules/imap/imap_list.c | 58 +++++++------------------------ citadel/modules/imap/imap_tools.c | 6 ++-- citadel/modules/imap/serv_imap.c | 2 +- 4 files changed, 23 insertions(+), 58 deletions(-) diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 2aedb2117..b784be778 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -348,7 +348,7 @@ void imap_output_envelope_from(struct CtdlMessage *msg) { /* * Output an envelope address (or set of addresses) in the official, - * convuluted, braindead format. (Note that we can't use this for + * convoluted, braindead format. (Note that we can't use this for * the "From" address because its data may come from a number of different * fields. But we can use it for "To" and possibly others. */ @@ -598,7 +598,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) { * fetching the entire RFC822 message from disk if the client was only * asking for the headers. Unfortunately, fetching only the Citadel * headers omits "Content-type:" and this behavior breaks the iPhone - * email client. So we have to fetch the whole message from disk. The + * email client. So we have to fetch the whole message from disk. * * if (!strncasecmp(section, "HEADER", 6)) { * need_body = 0; @@ -848,12 +848,11 @@ void imap_fetch_bodystructure_part( /* More gratuitous complexity */ if ((!strcasecmp(cbmaintype, "MESSAGE")) && (!strcasecmp(cbsubtype, "RFC822"))) { - /* FIXME - A body type of type MESSAGE and subtype RFC822 - contains, immediately after the basic fields, the - envelope structure, body structure, and size in - text lines of the encapsulated message. - */ + /* FIXME: message/rfc822 also needs to output the envelope structure, + * body structure, and line count of the encapsulated message. Fortunately + * there are not yet any clients depending on this, so we can get away + * with not implementing it for now. + */ } /* MD5 value of body part; we can get away with NIL'ing this */ diff --git a/citadel/modules/imap/imap_list.c b/citadel/modules/imap/imap_list.c index 2ced210ae..25ce44dc7 100644 --- a/citadel/modules/imap/imap_list.c +++ b/citadel/modules/imap/imap_list.c @@ -108,7 +108,6 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) char **patterns; int return_subscribed = 0; int return_children = 0; - int return_metadata = 0; /* FIXME obsolete remove this */ int i = 0; int match = 0; @@ -120,7 +119,6 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) patterns = (char **) data_for_callback[3]; return_subscribed = (int) data_for_callback[4]; return_children = (int) data_for_callback[5]; - return_metadata = (int) data_for_callback[6]; /* FIXME obsolete remove this */ /* Only list rooms to which the user has access!! */ yes_output_this_room = 0; @@ -168,11 +166,6 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) if (match) { cprintf("* %s (%s) \"/\" ", verb, return_options); imap_strout(buf); - - if (return_metadata) { - cprintf(" (METADATA ())"); /* FIXME obsolete remove this */ - } - cprintf("\r\n"); } } @@ -187,7 +180,7 @@ void imap_list(int num_parms, char *parms[]) int subscribed_rooms_only = 0; char verb[16]; int i, j, paren_nest; - char *data_for_callback[7]; + char *data_for_callback[6]; int num_patterns = 1; char *patterns[MAX_PATTERNS]; int selection_left = (-1); @@ -200,10 +193,6 @@ void imap_list(int num_parms, char *parms[]) int extended_list_in_use = 0; int return_subscribed = 0; int return_children = 0; - int return_metadata = 0; /* FIXME obsolete remove this */ - int select_metadata_left = (-1); /* FIXME obsolete remove this */ - int select_metadata_right = (-1); /* FIXME obsolete remove this */ - int select_metadata_nest = 0; /* FIXME obsolete remove this */ if (num_parms < 4) { cprintf("%s BAD arguments invalid\r\n", parms[0]); @@ -224,21 +213,19 @@ void imap_list(int num_parms, char *parms[]) } /* - * In order to implement draft-ietf-imapext-list-extensions-18 - * ("LIST Command Extensions") we need to: + * Partial implementation of LIST-EXTENDED (which will not get used because + * we don't advertise it in our capabilities string). Several requirements: * - * 1. Extract "selection options" - * (Extraction: done - * SUBSCRIBED option: done - * RECURSIVEMATCH option: not done yet - * REMOTE: safe to silently ignore) + * Extraction of selection options: + * SUBSCRIBED option: done + * RECURSIVEMATCH option: not done yet + * REMOTE: safe to silently ignore * - * 2. Extract "return options" - * (Extraction: done - * SUBSCRIBED option: done - * CHILDREN option: done, but needs a non-ugly rewrite) + * Extraction of return options: + * SUBSCRIBED option: done + * CHILDREN option: done, but needs a non-ugly rewrite * - * 3. Determine whether there is more than one match pattern (done) + * Multiple match patterns: done */ /* @@ -277,20 +264,7 @@ void imap_list(int num_parms, char *parms[]) for (i=selection_left; i<=selection_right; ++i) { - /* are we in the middle of a metadata select block? */ - if ((select_metadata_left >= 0) && (select_metadata_right < 0)) { - select_metadata_nest += haschar(parms[i], '(') - haschar(parms[i], ')') ; - if (select_metadata_nest == 0) { - select_metadata_right = i; - } - } - - else if (!strcasecmp(parms[i], "METADATA")) { - select_metadata_left = i+1; - select_metadata_nest = 0; - } - - else if (!strcasecmp(parms[i], "SUBSCRIBED")) { + if (!strcasecmp(parms[i], "SUBSCRIBED")) { subscribed_rooms_only = 1; } @@ -302,9 +276,6 @@ void imap_list(int num_parms, char *parms[]) } - CtdlLogPrintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right); - /* FIXME blah, we have to do something with this */ - /* The folder root appears immediately after the selection options, * or in position 2 if no selection options were specified. */ @@ -370,10 +341,6 @@ void imap_list(int num_parms, char *parms[]) return_children = 1; } - else if (!strcasecmp(parms[i], "METADATA")) { - return_metadata = 1; - } - if (paren_nest == 0) { return_right = i; /* found end of patterns */ i = num_parms + 1; /* break out of the loop */ @@ -389,7 +356,6 @@ void imap_list(int num_parms, char *parms[]) data_for_callback[3] = (char *) patterns; data_for_callback[4] = (char *) return_subscribed; data_for_callback[5] = (char *) return_children; - data_for_callback[6] = (char *) return_metadata; /* FIXME obsolete remove this */ /* The non-extended LIST command is required to treat an empty * ("" string) mailbox name argument as a special request to return the diff --git a/citadel/modules/imap/imap_tools.c b/citadel/modules/imap/imap_tools.c index 77d091c6d..6dda4a4cf 100644 --- a/citadel/modules/imap/imap_tools.c +++ b/citadel/modules/imap/imap_tools.c @@ -26,10 +26,10 @@ /* String handling helpers */ -/* This code uses some pretty narsty string manipulation. To make everything +/* This code uses some pretty nasty string manipulation. To make everything * manageable, we use this semi-high-level string manipulation API. Strings are - * always \0-terminated, despite the fact that we keep track of the size. */ - + * always \0-terminated, despite the fact that we keep track of the size. + */ struct string { char* buffer; int maxsize; diff --git a/citadel/modules/imap/serv_imap.c b/citadel/modules/imap/serv_imap.c index 9dd687500..d649c3cfa 100644 --- a/citadel/modules/imap/serv_imap.c +++ b/citadel/modules/imap/serv_imap.c @@ -762,7 +762,7 @@ void imap_select(int num_parms, char *parms[]) * * Unfortunately, omitting \Deleted as a PERMANENTFLAGS flag causes * some clients (particularly Thunderbird) to misbehave -- they simply - * electing not to transmit the flag at all. So we have to advertise + * elect not to transmit the flag at all. So we have to advertise * \Deleted as a PERMANENTFLAGS flag, even though it technically isn't. */ cprintf("* FLAGS (\\Deleted \\Seen \\Answered)\r\n"); -- 2.30.2