X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Ftextclient%2Ftuiconfig.c;h=df5c43bd5099c74e93b420696f0d6c04d2424ca2;hb=33a166e5fa4b6e3b013d6093a957fc3ba7edc252;hp=95596cd855303d15a9b544d5b14142fe90689c12;hpb=eff49d47e7e6bb5811409f79be338a7036e3ad46;p=citadel.git diff --git a/citadel/textclient/tuiconfig.c b/citadel/textclient/tuiconfig.c index 95596cd85..df5c43bd5 100644 --- a/citadel/textclient/tuiconfig.c +++ b/citadel/textclient/tuiconfig.c @@ -1,7 +1,15 @@ -/* $Id$ - * +/* * Configuration screens that are part of the text mode client. * + * Copyright (c) 1987-2012 by the citadel.org team + * + * This program is open source software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. */ #include @@ -63,7 +71,7 @@ extern int screenwidth; void do_system_configuration(CtdlIPC *ipc) { -#define NUM_CONFIGS 67 + /* NUM_CONFIGS is now defined in citadel.h */ char buf[256]; char sc[NUM_CONFIGS][256]; @@ -116,6 +124,9 @@ void do_system_configuration(CtdlIPC *ipc) atoi(&sc[29][0])))); strprompt("Initial access level for new users", &sc[6][0], 1); strprompt("Access level required to create rooms", &sc[19][0], 1); + snprintf(sc[67], sizeof sc[67], "%d", (boolprompt( + "Allow anonymous guest logins", + atoi(&sc[67][0])))); snprintf(sc[4], sizeof sc[4], "%d", (boolprompt( "Automatically give room aide privs to a user who creates a private room", atoi(&sc[4][0])))); @@ -353,11 +364,12 @@ void do_system_configuration(CtdlIPC *ipc) scr_printf("Save this configuration? "); if (yesno()) { r = 1; - for (a = 0; a < NUM_CONFIGS; a++) + for (a = 0; a < NUM_CONFIGS; a++) { r += 1 + strlen(sc[a]); + } resp = (char *)calloc(1, r); if (!resp) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } for (a = 0; a < NUM_CONFIGS; a++) { @@ -366,18 +378,18 @@ void do_system_configuration(CtdlIPC *ipc) } r = CtdlIPCSetSystemConfig(ipc, resp, buf); if (r / 100 != 4) { - err_printf("%s\n", buf); + scr_printf("%s\n", buf); } free(resp); r = CtdlIPCSetMessageExpirationPolicy(ipc, 2, site_expirepolicy, buf); if (r / 100 != 2) { - err_printf("%s\n", buf); + scr_printf("%s\n", buf); } r = CtdlIPCSetMessageExpirationPolicy(ipc, 3, mbx_expirepolicy, buf); if (r / 100 != 2) { - err_printf("%s\n", buf); + scr_printf("%s\n", buf); } } @@ -400,7 +412,7 @@ void get_inet_rec_type(CtdlIPC *ipc, char *buf) { keyopt(" <6> RBL (domain suffix of spam hunting RBL)\n"); keyopt(" <7> masq domains (Domains as which users are allowed to masquerade)\n"); keyopt(" <8> ClamAV (Address of ClamAV clamd server)\n"); - sel = intprompt("Which one", 1, 1, 7); + sel = intprompt("Which one", 1, 1, 8); switch(sel) { case 1: strcpy(buf, "localhost"); return; @@ -432,7 +444,6 @@ void do_internet_configuration(CtdlIPC *ipc) int num_recs = 0; char **recs = NULL; char ch; - int badkey; int i, j; int quitting = 0; int modified = 0; @@ -504,7 +515,7 @@ void do_internet_configuration(CtdlIPC *ipc) r += 1 + strlen(recs[i]); resp = (char *)calloc(1, r); if (!resp) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } if (num_recs) for (i = 0; i < num_recs; i++) { @@ -513,7 +524,7 @@ void do_internet_configuration(CtdlIPC *ipc) } r = CtdlIPCSetSystemConfigByType(ipc, INTERNETCFG, resp, buf); if (r / 100 != 4) { - err_printf("%s\n", buf); + scr_printf("%s\n", buf); } else { scr_printf("Wrote %d records.\n", num_recs); modified = 0; @@ -525,7 +536,7 @@ void do_internet_configuration(CtdlIPC *ipc) "Quit without saving", 0); break; default: - badkey = 1; + break; } } while (!quitting); @@ -567,7 +578,7 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) tempfp = fopen(filename, "w"); if (tempfp == NULL) { - err_printf("Cannot open %s: %s\n", filename, strerror(errno)); + scr_printf("Cannot open %s: %s\n", filename, strerror(errno)); return; } @@ -602,7 +613,6 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) fclose(tempfp); e_ex_code = 1; /* start with a failed exit code */ - screen_reset(); stty_ctdl(SB_RESTORE); editor_pid = fork(); cksum = file_checksum(filename); @@ -619,11 +629,10 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) } while ((b != editor_pid) && (b >= 0)); editor_pid = (-1); stty_ctdl(0); - screen_set(); } if (file_checksum(filename) == cksum) { - err_printf("*** No changes to save.\n"); + scr_printf("*** No changes to save.\n"); e_ex_code = 1; } @@ -687,7 +696,6 @@ void do_ignet_configuration(CtdlIPC *ipc) { int num_recs = 0; char **recs = NULL; char ch; - int badkey; int i, j; int quitting = 0; int modified = 0; @@ -776,7 +784,7 @@ void do_ignet_configuration(CtdlIPC *ipc) { r += 1 + strlen(recs[i]); listing = (char*) calloc(1, r); if (!listing) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } if (num_recs) for (i = 0; i < num_recs; ++i) { @@ -797,7 +805,7 @@ void do_ignet_configuration(CtdlIPC *ipc) { "Quit without saving", 0); break; default: - badkey = 1; + break; } } while (!quitting); @@ -817,7 +825,6 @@ void do_filterlist_configuration(CtdlIPC *ipc) int num_recs = 0; char **recs = NULL; char ch; - int badkey; int i, j; int quitting = 0; int modified = 0; @@ -901,7 +908,7 @@ void do_filterlist_configuration(CtdlIPC *ipc) r += 1 + strlen(recs[i]); listing = (char*) calloc(1, r); if (!listing) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } if (num_recs) for (i = 0; i < num_recs; ++i) { @@ -922,7 +929,7 @@ void do_filterlist_configuration(CtdlIPC *ipc) "Quit without saving", 0); break; default: - badkey = 1; + break; } } while (!quitting); @@ -944,7 +951,6 @@ void do_pop3client_configuration(CtdlIPC *ipc) int num_recs = 0; char **recs = NULL; char ch; - int badkey; int i, j; int quitting = 0; int modified = 0; @@ -1051,7 +1057,7 @@ void do_pop3client_configuration(CtdlIPC *ipc) } listing = (char*) calloc(1, r); if (!listing) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } if (num_recs) for (i = 0; i < num_recs; ++i) { @@ -1090,7 +1096,7 @@ void do_pop3client_configuration(CtdlIPC *ipc) "Quit without saving", 0); break; default: - badkey = 1; + break; } } while (!quitting); @@ -1114,7 +1120,6 @@ void do_rssclient_configuration(CtdlIPC *ipc) int num_recs = 0; char **recs = NULL; char ch; - int badkey; int i, j; int quitting = 0; int modified = 0; @@ -1196,7 +1201,7 @@ void do_rssclient_configuration(CtdlIPC *ipc) } listing = (char*) calloc(1, r); if (!listing) { - err_printf("Can't save config - out of memory!\n"); + scr_printf("Can't save config - out of memory!\n"); logoff(ipc, 1); } if (num_recs) for (i = 0; i < num_recs; ++i) { @@ -1235,7 +1240,7 @@ void do_rssclient_configuration(CtdlIPC *ipc) "Quit without saving", 0); break; default: - badkey = 1; + break; } } while (!quitting);