src/mime.c
changeset 93 6f3f781caaa0
parent 91 00c67be2d56d
child 94 9ec29aa10b58
     1.1 --- a/src/mime.c	Sun Mar 08 12:07:36 2015 +0100
     1.2 +++ b/src/mime.c	Sun Mar 08 12:18:20 2015 +0100
     1.3 @@ -267,10 +267,11 @@
     1.4      return NULL;
     1.5  }
     1.6  
     1.7 -static struct mailimf_mailbox_list * mbl_from_identity_list(identity_list *il)
     1.8 +static struct mailimf_address_list * mal_from_identity_list(identity_list *il)
     1.9  {
    1.10 -    struct mailimf_mailbox_list *mbl = NULL;
    1.11 +    struct mailimf_address_list *mal = NULL;
    1.12      struct mailimf_mailbox *mb = NULL;
    1.13 +    struct mailimf_address * addr = NULL;
    1.14      clist *list = NULL;
    1.15      int r;
    1.16  
    1.17 @@ -286,21 +287,29 @@
    1.18          if (mb == NULL)
    1.19              goto enomem;
    1.20  
    1.21 -        r = clist_append(list, mb);
    1.22 +        addr = mailimf_address_new(MAILIMF_ADDRESS_MAILBOX, mb, NULL);
    1.23 +        if (addr == NULL)
    1.24 +            goto enomem;
    1.25 +        mb = NULL;
    1.26 +
    1.27 +        r = clist_append(list, addr);
    1.28          if (r)
    1.29              goto enomem;
    1.30 +        addr = NULL;
    1.31      }
    1.32 -
    1.33 -    mbl = mailimf_mailbox_list_new(list);
    1.34 -    if (mbl == NULL)
    1.35 +    mal = mailimf_address_list_new(list);
    1.36 +    if (mal == NULL)
    1.37          goto enomem;
    1.38  
    1.39 -    return mbl;
    1.40 +    return mal;
    1.41  
    1.42  enomem:
    1.43      if (mb)
    1.44          mailimf_mailbox_free(mb);
    1.45  
    1.46 +    if (addr)
    1.47 +        mailimf_address_free(addr);
    1.48 +
    1.49      if (list)
    1.50          clist_free(list);
    1.51  
    1.52 @@ -409,40 +418,40 @@
    1.53      }
    1.54  
    1.55      if (msg->to) {
    1.56 -        struct mailimf_mailbox_list *to = mbl_from_identity_list(msg->to);
    1.57 +        struct mailimf_address_list *to = mal_from_identity_list(msg->to);
    1.58          if (to == NULL)
    1.59              goto enomem;
    1.60  
    1.61          r = _append_field(fields_list, MAILIMF_FIELD_TO,
    1.62                  (_new_func_t) mailimf_to_new, to);
    1.63          if (r) {
    1.64 -            mailimf_mailbox_list_free(to);
    1.65 +            mailimf_address_list_free(to);
    1.66              goto enomem;
    1.67          }
    1.68      }
    1.69  
    1.70      if (msg->cc) {
    1.71 -        struct mailimf_mailbox_list *cc = mbl_from_identity_list(msg->cc);
    1.72 +        struct mailimf_address_list *cc = mal_from_identity_list(msg->cc);
    1.73          if (cc == NULL)
    1.74              goto enomem;
    1.75  
    1.76          r = _append_field(fields_list, MAILIMF_FIELD_CC,
    1.77                  (_new_func_t) mailimf_cc_new, cc);
    1.78          if (r) {
    1.79 -            mailimf_mailbox_list_free(cc);
    1.80 +            mailimf_address_list_free(cc);
    1.81              goto enomem;
    1.82          }
    1.83      }
    1.84      
    1.85      if (msg->bcc) {
    1.86 -        struct mailimf_mailbox_list *bcc = mbl_from_identity_list(msg->bcc);
    1.87 +        struct mailimf_address_list *bcc = mal_from_identity_list(msg->bcc);
    1.88          if (bcc == NULL)
    1.89              goto enomem;
    1.90  
    1.91          r = _append_field(fields_list, MAILIMF_FIELD_BCC,
    1.92                  (_new_func_t) mailimf_bcc_new, bcc);
    1.93          if (r) {
    1.94 -            mailimf_mailbox_list_free(bcc);
    1.95 +            mailimf_address_list_free(bcc);
    1.96              goto enomem;
    1.97          }
    1.98      }