}
}
-void hit_any_key(void) { /* hit any key to continue */
+void hit_any_key(CtdlIPC *ipc) { /* hit any key to continue */
int a,b;
color(COLOR_PUSH);
/*
* change a user's access level
*/
-void edituser(void)
+void edituser(CtdlIPC *ipc)
{
char buf[SIZ];
char who[USERNAME_SIZE];
int r; /* IPC response code */
newprompt("User name: ", who, 25);
- while ((r = CtdlIPCAideGetUserParameters(who, &user, buf)) / 100 != 2) {
+ while ((r = CtdlIPCAideGetUserParameters(ipc, who, &user, buf)) / 100 != 2) {
scr_printf("%s\n", buf);
scr_printf("Do you want to create this user? ");
if (yesno()) {
- r = CtdlIPCCreateUser(who, 0, buf);
+ r = CtdlIPCCreateUser(ipc, who, 0, buf);
if (r / 100 == 2) {
newnow = 1;
continue;
return;
}
- val_user(user->fullname, 0); /* Display registration */
+ val_user(ipc, user->fullname, 0); /* Display registration */
if (newnow || boolprompt("Change password", 0)) { /* I'm lazy */
strprompt("Password", user->password, -19);
user->USuserpurge = intprompt("Purge time (in days, 0 for system default",
user->USuserpurge, 0, INT_MAX);
- r = CtdlIPCAideSetUserParameters(user, buf);
+ r = CtdlIPCAideSetUserParameters(ipc, user, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
}
* yes or no. Yes=1 and No=0, unless 'backwards' is set to a nonzero value
* in which case No=1 and Yes=0.
*/
-int set_attr(int sval, char *prompt, unsigned int sbit, int backwards)
+int set_attr(CtdlIPC *ipc, int sval, char *prompt, unsigned int sbit, int backwards)
{
int a;
int temp;
* modes are: 0 - .EC command, 1 - .EC for new user,
* 2 - toggle Xpert mode 3 - toggle floor mode
*/
-void enter_config(int mode)
+void enter_config(CtdlIPC *ipc, int mode)
{
char buf[SIZ];
struct usersupp *user = NULL;
int r; /* IPC response code */
- r = CtdlIPCGetConfig(&user, buf);
+ r = CtdlIPCGetConfig(ipc, &user, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
free(user);
user->USscreenheight = intprompt("Enter your screen height",
user->USscreenheight, 3, 255);
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Are you an experienced Citadel user",
US_EXPERT, 0);
if ((user->flags & US_EXPERT) == 0 && mode == 1) {
return;
}
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Print last old message on New message request",
US_LASTOLD, 0);
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Prompt after each message",
US_NOPROMPT, 1);
if ((user->flags & US_NOPROMPT) == 0)
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Use 'disappearing' prompts",
US_DISAPPEAR, 0);
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Pause after each screenful of text",
US_PAGINATOR, 0);
if (rc_prompt_control == 3 && (user->flags & US_PAGINATOR))
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"<N>ext and <S>top work at paginator prompt",
US_PROMPTCTL, 0);
if (rc_floor_mode == RC_DEFAULT)
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"View rooms by floor",
US_FLOORS, 0);
if (rc_ansi_color == 3)
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Enable color support",
US_COLOR, 0);
if ((user->flags & US_EXPERT) == 0)
- formout("unlisted");
+ formout(ipc, "unlisted");
- user->flags = set_attr(user->flags,
+ user->flags = set_attr(ipc, user->flags,
"Be unlisted in userlog",
US_UNLISTED, 0);
}
}
}
- r = CtdlIPCSetConfig(user, buf);
+ r = CtdlIPCSetConfig(ipc, user, buf);
if (r / 100 != 2) scr_printf("%s\n", buf);
userflags = user->flags;
free(user);
/* display internal error as defined in errmsgs */
+/*
void interr(int errnum) {
scr_printf("*** INTERNAL ERROR %d\n"
"(Press any key to continue)\n", errnum);
inkey();
logoff(errnum);
}
+*/
+
void strproc(char *string)
{
/*
* miscellaneous server commands (testing, etc.)
*/
-void misc_server_cmd(char *cmd) {
+void misc_server_cmd(CtdlIPC *ipc, char *cmd) {
char buf[SIZ];
- serv_puts(cmd);
- serv_gets(buf);
+ CtdlIPC_putline(ipc, cmd);
+ CtdlIPC_getline(ipc, buf);
scr_printf("%s\n",buf);
if (buf[0]=='1') {
set_keepalives(KA_HALF);
- while (serv_gets(buf), strcmp(buf,"000")) {
+ while (CtdlIPC_getline(ipc, buf), strcmp(buf,"000")) {
scr_printf("%s\n",buf);
}
set_keepalives(KA_YES);
if (buf[0]=='4') {
do {
newprompt("> ",buf,255);
- serv_puts(buf);
+ CtdlIPC_putline(ipc, buf);
} while(strcmp(buf,"000"));
return;
}