Several mbsetup protections and checks added

This commit is contained in:
Michiel Broek 2003-01-31 21:49:29 +00:00
parent d95fc43626
commit 08542985ff
8 changed files with 606 additions and 526 deletions

View File

@ -92,7 +92,7 @@ m_tty.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/use
mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h mutil.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h
m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h m_archive.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../paths.h screen.h mutil.h ledit.h stlist.h m_global.h m_archive.h
m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h m_fdb.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_global.h m_farea.h m_fdb.h
m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_global.h m_global.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h screen.h mutil.h ledit.h m_node.h m_marea.h m_ticarea.h m_new.h m_fgroup.h m_mgroup.h m_global.h
m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h m_magic.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h
m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h m_mgroup.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h stlist.h m_global.h m_node.h m_marea.h m_mgroup.h
m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h m_node.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_node.h

View File

@ -501,102 +501,105 @@ int EditFGrpRec(int Area)
void EditFGroup(void) void EditFGroup(void)
{ {
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12], temp[PATH_MAX];
FILE *fil; FILE *fil;
char temp[PATH_MAX]; long offset;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountFGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenFGroup() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index(); clr_index();
working(1, 0, 0); set_color(WHITE, BLACK);
IsDoing("Browsing Menu"); mvprintw( 5, 4, "10.1 FILE GROUPS SETUP");
if (config_read() == -1) { set_color(CYAN, BLACK);
working(2, 0, 0); if (records != 0) {
return; sprintf(temp, "%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
} working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
records = CountFGroup(); fread(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
if (records == -1) { x = 2;
working(2, 0, 0); y = 7;
return; set_color(CYAN, BLACK);
} for (i = 1; i <= 20; i++) {
if (i == 11 ) {
if (OpenFGroup() == -1) { x = 42;
working(2, 0, 0); y = 7;
return; }
if ((o + i) <= records) {
offset = sizeof(fgrouphdr) + (((o + i) - 1) * fgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&fgroup, fgrouphdr.recsize, 1, fil);
if (fgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, fgroup.Name, fgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
} }
working(0, 0, 0); working(0, 0, 0);
o = 0; strcpy(pick, select_record(records, 20));
if (! check_free())
if (strncmp(pick, "-", 1) == 0) {
CloseFGroup(FALSE);
open_bbs();
return; return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 4, "10.1 FILE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/fgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(fgrouphdr) + (((o + i) - 1) * fgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&fgroup, fgrouphdr.recsize, 1, fil);
if (fgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, fgroup.Name, fgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseFGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendFGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditFGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
} }
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.tic_groups) {
working(1, 0, 0);
if (AppendFGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.13.5");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o += 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o -= 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditFGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
} }

View File

@ -44,6 +44,8 @@
#include "m_marea.h" #include "m_marea.h"
#include "m_ticarea.h" #include "m_ticarea.h"
#include "m_new.h" #include "m_new.h"
#include "m_fgroup.h"
#include "m_mgroup.h"
#include "m_global.h" #include "m_global.h"
@ -822,6 +824,8 @@ void e_flags(int Users)
void e_ticconf(void) void e_ticconf(void)
{ {
int temp;
clr_index(); clr_index();
set_color(WHITE, BLACK); set_color(WHITE, BLACK);
mvprintw( 5, 6, "1.13 EDIT FILEECHO PROCESSING"); mvprintw( 5, 6, "1.13 EDIT FILEECHO PROCESSING");
@ -870,17 +874,29 @@ void e_ticconf(void)
case 1: E_INT( 7,18, CFG.tic_days, "Number of days to ^keep^ files on hold.") case 1: E_INT( 7,18, CFG.tic_days, "Number of days to ^keep^ files on hold.")
case 2: E_STR( 8,18,20, CFG.hatchpasswd, "Enter the internal ^hatch^ password.") case 2: E_STR( 8,18,20, CFG.hatchpasswd, "Enter the internal ^hatch^ password.")
case 3: E_INT( 9,18, CFG.drspace, "Enter the minimal ^free drivespace^ in KBytes.") case 3: E_INT( 9,18, CFG.drspace, "Enter the minimal ^free drivespace^ in KBytes.")
case 4: CFG.tic_systems = edit_int(10,18, CFG.tic_systems, case 4: temp = CFG.tic_systems;
(char *)"Enter the maximum number of ^connected systems^ in the database."); temp = edit_int(10,18, temp, (char *)"Enter the maximum number of ^connected systems^ in the database.");
if ((OpenTicarea() == 0)) if (temp < CountNoderec()) {
CloseTicarea(TRUE); errmsg("You have %d nodes defined", CountNoderec());
working(0, 0, 0); show_int(10,18, CFG.tic_systems);
} else {
CFG.tic_systems = temp;
if ((OpenTicarea() == 0))
CloseTicarea(TRUE);
working(0, 0, 0);
}
break; break;
case 5: CFG.tic_groups = edit_int(11,18, CFG.tic_groups, case 5: temp = CFG.tic_groups;
(char *)"Enter the maximum number of ^fileecho groups^ in the database."); temp = edit_int(11,18, temp, (char *)"Enter the maximum number of ^fileecho groups^ in the database.");
if ((OpenNoderec() == 0)) if (temp < CountFGroup()) {
CloseNoderec(TRUE); errmsg("You have %d groups defined", CountFGroup());
working(0, 0, 0); show_int(11,18, CFG.tic_groups);
} else {
CFG.tic_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break; break;
case 6: E_INT( 12,18, CFG.tic_dupes, "Enter the maximum number of ^dupes^ in the dupe database.") case 6: E_INT( 12,18, CFG.tic_dupes, "Enter the maximum number of ^dupes^ in the dupe database.")
@ -954,6 +970,8 @@ void s_fidomailcfg(void)
void e_fidomailcfg(void) void e_fidomailcfg(void)
{ {
int temp;
s_fidomailcfg(); s_fidomailcfg();
for (;;) { for (;;) {
switch(select_menu(19)) { switch(select_menu(19)) {
@ -968,17 +986,29 @@ void e_fidomailcfg(void)
case 8: E_INT( 14,16, CFG.toss_old, "^Reject^ mail older then days, 0 means never reject.") case 8: E_INT( 14,16, CFG.toss_old, "^Reject^ mail older then days, 0 means never reject.")
case 9: E_INT( 15,16, CFG.defmsgs, "The default maximum number of ^messages^ in each mail area.") case 9: E_INT( 15,16, CFG.defmsgs, "The default maximum number of ^messages^ in each mail area.")
case 10:E_INT( 16,16, CFG.defdays, "The default maximum ^age in days^ in each mail area.") case 10:E_INT( 16,16, CFG.defdays, "The default maximum ^age in days^ in each mail area.")
case 11:CFG.toss_systems = edit_int(17,16, CFG.toss_systems, case 11:temp = CFG.toss_systems;
(char *)"The maximum number of connected ^systems^ in the database."); temp = edit_int(17,16, temp, (char *)"The maximum number of connected ^systems^ in the database.");
if ((OpenMsgarea() == 0)) if (temp < CountNoderec()) {
CloseMsgarea(TRUE); errmsg("You have %d nodes defined", CountNoderec());
working(0, 0, 0); show_int( 17,16, CFG.toss_systems);
} else {
CFG.toss_systems = temp;
if ((OpenMsgarea() == 0))
CloseMsgarea(TRUE);
working(0, 0, 0);
}
break; break;
case 12:CFG.toss_groups = edit_int(18,16, CFG.toss_groups, case 12:temp = CFG.toss_groups;
(char *)"The maximum number of ^groups^ in the database."); temp = edit_int(18,16, temp, (char *)"The maximum number of ^groups^ in the database.");
if ((OpenNoderec() == 0)) if (temp < CountMGroup()) {
CloseNoderec(TRUE); errmsg("You have %d groups defined", CountMGroup());
working(0, 0, 0); show_int( 18,16, CFG.toss_groups);
} else {
CFG.toss_groups = temp;
if ((OpenNoderec() == 0))
CloseNoderec(TRUE);
working(0, 0, 0);
}
break; break;
case 13:E_BOOL(12,58, CFG.addr4d, "Use ^4d^ addressing instead of ^5d^ addressing.") case 13:E_BOOL(12,58, CFG.addr4d, "Use ^4d^ addressing instead of ^5d^ addressing.")
case 14:E_INT( 13,58, CFG.new_split, "Gently ^split^ newfiles reports after n kilobytes (12..60).") case 14:E_INT( 13,58, CFG.new_split, "Gently ^split^ newfiles reports after n kilobytes (12..60).")
@ -1162,25 +1192,33 @@ void s_newfiles(void)
void e_newfiles(void) void e_newfiles(void)
{ {
s_newfiles(); int temp;
for (;;) {
set_color(WHITE, BLACK);
show_int( 7,16, CFG.newdays);
show_sec( 8,16, CFG.security);
show_int( 9,16, CFG.new_groups);
switch(select_menu(3)) { s_newfiles();
case 0: return; for (;;) {
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.") set_color(WHITE, BLACK);
case 2: E_SEC(8,16, CFG.security, "1.14 NEWFILES REPORTS SECURITY", s_newfiles) show_int( 7,16, CFG.newdays);
case 3: CFG.new_groups = edit_int( 9, 16, CFG.new_groups, show_sec( 8,16, CFG.security);
(char *)"The maximum of ^newfiles^ groups in the newfiles database"); show_int( 9,16, CFG.new_groups);
switch(select_menu(3)) {
case 0: return;
case 1: E_INT(7,16, CFG.newdays, "Add files younger than this in newfiles report.")
case 2: E_SEC(8,16, CFG.security, "1.16 NEWFILES REPORTS SECURITY", s_newfiles)
case 3: temp = CFG.new_groups;
temp = edit_int( 9, 16, temp, (char *)"The maximum of ^newfiles^ groups in the newfiles database");
if (temp < CountNewfiles()) {
errmsg("You have %d newfiles reports defined", CountNewfiles());
show_int( 9,16, CFG.new_groups);
} else {
CFG.new_groups = temp;
if (OpenNewfiles() == 0) if (OpenNewfiles() == 0)
CloseNewfiles(TRUE); CloseNewfiles(TRUE);
working(0, 0, 0); working(0, 0, 0);
break; }
} break;
}; }
}
} }

View File

@ -1334,135 +1334,159 @@ int EditMsgRec(int Area)
void EditMsgarea(void) void EditMsgarea(void)
{ {
int records, i, o, y; int records, rc, i, o, y, from, too;
char pick[12]; char pick[12], temp[PATH_MAX];
FILE *fil; FILE *fil;
char temp[PATH_MAX]; long offset;
long offset; sysconnect System;
int from, too;
sysconnect System;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMsgarea();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMsgarea() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index(); clr_index();
working(1, 0, 0); set_color(WHITE, BLACK);
IsDoing("Browsing Menu"); mvprintw( 5, 3, "9.2 MESSAGE AREA SETUP");
if (config_read() == -1) { set_color(CYAN, BLACK);
working(2, 0, 0); if (records != 0) {
return; sprintf(temp, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
} working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
records = CountMsgarea(); fread(&msgshdr, sizeof(msgshdr), 1, fil);
if (records == -1) { y = 7;
working(2, 0, 0); set_color(CYAN, BLACK);
return; for (i = 1; i <= 10; i++) {
} if ((o + i) <= records) {
offset = sizeof(msgshdr) + (((o + i) - 1) * (msgshdr.recsize + msgshdr.syssize));
if (OpenMsgarea() == -1) { fseek(fil, offset, 0);
working(2, 0, 0); fread(&msgs, msgshdr.recsize, 1, fil);
return; if (msgs.Active) {
set_color(CYAN, BLACK);
sprintf(temp, "%3d. %-8s %-23s %-40s", o + i, getmsgtype(msgs.Type), msgs.Tag, msgs.Name);
} else {
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d.", o+i);
}
mvprintw(y, 2, temp);
y++;
}
}
fclose(fil);
}
} }
working(0, 0, 0); working(0, 0, 0);
o = 0; strcpy(pick, select_area(records, 10));
if (! check_free())
if (strncmp(pick, "-", 1) == 0) {
CloseMsgarea(MailForced);
open_bbs();
return; return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 3, "9.2 MESSAGE AREA SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mareas.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, fil);
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 10; i++) {
if ((o + i) <= records) {
offset = sizeof(msgshdr) + (((o + i) - 1) * (msgshdr.recsize + msgshdr.syssize));
fseek(fil, offset, 0);
fread(&msgs, msgshdr.recsize, 1, fil);
if (msgs.Active) {
set_color(CYAN, BLACK);
sprintf(temp, "%3d. %-8s %-23s %-40s", o + i, getmsgtype(msgs.Type), msgs.Tag, msgs.Name);
} else {
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d.", o+i);
}
mvprintw(y, 2, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_area(records, 10));
if (strncmp(pick, "-", 1) == 0) {
CloseMsgarea(MailForced);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMsgarea() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "G", 1) == 0) {
MsgGlobal();
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 10) < records)
o = o + 10;
if (strncmp(pick, "P", 1) == 0)
if ((o - 10) >= 0)
o = o - 10;
if (strncmp(pick, "M", 1) == 0) {
from = too = 0;
mvprintw(LINES -3, 5, "From");
from = edit_int(LINES -3, 10, from, (char *)"Wich ^area^ you want to move");
mvprintw(LINES -3,15, "To");
too = edit_int(LINES -3, 18, too, (char *)"Too which ^area^ to move");
if ((LoadMsgRec(from, TRUE) == -1) || (!msgs.Active)) {
errmsg((char *)"The originating area is invalid");
fclose(tfil);
} else {
fclose(tfil);
if ((LoadMsgRec(too, TRUE) == -1) || (msgs.Active)) {
errmsg((char *)"The destination area is invalid");
fclose(tfil);
} else {
fclose(tfil);
LoadMsgRec(from, TRUE);
SaveMsgRec(too, TRUE);
LoadMsgRec(from, TRUE);
InitMsgRec();
fseek(tfil, 0, SEEK_SET);
memset(&System, 0, sizeof(sysconnect));
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fwrite(&System, sizeof(sysconnect), 1, tfil);
}
SaveMsgRec(from, TRUE);
MsgUpdated = 1;
}
}
}
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMsgRec(atoi(pick));
o = ((atoi(pick) - 1) / 10) * 10;
}
} }
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMsgarea() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "G", 1) == 0) {
MsgGlobal();
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 10) < records)
o = o + 10;
if (strncmp(pick, "P", 1) == 0)
if ((o - 10) >= 0)
o = o - 10;
if (strncmp(pick, "M", 1) == 0) {
from = too = 0;
mvprintw(LINES -3, 5, "From");
from = edit_int(LINES -3, 10, from, (char *)"Wich ^area^ you want to move");
mvprintw(LINES -3,15, "To");
too = edit_int(LINES -3, 18, too, (char *)"Too which ^area^ to move");
rc = 0;
/*
* Check originating area
*/
if (from == 0) {
errmsg((char *)"The originating area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(from, TRUE) == -1) {
errmsg((char *)"The originating area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
if (!rc && !msgs.Active) {
errmsg((char *)"The originating area is not in use");
rc = 1;
}
if (!rc && (too == 0)) {
errmsg((char *)"The destination area cannot be zero");
rc = 1;
}
if (!rc && LoadMsgRec(too, TRUE) == -1) {
errmsg((char *)"The destination area does not exist");
rc = 1;
}
if (!rc)
fclose(tfil);
if (!rc && (msgs.Active)) {
errmsg((char *)"The destination area is in use");
rc = 1;
}
if (!rc) {
LoadMsgRec(from, TRUE);
SaveMsgRec(too, TRUE);
LoadMsgRec(from, TRUE);
InitMsgRec();
fseek(tfil, 0, SEEK_SET);
memset(&System, 0, sizeof(sysconnect));
for (i = 0; i < (msgshdr.syssize / sizeof(sysconnect)); i++) {
fwrite(&System, sizeof(sysconnect), 1, tfil);
}
SaveMsgRec(from, TRUE);
MsgUpdated = 1;
Syslog('+', "Moved message area %d to %d", from, too);
}
}
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMsgRec(atoi(pick));
o = ((atoi(pick) - 1) / 10) * 10;
}
}
} }

View File

@ -435,102 +435,106 @@ int EditMGrpRec(int Area)
void EditMGroup(void) void EditMGroup(void)
{ {
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12], temp[PATH_MAX];
FILE *fil; FILE *fil;
char temp[PATH_MAX]; long offset;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountMGroup();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenMGroup() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index(); clr_index();
working(1, 0, 0); set_color(WHITE, BLACK);
IsDoing("Browsing Menu"); mvprintw( 5, 4, "9.1 MESSAGE GROUPS SETUP");
if (config_read() == -1) { set_color(CYAN, BLACK);
working(2, 0, 0); if (records != 0) {
return; sprintf(temp, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
} working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
records = CountMGroup(); fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
if (records == -1) { x = 2;
working(2, 0, 0); y = 7;
return; set_color(CYAN, BLACK);
} for (i = 1; i <= 20; i++) {
if (i == 11 ) {
if (OpenMGroup() == -1) { x = 42;
working(2, 0, 0); y = 7;
return; }
if ((o + i) <= records) {
offset = sizeof(mgrouphdr) + (((o + i) - 1) * mgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&mgroup, mgrouphdr.recsize, 1, fil);
if (mgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, mgroup.Name, mgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
} }
working(0, 0, 0); working(0, 0, 0);
o = 0; strcpy(pick, select_record(records, 20));
if (! check_free())
if (strncmp(pick, "-", 1) == 0) {
CloseMGroup(FALSE);
open_bbs();
return; return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 4, "9.1 MESSAGE GROUPS SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11 ) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(mgrouphdr) + (((o + i) - 1) * mgrouphdr.recsize);
fseek(fil, offset, 0);
fread(&mgroup, mgrouphdr.recsize, 1, fil);
if (mgroup.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-12s %-18s", o + i, mgroup.Name, mgroup.Comment);
temp[38] = '\0';
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseMGroup(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendMGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
} }
if (strncmp(pick, "A", 1) == 0) {
if (records < CFG.toss_groups) {
working(1, 0, 0);
if (AppendMGroup() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add group, change global setting in menu 1.14.12");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditMGrpRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
} }

View File

@ -436,99 +436,102 @@ int EditNewRec(int Area)
void EditNewfiles(void) void EditNewfiles(void)
{ {
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12], temp[PATH_MAX];
FILE *fil; FILE *fil;
char temp[PATH_MAX]; long offset;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNewfiles();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNewfiles() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
for (;;) {
clr_index(); clr_index();
working(1, 0, 0); set_color(WHITE, BLACK);
IsDoing("Browsing Menu"); mvprintw( 5, 4, "12. NEWFILES REPORTS");
if (config_read() == -1) { set_color(CYAN, BLACK);
working(2, 0, 0); if (records != 0) {
return; sprintf(temp, "%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
} working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
records = CountNewfiles(); fread(&newfileshdr, sizeof(newfileshdr), 1, fil);
if (records == -1) { x = 2;
working(2, 0, 0); y = 7;
return; set_color(CYAN, BLACK);
} for (i = 1; i <= 20; i++) {
if (i == 11) {
if (OpenNewfiles() == -1) { x = 42;
working(2, 0, 0); y = 7;
return; }
if ((o + i) <= records) {
offset = sizeof(newfileshdr) + (((o + i) - 1) * (newfileshdr.recsize + newfileshdr.grpsize));
fseek(fil, offset, 0);
fread(&newfiles, newfileshdr.recsize, 1, fil);
if (newfiles.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-32s", o + i, newfiles.Comment);
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
} }
working(0, 0, 0); working(0, 0, 0);
o = 0; strcpy(pick, select_record(records, 20));
for (;;) { if (strncmp(pick, "-", 1) == 0) {
clr_index(); CloseNewfiles(FALSE);
set_color(WHITE, BLACK); return;
mvprintw( 5, 4, "12. NEWFILES REPORTS");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/newfiles.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&newfileshdr, sizeof(newfileshdr), 1, fil);
x = 2;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(newfileshdr) + (((o + i) - 1) * (newfileshdr.recsize + newfileshdr.grpsize));
fseek(fil, offset, 0);
fread(&newfiles, newfileshdr.recsize, 1, fil);
if (newfiles.Active)
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %-32s", o + i, newfiles.Comment);
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseNewfiles(FALSE);
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendNewfiles() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNewRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
} }
if (strncmp(pick, "A", 1) == 0) {
if (records > CFG.new_groups) {
working(1, 0, 0);
if (AppendNewfiles() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
errmsg("Cannot add, change global setting in menu 1.16.3");
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNewRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Nodes Setup Program * Purpose ...............: Nodes Setup Program
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2003
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -55,7 +55,6 @@ int NodeUpdated = 0;
* Count nr of nodes records in the database. * Count nr of nodes records in the database.
* Creates the database if it doesn't exist. * Creates the database if it doesn't exist.
*/ */
int CountNoderec(void);
int CountNoderec(void) int CountNoderec(void)
{ {
FILE *fil; FILE *fil;
@ -1180,102 +1179,109 @@ int EditNodeRec(int Area)
void EditNodes(void) void EditNodes(void)
{ {
int records, i, o, x, y; int records, i, o, x, y;
char pick[12]; char pick[12], temp[PATH_MAX];
FILE *fil; FILE *fil;
char temp[PATH_MAX]; long offset;
long offset;
clr_index();
working(1, 0, 0);
IsDoing("Browsing Menu");
if (config_read() == -1) {
working(2, 0, 0);
return;
}
records = CountNoderec();
if (records == -1) {
working(2, 0, 0);
return;
}
if (OpenNoderec() == -1) {
working(2, 0, 0);
return;
}
working(0, 0, 0);
o = 0;
if (! check_free())
return;
for (;;) {
clr_index(); clr_index();
working(1, 0, 0); set_color(WHITE, BLACK);
IsDoing("Browsing Menu"); mvprintw( 5, 6, "7. NODES SETUP");
if (config_read() == -1) { set_color(CYAN, BLACK);
working(2, 0, 0); if (records != 0) {
return; sprintf(temp, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
} working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
records = CountNoderec(); fread(&nodeshdr, sizeof(nodeshdr), 1, fil);
if (records == -1) { x = 4;
working(2, 0, 0); y = 7;
return; set_color(CYAN, BLACK);
} for (i = 1; i <= 20; i++) {
if (i == 11) {
if (OpenNoderec() == -1) { x = 42;
working(2, 0, 0); y = 7;
return; }
if ((o + i) <= records) {
offset = sizeof(nodeshdr) + (((o + i) - 1) * (nodeshdr.recsize + nodeshdr.filegrp + nodeshdr.mailgrp));
fseek(fil, offset, 0);
fread(&nodes, nodeshdr.recsize, 1, fil);
if (strlen(nodes.Sysop))
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %s (%s)", o + i, nodes.Sysop, strtok(aka2str(nodes.Aka[0]), "@"));
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
} }
working(0, 0, 0); working(0, 0, 0);
o = 0; strcpy(pick, select_record(records, 20));
if (! check_free())
if (strncmp(pick, "-", 1) == 0) {
CloseNoderec(FALSE);
open_bbs();
return; return;
for (;;) {
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 6, "7. NODES SETUP");
set_color(CYAN, BLACK);
if (records != 0) {
sprintf(temp, "%s/etc/nodes.temp", getenv("MBSE_ROOT"));
working(1, 0, 0);
if ((fil = fopen(temp, "r")) != NULL) {
fread(&nodeshdr, sizeof(nodeshdr), 1, fil);
x = 4;
y = 7;
set_color(CYAN, BLACK);
for (i = 1; i <= 20; i++) {
if (i == 11) {
x = 42;
y = 7;
}
if ((o + i) <= records) {
offset = sizeof(nodeshdr) + (((o + i) - 1) * (nodeshdr.recsize + nodeshdr.filegrp + nodeshdr.mailgrp));
fseek(fil, offset, 0);
fread(&nodes, nodeshdr.recsize, 1, fil);
if (strlen(nodes.Sysop))
set_color(CYAN, BLACK);
else
set_color(LIGHTBLUE, BLACK);
sprintf(temp, "%3d. %s (%s)", o + i, nodes.Sysop, strtok(aka2str(nodes.Aka[0]), "@"));
temp[37] = 0;
mvprintw(y, x, temp);
y++;
}
}
fclose(fil);
}
}
working(0, 0, 0);
strcpy(pick, select_record(records, 20));
if (strncmp(pick, "-", 1) == 0) {
CloseNoderec(FALSE);
open_bbs();
return;
}
if (strncmp(pick, "A", 1) == 0) {
working(1, 0, 0);
if (AppendNoderec() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNodeRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
} }
if (strncmp(pick, "A", 1) == 0) {
if ((records < CFG.toss_systems) && (records < CFG.tic_systems)) {
working(1, 0, 0);
if (AppendNoderec() == 0) {
records++;
working(1, 0, 0);
} else
working(2, 0, 0);
working(0, 0, 0);
} else {
if ((records + 1) > CFG.toss_systems) {
errmsg("Cannot add node, change global setting in menu 1.14.11");
} else {
errmsg("Cannot add node, change global setting in menu 1.13.4");
}
}
}
if (strncmp(pick, "N", 1) == 0)
if ((o + 20) < records)
o = o + 20;
if (strncmp(pick, "P", 1) == 0)
if ((o - 20) >= 0)
o = o - 20;
if ((atoi(pick) >= 1) && (atoi(pick) <= records)) {
EditNodeRec(atoi(pick));
o = ((atoi(pick) - 1) / 20) * 20;
}
}
} }

View File

@ -1,13 +1,15 @@
#ifndef _NODE_H #ifndef _NODE_H
#define _NODE_H #define _NODE_H
int OpenNoderec(void); /* $Id$ */
void CloseNoderec(int);
int GroupInNode(char *, int); int CountNoderec(void);
void EditNodes(void); int OpenNoderec(void);
void InitNodes(void); void CloseNoderec(int);
int node_doc(FILE *, FILE *, int); int GroupInNode(char *, int);
fidoaddr PullUplink(char *); void EditNodes(void);
void InitNodes(void);
int node_doc(FILE *, FILE *, int);
fidoaddr PullUplink(char *);
#endif #endif