Skip to content
Snippets Groups Projects
Commit a67eb427 authored by rswindell's avatar rswindell
Browse files

Add a "newsgroup.lst" import feature to import a list of newsgroups from a text

file (one newsgroup name per line). The newsgroup name is used for all the
area fields/names, removing the group name if applicable. Any additional text
following the first word of each line is ignored.
Also sets the INET/NTTP networked flag for all the imported subs.

Also, fixed apparently long-standing bug where QWK name of imported subs was
always overwritten with sub's short name.
parent fc24a2d5
No related branches found
No related tags found
No related merge requests found
...@@ -87,6 +87,8 @@ enum import_list_type determine_msg_list_type(const char* path) ...@@ -87,6 +87,8 @@ enum import_list_type determine_msg_list_type(const char* path)
return IMPORT_LIST_TYPE_SBBSECHO_AREAS_BBS; return IMPORT_LIST_TYPE_SBBSECHO_AREAS_BBS;
if(stricmp(fname, "control.dat") == 0) if(stricmp(fname, "control.dat") == 0)
return IMPORT_LIST_TYPE_QWK_CONTROL_DAT; return IMPORT_LIST_TYPE_QWK_CONTROL_DAT;
if(stricmp(fname, "newsgroup.lst") == 0)
return IMPORT_LIST_TYPE_NEWSGROUPS;
return IMPORT_LIST_TYPE_BACKBONE_NA; return IMPORT_LIST_TYPE_BACKBONE_NA;
} }
......
...@@ -81,6 +81,8 @@ enum import_list_type { ...@@ -81,6 +81,8 @@ enum import_list_type {
IMPORT_LIST_TYPE_GENERIC_AREAS_BBS, IMPORT_LIST_TYPE_GENERIC_AREAS_BBS,
IMPORT_LIST_TYPE_SBBSECHO_AREAS_BBS, IMPORT_LIST_TYPE_SBBSECHO_AREAS_BBS,
IMPORT_LIST_TYPE_BACKBONE_NA, IMPORT_LIST_TYPE_BACKBONE_NA,
IMPORT_LIST_TYPE_BAD_AREAS,
IMPORT_LIST_TYPE_NEWSGROUPS,
}; };
/************/ /************/
......
...@@ -226,6 +226,24 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum ...@@ -226,6 +226,24 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
SAFECOPY(tmpsub.qwkname, p); SAFECOPY(tmpsub.qwkname, p);
new_sub_misc = SUB_QNET; new_sub_misc = SUB_QNET;
} }
else if(type == IMPORT_LIST_TYPE_NEWSGROUPS) {
char* p=str;
SKIP_WHITESPACE(p);
if(*p == 0)
continue;
char* tp = p + 1;
FIND_WHITESPACE(tp);
*tp = 0;
SAFECOPY(tmpsub.newsgroup, p);
if(strlen(p) > grpname_len && strnicmp(p, cfg.grp[grpnum]->sname, grpname_len) == 0)
p += grpname_len;
SKIP_CHAR(p, '.');
SAFECOPY(tmp_code, p);
SAFECOPY(tmpsub.lname, p);
SAFECOPY(tmpsub.sname, p);
SAFECOPY(tmpsub.qwkname, p);
new_sub_misc = SUB_INET;
}
else { else {
new_sub_misc = SUB_FIDO; new_sub_misc = SUB_FIDO;
char* p=str; char* p=str;
...@@ -279,7 +297,9 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum ...@@ -279,7 +297,9 @@ long import_msg_areas(enum import_list_type type, FILE* stream, unsigned grpnum
truncsp(tmpsub.sname); truncsp(tmpsub.sname);
truncsp(tmpsub.lname); truncsp(tmpsub.lname);
truncsp(tmpsub.qwkname); truncsp(tmpsub.qwkname);
if(tmpsub.qwkname[0] == 0) {
SAFECOPY(tmpsub.qwkname, tmpsub.sname); SAFECOPY(tmpsub.qwkname, tmpsub.sname);
}
if(tmpsub.code_suffix[0]==0 || tmpsub.sname[0]==0) if(tmpsub.code_suffix[0]==0 || tmpsub.sname[0]==0)
continue; continue;
...@@ -834,6 +854,7 @@ void msgs_cfg() ...@@ -834,6 +854,7 @@ void msgs_cfg()
strcpy(opt[k++],"areas.bbs SBBSecho Area File"); strcpy(opt[k++],"areas.bbs SBBSecho Area File");
strcpy(opt[k++],"backbone.na FidoNet EchoList"); strcpy(opt[k++],"backbone.na FidoNet EchoList");
strcpy(opt[k++],"badareas.lst SBBSecho Bad Area List"); strcpy(opt[k++],"badareas.lst SBBSecho Bad Area List");
strcpy(opt[k++],"newsgroup.lst Newsgroup List");
opt[k][0]=0; opt[k][0]=0;
uifc.helpbuf= uifc.helpbuf=
"`Import Area File Format:`\n" "`Import Area File Format:`\n"
...@@ -853,6 +874,9 @@ void msgs_cfg() ...@@ -853,6 +874,9 @@ void msgs_cfg()
"`backbone.na` (also `fidonet.na` and `badareas.lst`)\n" "`backbone.na` (also `fidonet.na` and `badareas.lst`)\n"
" FidoNet standard EchoList containing standardized echo `Area Tags`\n" " FidoNet standard EchoList containing standardized echo `Area Tags`\n"
" and (optional) descriptions.\n" " and (optional) descriptions.\n"
"\n"
"`newsgroup.list`\n"
" A simple listing of newsgroup names, one line per group.\n"
; ;
k=uifc.list(WIN_MID|WIN_ACT,0,0,0,&import_list_type,0 k=uifc.list(WIN_MID|WIN_ACT,0,0,0,&import_list_type,0
,"Import Area File Format",opt); ,"Import Area File Format",opt);
...@@ -875,6 +899,9 @@ void msgs_cfg() ...@@ -875,6 +899,9 @@ void msgs_cfg()
case IMPORT_LIST_TYPE_BACKBONE_NA: case IMPORT_LIST_TYPE_BACKBONE_NA:
sprintf(filename, "backbone.na"); sprintf(filename, "backbone.na");
break; break;
case IMPORT_LIST_TYPE_NEWSGROUPS:
SAFECOPY(filename, "newsgroup.lst");
break;
default: default:
sprintf(filename,"%sbadareas.lst", cfg.data_dir); sprintf(filename,"%sbadareas.lst", cfg.data_dir);
k = IMPORT_LIST_TYPE_BACKBONE_NA; k = IMPORT_LIST_TYPE_BACKBONE_NA;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment