]> andersk Git - moira.git/commitdiff
Assign EXCHANGE poboxes to all incoming students.
authorzacheiss <zacheiss>
Thu, 2 Apr 2009 16:24:34 +0000 (16:24 +0000)
committerzacheiss <zacheiss>
Thu, 2 Apr 2009 16:24:34 +0000 (16:24 +0000)
reg_svr/reg_svr.pc

index a08450ce30e2673afedc3fe66e5b18bd7a320b7f..79d209ca634e647a8cfe49f29629656bfba5cb7c 100644 (file)
@@ -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();
This page took 0.041256 seconds and 5 git commands to generate.