Mercurial > dovecot > core-2.2
changeset 1682:1534976b029b HEAD
Removed get_address() and get_first_mailbox() from mail interface.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 14 Aug 2003 01:24:32 +0300 |
parents | 174b0a707426 |
children | cc366700adfc |
files | src/imap/imap-sort.c src/lib-storage/index/index-mail.c src/lib-storage/mail-storage.h src/lib-storage/proxy-mail.c |
diffstat | 4 files changed, 25 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-sort.c Mon Aug 11 17:28:27 2003 +0300 +++ b/src/imap/imap-sort.c Thu Aug 14 01:24:32 2003 +0300 @@ -12,6 +12,7 @@ #include "str.h" #include "imap-base-subject.h" #include "mail-storage.h" +#include "message-address.h" #include "imap-sort.h" #include <stdlib.h> @@ -274,6 +275,21 @@ return value; } +static const char *get_first_mailbox(struct mail *mail, const char *field) +{ + struct message_address *addr; + const char *str; + + str = mail->get_header(mail, field); + if (str == NULL) + return NULL; + + addr = message_address_parse(data_stack_pool, + (const unsigned char *) str, + (size_t)-1, 1); + return addr != NULL ? addr->mailbox : NULL; +} + static void mail_sort_check_flush(struct sort_context *ctx, struct mail *mail) { const char *str; @@ -290,7 +306,7 @@ } if (ctx->common_mask & MAIL_SORT_CC) { - str = mail->get_first_mailbox(mail, "cc"); + str = get_first_mailbox(mail, "cc"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); @@ -310,7 +326,7 @@ } if (ctx->common_mask & MAIL_SORT_FROM) { - str = mail->get_first_mailbox(mail, "from"); + str = get_first_mailbox(mail, "from"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); @@ -345,7 +361,7 @@ } if (ctx->common_mask & MAIL_SORT_TO) { - str = mail->get_first_mailbox(mail, "to"); + str = get_first_mailbox(mail, "to"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); @@ -408,7 +424,7 @@ if (ctx->common_mask & MAIL_SORT_CC) str = ctx->last_cc; else { - str = mail->get_first_mailbox(mail, "cc"); + str = get_first_mailbox(mail, "cc"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); } @@ -422,7 +438,7 @@ if (ctx->common_mask & MAIL_SORT_FROM) str = ctx->last_from; else { - str = mail->get_first_mailbox(mail, "from"); + str = get_first_mailbox(mail, "from"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); } @@ -436,7 +452,7 @@ if (ctx->common_mask & MAIL_SORT_TO) str = ctx->last_to; else { - str = mail->get_first_mailbox(mail, "to"); + str = get_first_mailbox(mail, "to"); if (str != NULL) str = str_ucase(t_strdup_noconst(str)); } @@ -556,13 +572,13 @@ return imap_get_base_subject_cased(ctx->temp_pool, str, NULL); case MAIL_SORT_CC: - str = mail->get_first_mailbox(mail, "cc"); + str = get_first_mailbox(mail, "cc"); break; case MAIL_SORT_FROM: - str = mail->get_first_mailbox(mail, "from"); + str = get_first_mailbox(mail, "from"); break; case MAIL_SORT_TO: - str = mail->get_first_mailbox(mail, "to"); + str = get_first_mailbox(mail, "to"); break; default: i_unreached();
--- a/src/lib-storage/index/index-mail.c Mon Aug 11 17:28:27 2003 +0300 +++ b/src/lib-storage/index/index-mail.c Thu Aug 14 01:24:32 2003 +0300 @@ -808,35 +808,6 @@ str_len(mail->data.header_data)); } -static const struct message_address * -get_address(struct mail *_mail, const char *field) -{ - struct index_mail *mail = (struct index_mail *) _mail; - const char *str; - - str = get_header(_mail, field); - if (str == NULL) - return NULL; - - return message_address_parse(mail->pool, (const unsigned char *) str, - (size_t)-1, 1); -} - -static const char *get_first_mailbox(struct mail *_mail, const char *field) -{ - struct index_mail *mail = (struct index_mail *) _mail; - struct message_address *addr; - const char *str; - - str = get_header(_mail, field); - if (str == NULL) - return NULL; - - addr = message_address_parse(mail->pool, (const unsigned char *) str, - (size_t)-1, 1); - return addr != NULL ? addr->mailbox : NULL; -} - static struct istream *get_stream(struct mail *_mail, struct message_size *hdr_size, struct message_size *body_size) @@ -996,8 +967,6 @@ get_size, get_header, get_headers, - get_address, - get_first_mailbox, get_stream, get_special, index_storage_update_flags,
--- a/src/lib-storage/mail-storage.h Mon Aug 11 17:28:27 2003 +0300 +++ b/src/lib-storage/mail-storage.h Thu Aug 14 01:24:32 2003 +0300 @@ -377,13 +377,6 @@ struct istream *(*get_headers)(struct mail *mail, const char *const minimum_fields[]); - /* Returns the parsed address for given header field. */ - const struct message_address *(*get_address)(struct mail *mail, - const char *field); - /* Returns the first mailbox (RFC2822 local-part) field for given - address header field. */ - const char *(*get_first_mailbox)(struct mail *mail, const char *field); - /* Returns input stream pointing to beginning of message header. hdr_size and body_size are updated unless they're NULL. */ struct istream *(*get_stream)(struct mail *mail,
--- a/src/lib-storage/proxy-mail.c Mon Aug 11 17:28:27 2003 +0300 +++ b/src/lib-storage/proxy-mail.c Thu Aug 14 01:24:32 2003 +0300 @@ -45,21 +45,6 @@ return p->mail->get_header(p->mail, field); } -static const struct message_address * -_get_address(struct mail *mail, const char *field) -{ - struct proxy_mail *p = (struct proxy_mail *) mail; - - return p->mail->get_address(p->mail, field); -} - -static const char *_get_first_mailbox(struct mail *mail, const char *field) -{ - struct proxy_mail *p = (struct proxy_mail *) mail; - - return p->mail->get_first_mailbox(p->mail, field); -} - static struct istream *_get_stream(struct mail *mail, struct message_size *hdr_size, struct message_size *body_size) @@ -113,8 +98,6 @@ pm->get_date = _get_date; pm->get_size = _get_size; pm->get_header = _get_header; - pm->get_address = _get_address; - pm->get_first_mailbox = _get_first_mailbox; pm->get_stream = _get_stream; pm->get_special = _get_special; pm->update_flags = _update_flags;