int register_user(int uid, char *username)
{
EXEC SQL BEGIN DECLARE SECTION;
- char pin[USERS_PIN_SIZE];
+ char class[USERS_TYPE_SIZE];
EXEC SQL END DECLARE SECTION;
char uidbuf[10], *qargv[3], *motd = NULL;
long status;
return MR_INTERNAL;
}
- EXEC SQL SELECT pin INTO :pin FROM users WHERE unix_uid = :uid;
+ EXEC SQL SELECT type INTO :class FROM users WHERE unix_uid = :uid;
sprintf(uidbuf, "%d", uid);
qargv[0] = uidbuf;
qargv[1] = username;
- /* HACK: If user has a PIN set, they're from Sloan.
- * Give them Exchange poboxes.
+ /* Incoming students should be given Exchange poboxes.
+ * Doesn't work for undergrads in the class of 2100 or higher.
*/
- if (*pin != '\0')
+ if (!strcmp(strtrim(class), "G") || !strncmp(class, "FALL", 4) ||
+ !strncmp(class, "SPRING", 5) || !strncmp(class, "SUMMER", 6) ||
+ !strncmp(class, "20", 2))
+ {
+ com_err(whoami, 0, "assigning EXCHANGE pobox to user %s, class %s", username, class);
qargv[2] = "EXCHANGE";
+ }
else
- qargv[2] = "IMAP";
+ {
+ com_err(whoami, 0, "assigning IMAP pobox to user %s, class %s", username, class);
+ qargv[2] = "IMAP";
+ }
status = mr_query("register_user", 3, qargv, NULL, NULL);
mr_disconnect();