$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.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
}
/*
- * 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;
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);
}
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);
}
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);