From bc06d5e3a6796f0def40f739fcc5ad09dc7cc8b0 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Thu, 2 Apr 2009 16:24:34 +0000 Subject: [PATCH] Assign EXCHANGE poboxes to all incoming students. --- reg_svr/reg_svr.pc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/reg_svr/reg_svr.pc b/reg_svr/reg_svr.pc index a08450ce..79d209ca 100644 --- a/reg_svr/reg_svr.pc +++ b/reg_svr/reg_svr.pc @@ -789,7 +789,7 @@ void QUIT(reg_client *rc, int argc, char **argv) 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; @@ -819,19 +819,27 @@ int register_user(int uid, char *username) 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(); -- 2.45.1