diff --git a/ChangeLog b/ChangeLog index f79d83b3..02677cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ $Id$ v0.83.14 23-Feb-2006 + mbsetup: + Added archiver selection for nodes in node setup. + + v0.83.13 13-Feb-2006 - 23-Feb-2006 upgrade: diff --git a/lib/mbselib.h b/lib/mbselib.h index 748be248..7024ae91 100644 --- a/lib/mbselib.h +++ b/lib/mbselib.h @@ -1738,6 +1738,7 @@ struct _nodes { char Ct_remark[65]; /* Remark */ securityrec Security; /* Security flags */ + char Archiver[6]; /* Archiver to use */ }; diff --git a/mbsetup/Makefile b/mbsetup/Makefile index 370fc4de..a662034b 100644 --- a/mbsetup/Makefile +++ b/mbsetup/Makefile @@ -95,7 +95,7 @@ m_fdb.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h screen.h mu m_global.o: ../config.h ../paths.h ../lib/mbselib.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_limits.h m_global.h m_magic.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h stlist.h m_ticarea.h m_global.h m_magic.h m_mgroup.o: ../config.h ../lib/mbselib.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/mbselib.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/mbselib.h screen.h mutil.h ledit.h grlist.h stlist.h m_global.h m_lang.h m_ticarea.h m_marea.h m_archive.h m_node.h m_task.o: ../config.h ../lib/mbselib.h screen.h mutil.h ledit.h m_task.h m_users.o: ../config.h ../lib/mbselib.h ../lib/users.h screen.h mutil.h ledit.h m_lang.h m_global.h m_archive.h m_protocol.h m_users.h screen.o: ../config.h ../lib/mbselib.h screen.h diff --git a/mbsetup/m_archive.c b/mbsetup/m_archive.c index d6389f0b..33e7c16f 100644 --- a/mbsetup/m_archive.c +++ b/mbsetup/m_archive.c @@ -710,71 +710,79 @@ void InitArchive(void) -char *PickArchive(char *shdr) +char *PickArchive(char *shdr, int mailmode) { - static char Arch[6] = ""; - int records, i, x, y; - char pick[12]; - FILE *fil; - char temp[PATH_MAX]; - int offset; + static char Arch[6] = ""; + int records, i, y, o = 0; + char pick[12]; + FILE *fil; + char temp[PATH_MAX]; + int offset; - clr_index(); - working(1, 0, 0); - if (config_read() == -1) { - working(2, 0, 0); - return Arch; - } - - records = CountArchive(); - if (records == -1) { - working(2, 0, 0); - return Arch; - } - - - clr_index(); - set_color(WHITE, BLACK); - snprintf(temp, 81, "%s. ARCHIVER SELECT", shdr); - mbse_mvprintw( 5, 4, temp); - set_color(CYAN, BLACK); - if (records != 0) { - snprintf(temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT")); - if ((fil = fopen(temp, "r")) != NULL) { - fread(&archiverhdr, sizeof(archiverhdr), 1, fil); - x = 2; - y = 7; - set_color(CYAN, BLACK); - for (i = 1; i <= records; i++) { - offset = sizeof(archiverhdr) + ((i - 1) * archiverhdr.recsize); - fseek(fil, offset, 0); - fread(&archiver, archiverhdr.recsize, 1, fil); - if (i == 11) { - x = 41; - y = 7; - } - if (archiver.available) - set_color(CYAN, BLACK); - else - set_color(LIGHTBLUE, BLACK); - snprintf(temp, 81, "%3d. %-32s", i, archiver.comment); - temp[37] = 0; - mbse_mvprintw(y, x, temp); - y++; - } - strcpy(pick, select_pick(records, 20)); - - if ((atoi(pick) >= 1) && (atoi(pick) <= records)) { - offset = sizeof(archiverhdr) + ((atoi(pick) - 1) * archiverhdr.recsize); - fseek(fil, offset, 0); - fread(&archiver, archiverhdr.recsize, 1, fil); - strcpy(Arch, archiver.name); - } - fclose(fil); - } - } + clr_index(); + working(1, 0, 0); + if (config_read() == -1) { + working(2, 0, 0); return Arch; + } + + records = CountArchive(); + if (records == -1) { + working(2, 0, 0); + return Arch; + } + + if (records != 0) { + snprintf(temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT")); + if ((fil = fopen(temp, "r")) != NULL) { + fread(&archiverhdr, sizeof(archiverhdr), 1, fil); + + for (;;) { + clr_index(); + set_color(WHITE, BLACK); + snprintf(temp, 81, "%s. ARCHIVER SELECT", shdr); + mbse_mvprintw( 5, 4, temp); + set_color(CYAN, BLACK); + y = 7; + for (i = 1; i <= 10; i++) { + if ((o + i) <= records) { + offset = sizeof(archiverhdr) + (((o + i) - 1) * archiverhdr.recsize); + fseek(fil, offset, 0); + fread(&archiver, archiverhdr.recsize, 1, fil); + if (mailmode && archiver.available && strlen(archiver.marc)) + set_color(CYAN, BLACK); + else if (! mailmode && archiver.available && strlen(archiver.farc)) + set_color(CYAN, BLACK); + else + set_color(LIGHTBLUE, BLACK); + snprintf(temp, 81, "%3d. %-5s %-32s", o+i, archiver.name, archiver.comment); + mbse_mvprintw(y, 2, temp); + y++; + } + } + strcpy(pick, select_pick(records, 10)); + + 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 ((atoi(pick) >= 1) && (atoi(pick) <= records)) { + offset = sizeof(archiverhdr) + ((atoi(pick) - 1) * archiverhdr.recsize); + fseek(fil, offset, 0); + fread(&archiver, archiverhdr.recsize, 1, fil); + strcpy(Arch, archiver.name); + break; + } + } + fclose(fil); + } + } + return Arch; } diff --git a/mbsetup/m_archive.h b/mbsetup/m_archive.h index 272c8673..1e983565 100644 --- a/mbsetup/m_archive.h +++ b/mbsetup/m_archive.h @@ -6,7 +6,7 @@ int CountArchive(void); void EditArchive(void); -char *PickArchive(char *); +char *PickArchive(char *, int); void InitArchive(void); int archive_doc(FILE *, FILE *, int); diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 5c865f12..cb6fce4b 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -480,7 +480,7 @@ int EditFileRec(int Area) case 19:E_INT( 12,73, area.DLdays, "The not ^downloaded days^ to move/kill files") case 20:E_INT( 13,73, area.FDdays, "The ^file age^ in days to move/kill files") case 21:E_INT( 14,73, area.MoveArea, "The ^area to move^ files to, 0 is kill") - case 22:strcpy(area.Archiver, PickArchive((char *)"8.4")); + case 22:strcpy(area.Archiver, PickArchive((char *)"8.4", FALSE)); FileScreen(); break; case 23:E_INT( 16,73, area.Upload, "The ^upload^ area, 0 if upload in this area") diff --git a/mbsetup/m_fgroup.c b/mbsetup/m_fgroup.c index 15217a54..abb08543 100644 --- a/mbsetup/m_fgroup.c +++ b/mbsetup/m_fgroup.c @@ -4,7 +4,7 @@ * Purpose ...............: Setup FGroups. * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -425,7 +425,7 @@ int EditFGrpRec(int Area) case 6: E_STR( 11,16,12,fgroup.AreaFile, "The name of the ^Areas File^ from the uplink (case sensitive)") case 7: E_BOOL(12,16, fgroup.FileGate, "Is the areas file in ^filegate.zxx^ format") case 8: E_STR( 13,16,14,fgroup.Banner, "The ^banner^ to add to the archives") - case 9: strcpy(fgroup.Convert, PickArchive((char *)"10.1.9")); + case 9: strcpy(fgroup.Convert, PickArchive((char *)"10.1.9", FALSE)); FgScreen(); break; case 10:strncpy(fgroup.BbsGroup, PickFGroup((char *)"8.4.17"), 12); diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index 9a63c07b..36e2fbc0 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -39,6 +39,7 @@ #include "m_lang.h" #include "m_ticarea.h" #include "m_marea.h" +#include "m_archive.h" #include "m_node.h" @@ -154,6 +155,9 @@ int OpenNoderec(void) nodes.Security.level = 1; nodes.Security.flags = 1; } + if (strlen(nodes.Archiver) == 0) { + snprintf(nodes.Archiver, 6, (char *)"ZIP"); + } } fwrite(&nodes, sizeof(nodes), 1, fout); memset(&nodes, 0, sizeof(nodes)); @@ -435,31 +439,44 @@ void E_UplMgr(void) void E_Mail(void); void E_Mail(void) { - clr_index(); - set_color(WHITE, BLACK); - mbse_mvprintw( 5, 6, "7.4 EDIT NODE - MAIL PROCESSING"); - set_color(CYAN, BLACK); - mbse_mvprintw( 7, 6, "1. PKT password"); - mbse_mvprintw( 8, 6, "2. Check PKT pwd"); - mbse_mvprintw( 9, 6, "3. Mail forward"); - mbse_mvprintw(10, 6, "4. ARCmail comp."); - mbse_mvprintw(11, 6, "5. ARCmail a..z"); + char temp[6]; + int show = TRUE; for (;;) { + if (show) { + clr_index(); + set_color(WHITE, BLACK); + mbse_mvprintw( 5, 6, "7.4 EDIT NODE - MAIL PROCESSING"); + set_color(CYAN, BLACK); + mbse_mvprintw( 7, 6, "1. PKT password"); + mbse_mvprintw( 8, 6, "2. Check PKT pwd"); + mbse_mvprintw( 9, 6, "3. Mail forward"); + mbse_mvprintw(10, 6, "4. ARCmail comp."); + mbse_mvprintw(11, 6, "5. ARCmail a..z"); + mbse_mvprintw(12, 6, "6. Archiver"); + show = FALSE; + } + set_color(WHITE, BLACK); show_str( 7,25,15, (char *)"***************"); show_bool( 8,25, nodes.MailPwdCheck); show_bool( 9,25, nodes.MailFwd); show_bool(10,25, nodes.ARCmailCompat); show_bool(11,25, nodes.ARCmailAlpha); + show_str( 12,25, 5, nodes.Archiver); - switch(select_menu(5)) { + switch(select_menu(6)) { case 0: return; case 1: E_STR( 7,25,15, nodes.Epasswd, "The ^Mail (.pkt)^ password^ for this node") case 2: E_BOOL( 8,25, nodes.MailPwdCheck, "Check the ^mail PKT^ password") case 3: E_BOOL( 9,25, nodes.MailFwd, "^Forward^ echomail for this node") case 4: E_BOOL(10,25, nodes.ARCmailCompat, "Use ^ARCmail 0.60^ file naming convention for out of zone mail") case 5: E_BOOL(11,25, nodes.ARCmailAlpha, "Allow ^0..9 and a..z^ filename extensions for ARCmail archives") + case 6: strcpy(temp, PickArchive((char *)"7.4", TRUE)); + if (strlen(temp) != 0) + strcpy(nodes.Archiver, temp); + show = TRUE; + break; } } } diff --git a/mbsetup/m_ticarea.c b/mbsetup/m_ticarea.c index 14e58a99..fde6dfbd 100644 --- a/mbsetup/m_ticarea.c +++ b/mbsetup/m_ticarea.c @@ -4,7 +4,7 @@ * Purpose ...............: TIC Areas Setup Program * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -959,7 +959,7 @@ int EditTicRec(int Area) tic.Aka = CFG.aka[tmp]; SetTicScreen(); break; - case 9: strcpy(tic.Convert, PickArchive((char *)"10.2.9")); + case 9: strcpy(tic.Convert, PickArchive((char *)"10.2.9", FALSE)); SetTicScreen(); break; case 10:E_STR(15,16,14, tic.Banner, "The ^banner^ to put in the file archives"); diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c index c0da0b3f..8db7bef1 100644 --- a/mbsetup/m_users.c +++ b/mbsetup/m_users.c @@ -4,7 +4,7 @@ * Purpose ...............: Edit Users * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2006 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -403,7 +403,7 @@ int EditUsrRec2(void) clr_index(); Screen2(); break; - case 12:strcpy(temp, PickArchive((char *)"15")); + case 12:strcpy(temp, PickArchive((char *)"15", TRUE)); if (strlen(temp) != 0) strcpy(usrconfig.Archiver, temp); clr_index();