[dovecot-cvs] dovecot/src/lib-storage/index index-search.c,1.49,1.50 index-sort.c,1.2,1.3
cras at procontrol.fi
cras at procontrol.fi
Tue Dec 17 06:28:43 EET 2002
Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv32695/src/lib-storage/index
Modified Files:
index-search.c index-sort.c
Log Message:
Full not-too-well-tested support for SORT extension. Required a few
library interface changes.
Index: index-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- index-search.c 8 Dec 2002 05:23:08 -0000 1.49
+++ index-search.c 17 Dec 2002 04:28:41 -0000 1.50
@@ -379,9 +379,10 @@
/* get field from hopefully cached envelope */
envelope = index->lookup_field(index, ctx->rec, DATA_FIELD_ENVELOPE);
- if (envelope != NULL)
- field = imap_envelope_parse(envelope, env_field);
- else {
+ if (envelope != NULL) {
+ field = imap_envelope_parse(envelope, env_field,
+ IMAP_ENVELOPE_RESULT_STRING);
+ } else {
index->cache_fields_later(index, DATA_FIELD_ENVELOPE);
field = NULL;
}
Index: index-sort.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-sort.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- index-sort.c 6 Dec 2002 01:09:23 -0000 1.2
+++ index-sort.c 17 Dec 2002 04:28:41 -0000 1.3
@@ -47,7 +47,8 @@
return cache == NULL ? 0 : imap_msgcache_get_virtual_size(cache);
}
-static const char *_input_str(MailSortType type, unsigned int id, void *context)
+static const char *_input_mailbox(MailSortType type, unsigned int id,
+ void *context)
{
IndexSortContext *ctx = context;
ImapEnvelopeField env_field;
@@ -57,15 +58,9 @@
case MAIL_SORT_CC:
env_field = IMAP_ENVELOPE_CC;
break;
- case MAIL_SORT_DATE:
- env_field = IMAP_ENVELOPE_DATE;
- break;
case MAIL_SORT_FROM:
env_field = IMAP_ENVELOPE_FROM;
break;
- case MAIL_SORT_SUBJECT:
- env_field = IMAP_ENVELOPE_SUBJECT;
- break;
case MAIL_SORT_TO:
env_field = IMAP_ENVELOPE_TO;
break;
@@ -78,7 +73,34 @@
envelope = imap_msgcache_get(search_open_cache(ctx, id),
IMAP_CACHE_ENVELOPE);
return envelope == NULL ? NULL :
- imap_envelope_parse(envelope, env_field);
+ imap_envelope_parse(envelope, env_field,
+ IMAP_ENVELOPE_RESULT_FIRST_MAILBOX);
+}
+
+static const char *_input_str(MailSortType type, unsigned int id, void *context)
+{
+ IndexSortContext *ctx = context;
+ ImapEnvelopeField env_field;
+ const char *envelope;
+
+ switch (type) {
+ case MAIL_SORT_DATE:
+ env_field = IMAP_ENVELOPE_DATE;
+ break;
+ case MAIL_SORT_SUBJECT:
+ env_field = IMAP_ENVELOPE_SUBJECT;
+ break;
+ default:
+ i_unreached();
+ return NULL;
+ }
+
+ /* get field from hopefully cached envelope */
+ envelope = imap_msgcache_get(search_open_cache(ctx, id),
+ IMAP_CACHE_ENVELOPE);
+ return envelope == NULL ? NULL :
+ imap_envelope_parse(envelope, env_field,
+ IMAP_ENVELOPE_RESULT_STRING);
}
static time_t _input_time(MailSortType type, unsigned int id, void *context)
@@ -131,6 +153,7 @@
MailSortFuncs index_sort_funcs = {
_input_time,
_input_uofft,
+ _input_mailbox,
_input_str,
_input_reset,
_output
More information about the dovecot-cvs
mailing list