Added setup for character sets

This commit is contained in:
Michiel Broek
2004-02-23 14:46:06 +00:00
parent f7070bee91
commit 022bd58797
11 changed files with 421 additions and 326 deletions

View File

@@ -111,94 +111,99 @@ void sort_grlist(gr_list **fdp)
int compgroup(gr_list **fdp1, gr_list **fdp2)
{
return strcmp((*fdp1)->group, (*fdp2)->group);
return strcmp((*fdp1)->group, (*fdp2)->group);
}
int E_Group(gr_list **fdp, char *title)
{
int o = 0, n = 0, i, j, x, y, rc = FALSE;
gr_list *tmp;
int o = 0, n = 0, i, j, x, y, rc = FALSE, All = FALSE;
gr_list *tmp;
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 6, (char *)"%s", title);
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 6, (char *)"%s", title);
set_color(CYAN, BLACK);
for (tmp = *fdp; tmp; tmp = tmp->next)
n++;
for (;;) {
set_color(CYAN, BLACK);
y = 7;
x = 5;
j = 0;
for (tmp = *fdp; tmp; tmp = tmp->next)
n++;
for (;;) {
set_color(CYAN, BLACK);
y = 7;
x = 5;
j = 0;
for (tmp = *fdp; tmp; tmp = tmp->next) {
j++;
if ((j >= (o + 1)) && (j < (o + 41))) {
if (tmp->tagged)
mvprintw(y, x, (char *)"%2d. + %s", j, tmp->group);
else
mvprintw(y, x, (char *)"%2d. %s", j, tmp->group);
y++;
if (y == 17) {
y = 7;
x += 20;
}
}
}
i = select_tag(n);
switch (i) {
case 0: clr_index();
return rc;
break;
case -2: if ((o - 40) >= 0) {
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
o -= 40;
}
break;
case -1: if ((o + 40) < n) {
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
o += 40;
}
break;
default: if ((i >= 1) && (i <= n)) {
j = 0;
rc = TRUE;
for (tmp = *fdp; tmp; tmp = tmp->next) {
j++;
if (j == i) {
if (tmp->tagged)
tmp->tagged = FALSE;
else
tmp->tagged = TRUE;
}
}
if (o != ((i -1) / 40) * 40) {
/*
* If a group is selected outside the visible
* range, change the groupview.
*/
o = ((i -1) / 40) * 40;
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
}
}
break;
for (tmp = *fdp; tmp; tmp = tmp->next) {
j++;
if ((j >= (o + 1)) && (j < (o + 41))) {
if (tmp->tagged)
mvprintw(y, x, (char *)"%2d. + %s", j, tmp->group);
else
mvprintw(y, x, (char *)"%2d. %s", j, tmp->group);
y++;
if (y == 17) {
y = 7;
x += 20;
}
}
}
i = select_tag(n);
switch (i) {
case 0: clr_index();
return rc;
break;
case -2:if ((o - 40) >= 0) {
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
o -= 40;
}
break;
case -1:if ((o + 40) < n) {
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
o += 40;
}
break;
case -3:All = !All;
for (tmp = *fdp; tmp; tmp = tmp->next)
tmp->tagged = All;
rc = TRUE;
break;
default:if ((i >= 1) && (i <= n)) {
j = 0;
rc = TRUE;
for (tmp = *fdp; tmp; tmp = tmp->next) {
j++;
if (j == i) {
if (tmp->tagged)
tmp->tagged = FALSE;
else
tmp->tagged = TRUE;
}
}
if (o != ((i -1) / 40) * 40) {
/*
* If a group is selected outside the visible
* range, change the groupview.
*/
o = ((i -1) / 40) * 40;
clr_index();
set_color(WHITE, BLACK);
mvprintw(5, 5, (char *)"%s", title);
set_color(CYAN, BLACK);
}
}
break;
}
}
}

View File

@@ -627,21 +627,22 @@ char *select_aka(int max, int items)
/*
* Select menu, max is the highest item to pick. Returns zero if
* "-" (previous level) is selected, -2 and -1 for the N and P keys.
* If allowall, the -3 is for the * key.
*/
int select_menu_sub(int, int, char *);
int select_menu_sub(int, int, int, char *);
int select_menu(int max)
{
return select_menu_sub(max, 50, (char *)"Select menu item");
return select_menu_sub(max, 50, FALSE, (char *)"Select menu item");
}
int select_tag(int max)
{
return select_menu_sub(max, 40, (char *)"Toggle item");
return select_menu_sub(max, 40, TRUE, (char *)"Toggle item");
}
int select_menu_sub(int max, int items, char *hlp)
int select_menu_sub(int max, int items, int allowall, char *hlp)
{
static char *menu=(char *)"-";
char help[81];
@@ -649,11 +650,19 @@ int select_menu_sub(int max, int items, char *hlp)
if (max == 0)
sprintf(help, "Select ^\"-\"^ for previous level");
else
if (max > items)
sprintf(help, "%s (1..%d), ^\"-\"^ prev. level, ^\"P\" or \"N\"^ to page", hlp, max);
else
sprintf(help, "%s (1..%d), ^\"-\"^ for previous level", hlp, max);
else {
if (allowall) {
if (max > items)
sprintf(help, "%s (1..%d), ^\"-\"^ prev. level, ^\"*\"^ (de)select all, ^\"P\" or \"N\"^ to page", hlp, max);
else
sprintf(help, "%s (1..%d), ^\"-\"^ for previous level, ^\"*\"^ (de)select all", hlp, max);
} else {
if (max > items)
sprintf(help, "%s (1..%d), ^\"-\"^ prev. level, ^\"P\" or \"N\"^ to page", hlp, max);
else
sprintf(help, "%s (1..%d), ^\"-\"^ for previous level", hlp, max);
}
}
showhelp(help);
/*
@@ -675,6 +684,8 @@ int select_menu_sub(int max, int items, char *hlp)
if (strncmp(menu, "P", 1) == 0)
return -2;
}
if (allowall && (strncmp(menu, "*", 1) == 0))
return -3;
pick = atoi(menu);
if ((pick >= 1) && (pick <= max))
@@ -2179,3 +2190,52 @@ char *getmenutype(int val)
char *getchrs(int val)
{
switch (val) {
case FTNC_NONE: return (char *)"Undefined";
case FTNC_CP437: return (char *)"CP437";
case FTNC_CP850: return (char *)"CP850";
case FTNC_CP865: return (char *)"CP865";
case FTNC_CP866: return (char *)"CP866";
case FTNC_LATIN_1: return (char *)"Latin-1";
case FTNC_LATIN_2: return (char *)"Latin-2";
case FTNC_LATIN_5: return (char *)"Latin-5";
case FTNC_MAC: return (char *)"Mac";
default: return (char *)"ERROR";
}
}
void show_charset(int y, int x, int val)
{
show_str(y, x, 9, getchrs(val));
}
int edit_charset(int y, int x, int val)
{
int ch;
showhelp((char *)"Toggle ^Charset^ with spacebar, press <Enter> when done.");
do {
set_color(YELLOW, BLUE);
show_charset(y, x, val);
ch = readkey(y, x, YELLOW, BLUE);
if (ch == ' ') {
if (val < FTNC_MAXCHARS)
val++;
else
val = FTNC_NONE;
}
} while (ch != KEY_ENTER && ch != '\012');
set_color(WHITE, BLACK);
show_charset(y, x, val);
return val;
}

View File

@@ -80,6 +80,9 @@ void show_aka(int, int, fidoaddr);
void edit_color(int *, int *, char *, char *);
char *get_color(int);
char *getmenutype(int);
char *getchrs(int);
void show_charset(int, int, int);
int edit_charset(int, int, int);
/*

View File

@@ -85,8 +85,7 @@ int CountMsgarea(void)
msgs.Quotes = TRUE;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
msgs.Charset = FTNC_NONE;
strcpy(msgs.Origin, CFG.origin);
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770);
@@ -111,8 +110,7 @@ int CountMsgarea(void)
msgs.SYSec.level = 32000;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
msgs.Charset = FTNC_NONE;
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base))
@@ -135,8 +133,7 @@ int CountMsgarea(void)
msgs.SYSec.level = 32000;
msgs.DaysOld = CFG.defdays;
msgs.MaxMsgs = CFG.defmsgs;
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
msgs.Charset = FTNC_NONE;
fwrite(&msgs, sizeof(msgs), 1, fil);
mkdirs(msgs.Base, 0770);
if (Msg_Open(msgs.Base))
@@ -220,10 +217,6 @@ int OpenMsgarea(void)
*/
memset(&msgs, 0, sizeof(msgs));
while (fread(&msgs, oldsize, 1, fin) == 1) {
if ((oldsize != sizeof(msgs)) && !msgs.Rfccode) {
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
}
if ((oldsize != sizeof(msgs)) && !msgs.LinkSec.level) {
msgs.LinkSec.level = 1;
msgs.LinkSec.flags = 1;
@@ -301,8 +294,11 @@ void InitMsgRec(void)
msgs.Type = ECHOMAIL;
msgs.MsgKinds = PUBLIC;
msgs.UsrDelete = TRUE;
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
#ifdef HAVE_ICONV_H
msgs.Charset = FTNC_LATIN_1;
#else
msgs.Charset = FTNC_NONE;
#endif
msgs.MaxArticles = CFG.maxarticles;
strcpy(msgs.Origin, CFG.origin);
msgs.LinkSec.level = 1;
@@ -493,38 +489,37 @@ void SetScreen()
mvprintw(14, 2, "9. Distrib.");
mvprintw(15, 2, "10. Area Type");
mvprintw(16, 2, "11. Msg Kinds");
mvprintw(17, 2, "12. FTN chars");
mvprintw(18, 2, "13. RFC chars");
mvprintw(19, 2, "14. Active");
mvprintw(17, 2, "12. Charset");
mvprintw(18, 2, "13. Active");
mvprintw(19, 2, "14. Days Old");
mvprintw(13,34, "15. Days Old");
mvprintw(14,34, "16. Max. Msgs");
mvprintw(13,34, "15. Max. Msgs");
switch (msgs.Type) {
case ECHOMAIL: mvprintw(15,34, "17. Netreply");
case ECHOMAIL: mvprintw(14,34, "16. Netreply");
break;
case NEWS: mvprintw(15,34, "17. Articles");
case NEWS: mvprintw(14,34, "16. Articles");
break;
default: mvprintw(15,34, "17. N/A");
default: mvprintw(14,34, "16. N/A");
break;
}
mvprintw(16,34, "18. Read Sec.");
mvprintw(17,34, "19. Write Sec.");
mvprintw(18,34, "20. Sysop Sec.");
mvprintw(19,34, "21. User Del.");
mvprintw(12,58, "22. Aliases");
mvprintw(13,58, "23. Quotes");
mvprintw(14,58, "24. Mandatory");
mvprintw(15,58, "25. UnSecure");
mvprintw(16,58, "26. OLR Default");
mvprintw(17,58, "27. OLR Forced");
mvprintw(15,34, "17. Read Sec.");
mvprintw(16,34, "18. Write Sec.");
mvprintw(17,34, "19. Sysop Sec.");
mvprintw(18,34, "20. User Del.");
mvprintw(19,34, "21. Aliases");
mvprintw(13,58, "22. Quotes");
mvprintw(14,58, "23. Mandatory");
mvprintw(15,58, "24. UnSecure");
mvprintw(16,58, "25. OLR Default");
mvprintw(17,58, "26. OLR Forced");
switch (msgs.Type) {
case ECHOMAIL:
case NEWS:
case LIST: mvprintw(18,58, "28. Connections");
case LIST: mvprintw(18,58, "27. Connections");
break;
}
mvprintw(19,58, "29. Security");
mvprintw(19,58, "28. Security");
}
@@ -639,7 +634,7 @@ void MsgGlobal(void)
char *p, mfile[PATH_MAX];
FILE *fil;
fidoaddr a1, a2;
int menu = 0, marea, Areas, akan = 0, Found;
int menu = 0, marea, Areas, akan = 0, Found, charset = FTNC_LATIN_1;
int Total, Done, netbrd, daysold, maxmsgs, maxarticles;
long offset;
securityrec rs, ws, ss, as;
@@ -694,14 +689,15 @@ void MsgGlobal(void)
mvprintw(14, 6, "8. Change bbs security");
mvprintw(15, 6, "9. Change link security");
mvprintw(16, 6, "10. Change aka to use");
mvprintw(17, 6, "11. Change origin line");
mvprintw(18, 6, "12. Change netmail reply");
mvprintw(19, 6, "13. Delete message area");
mvprintw( 7,41, "11. Change origin line");
mvprintw( 8,41, "12. Change netmail reply");
mvprintw( 9,41, "13. Change character set");
mvprintw(10,41, "14. Delete message area");
memset(&a1, 0, sizeof(fidoaddr));
memset(&a2, 0, sizeof(fidoaddr));
menu = select_menu(13);
menu = select_menu(14);
switch (menu) {
case 0: tidy_grlist(&mgr);
return;
@@ -736,6 +732,9 @@ void MsgGlobal(void)
case 11:E_STR(LINES -3, 5, 64, mfile, "Enter new ^origin^ line");
case 12:mvprintw(LINES -3, 5, "Netmail reply board");
E_INT(LINES -3, 25, netbrd, (char *)"The ^netmail reply^ board number")
case 13:mvprintw(LINES -3, 5, "Character set to set");
charset = edit_charset(LINES -3,26, charset);
break;
}
E_Group(&mgr, (char *)"SELECT MESSAGE GROUPS TO CHANGE");
@@ -782,7 +781,9 @@ void MsgGlobal(void)
break;
case 12:mvprintw(7, 6, "New netmail reply board %d", netbrd);
break;
case 13:mvprintw(7, 6, "Delete message areas");
case 13:mvprintw(7, 6, "New character set %s", getchrs(charset));
break;
case 14:mvprintw(7, 6, "Delete message areas");
break;
}
@@ -965,7 +966,15 @@ void MsgGlobal(void)
}
}
break;
case 13:if (msgs.Active) {
case 13:if (charset != msgs.Charset) {
msgs.Charset = charset;
if (SaveMsgRec(marea, FALSE) == 0) {
Done++;
Syslog('+', "Changed character set to %s in area %s", getchrs(charset), msgs.Tag);
}
}
break;
case 14:if (msgs.Active) {
msgs.Active = FALSE;
Msg_DeleteMsgBase(msgs.Base);
memset(&msgs, 0, sizeof(msgs));
@@ -1029,24 +1038,23 @@ int EditMsgRec(int Area)
show_str(14,16,16, msgs.Distribution);
show_msgtype(15,16, msgs.Type);
show_msgkinds(16,16, msgs.MsgKinds);
// show_str(17,16,16, printable(getchrs(msgs.Ftncode), 0));
// show_str(18,16,16, printable(getchrs(msgs.Rfccode), 0));
show_bool(19,16, msgs.Active);
show_charset(17,16, msgs.Charset);
show_bool(18,16, msgs.Active);
show_int( 19,16, msgs.DaysOld);
show_int( 13,50, msgs.DaysOld);
show_int( 14,50, msgs.MaxMsgs);
show_int( 13,50, msgs.MaxMsgs);
switch (msgs.Type) {
case ECHOMAIL: show_int( 15,50, msgs.NetReply);
case ECHOMAIL: show_int( 14,50, msgs.NetReply);
break;
case NEWS: show_int( 15,50, msgs.MaxArticles);
case NEWS: show_int( 14,50, msgs.MaxArticles);
break;
}
show_int( 16,50, msgs.RDSec.level);
show_int( 17,50, msgs.WRSec.level);
show_int( 18,50, msgs.SYSec.level);
show_bool(19,50, msgs.UsrDelete);
show_int( 15,50, msgs.RDSec.level);
show_int( 16,50, msgs.WRSec.level);
show_int( 17,50, msgs.SYSec.level);
show_bool(18,50, msgs.UsrDelete);
show_bool(19,50, msgs.Aliases);
show_bool(12,74, msgs.Aliases);
show_bool(13,74, msgs.Quotes);
show_bool(14,74, msgs.Mandatory);
show_bool(15,74, msgs.UnSecure);
@@ -1064,7 +1072,7 @@ int EditMsgRec(int Area)
break;
}
switch (select_menu(29)) {
switch (select_menu(28)) {
case 0: crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&msgs, crc1, msgshdr.recsize);
fseek(tfil, 0, 0);
@@ -1122,8 +1130,7 @@ int EditMsgRec(int Area)
msgs.NetReply = mgroup.NetReply;
msgs.Quotes = mgroup.Quotes;
msgs.MaxArticles = CFG.maxarticles;
msgs.Rfccode = 0; // CHRS_DEFAULT_RFC;
msgs.Ftncode = 0; // CHRS_DEFAULT_FTN;
msgs.Charset = mgroup.Charset;
strncpy(msgs.Origin, CFG.origin, 50);
msgs.LinkSec = mgroup.LinkSec;
@@ -1249,7 +1256,8 @@ int EditMsgRec(int Area)
SetScreen();
break;
case 11:msgs.MsgKinds = edit_msgkinds(16,16, msgs.MsgKinds); break;
case 14:Active = edit_bool(19,16, msgs.Active, (char *)"Is this area ^Active^");
case 12:msgs.Charset = edit_charset(17,16, msgs.Charset); break;
case 13:Active = edit_bool(18,16, msgs.Active, (char *)"Is this area ^Active^");
if (msgs.Active && !Active) {
/*
* Attempt to deactivate area, do some checks.
@@ -1285,29 +1293,29 @@ int EditMsgRec(int Area)
msgs.Active = TRUE;
SetScreen();
break;
case 15:E_INT( 13,50, msgs.DaysOld, "Maximum ^days^ to keep mail in this area")
case 16:E_INT( 14,50, msgs.MaxMsgs, "The ^maximum^ amount of messages in this area")
case 17:switch (msgs.Type) {
case ECHOMAIL: msgs.NetReply = edit_int(15,50,msgs.NetReply,
case 14:E_INT( 19,16, msgs.DaysOld, "Maximum ^days^ to keep mail in this area")
case 15:E_INT( 13,50, msgs.MaxMsgs, "The ^maximum^ amount of messages in this area")
case 16:switch (msgs.Type) {
case ECHOMAIL: msgs.NetReply = edit_int(14,50,msgs.NetReply,
(char *)"The ^Area Number^ for netmail replies");
break;
case NEWS: msgs.MaxArticles = edit_int(15,50,msgs.MaxArticles,
case NEWS: msgs.MaxArticles = edit_int(14,50,msgs.MaxArticles,
(char *)"The ^maximum news articles^ to fetch");
break;
}
break;
case 18:E_SEC( 16,50, msgs.RDSec, "9.2 EDIT READ SECURITY", SetScreen)
case 19:E_SEC( 17,50, msgs.WRSec, "9.2 EDIT WRITE SECURITY", SetScreen)
case 20:E_SEC( 18,50, msgs.SYSec, "9.2 EDIT SYSOP SECURITY", SetScreen)
case 21:E_BOOL(19,50, msgs.UsrDelete, "Allow users to ^Delete^ their messages")
case 17:E_SEC( 15,50, msgs.RDSec, "9.2 EDIT READ SECURITY", SetScreen)
case 18:E_SEC( 16,50, msgs.WRSec, "9.2 EDIT WRITE SECURITY", SetScreen)
case 19:E_SEC( 17,50, msgs.SYSec, "9.2 EDIT SYSOP SECURITY", SetScreen)
case 20:E_BOOL(18,50, msgs.UsrDelete, "Allow users to ^Delete^ their messages")
case 21:E_BOOL(19,50, msgs.Aliases, "Allow ^aliases^ or real names only")
case 22:E_BOOL(12,74, msgs.Aliases, "Allow ^aliases^ or real names only")
case 23:E_BOOL(13,74, msgs.Quotes, "Add random ^quotes^ to new messages")
case 24:E_BOOL(14,74, msgs.Mandatory, "Is this area ^mandatory^ for nodes")
case 25:E_BOOL(15,74, msgs.UnSecure, "Toss messages ^UnSecure^, ie: no originating check")
case 26:E_BOOL(16,74, msgs.OLR_Default, "Area is ^default^ for ^offline^ users.")
case 27:E_BOOL(17,74, msgs.OLR_Forced, "Area is ^always on^ for ^offline^ users.")
case 28:switch (msgs.Type) {
case 22:E_BOOL(13,74, msgs.Quotes, "Add random ^quotes^ to new messages")
case 23:E_BOOL(14,74, msgs.Mandatory, "Is this area ^mandatory^ for nodes")
case 24:E_BOOL(15,74, msgs.UnSecure, "Toss messages ^UnSecure^, ie: no originating check")
case 25:E_BOOL(16,74, msgs.OLR_Default, "Area is ^default^ for ^offline^ users.")
case 26:E_BOOL(17,74, msgs.OLR_Forced, "Area is ^always on^ for ^offline^ users.")
case 27:switch (msgs.Type) {
case ECHOMAIL:
case NEWS:
case LIST: if (EditConnections(tfil))
@@ -1316,7 +1324,7 @@ int EditMsgRec(int Area)
break;
}
break;
case 29:msgs.LinkSec = edit_asec(msgs.LinkSec, (char *)"9.2 EDIT LINK SECURITY");
case 28:msgs.LinkSec = edit_asec(msgs.LinkSec, (char *)"9.2 EDIT LINK SECURITY");
SetScreen();
break;
}
@@ -1804,8 +1812,7 @@ int mail_area_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Offline name %s\n", msgs.QWKname);
fprintf(fp, " Area type %s\n", getmsgtype(msgs.Type));
fprintf(fp, " Messages type %s\n", getmsgkinds(msgs.MsgKinds));
// fprintf(fp, " FTN charset %s\n", printable(getchrs(msgs.Ftncode), 0));
// fprintf(fp, " RFC charset %s\n", printable(getchrs(msgs.Rfccode), 0));
fprintf(fp, " Character set %s\n", getchrs(msgs.Charset));
fprintf(fp, " Days old msgs. %d\n", msgs.DaysOld);
fprintf(fp, " Maximum msgs. %d\n", msgs.MaxMsgs);
fprintf(fp, " Max articles %d\n", msgs.MaxArticles);

View File

@@ -154,6 +154,9 @@ int OpenMGroup(void)
mgroup.LinkSec.level = 1;
mgroup.LinkSec.flags = 1;
}
if (MGrpUpdated && (mgroup.Charset == FTNC_NONE)) {
mgroup.Charset = FTNC_LATIN_1;
}
fwrite(&mgroup, sizeof(mgroup), 1, fout);
memset(&mgroup, 0, sizeof(mgroup));
}
@@ -218,51 +221,54 @@ void CloseMGroup(int force)
int AppendMGroup(void)
{
FILE *fil;
char ffile[PATH_MAX];
FILE *fil;
char ffile[PATH_MAX];
sprintf(ffile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) {
memset(&mgroup, 0, sizeof(mgroup));
mgroup.StartDate = time(NULL);
mgroup.LinkSec.level = 1;
mgroup.LinkSec.flags = 1;
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
MGrpUpdated = 1;
return 0;
} else
return -1;
sprintf(ffile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(ffile, "a")) != NULL) {
memset(&mgroup, 0, sizeof(mgroup));
mgroup.StartDate = time(NULL);
mgroup.LinkSec.level = 1;
mgroup.LinkSec.flags = 1;
mgroup.Charset = FTNC_LATIN_1;
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
MGrpUpdated = 1;
return 0;
} else
return -1;
}
void MgScreen(void)
{
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "9.1 EDIT MESSAGE GROUP");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Name");
mvprintw( 8, 2, "2. Comment");
mvprintw( 9, 2, "3. Base path");
mvprintw(10, 2, "4. Read sec");
mvprintw(11, 2, "5. Write sec");
mvprintw(12, 2, "6. Sysop sec");
mvprintw(13, 2, "7. Link sec");
mvprintw(14, 2, "8. Start at");
mvprintw(15, 2, "9. Net reply");
mvprintw(16, 2, "10. Users del");
mvprintw(17, 2, "11. Aliases");
mvprintw(18, 2, "12. Quotes");
mvprintw(19, 2, "13. Active");
clr_index();
set_color(WHITE, BLACK);
mvprintw( 5, 2, "9.1 EDIT MESSAGE GROUP");
set_color(CYAN, BLACK);
mvprintw( 7, 2, "1. Name");
mvprintw( 8, 2, "2. Comment");
mvprintw( 9, 2, "3. Base path");
mvprintw(10, 2, "4. Read sec");
mvprintw(11, 2, "5. Write sec");
mvprintw(12, 2, "6. Sysop sec");
mvprintw(13, 2, "7. Link sec");
mvprintw(14, 2, "8. Start at");
mvprintw(15, 2, "9. Net reply");
mvprintw(16, 2, "10. Users del");
mvprintw(17, 2, "11. Aliases");
mvprintw(18, 2, "12. Quotes");
mvprintw(19, 2, "13. Active");
mvprintw(14,41, "14. Deleted");
mvprintw(15,41, "15. Auto change");
mvprintw(16,41, "16. User change");
mvprintw(17,41, "17. Use Aka");
mvprintw(18,41, "18. Uplink");
mvprintw(19,41, "19. Areas");
mvprintw(14,26, "14. Deleted");
mvprintw(15,26, "15. Auto change");
mvprintw(16,26, "16. User change");
mvprintw(17,26, "17. Use Aka");
mvprintw(18,26, "18. Uplink");
mvprintw(19,26, "19. Areas");
mvprintw(14,54, "20. Charset");
}
@@ -292,136 +298,140 @@ int CheckMgroup(void)
*/
int EditMGrpRec(int Area)
{
FILE *fil;
static char mfile[PATH_MAX], temp[13];
static long offset;
static int i, j, tmp;
unsigned long crc, crc1;
FILE *fil;
static char mfile[PATH_MAX], temp[13];
static long offset;
static int i, j, tmp;
unsigned long crc, crc1;
clr_index();
working(1, 0, 0);
IsDoing("Edit MessageGroup");
clr_index();
working(1, 0, 0);
IsDoing("Edit MessageGroup");
sprintf(mfile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
sprintf(mfile, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
if ((fil = fopen(mfile, "r")) == NULL) {
working(2, 0, 0);
return -1;
}
offset = sizeof(mgrouphdr) + ((Area -1) * sizeof(mgroup));
if (fseek(fil, offset, 0) != 0) {
working(2, 0, 0);
return -1;
}
offset = sizeof(mgrouphdr) + ((Area -1) * sizeof(mgroup));
if (fseek(fil, offset, 0) != 0) {
working(2, 0, 0);
return -1;
}
fread(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&mgroup, crc, sizeof(mgroup));
MgScreen();
fread(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
crc = 0xffffffff;
crc = upd_crc32((char *)&mgroup, crc, sizeof(mgroup));
MgScreen();
for (;;) {
set_color(WHITE, BLACK);
show_str( 7,16,12, mgroup.Name);
show_str( 8,16,55, mgroup.Comment);
show_str( 9,16,64, mgroup.BasePath);
show_sec( 10,16, mgroup.RDSec);
show_sec( 11,16, mgroup.WRSec);
show_sec( 12,16, mgroup.SYSec);
mvprintw( 13,22, getflag(mgroup.LinkSec.flags, mgroup.LinkSec.notflags));
show_int( 14,16, mgroup.StartArea);
show_int( 15,16, mgroup.NetReply);
show_bool(16,16, mgroup.UsrDelete);
show_bool(17,16, mgroup.Aliases);
show_bool(18,16, mgroup.Quotes);
show_bool(19,16, mgroup.Active);
for (;;) {
set_color(WHITE, BLACK);
show_str( 7,16,12, mgroup.Name);
show_str( 8,16,55, mgroup.Comment);
show_str( 9,16,64, mgroup.BasePath);
show_sec( 10,16, mgroup.RDSec);
show_sec( 11,16, mgroup.WRSec);
show_sec( 12,16, mgroup.SYSec);
mvprintw( 13,22, getflag(mgroup.LinkSec.flags, mgroup.LinkSec.notflags));
show_int( 14,16, mgroup.StartArea);
show_int( 15,16, mgroup.NetReply);
show_bool(16,16, mgroup.UsrDelete);
show_bool(17,16, mgroup.Aliases);
show_bool(18,16, mgroup.Quotes);
show_bool(19,16, mgroup.Active);
show_bool(14,57, mgroup.Deleted);
show_bool(15,57, mgroup.AutoChange);
show_bool(16,57, mgroup.UserChange);
show_aka( 17,57, mgroup.UseAka);
show_aka( 18,57, mgroup.UpLink);
show_str( 19,57,12, mgroup.AreaFile);
show_bool(14,42, mgroup.Deleted);
show_bool(15,42, mgroup.AutoChange);
show_bool(16,42, mgroup.UserChange);
show_aka( 17,42, mgroup.UseAka);
show_aka( 18,42, mgroup.UpLink);
show_str( 19,42,12, mgroup.AreaFile);
j = select_menu(19);
switch(j) {
case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
errmsg("Areas file defined but no BBS start area");
break;
}
crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&mgroup, crc1, sizeof(mgroup));
if (crc != crc1) {
if (yes_no((char *)"Record is changed, save") == 1) {
working(1, 0, 0);
if ((fil = fopen(mfile, "r+")) == NULL) {
WriteError("$Can't reopen %s", mfile);
working(2, 0, 0);
return -1;
}
fseek(fil, offset, 0);
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
MGrpUpdated = 1;
working(6, 0, 0);
}
}
IsDoing("Browsing Menu");
return 0;
case 1: if (CheckMgroup())
break;
strcpy(mgroup.Name, edit_str(7,16,12, mgroup.Name, (char *)"The ^name^ for this message group"));
if (strlen(mgroup.BasePath) == 0) {
memset(&temp, 0, sizeof(temp));
strcpy(temp, mgroup.Name);
for (i = 0; i < strlen(temp); i++) {
if (temp[i] == '.')
temp[i] = '/';
if (isupper(temp[i]))
temp[i] = tolower(temp[i]);
show_charset(14,70, mgroup.Charset);
j = select_menu(20);
switch(j) {
case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
errmsg("Areas file defined but no BBS start area");
break;
}
crc1 = 0xffffffff;
crc1 = upd_crc32((char *)&mgroup, crc1, sizeof(mgroup));
if (crc != crc1) {
if (yes_no((char *)"Record is changed, save") == 1) {
working(1, 0, 0);
if ((fil = fopen(mfile, "r+")) == NULL) {
WriteError("$Can't reopen %s", mfile);
working(2, 0, 0);
return -1;
}
sprintf(mgroup.BasePath, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
fseek(fil, offset, 0);
fwrite(&mgroup, sizeof(mgroup), 1, fil);
fclose(fil);
MGrpUpdated = 1;
working(6, 0, 0);
}
}
IsDoing("Browsing Menu");
return 0;
case 1: if (CheckMgroup())
break;
case 2: E_STR( 8,16,55, mgroup.Comment, "The ^desription^ for this message group")
case 3: E_PTH( 9,16,64, mgroup.BasePath, "The ^Base path^ where new JAM areas are created", 0770)
case 4: E_SEC( 10,16, mgroup.RDSec, "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen)
case 5: E_SEC( 11,16, mgroup.WRSec, "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen)
case 6: E_SEC( 12,16, mgroup.SYSec, "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen)
case 7: mgroup.LinkSec = edit_asec(mgroup.LinkSec, (char *)"9.1.7 DEFAULT SECURITY FOR NEW AREAS");
MgScreen();
break;
case 8: E_INT( 14,16, mgroup.StartArea, "The ^Start area number^ from where to add areas")
case 9: E_INT( 15,16, mgroup.NetReply, "The ^Area Number^ for netmail replies")
case 10:E_BOOL(16,16, mgroup.UsrDelete, "Allow users to ^Delete^ their messages")
case 11:E_BOOL(17,16, mgroup.Aliases, "Allow ^Aliases^ or real names only")
case 12:E_BOOL(18,16, mgroup.Quotes, "Allow random ^quotes^ to new messages")
case 13:if (CheckMgroup())
break;
E_BOOL(19,16, mgroup.Active, "Is this message group ^active^")
case 14:if (CheckMgroup())
break;
E_BOOL(14,57, mgroup.Deleted, "Is this group ^Deleted^")
case 15:E_BOOL(15,57, mgroup.AutoChange, "^Auto change^ areas from new areas lists")
case 16:tmp = edit_bool(16,57, mgroup.UserChange, (char *)"^Auto add/delete^ areas from downlinks requests");
if (tmp && !mgroup.UpLink.zone)
errmsg("It looks like you are the toplevel, no Uplink defined");
else
mgroup.UserChange = tmp;
break;
case 17:tmp = PickAka((char *)"9.1.17", TRUE);
if (tmp != -1)
memcpy(&mgroup.UseAka, &CFG.aka[tmp], sizeof(fidoaddr));
MgScreen();
break;
case 18:mgroup.UpLink = PullUplink((char *)"9.1.18");
MgScreen();
break;
case 19:E_STR( 19,57,12, mgroup.AreaFile, "The name of the ^Areas File^ from the uplink")
}
strcpy(mgroup.Name, edit_str(7,16,12, mgroup.Name, (char *)"The ^name^ for this message group"));
if (strlen(mgroup.BasePath) == 0) {
memset(&temp, 0, sizeof(temp));
strcpy(temp, mgroup.Name);
for (i = 0; i < strlen(temp); i++) {
if (temp[i] == '.')
temp[i] = '/';
if (isupper(temp[i]))
temp[i] = tolower(temp[i]);
}
sprintf(mgroup.BasePath, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
}
break;
case 2: E_STR( 8,16,55, mgroup.Comment, "The ^desription^ for this message group")
case 3: E_PTH( 9,16,64, mgroup.BasePath, "The ^Base path^ where new JAM areas are created", 0770)
case 4: E_SEC( 10,16, mgroup.RDSec, "9.1.4 MESSAGE GROUP READ SECURITY", MgScreen)
case 5: E_SEC( 11,16, mgroup.WRSec, "9.1.5 MESSAGE GROUP WRITE SECURITY", MgScreen)
case 6: E_SEC( 12,16, mgroup.SYSec, "9.1.6 MESSAGE GROUP SYSOP SECURITY", MgScreen)
case 7: mgroup.LinkSec = edit_asec(mgroup.LinkSec, (char *)"9.1.7 DEFAULT SECURITY FOR NEW AREAS");
MgScreen();
break;
case 8: E_INT( 14,16, mgroup.StartArea, "The ^Start area number^ from where to add areas")
case 9: E_INT( 15,16, mgroup.NetReply, "The ^Area Number^ for netmail replies")
case 10:E_BOOL(16,16, mgroup.UsrDelete, "Allow users to ^Delete^ their messages")
case 11:E_BOOL(17,16, mgroup.Aliases, "Allow ^Aliases^ or real names only")
case 12:E_BOOL(18,16, mgroup.Quotes, "Allow random ^quotes^ to new messages")
case 13:if (CheckMgroup())
break;
E_BOOL(19,16, mgroup.Active, "Is this message group ^active^")
case 14:if (CheckMgroup())
break;
E_BOOL(14,42, mgroup.Deleted, "Is this group ^Deleted^")
case 15:E_BOOL(15,42, mgroup.AutoChange, "^Auto change^ areas from new areas lists")
case 16:tmp = edit_bool(16,42, mgroup.UserChange, (char *)"^Auto add/delete^ areas from downlinks requests");
if (tmp && !mgroup.UpLink.zone)
errmsg("It looks like you are the toplevel, no Uplink defined");
else
mgroup.UserChange = tmp;
break;
case 17:tmp = PickAka((char *)"9.1.17", TRUE);
if (tmp != -1)
memcpy(&mgroup.UseAka, &CFG.aka[tmp], sizeof(fidoaddr));
MgScreen();
break;
case 18:mgroup.UpLink = PullUplink((char *)"9.1.18");
MgScreen();
break;
case 19:E_STR( 19,42,12, mgroup.AreaFile, "The name of the ^Areas File^ from the uplink")
case 20:mgroup.Charset = edit_charset(14, 70, mgroup.Charset);
break;
}
}
return 0;
return 0;
}
@@ -667,7 +677,8 @@ int mail_group_doc(FILE *fp, FILE *toc, int page)
fprintf(fp, " Use aliases %s\n", getboolean(mgroup.Aliases));
fprintf(fp, " Add quotes %s\n", getboolean(mgroup.Quotes));
fprintf(fp, " Auto add/del areas %s\n", getboolean(mgroup.AutoChange));
fprintf(fp, " user add/del areas %s\n", getboolean(mgroup.UserChange));
fprintf(fp, " User add/del areas %s\n", getboolean(mgroup.UserChange));
fprintf(fp, " Default charset %s\n", getchrs(mgroup.Charset));
fprintf(fp, " Start area date %s", ctime(&mgroup.StartDate));
fprintf(fp, " Last active date %s\n", ctime(&mgroup.LastDate));
fprintf(fp, "\n\n");

View File

@@ -420,7 +420,7 @@ int EditNewRec(int Area)
case 10:E_BOOL(16,18, newfiles.Active, "If this report is ^active^")
case 11:E_BOOL(17,18, newfiles.Deleted, "Is this record ^deleted^")
case 12:E_BOOL(16,58, newfiles.HiAscii, "Allow ^High ASCII^ in this report")
case 13:if (E_Group(&fgr, (char *)"12.12 NEWFILE GROUPS"))
case 13:if (E_Group(&fgr, (char *)"12.13 NEWFILE GROUPS"))
GrpChanged = TRUE;
break;
}