$Log$
+ Revision 601.74 2002/11/29 15:44:41 ajc
+ * CC->cs_inet_email is now a string buffer, not a pointer
+ * Initialize CC->cs_inet_email with a default address, so it always
+ contains something even when the directory doesn't
+ * Augment CHEK command to return the user's preferred Internet e-mail addr.
+
Revision 601.73 2002/11/27 21:05:31 nixo
added dot ungoto functionality.
It allows you to enter a room to ungoto, it will look
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
msg->cm_fields['D'] = strdoop(dest_node);
}
- if ( (author == &CC->usersupp) && (CC->cs_inet_email != NULL) ) {
+ if ( (author == &CC->usersupp) && (strlen(CC->cs_inet_email) > 0) ) {
msg->cm_fields['F'] = strdoop(CC->cs_inet_email);
}
int continue_searching = 1;
int instance = 0;
- /*
- * Clear whatever was in there previously.
- */
- if (CC->cs_inet_email != NULL) {
- phree(CC->cs_inet_email);
- CC->cs_inet_email = NULL;
- }
-
/* Go through the vCard searching for *all* instances of
* the "email;internet" key
*/
if (strlen(addr) > 0) {
if (IsDirectory(addr)) {
continue_searching = 0;
- CC->cs_inet_email = strdoop(addr);
+ safestrncpy(CC->cs_inet_email,
+ addr,
+ sizeof(CC->cs_inet_email)
+ );
}
}
phree(addr);
}
-/*
- * When a user logs out...
- */
-void vcard_session_logout_hook(void) {
- if (CC->cs_inet_email != NULL) {
- phree(CC->cs_inet_email);
- CC->cs_inet_email = NULL;
- }
-}
-
char *Dynamic_Module_Init(void)
{
SYM_VCARD = CtdlGetDynamicSymbol();
CtdlRegisterSessionHook(vcard_session_startup_hook, EVT_START);
CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
- CtdlRegisterSessionHook(vcard_session_logout_hook, EVT_LOGOUT);
CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);
CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE);
CtdlRegisterDeleteHook(vcard_delete_remove);
char cs_host[64]; /* host logged in from */
/* The Internet type of thing */
- char *cs_inet_email; /* Return address of outbound Internet mail */
+ char cs_inet_email[SIZ];/* Return address of outbound Internet mail */
FILE *download_fp; /* Fields relating to file transfer */
FILE *upload_fp;
0: Number of new private messages in Mail>
1: Nonzero if the user needs to register
2: (Relevant to Aides only) Nonzero if new users require validation
+ 3: The user's preferred Internet e-mail address
DELF (DELete a File)
#include <fcntl.h>
#include <signal.h>
#include <pwd.h>
+#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
*/
void session_startup(void)
{
+ int i;
+
syslog(LOG_NOTICE, "session %d: user <%s> logged in",
CC->cs_pid, CC->curr_user);
}
lputuser(&CC->usersupp);
+ /*
+ * Populate CC->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.
+ */
+ snprintf(CC->cs_inet_email, sizeof CC->cs_inet_email, "%s@%s",
+ CC->usersupp.fullname, config.c_fqdn);
+ for (i=0; i<strlen(CC->cs_inet_email); ++i) {
+ if (isspace(CC->cs_inet_email[i])) {
+ CC->cs_inet_email[i] = '_';
+ }
+ }
+
/* Create any personal rooms required by the system.
* (Technically, MAILROOM should be there already, but just in case...)
*/
network_talking_to(who->net_node, NTT_REMOVE);
}
- /*
- * Yes, we really need to free EVERY LAST BYTE we allocated.
- */
- if (who->cs_inet_email != NULL) {
- phree(who->cs_inet_email);
- who->cs_inet_email = NULL;
- }
-
/* Do modular stuff... */
PerformSessionHooks(EVT_LOGOUT);
}
/* check for mail */
mail = InitialMailCheck();
- cprintf("%d %d|%d|%d\n", CIT_OK, mail, regis, vali);
+ cprintf("%d %d|%d|%d|%s|\n", CIT_OK, mail, regis, vali, CC->cs_inet_email);
}