X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=7cff90d024847cdfc1292efd8278707d7c2553d6;hb=b4166762f14b4d28f4368dd1450eeec27164f9b8;hp=e19f238b0359fddac35def6586ae2dca5bd98cd1;hpb=9150fda1dc8e0c58dc24efb4472fd58ef284bff3;p=citadel.git diff --git a/citadel/user_ops.c b/citadel/user_ops.c index e19f238b0..7cff90d02 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -666,13 +666,24 @@ void do_login(void) CtdlPutUserLock(&CCC->user); /* - * Populate CCC->cs_inet_email with a default address. This will be - * overwritten with the user's directory address, if one exists, when - * the vCard module's login hook runs. + * No email address for user? Make one up. */ - snprintf(CCC->cs_inet_email, sizeof CCC->cs_inet_email, "%s@%s", - CCC->user.fullname, CtdlGetConfigStr("c_fqdn")); - convert_spaces_to_underscores(CCC->cs_inet_email); + if (IsEmptyStr(CCC->user.emailaddrs)) { + sprintf(CCC->user.emailaddrs, "cit%ld@%s", CCC->user.usernum, CtdlGetConfigStr("c_fqdn")); + } + + /* + * Populate cs_inet_email and cs_inet_other_emails with valid email addresses from the user record + */ + strcpy(CCC->cs_inet_email, CCC->user.emailaddrs); + char *firstsep = strstr(CCC->cs_inet_email, "|"); + if (firstsep) { + strcpy(CCC->cs_inet_other_emails, firstsep+1); + *firstsep = 0; + } + else { + CCC->cs_inet_other_emails[0] = 0; + } /* Create any personal rooms required by the system. * (Technically, MAILROOM should be there already, but just in case...)