]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed get_address() and get_first_mailbox() from mail interface.
authorTimo Sirainen <tss@iki.fi>
Wed, 13 Aug 2003 22:24:32 +0000 (01:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 13 Aug 2003 22:24:32 +0000 (01:24 +0300)
--HG--
branch : HEAD

src/imap/imap-sort.c
src/lib-storage/index/index-mail.c
src/lib-storage/mail-storage.h
src/lib-storage/proxy-mail.c

index 74b3b5d9f99e564824eba3d6da5beca4743e0c96..98ffa51fbb2dfddef20a442118fa82955f031134 100644 (file)
@@ -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 @@ static const char *string_table_get(struct sort_context *ctx, const char *str)
        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 @@ static void mail_sort_check_flush(struct sort_context *ctx, struct mail *mail)
        }
 
        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 @@ static void mail_sort_check_flush(struct sort_context *ctx, struct mail *mail)
        }
 
        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 @@ static void mail_sort_check_flush(struct sort_context *ctx, struct mail *mail)
        }
 
        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 @@ static void mail_sort_input(struct sort_context *ctx, struct mail *mail)
                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 @@ static void mail_sort_input(struct sort_context *ctx, struct mail *mail)
                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 @@ static void mail_sort_input(struct sort_context *ctx, struct mail *mail)
                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 @@ static const char *get_str(enum mail_sort_type type, const unsigned char *buf,
                        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();
index 542c6ff0bd2719bf88754aa1a7bb0350d4458ae4..64222387d1f1fdb131ae71ff84e602b0889b6eaa 100644 (file)
@@ -808,35 +808,6 @@ static struct istream *get_headers(struct mail *_mail,
                                         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 @@ static struct mail index_mail = {
        get_size,
        get_header,
        get_headers,
-       get_address,
-       get_first_mailbox,
        get_stream,
        get_special,
        index_storage_update_flags,
index 203d2986bea500f469e7e5cdd45190c9fbf84bb3..9e2eed7a35440d729c49d97aef9bdc46ac2a7357 100644 (file)
@@ -377,13 +377,6 @@ struct mail {
        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,
index 7ab43c2629ef3c013eb1c02ba3eb535f2a1df80e..c7aa7fcffdbb3bfdb81cab0385e1b37595a1e152 100644 (file)
@@ -45,21 +45,6 @@ static const char *_get_header(struct mail *mail, const char *field)
        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 @@ void proxy_mail_init(struct proxy_mail *proxy, struct mail *mail)
        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;