Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit fa0a154e authored by Rob Swindell's avatar Rob Swindell 💬

Add a separate "area tag" string configured per sub-board

According to  Lupine Furmen (FURFOL):
It says in the help that the field is used for both the Newsgroup name AND the
Fido Echo-tag.

These really should be 2 different fields.

Now, the echo/area tag is usually configured in the area file (areas.bbs) and so does not need to match *any* string configured in SCFG. But since an area file *can* be generated from SCFG (Export Areas option) and its possible to use SBBSecho withOUT an area file at all, then it's possible someone would like to have their FidoNet-style area tags configured different from any other strings related to a sub-board (e.g. newsgroup name) - why? I'm not clear, but there it is: another string that  a sysop can set (or not).

Since I'd recently added an area tag field per directory for use by hatchit.js, this does create some logical symmetry. And there were enough free bytes per-sub in the msgs.cnf, so why not.
parent 53235542
Pipeline #2069 passed with stage
in 8 minutes and 19 seconds
......@@ -1791,16 +1791,8 @@ bool add_sub_to_arealist(sub_t* sub, fidoaddr_t uplink)
{
FILE* fp = NULL;
/* Replace spaces in the sub short-name with underscores (for use as the echotag) */
char echotag[FIDO_AREATAG_LEN+1];
if(sub->newsgroup[0])
SAFECOPY(echotag, sub->newsgroup);
else {
SAFECOPY(echotag, sub->sname);
char* p;
REPLACE_CHARS(echotag, ' ', '_', p);
}
strupr(echotag);
sub_area_tag(&scfg, sub, echotag, sizeof(echotag));
for(unsigned u=0; u < cfg.areas; u++) {
if(stricmp(cfg.area[u].tag, echotag) == 0)
......
......@@ -149,8 +149,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
continue;
SAFECOPY(tmp_code, areatag); // Copy tag to internal code suffix
SAFECOPY(tmpsub.sname, utos(areatag)); // ... to short name, converting underscores to spaces
if(strlen(areatag) > sizeof(tmpsub.sname) - 1)
SAFECOPY(tmpsub.newsgroup, areatag);
SAFECOPY(tmpsub.area_tag, areatag);
SAFECOPY(tmpsub.lname, iniGetString(ini, areatag, "Title", "", value));
} else {
if(feof(stream))
......@@ -279,8 +278,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
SAFECOPY(tmp_code,p); /* Copy tag to internal code */
SAFECOPY(tmpsub.lname,utos(p));
SAFECOPY(tmpsub.sname,tmpsub.lname);
if(strlen(p) > sizeof(tmpsub.sname) - 1)
SAFECOPY(tmpsub.newsgroup, p);
SAFECOPY(tmpsub.area_tag, p);
}
else if(type == IMPORT_LIST_TYPE_SBBSECHO_AREAS_BBS) { /* AREAS.BBS SBBSecho */
p=str;
......@@ -294,8 +292,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
truncstr(p," \t"); /* Truncate tag */
SAFECOPY(tmpsub.lname,utos(p));
SAFECOPY(tmpsub.sname,tmpsub.lname);
if(strlen(p) > sizeof(tmpsub.sname) - 1)
SAFECOPY(tmpsub.newsgroup, p);
SAFECOPY(tmpsub.area_tag, p);
}
else if(type == IMPORT_LIST_TYPE_BACKBONE_NA) { /* BACKBONE.NA */
p=str;
......@@ -305,8 +302,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
*tp=0; /* Truncate echo tag */
SAFECOPY(tmp_code,p); /* Copy tag to internal code suffix */
SAFECOPY(tmpsub.sname,utos(p)); /* ... to short name, converting underscores to spaces */
if(strlen(p) > sizeof(tmpsub.sname) - 1)
SAFECOPY(tmpsub.newsgroup, p);
SAFECOPY(tmpsub.area_tag, p);
p=tp+1;
SKIP_WHITESPACE(p); /* Find description */
SAFECOPY(tmpsub.lname,p); /* Copy description to long name */
......@@ -327,6 +323,8 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
if(tmpsub.lname[0] == 0) {
if(tmpsub.newsgroup[0])
SAFECOPY(tmpsub.lname, tmpsub.newsgroup);
else if(tmpsub.area_tag[0])
SAFECOPY(tmpsub.lname, tmpsub.area_tag);
else
SAFECOPY(tmpsub.lname, tmpsub.sname);
}
......@@ -343,6 +341,9 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
if(cfg.sub[j]->newsgroup[0] || tmpsub.newsgroup[0]) {
if(stricmp(cfg.sub[j]->newsgroup, tmpsub.newsgroup) == 0)
break;
} else if(cfg.sub[j]->area_tag[0] || tmpsub.area_tag[0]) {
if(stricmp(cfg.sub[j]->area_tag, tmpsub.area_tag) == 0)
break;
} else {
if(stricmp(cfg.sub[j]->sname, tmpsub.sname) == 0)
break;
......@@ -392,6 +393,7 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
SAFECOPY(cfg.sub[j]->lname,tmpsub.lname);
SAFECOPY(cfg.sub[j]->newsgroup,tmpsub.newsgroup);
SAFECOPY(cfg.sub[j]->qwkname,tmpsub.qwkname);
SAFECOPY(cfg.sub[j]->area_tag, tmpsub.area_tag);
if(tmpsub.data_dir[0])
SAFECOPY(cfg.sub[j]->data_dir,tmpsub.data_dir);
if(strcasestr(tmpsub.lname, "sysop") != NULL && strcasestr(tmpsub.lname, "only") != NULL) {
......
......@@ -140,12 +140,6 @@ void sub_cfg(uint grpnum)
"a full message area description (Long Name) is unnecessary.\n"
"\n"
"Sub-board Short Names are limited to 25 characters in length.\n"
"\n"
"For sub-boards that are FidoNet-networked (using FTN), it is customary\n"
"to use the standardized `Echo Tag` or `Area Tag` as the sub-board Short Name\n"
"replacing underscore (`_`) characters with spaces. This will make the\n"
"task of importing-from or exporting-to EchoLists (e.g. `BACKBONE.NA`) or\n"
"an Area File (e.g. `areas.bbs`) much easier."
;
char* sub_code_help =
"`Sub-board Internal Code Suffix:`\n"
......@@ -333,6 +327,7 @@ void sub_cfg(uint grpnum)
sprintf(opt[n++],"%-27.27s%s","QWK Name",cfg.sub[i]->qwkname);
sprintf(opt[n++],"%-27.27s%s%s","Internal Code"
,cfg.grp[cfg.sub[i]->grp]->code_prefix, cfg.sub[i]->code_suffix);
sprintf(opt[n++],"%-27.27s%s","FidoNet Area Tag", cfg.sub[i]->area_tag);
sprintf(opt[n++],"%-27.27s%s","Newsgroup Name",cfg.sub[i]->newsgroup);
sprintf(opt[n++],"%-27.27s%s","Access Requirements"
,cfg.sub[i]->arstr);
......@@ -420,6 +415,19 @@ void sub_cfg(uint grpnum)
}
break;
case 4:
uifc.helpbuf=
"`FidoNet Area Tag:`\n"
"\n"
"This field may be used to specify the FidoNet-style `Echo/Area Tag` for\n"
"this message area. If no tag name is configured here, a tag name will be\n"
"automatically generated from the Sub-board's `Short Name`.\n"
"\n"
"This tag should ~ not ~ contain spaces."
;
uifc.input(WIN_MID|WIN_SAV, 0, 17, "FidoNet Area Tag"
,cfg.sub[i]->area_tag, sizeof(cfg.sub[i]->area_tag)-1, K_EDIT|K_UPPER);
break;
case 5:
uifc.helpbuf=
"`Newsgroup Name:`\n"
"\n"
......@@ -427,35 +435,32 @@ void sub_cfg(uint grpnum)
"is configured here, a name will be automatically generated from the\n"
"Sub-board's Short Name and message group's Short Name.\n"
"\n"
"This field may also be used to specify the FidoNet-style `Echo Tag` for\n"
"this message area.\n"
"\n"
"This name should ~ not ~ contain spaces."
;
uifc.input(WIN_MID|WIN_SAV,0,17,""
,cfg.sub[i]->newsgroup,sizeof(cfg.sub[i]->newsgroup)-1,K_EDIT);
break;
case 5:
case 6:
sprintf(str,"%s Access",cfg.sub[i]->sname);
getar(str,cfg.sub[i]->arstr);
break;
case 6:
case 7:
sprintf(str,"%s Reading",cfg.sub[i]->sname);
getar(str,cfg.sub[i]->read_arstr);
break;
case 7:
case 8:
sprintf(str,"%s Posting",cfg.sub[i]->sname);
getar(str,cfg.sub[i]->post_arstr);
break;
case 8:
case 9:
sprintf(str,"%s Operator",cfg.sub[i]->sname);
getar(str,cfg.sub[i]->op_arstr);
break;
case 9:
case 10:
sprintf(str,"%s Moderated Posting User",cfg.sub[i]->sname);
getar(str,cfg.sub[i]->mod_arstr);
break;
case 10:
case 11:
sprintf(str,"%"PRIu32,cfg.sub[i]->maxmsgs);
uifc.helpbuf=
"`Maximum Number of Messages:`\n"
......@@ -475,7 +480,7 @@ void sub_cfg(uint grpnum)
cfg.sub[i]->maxmsgs=atoi(str);
cfg.sub[i]->misc|=SUB_HDRMOD;
break;
case 11:
case 12:
sprintf(str,"%u",cfg.sub[i]->maxage);
uifc.helpbuf=
"`Maximum Age of Messages:`\n"
......@@ -497,7 +502,7 @@ void sub_cfg(uint grpnum)
cfg.sub[i]->maxage=atoi(str);
cfg.sub[i]->misc|=SUB_HDRMOD;
break;
case 12:
case 13:
sprintf(str,"%"PRIu32,cfg.sub[i]->maxcrcs);
uifc.helpbuf=
"`Maximum Number of CRCs:`\n"
......@@ -515,7 +520,7 @@ void sub_cfg(uint grpnum)
cfg.sub[i]->maxcrcs=atol(str);
cfg.sub[i]->misc|=SUB_HDRMOD;
break;
case 13:
case 14:
while(1) {
n=0;
sprintf(opt[n++],"%-30.30s%s","Allow Private Posts"
......@@ -1194,7 +1199,7 @@ void sub_cfg(uint grpnum)
}
}
break;
case 14:
case 15:
while(1) {
n=0;
sprintf(opt[n++],"%-27.27s%s","Append Tag/Origin Line"
......@@ -1427,7 +1432,7 @@ void sub_cfg(uint grpnum)
}
}
break;
case 15:
case 16:
while(1) {
n=0;
if(cfg.sub[i]->qwkconf)
......
......@@ -1141,7 +1141,7 @@ void dir_cfg(uint libnum)
sprintf(opt[n++],"%-27.27s%s","Short Name",cfg.dir[i]->sname);
sprintf(opt[n++],"%-27.27s%s%s","Internal Code"
,cfg.lib[cfg.dir[i]->lib]->code_prefix, cfg.dir[i]->code_suffix);
sprintf(opt[n++],"%-27.27s%s","Area Tag",cfg.dir[i]->area_tag);
sprintf(opt[n++],"%-27.27s%s","FidoNet Area Tag",cfg.dir[i]->area_tag);
sprintf(opt[n++],"%-27.27s%s","Access Requirements"
,cfg.dir[i]->arstr);
sprintf(opt[n++],"%-27.27s%s","Upload Requirements"
......@@ -1230,7 +1230,15 @@ void dir_cfg(uint libnum)
}
break;
case 3:
uifc.helpbuf="FidoNet Area Tag!";
uifc.helpbuf=
"`FidoNet Area Tag:`\n"
"\n"
"This field may be used to specify the FidoNet-style `Echo/Area Tag` for\n"
"this file area. If no tag name is configured here, a tag name will be\n"
"automatically generated from the Directory's `Short Name`.\n"
"\n"
"This tag should ~ not ~ contain spaces."
;
SAFECOPY(str, cfg.dir[i]->area_tag);
if(uifc.input(WIN_L2R|WIN_SAV,0,17,"FidoNet File Echo Area Tag"
,str, FIDO_AREATAG_LEN, K_EDIT | K_UPPER) > 0)
......
......@@ -40,6 +40,7 @@ typedef struct { /* Message sub board info */
post_sem[LEN_DIR+1], /* Semaphore file for this sub */
tagline[81], /* Optional QWK net tag line */
newsgroup[LEN_DIR+1]; /* Newsgroup name */
char area_tag[FIDO_AREATAG_LEN+1];
uchar ar[LEN_ARSTR+1],
read_ar[LEN_ARSTR+1],
post_ar[LEN_ARSTR+1],
......
......@@ -537,7 +537,8 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error, size_t maxerrlen)
get_int(c,instream); // unused
get_int(cfg->sub[i]->pmode,instream);
get_int(cfg->sub[i]->n_pmode,instream);
for(j=0;j<22;j++)
get_str(cfg->sub[i]->area_tag, instream);
for(j=0;j<4;j++)
get_int(n,instream);
}
cfg->total_subs=i;
......
......@@ -426,8 +426,9 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
put_int(c,stream); // unused
put_int(cfg->sub[i]->pmode,stream);
put_int(cfg->sub[i]->n_pmode,stream);
put_str(cfg->sub[i]->area_tag, stream);
n=0;
for(k=0;k<22;k++)
for(k=0;k<4;k++)
put_int(n,stream);
if(all_msghdr || (cfg->sub[i]->misc&SUB_HDRMOD && !no_msghdr)) {
......
......@@ -915,13 +915,15 @@ char* sub_area_tag(scfg_t* cfg, sub_t* sub, char* str, size_t size)
char* p;
memset(str, 0, size);
if(sub->newsgroup[0])
if(sub->area_tag[0])
strncpy(str, sub->area_tag, size - 1);
else if(sub->newsgroup[0])
strncpy(str, sub->newsgroup, size - 1);
else {
strncpy(str, sub->sname, size - 1);
REPLACE_CHARS(str, ' ', '_', p);
strupr(str);
}
strupr(str);
return str;
}
......@@ -935,8 +937,8 @@ char* dir_area_tag(scfg_t* cfg, dir_t* dir, char* str, size_t size)
else {
strncpy(str, dir->sname, size - 1);
REPLACE_CHARS(str, ' ', '_', p);
strupr(str);
}
strupr(str);
return str;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment