Commit 23fd0592 23fd0592e1bba8ad05f44d24e08b47d77314154f by Sergey Poznyakoff

New mtstailor variable "username"

1 parent a581fd70
Showing 1 changed file with 30 additions and 0 deletions
...@@ -341,6 +341,36 @@ read_mts_profile () ...@@ -341,6 +341,36 @@ read_mts_profile ()
341 exit (1); 341 exit (1);
342 } 342 }
343 } 343 }
344
345 if ((p = mh_context_get_value (mts_profile, "username", NULL)))
346 {
347 size_t len;
348 const char *domain;
349 char *newemail;
350 int rc;
351
352 rc = mu_get_user_email_domain (&domain);
353 if (rc)
354 {
355 mu_error (_("Cannot get user email: %s"), mu_strerror (rc));
356 exit (1);
357 }
358 len = strlen (p) + 1 + strlen (domain) + 1;
359 newemail = xmalloc (len);
360 strcpy (newemail, p);
361 strcat (newemail, "@");
362 strcat (newemail, domain);
363
364 rc = mu_set_user_email (newemail);
365 if (rc)
366 {
367 mu_error (_("Cannot set user email (%s): %s"),
368 newemail, mu_strerror (rc));
369 exit (1);
370 }
371
372 free (newemail);
373 }
344 } 374 }
345 375
346 376
......