Commit 81d25f12 81d25f128f992c87dca78df64cb6c093fabc31d6 by Sergey Poznyakoff

(expand_aliases): Use mh_expand_aliases

1 parent 42dd9ada
Showing 1 changed file with 5 additions and 33 deletions
...@@ -364,41 +364,13 @@ void ...@@ -364,41 +364,13 @@ void
364 expand_aliases (mu_message_t msg) 364 expand_aliases (mu_message_t msg)
365 { 365 {
366 mu_header_t hdr; 366 mu_header_t hdr;
367 size_t i, num;
368 char *buf;
369 mu_address_t addr_to = NULL, 367 mu_address_t addr_to = NULL,
370 addr_cc = NULL, 368 addr_cc = NULL,
371 addr_bcc = NULL; 369 addr_bcc = NULL;
372
373 mu_message_get_header (msg, &hdr);
374 mu_header_get_field_count (hdr, &num);
375 for (i = 1; i <= num; i++)
376 {
377 if (mu_header_aget_field_name (hdr, i, &buf) == 0)
378 {
379 if (strcasecmp (buf, MU_HEADER_TO) == 0
380 || strcasecmp (buf, MU_HEADER_CC) == 0
381 || strcasecmp (buf, MU_HEADER_BCC) == 0)
382 {
383 char *value;
384 mu_address_t addr = NULL;
385 int incl;
386
387 mu_header_aget_field_value_unfold (hdr, i, &value);
388
389 mh_alias_expand (value, &addr, &incl);
390 free (value);
391 if (strcasecmp (buf, MU_HEADER_TO) == 0)
392 mu_address_union (&addr_to, addr);
393 else if (strcasecmp (buf, MU_HEADER_CC) == 0)
394 mu_address_union (&addr_cc, addr);
395 else if (strcasecmp (buf, MU_HEADER_BCC) == 0)
396 mu_address_union (&addr_bcc, addr);
397 }
398 free (buf);
399 }
400 }
401 370
371 mh_expand_aliases (msg, &addr_to, &addr_cc, &addr_bcc);
372
373 mu_message_get_header (msg, &hdr);
402 if (addr_to) 374 if (addr_to)
403 { 375 {
404 set_address_header (hdr, MU_HEADER_TO, addr_to); 376 set_address_header (hdr, MU_HEADER_TO, addr_to);
......