* Here's the big one... the Citadel context structure.
*
* This structure keeps track of all information relating to a running
- * session on the server. We keep one of these for each session thread.
+ * session on the server. We keep one of these for each session.
*
*/
struct CitContext {
int cs_pid; /* session ID */
int dont_term; /* for special activities like artv so we don't get killed */
- double created; /* time of birth */
+ double created; /* time of birth */
time_t lastcmd; /* time of last command executed */
time_t lastidle; /* For computing idle time */
CCState state; /* thread state (see CON_ values below) */
ForEachUser(miafvtur_backend, NULL);
miafvtur_backend(NULL, NULL);
CtdlRebuildDirectoryIndex();
- abort();
}
I = atol(msg->cm_fields[eVltMsgNum]);
if (I <= 0L) return(0);
- /* Store our Internet return address in memory */
+ /* Store our friendly/display name in memory */
if (is_MY_UserConf) {
v = vcard_load(msg->cm_fields[eMesageText]);
- extract_inet_email_addrs(CCC->cs_inet_email, sizeof CCC->cs_inet_email,
- CCC->cs_inet_other_emails, sizeof CCC->cs_inet_other_emails,
- v, 1);
extract_friendly_name(CCC->cs_inet_fn, sizeof CCC->cs_inet_fn, v);
vcard_free(v);
}
/*
* Get Valid Email Addresses
+ * FIXME this doesn't belong in serv_vcard.c anymore , maybe move it to internet_addressing.c
*/
void cmd_gvea(char *argbuf)
{
}
-
-
/*
* Callback function for cmd_dvca() that hunts for vCard content types
* and outputs any email addresses found within.
#endif
/*
- * Extract from the user's vCard, any Internet email addresses and the user's real name.
+ * Extract the user's friendly/screen name
* These are inserted into the session data for various message entry commands to use.
*/
v = vcard_get_user(&CCC->user);
if (v) {
- extract_inet_email_addrs(CCC->cs_inet_email, sizeof CCC->cs_inet_email,
- CCC->cs_inet_other_emails, sizeof CCC->cs_inet_other_emails,
- v, 1
- );
extract_friendly_name(CCC->cs_inet_fn, sizeof CCC->cs_inet_fn, v);
vcard_free(v);
}
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...)