diff --git a/ChangeLog b/ChangeLog index c7f98b48..d0d53998 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4665,6 +4665,13 @@ v0.33.20 10-Feb-2002 Fixed a non understandable logmessage in check if nodes are connected to file and or mail groups. It is now possible to reset a users time left for today. + The top statusbar now displays the bbs Free/Down/Busy status. + Some dangerous menus cannot be entered anymore while some + programs are being used, ie. the bbs must be free. When these + menus are entered, the bbs will be closed for use. + + mbmon: + The top statusbar now displays the bbs Free/Down/Busy status. mbfido: In AreaMgr and FileMgr changed aka matching for area @@ -4838,6 +4845,10 @@ v0.33.20 10-Feb-2002 would kill that user because the last login date wasn't set. It will use the registration date instead. + mbstat: + The timeout for the wait command was wrong due to a wrong + upsdown semafore test. + hatch: A new shellscript to hatch files in a tic area. diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index ac3b32ea..31765d17 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -34,6 +34,9 @@ #include "mutil.h" +extern int bbs_free; + + static void die(int onsig) { signal(onsig, SIG_IGN); @@ -420,7 +423,9 @@ int main(int argc, char *argv[]) pw = getpwuid(getuid()); InitClient(pw->pw_name); Syslog(' ', "Started by %s", pw->pw_name); + bbs_free = FALSE; + /* * Setup several signals so when the program terminate's it * will properly close. diff --git a/mbmon/mutil.c b/mbmon/mutil.c index a8d6f12d..754c035a 100644 --- a/mbmon/mutil.c +++ b/mbmon/mutil.c @@ -33,6 +33,7 @@ #include "mutil.h" extern int ttyfd; +int bbs_free; unsigned char readkey(int y, int x, int fg, int bg) @@ -370,7 +371,7 @@ static time_t lasttime; void show_date(int fg, int bg, int y, int x) { time_t now; - char *p; + char *p, buf[128]; now = time(NULL); if (now != lasttime) { @@ -382,6 +383,27 @@ void show_date(int fg, int bg, int y, int x) p = asctime(gmtime(&now)); Striplf(p); mvprintw(2, 44, (char *)"%s UTC", p); + + /* + * Indicator if bbs is free + */ + strcpy(buf, SockR("SFRE:0;")); + if (strncmp(buf, "100:0;", 6) == 0) { + strcpy(buf, SockR("SBBS:0;")); + if (strncmp(buf, "100:2,1", 7) == 0) { + set_color(WHITE, RED); + mvprintw(2,74, (char *)" Down "); + } else { + set_color(WHITE, BLUE); + mvprintw(2,74, (char *)" Free "); + } + bbs_free = TRUE; + } else { + set_color(WHITE, RED); + mvprintw(2,74, (char *)" Busy "); + bbs_free = FALSE; + } + if (y && x) locate(y, x); set_color(fg, bg); diff --git a/mbsetup/Makefile b/mbsetup/Makefile index 885069ac..189afbca 100644 --- a/mbsetup/Makefile +++ b/mbsetup/Makefile @@ -96,7 +96,7 @@ m_mgroup.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../li m_node.o: ../lib/libs.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_task.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_task.h m_users.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h screen.h mutil.h ledit.h m_lang.h m_global.h m_archive.h m_protocol.h m_users.h -screen.o: ../lib/libs.h ../lib/structs.h ../lib/ansi.h ../lib/common.h screen.h +screen.o: ../lib/libs.h ../lib/structs.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h screen.h m_bbs.o: ../lib/libs.h ../lib/structs.h ../lib/common.h screen.h mutil.h ledit.h m_lang.h m_protocol.h m_ol.h m_fgroup.h m_farea.h m_menu.h m_bbs.h m_limits.h m_ff.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h screen.h mutil.h ledit.h stlist.h m_global.h m_ff.h m_lang.h m_marea.h m_hatch.o: ../lib/libs.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_fgroup.h m_ticarea.h m_hatch.h diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index 02c1dc9d..d5caa4a0 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -42,6 +42,7 @@ int sock; /* Connected socket */ +extern int bbs_free; int yes_no(char *T_) @@ -94,6 +95,47 @@ void errmsg(const char *format, ...) +/* + * Check if bbs is free, if so close it. + */ +int check_free(void) +{ + char buf[81]; + + if (bbs_free) { + strcpy(buf, SockR("SCLO:0;")); + if (strncmp(buf, "100:0;", 6) == 0) { + Syslog('+', "The BBS is closed"); + return TRUE; + } else { + errmsg("Cannon continue, failed to close the bbs"); + return FALSE; + } + } + + errmsg("You cannot edit right now, the system is busy"); + return FALSE; +} + + + +/* + * Reopen the bbs. + */ +void open_bbs(void) +{ + char buf[81]; + + strcpy(buf, SockR("SOPE:0;")); + if (strncmp(buf, "100:0;", 6) == 0) { + Syslog('+', "The BBS is open"); + } else { + errmsg("Failed to reopen the bbs"); + } +} + + + /* * Safe field display, does not format % characters but displays it. */ diff --git a/mbsetup/ledit.h b/mbsetup/ledit.h index 6fd916ef..760c2f13 100644 --- a/mbsetup/ledit.h +++ b/mbsetup/ledit.h @@ -5,6 +5,8 @@ int yes_no(char *); void errmsg(const char *, ...); +int check_free(void); +void open_bbs(void); void show_field(int, int, char *, int, int); void newinsert(int, int, int); char *edit_field(int, int, int, int, char *); diff --git a/mbsetup/m_domain.c b/mbsetup/m_domain.c index d57c7d78..e53b9711 100644 --- a/mbsetup/m_domain.c +++ b/mbsetup/m_domain.c @@ -309,6 +309,9 @@ void EditDomain(void) long offset; struct domrec tdomtrans; + if (! check_free()) + return; + clr_index(); working(1, 0, 0); IsDoing("Browsing Menu"); @@ -366,6 +369,7 @@ void EditDomain(void) strcpy(pick, select_menurec(records)); if (strncmp(pick, "-", 1) == 0) { + open_bbs(); CloseDomain(FALSE); return; } diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 1f896340..b5e1153a 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -487,6 +487,8 @@ void EditFilearea(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -527,6 +529,7 @@ void EditFilearea(void) strcpy(pick, select_filearea(records, 20)); if (strncmp(pick, "-", 1) == 0) { + open_bbs(); CloseFilearea(FileForced); return; } diff --git a/mbsetup/m_fdb.c b/mbsetup/m_fdb.c index 6bd9d31f..0c0ef4eb 100644 --- a/mbsetup/m_fdb.c +++ b/mbsetup/m_fdb.c @@ -136,6 +136,8 @@ void E_F(long areanr) working(2, 0, 0); return; } + if (! check_free()) + return; fseek(fil, 0, SEEK_END); records = ftell(fil) / sizeof(file); @@ -216,6 +218,7 @@ void E_F(long areanr) if (strncmp(menu, "-", 1) == 0) { fclose(fil); + open_bbs(); return; } diff --git a/mbsetup/m_fgroup.c b/mbsetup/m_fgroup.c index d7c88bf7..34f875c3 100644 --- a/mbsetup/m_fgroup.c +++ b/mbsetup/m_fgroup.c @@ -503,6 +503,8 @@ void EditFGroup(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -544,6 +546,7 @@ void EditFGroup(void) if (strncmp(pick, "-", 1) == 0) { CloseFGroup(FALSE); + open_bbs(); return; } diff --git a/mbsetup/m_fido.c b/mbsetup/m_fido.c index 7501a5e1..164d12cf 100644 --- a/mbsetup/m_fido.c +++ b/mbsetup/m_fido.c @@ -408,6 +408,8 @@ void EditFidonet(void) IsDoing("Browsing Menu"); working(0, 0, 0); + if (! check_free()) + return; for (;;) { clr_index(); @@ -445,6 +447,7 @@ void EditFidonet(void) if (strncmp(pick, "-", 1) == 0) { CloseFidonet(FALSE); + open_bbs(); return; } diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 7164fbed..8773ff17 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -1493,6 +1493,9 @@ void global_menu(void) { unsigned long crc, crc1; + if (! check_free()) + return; + if (cf_open() == -1) return; @@ -1561,6 +1564,7 @@ void global_menu(void) Syslog('+', "Saved main config"); } } + open_bbs(); return; case 1: e_fidoakas(); diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 4a3a3123..c3e42cc6 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -433,8 +433,6 @@ int EditConnections(FILE *fil) if (System.aka.zone) { set_color(CYAN,BLACK); sprintf(temp, "%3d. %s %s", o+i, status, aka2str(System.aka)); -// System.aka.zone, System.aka.net, System.aka.node, -// System.aka.point, System.aka.domain); } else { set_color(LIGHTBLUE, BLACK); sprintf(temp, "%3d.", o+i); @@ -1251,6 +1249,8 @@ void EditMsgarea(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -1288,6 +1288,7 @@ void EditMsgarea(void) if (strncmp(pick, "-", 1) == 0) { CloseMsgarea(MailForced); + open_bbs(); return; } diff --git a/mbsetup/m_mgroup.c b/mbsetup/m_mgroup.c index 80eaf37c..f1dc2150 100644 --- a/mbsetup/m_mgroup.c +++ b/mbsetup/m_mgroup.c @@ -440,6 +440,8 @@ void EditMGroup(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -481,6 +483,7 @@ void EditMGroup(void) if (strncmp(pick, "-", 1) == 0) { CloseMGroup(FALSE); + open_bbs(); return; } diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index 0913ebeb..5d65561c 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -921,6 +921,8 @@ void EditNodes(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -962,6 +964,7 @@ void EditNodes(void) if (strncmp(pick, "-", 1) == 0) { CloseNoderec(FALSE); + open_bbs(); return; } diff --git a/mbsetup/m_ticarea.c b/mbsetup/m_ticarea.c index 7cbfad64..7d4b67ae 100644 --- a/mbsetup/m_ticarea.c +++ b/mbsetup/m_ticarea.c @@ -977,6 +977,8 @@ void EditTicarea(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -1015,6 +1017,7 @@ Comment); if (strncmp(pick, "-", 1) == 0) { CloseTicarea(FALSE); + open_bbs(); return; } diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c index 238c280b..fa374252 100644 --- a/mbsetup/m_users.c +++ b/mbsetup/m_users.c @@ -566,6 +566,8 @@ void EditUsers(void) } working(0, 0, 0); o = 0; + if (! check_free()) + return; for (;;) { clr_index(); @@ -607,6 +609,7 @@ void EditUsers(void) if (strncmp(pick, "-", 1) == 0) { CloseUsers(FALSE); + open_bbs(); return; } diff --git a/mbsetup/mbsetup.c b/mbsetup/mbsetup.c index c2a2e839..14806a1e 100644 --- a/mbsetup/mbsetup.c +++ b/mbsetup/mbsetup.c @@ -70,10 +70,12 @@ mode_t oldmask; /* Old umask value */ extern int do_quiet; /* Suppress log to screen */ +extern int bbs_free; /* Free/Busy status */ int exp_golded = FALSE; /* Export GoldED config */ int init = FALSE; /* Run init only */ + static void die(int onsig) { FILE *fp; @@ -423,6 +425,7 @@ int main(int argc, char *argv[]) Syslog(' ', "MBSETUP v%s started by %s", VERSION, pw->pw_name); if (init) Syslog('+', "Cmd: mbsetup init"); + bbs_free = FALSE; initdatabases(); if (!init) { diff --git a/mbsetup/screen.c b/mbsetup/screen.c index 627f5586..8a2802aa 100644 --- a/mbsetup/screen.c +++ b/mbsetup/screen.c @@ -32,10 +32,13 @@ #include "../lib/structs.h" #include "../lib/ansi.h" #include "../lib/common.h" +#include "../lib/clcomm.h" #include "screen.h" extern int init; +int bbs_free; + /************************************************************************* @@ -95,7 +98,7 @@ static time_t lasttime; void show_date(int fg, int bg, int y, int x) { time_t now; - char *p; + char *p, buf[128]; now = time(NULL); if (now != lasttime) { @@ -107,6 +110,27 @@ void show_date(int fg, int bg, int y, int x) p = asctime(gmtime(&now)); Striplf(p); mvprintw(2, 44, (char *)"%s UTC", p); + + /* + * Indicator if bbs is free + */ + strcpy(buf, SockR("SFRE:0;")); + if (strncmp(buf, "100:0;", 6) == 0) { + strcpy(buf, SockR("SBBS:0;")); + if (strncmp(buf, "100:2,1", 7) == 0) { + set_color(WHITE, RED); + mvprintw(2,74, (char *)" Down "); + } else { + set_color(WHITE, BLUE); + mvprintw(2,74, (char *)" Free "); + } + bbs_free = TRUE; + } else { + set_color(WHITE, RED); + mvprintw(2,74, (char *)" Busy "); + bbs_free = FALSE; + } + if (y && x) locate(y, x); set_color(fg, bg); diff --git a/mbtask/taskregs.c b/mbtask/taskregs.c index 77c539ee..e81a73f4 100644 --- a/mbtask/taskregs.c +++ b/mbtask/taskregs.c @@ -449,6 +449,7 @@ char *reg_fre(void) for (i = 1; i < MAXCLIENT; i++) { if (reginfo[i].pid) { if ((!strncmp(reginfo[i].prg, "mbsebbs", 7)) || + (!strncmp(reginfo[i].prg, "mbnewusr", 8)) || (!strncmp(reginfo[i].prg, "mbftpd", 6))) users++;