]> code.citadel.org Git - citadel.git/commitdiff
* Add the ability to quit out while validating users. Also added a help
authorArt Cancro <ajc@citadel.org>
Mon, 24 Mar 2003 03:42:15 +0000 (03:42 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Mar 2003 03:42:15 +0000 (03:42 +0000)
  option listing available access levels.  This closes Bugzilla #37.

citadel/ChangeLog
citadel/routines2.c
citadel/routines2.h

index edd198b25e7df82e4718893683c6118815af26ee..ce40fa5a92282049605bae0106cb04c6a7c4b8f3 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 605.27  2003/03/24 03:42:14  ajc
+ * Add the ability to quit out while validating users.  Also added a help
+   option listing available access levels.  This closes Bugzilla #37.
+
  Revision 605.26  2003/03/22 05:38:23  ajc
  * During startup, display the version string from the Berkeley DB library.
  * When deleting a mailbox, don't reveal the namespace prefix to the user.
@@ -4588,3 +4592,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 86b53a5c3ac4fd7cc07b6627670ea875b260b058..111864869a63ac22e01db53c23c6b37aba6a169b 100644 (file)
@@ -394,17 +394,19 @@ void upload(CtdlIPC *ipc, int c)
 }
 
 /* 
- * validate a user
+ * validate a user (returns 0 for successful validation, nonzero if quitting)
  */
-void val_user(CtdlIPC *ipc, char *user, int do_validate)
+int val_user(CtdlIPC *ipc, char *user, int do_validate)
 {
        int a;
        char cmd[SIZ];
        char buf[SIZ];
        char *resp = NULL;
        int ax = 0;
+       char answer[2];
        int r;                          /* IPC response code */
 
+       scr_printf("\n");
        r = CtdlIPCGetUserRegistration(ipc, user, &resp, cmd);
        if (r / 100 == 1) {
                a = 0;
@@ -443,12 +445,31 @@ void val_user(CtdlIPC *ipc, char *user, int do_validate)
 
        if (do_validate) {
                /* now set the access level */
-               ax = intprompt("Access level", ax, 0, 6);
-               r = CtdlIPCValidateUser(ipc, user, ax, cmd);
-               if (r / 100 != 2)
-                       scr_printf("%s\n", cmd);
+               while(1) {
+                       sprintf(answer, "%d", ax);
+                       strprompt("New access level (? for help, q to quit)",
+                               answer, 1);
+                       if ((answer[0] >= '0') && (answer[0] <= '6')) {
+                               ax = atoi(answer);
+                               r = CtdlIPCValidateUser(ipc, user, ax, cmd);
+                               if (r / 100 != 2)
+                               scr_printf("%s\n\n", cmd);
+                               return(0);
+                       }
+                       if (tolower(answer[0]) == 'q') {
+                               scr_printf("*** Aborted.\n\n");
+                               return(1);
+                       }
+                       if (answer[0] == '?') {
+                               scr_printf("Available access levels:\n");
+                               for (a=0; a<7; ++a) {
+                                       scr_printf("%d - %s\n",
+                                               a, axdefs[a]);
+                               }
+                       }
+               }
        }
-       scr_printf("\n");
+       return(0);
 }
 
 
@@ -467,7 +488,7 @@ void validate(CtdlIPC *ipc)
                        scr_printf("%s\n", cmd);
                if (r / 100 == 3) {
                        extract(buf, cmd, 0);
-                       val_user(ipc, buf, 1);
+                       if (val_user(ipc, buf, 1) != 0) finished = 1;
                }
        } while (finished == 0);
 }
index 12204a526ec18930ac7d904b25f6265a80e4e852..3b0ba8ab5f59030a3f9fb1812b93a9d249bbd262 100644 (file)
@@ -16,5 +16,5 @@ void do_internet_configuration(CtdlIPC *ipc);
 void do_ignet_configuration(CtdlIPC *ipc);
 void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment);
 void do_filterlist_configuration(CtdlIPC *ipc);
-void val_user(CtdlIPC *ipc, char *user, int do_validate);
+int val_user(CtdlIPC *ipc, char *user, int do_validate);
 void do_system_configuration(CtdlIPC *ipc);