Determine full user email address (mail_set_my_name).
Showing
1 changed file
with
8 additions
and
10 deletions
... | @@ -52,28 +52,26 @@ mail_whoami () | ... | @@ -52,28 +52,26 @@ mail_whoami () |
52 | return my_name; | 52 | return my_name; |
53 | } | 53 | } |
54 | 54 | ||
55 | /* FIXME: this lacks domain name part! */ | ||
56 | void | 55 | void |
57 | mail_set_my_name (char *name) | 56 | mail_set_my_name (char *name) |
58 | { | 57 | { |
59 | char hostname[256]; | ||
60 | |||
61 | if (!name) | 58 | if (!name) |
62 | { | 59 | { |
63 | struct passwd *pw = getpwuid(getuid()); | 60 | struct passwd *pw = getpwuid (getuid ()); |
64 | if (!pw) | 61 | if (!pw) |
65 | { | 62 | { |
66 | util_error("can't determine my username"); | 63 | util_error ("can't determine my username"); |
67 | exit (1); | 64 | exit (1); |
68 | } | 65 | } |
69 | name = pw->pw_name; | 66 | name = pw->pw_name; |
70 | } | 67 | } |
71 | |||
72 | my_name = strdup (name); | 68 | my_name = strdup (name); |
73 | gethostname(hostname, sizeof(hostname)); | 69 | my_email = mu_get_user_email (name); |
74 | hostname[sizeof(hostname)-1] = 0; | 70 | if (!my_email) |
75 | my_email = xmalloc (strlen (name) + strlen (hostname) + 2); | 71 | { |
76 | sprintf (my_email, "%s@%s", name, hostname); | 72 | util_error("can't determine my email address: %s", strerror (errno)); |
73 | exit (1); | ||
74 | } | ||
77 | } | 75 | } |
78 | 76 | ||
79 | int | 77 | int | ... | ... |
-
Please register or sign in to post a comment