cmd=78,1,&.,&Admin,&Post
cmd=80,2,&.,&Admin,&System configuration,&General
cmd=82,2,&.,&Admin,&System configuration,&Internet
-cmd=88,2,&.,&Admin,&System configuration,&Network
-cmd=92,2,&.,&Admin,&System configuration,network &Filter list
cmd=85,2,&.,&Admin,&Terminate server,&Now
cmd=86,2,&.,&Admin,&Terminate server,&Scheduled
cmd=87,1,&.,&Admin,mailing &List recipients
cmd=94,1,&.,&Admin,mailing list &Digest recipients
-cmd=89,1,&.,&Admin,&Network room sharing
cmd=29,0,&.,&Terminate,and &Quit
cmd=30,0,&.,&Terminate,and &Stay online
/*
* Configuration screens that are part of the text mode client.
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 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.
}
-/*
- * IGnet node configuration
- */
-void do_ignet_configuration(CtdlIPC *ipc) {
- char buf[SIZ];
- int num_recs = 0;
- char **recs = NULL;
- char ch;
- int i, j;
- int quitting = 0;
- int modified = 0;
- char *listing = NULL;
- int r;
-
- r = CtdlIPCGetSystemConfigByType(ipc, IGNETCFG, &listing, buf);
- if (r / 100 == 1) while (*listing && !IsEmptyStr(listing)) {
- extract_token(buf, listing, 0, '\n', sizeof buf);
- remove_token(listing, 0, '\n');
-
- ++num_recs;
- if (num_recs == 1) recs = malloc(sizeof(char *));
- else recs = realloc(recs, (sizeof(char *)) * num_recs);
- recs[num_recs-1] = malloc(SIZ);
- strcpy(recs[num_recs-1], buf);
- }
- if (listing) free(listing);
-
- do {
- scr_printf("\n");
- color(BRIGHT_WHITE);
- scr_printf( "### "
- " Node "
- " Secret "
- " Host or IP "
- "Port#\n");
- color(DIM_WHITE);
- scr_printf( "--- "
- "---------------- "
- "------------------ "
- "-------------------------------- "
- "-----\n");
- for (i=0; i<num_recs; ++i) {
- color(DIM_WHITE);
- scr_printf("%3d ", i+1);
- extract_token(buf, recs[i], 0, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-16s ", buf);
- extract_token(buf, recs[i], 1, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-18s ", buf);
- extract_token(buf, recs[i], 2, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-32s ", buf);
- extract_token(buf, recs[i], 3, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-3s\n", buf);
- color(DIM_WHITE);
- }
- scr_printf("\n");
-
- ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
- switch(ch) {
- case 'a':
- ++num_recs;
- if (num_recs == 1)
- recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
- newprompt("Enter node name : ", buf, 16);
- strcat(buf, "|");
- newprompt("Enter shared secret: ",
- &buf[strlen(buf)], 18);
- strcat(buf, "|");
- newprompt("Enter host or IP : ",
- &buf[strlen(buf)], 32);
- strcat(buf, "|504");
- strprompt("Enter port number : ",
- &buf[strlen(buf)-3], 5);
- recs[num_recs-1] = strdup(buf);
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j)
- recs[j] = recs[j+1];
- modified = 1;
- break;
- case 's':
- r = 1;
- for (i = 0; i < num_recs; ++i)
- r += 1 + strlen(recs[i]);
- listing = (char*) calloc(1, r);
- if (!listing) {
- scr_printf("Can't save config - out of memory!\n");
- logoff(ipc, 1);
- }
- if (num_recs) for (i = 0; i < num_recs; ++i) {
- strcat(listing, recs[i]);
- strcat(listing, "\n");
- }
- r = CtdlIPCSetSystemConfigByType(ipc, IGNETCFG, listing, buf);
- if (r / 100 != 4) {
- scr_printf("%s\n", buf);
- } else {
- scr_printf("Wrote %d records.\n", num_recs);
- modified = 0;
- }
- free(listing);
- break;
- case 'q':
- quitting = !modified || boolprompt(
- "Quit without saving", 0);
- break;
- default:
- break;
- }
- } while (!quitting);
-
- if (recs != NULL) {
- for (i=0; i<num_recs; ++i) free(recs[i]);
- free(recs);
- }
-}
-
-
-/*
- * Filter list configuration
- */
-void do_filterlist_configuration(CtdlIPC *ipc)
-{
- char buf[SIZ];
- int num_recs = 0;
- char **recs = NULL;
- char ch;
- int i, j;
- int quitting = 0;
- int modified = 0;
- char *listing = NULL;
- int r;
-
- r = CtdlIPCGetSystemConfigByType(ipc, FILTERLIST, &listing, buf);
- if (r / 100 == 1) while (*listing && !IsEmptyStr(listing)) {
- extract_token(buf, listing, 0, '\n', sizeof buf);
- remove_token(listing, 0, '\n');
-
- ++num_recs;
- if (num_recs == 1) recs = malloc(sizeof(char *));
- else recs = realloc(recs, (sizeof(char *)) * num_recs);
- recs[num_recs-1] = malloc(SIZ);
- strcpy(recs[num_recs-1], buf);
- }
- if (listing) free(listing);
-
- do {
- scr_printf("\n");
- color(BRIGHT_WHITE);
- scr_printf( "### "
- " User name "
- " Room name "
- " Node name "
- "\n");
- color(DIM_WHITE);
- scr_printf( "--- "
- "---------------------------- "
- "---------------------------- "
- "---------------- "
- "\n");
- for (i=0; i<num_recs; ++i) {
- color(DIM_WHITE);
- scr_printf("%3d ", i+1);
- extract_token(buf, recs[i], 0, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-28s ", buf);
- extract_token(buf, recs[i], 1, '|', sizeof buf);
- color(BRIGHT_MAGENTA);
- scr_printf("%-28s ", buf);
- extract_token(buf, recs[i], 2, '|', sizeof buf);
- color(BRIGHT_CYAN);
- scr_printf("%-16s\n", buf);
- extract_token(buf, recs[i], 3, '|', sizeof buf);
- color(DIM_WHITE);
- }
-
- ch = keymenu("", "<A>dd|<D>elete|<S>ave|<Q>uit");
- switch(ch) {
- case 'a':
- ++num_recs;
- if (num_recs == 1)
- recs = malloc(sizeof(char *));
- else recs = realloc(recs,
- (sizeof(char *)) * num_recs);
- newprompt("Enter user name: ", buf, 28);
- strcat(buf, "|");
- newprompt("Enter room name: ",
- &buf[strlen(buf)], 28);
- strcat(buf, "|");
- newprompt("Enter node name: ",
- &buf[strlen(buf)], 16);
- strcat(buf, "|");
- recs[num_recs-1] = strdup(buf);
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which one",
- 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j)
- recs[j] = recs[j+1];
- modified = 1;
- break;
- case 's':
- r = 1;
- for (i = 0; i < num_recs; ++i)
- r += 1 + strlen(recs[i]);
- listing = (char*) calloc(1, r);
- if (!listing) {
- scr_printf("Can't save config - out of memory!\n");
- logoff(ipc, 1);
- }
- if (num_recs) for (i = 0; i < num_recs; ++i) {
- strcat(listing, recs[i]);
- strcat(listing, "\n");
- }
- r = CtdlIPCSetSystemConfigByType(ipc, FILTERLIST, listing, buf);
- if (r / 100 != 4) {
- scr_printf("%s\n", buf);
- } else {
- scr_printf("Wrote %d records.\n", num_recs);
- modified = 0;
- }
- free(listing);
- break;
- case 'q':
- quitting = !modified || boolprompt(
- "Quit without saving", 0);
- break;
- default:
- break;
- }
- } while (!quitting);
-
- if (recs != NULL) {
- for (i=0; i<num_recs; ++i) free(recs[i]);
- free(recs);
- }
-}
-
-
-
-
/*
* POP3 aggregation client configuration
*/