Commit 0819261e 0819261ed5b12d9bf96fd2ef070ea2d2b44c3f2a by Sergey Poznyakoff

(mu_set_user_email): Set user's domain as well.

1 parent f423b825
...@@ -485,7 +485,8 @@ mu_set_user_email (const char *candidate) ...@@ -485,7 +485,8 @@ mu_set_user_email (const char *candidate)
485 address_t addr = NULL; 485 address_t addr = NULL;
486 size_t emailno = 0; 486 size_t emailno = 0;
487 char *email = NULL; 487 char *email = NULL;
488 488 char *domain = NULL;
489
489 if ((err = address_create (&addr, candidate)) != 0) 490 if ((err = address_create (&addr, candidate)) != 0)
490 return err; 491 return err;
491 492
...@@ -501,12 +502,15 @@ mu_set_user_email (const char *candidate) ...@@ -501,12 +502,15 @@ mu_set_user_email (const char *candidate)
501 if ((err = address_aget_email (addr, 1, &email)) != 0) 502 if ((err = address_aget_email (addr, 1, &email)) != 0)
502 goto cleanup; 503 goto cleanup;
503 504
504
505 if (mu_user_email) 505 if (mu_user_email)
506 free (mu_user_email); 506 free (mu_user_email);
507 507
508 mu_user_email = email; 508 mu_user_email = email;
509 509
510 address_aget_domain (addr, 1, &domain);
511 mu_set_user_email_domain (domain);
512 free (domain);
513
510 cleanup: 514 cleanup:
511 address_destroy (&addr); 515 address_destroy (&addr);
512 516
...@@ -582,10 +586,10 @@ mu_get_user_email (const char *name) ...@@ -582,10 +586,10 @@ mu_get_user_email (const char *name)
582 status = mu_get_user_email_domain (&domainpart); 586 status = mu_get_user_email_domain (&domainpart);
583 587
584 if (status) 588 if (status)
585 { 589 {
586 errno = status; 590 errno = status;
587 return NULL; 591 return NULL;
588 } 592 }
589 593
590 if ((status = parse822_quote_local_part (&localpart, name))) 594 if ((status = parse822_quote_local_part (&localpart, name)))
591 { 595 {
......