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

Overhauled the importing of AREAS.BBS - now supports lines that begin with

white-space, no longer unnecessarily truncates long descriptions (SBBSecho
format from echotags, which are never really that long anyway).
Using new xpdev macros and functions for easy string parsing/pruning.
Skips group's internal code prefix if part of imported internal code.
Eliminated import/export of the SMB-format AREAS.BBS (unused and confusing).
parent 0640d7e2
No related branches found
No related tags found
No related merge requests found
...@@ -115,10 +115,12 @@ void clearptrs(int subnum) ...@@ -115,10 +115,12 @@ void clearptrs(int subnum)
void msgs_cfg() void msgs_cfg()
{ {
static int dflt,msgs_dflt,bar; static int dflt,msgs_dflt,bar;
char str[256],str2[256],done=0,*p; char str[256],str2[256],done=0;
char* p;
char* tp;
char tmp[128]; char tmp[128];
char tmp_code[16]; char tmp_code[16];
int j,k,q,s; int j,k,l,q,s;
int i,file,ptridx,n; int i,file,ptridx,n;
long ported; long ported;
sub_t tmpsub; sub_t tmpsub;
...@@ -389,8 +391,7 @@ of CRCs, maximum age of messages, storage method, and data directory. ...@@ -389,8 +391,7 @@ of CRCs, maximum age of messages, storage method, and data directory.
q=uifc.changes; q=uifc.changes;
strcpy(opt[k++],"SUBS.TXT (Synchronet)"); strcpy(opt[k++],"SUBS.TXT (Synchronet)");
strcpy(opt[k++],"AREAS.BBS (MSG)"); strcpy(opt[k++],"AREAS.BBS (MSG)");
strcpy(opt[k++],"AREAS.BBS (SMB)"); strcpy(opt[k++],"AREAS.BBS (SBBSecho)");
strcpy(opt[k++],"AREAS.BBS (SBBSECHO)");
strcpy(opt[k++],"FIDONET.NA (Fido)"); strcpy(opt[k++],"FIDONET.NA (Fido)");
opt[k][0]=0; opt[k][0]=0;
SETHELP(WHERE); SETHELP(WHERE);
...@@ -407,14 +408,13 @@ export the current message group into. ...@@ -407,14 +408,13 @@ export the current message group into.
break; break;
if(k==0) if(k==0)
sprintf(str,"%sSUBS.TXT",cfg.ctrl_dir); sprintf(str,"%sSUBS.TXT",cfg.ctrl_dir);
else if(k==1 || k==2) else if(k==1)
sprintf(str,"AREAS.BBS"); sprintf(str,"AREAS.BBS");
else if(k==3) else if(k==2)
sprintf(str,"%sAREAS.BBS",cfg.data_dir); sprintf(str,"%sAREAS.BBS",cfg.data_dir);
else if(k==4) else if(k==3)
sprintf(str,"FIDONET.NA"); sprintf(str,"FIDONET.NA");
strupr(str); if(k && k<3)
if(k && k<4)
if(uifc.input(WIN_MID|WIN_SAV,0,0,"Uplinks" if(uifc.input(WIN_MID|WIN_SAV,0,0,"Uplinks"
,str2,40,0)<=0) { ,str2,40,0)<=0) {
uifc.changes=q; uifc.changes=q;
...@@ -456,28 +456,14 @@ export the current message group into. ...@@ -456,28 +456,14 @@ export the current message group into.
fprintf(stream,"%-30s %-20s %s\r\n" fprintf(stream,"%-30s %-20s %s\r\n"
,str,stou(cfg.sub[j]->sname),str2); ,str,stou(cfg.sub[j]->sname),str2);
continue; } continue; }
if(k==2) { /* AREAS.BBS SMB */ if(k==2) { /* AREAS.BBS SBBSecho */
if(!cfg.sub[j]->data_dir[0])
sprintf(str,"%ssubs/%s%s"
,cfg.data_dir
,cfg.grp[cfg.sub[j]->grp]->code_prefix
,cfg.sub[j]->code_suffix);
else
sprintf(str,"%s%s%s"
,cfg.sub[j]->data_dir
,cfg.grp[cfg.sub[j]->grp]->code_prefix
,cfg.sub[j]->code_suffix);
fprintf(stream,"%-30s %-20s %s\r\n"
,str,stou(cfg.sub[j]->sname),str2);
continue; }
if(k==3) { /* AREAS.BBS SBBSECHO */
fprintf(stream,"%s%-30s %-20s %s\r\n" fprintf(stream,"%s%-30s %-20s %s\r\n"
,cfg.grp[cfg.sub[j]->grp]->code_prefix ,cfg.grp[cfg.sub[j]->grp]->code_prefix
,cfg.sub[j]->code_suffix ,cfg.sub[j]->code_suffix
,stou(cfg.sub[j]->sname) ,stou(cfg.sub[j]->sname)
,str2); ,str2);
continue; } continue; }
if(k==4) { /* FIDONET.NA */ if(k==3) { /* FIDONET.NA */
fprintf(stream,"%-20s %s\r\n" fprintf(stream,"%-20s %s\r\n"
,stou(cfg.sub[j]->sname),cfg.sub[j]->lname); ,stou(cfg.sub[j]->sname),cfg.sub[j]->lname);
continue; } continue; }
...@@ -520,8 +506,7 @@ export the current message group into. ...@@ -520,8 +506,7 @@ export the current message group into.
k=0; k=0;
strcpy(opt[k++],"SUBS.TXT (Synchronet)"); strcpy(opt[k++],"SUBS.TXT (Synchronet)");
strcpy(opt[k++],"AREAS.BBS (Generic)"); strcpy(opt[k++],"AREAS.BBS (Generic)");
strcpy(opt[k++],"AREAS.BBS (SMB)"); strcpy(opt[k++],"AREAS.BBS (SBBSecho)");
strcpy(opt[k++],"AREAS.BBS (SBBSECHO)");
strcpy(opt[k++],"FIDONET.NA (Fido)"); strcpy(opt[k++],"FIDONET.NA (Fido)");
opt[k][0]=0; opt[k][0]=0;
SETHELP(WHERE); SETHELP(WHERE);
...@@ -538,13 +523,12 @@ import into the current message group. ...@@ -538,13 +523,12 @@ import into the current message group.
break; break;
if(k==0) if(k==0)
sprintf(str,"%sSUBS.TXT",cfg.ctrl_dir); sprintf(str,"%sSUBS.TXT",cfg.ctrl_dir);
else if(k==1 || k==2) else if(k==1)
sprintf(str,"AREAS.BBS"); sprintf(str,"AREAS.BBS");
else if(k==3) else if(k==2)
sprintf(str,"%sAREAS.BBS",cfg.data_dir); sprintf(str,"%sAREAS.BBS",cfg.data_dir);
else if(k==4) else if(k==3)
sprintf(str,"FIDONET.NA"); sprintf(str,"FIDONET.NA");
strupr(str);
if(uifc.input(WIN_MID|WIN_SAV,0,0,"Filename" if(uifc.input(WIN_MID|WIN_SAV,0,0,"Filename"
,str,40,K_EDIT)<=0) ,str,40,K_EDIT)<=0)
break; break;
...@@ -567,61 +551,43 @@ import into the current message group. ...@@ -567,61 +551,43 @@ import into the current message group.
(SUB_FIDO|SUB_NAME|SUB_TOUSER|SUB_QUOTE|SUB_HYPER); (SUB_FIDO|SUB_NAME|SUB_TOUSER|SUB_QUOTE|SUB_HYPER);
if(k==1) { /* AREAS.BBS Generic/*.MSG */ if(k==1) { /* AREAS.BBS Generic/*.MSG */
p=str; p=str;
while(*p && *p<=' ') p++; // Find path SKIP_WHITESPACE(p); /* Find path */
while(*p && *p>' ') p++; // Skip path FIND_WHITESPACE(p); /* Skip path */
while(*p && *p<=' ') p++; // Find tag SKIP_WHITESPACE(p); /* Find tag */
truncstr(p," \t"); truncstr(p," \t"); /* Truncate tag */
SAFECOPY(tmp_code,p); SAFECOPY(tmp_code,p); /* Copy tag to internal code */
SAFECOPY(tmpsub.sname,utos(p));
SAFECOPY(tmpsub.lname,utos(p)); SAFECOPY(tmpsub.lname,utos(p));
SAFECOPY(tmpsub.qwkname,utos(p)); SAFECOPY(tmpsub.sname,tmpsub.lname);
} SAFECOPY(tmpsub.qwkname,tmpsub.qwkname);
if(k==2) { /* AREAS.BBS SMB */
p=strrchr(str,'\\');
if(p==NULL) p=strrchr(str,'/');
if(p) *p=0;
else p=str;
sprintf(tmpsub.data_dir,"%.*s",LEN_DIR,str);
p++;
SAFECOPY(tmp_code,p);
while(*p && *p<=SP) p++;
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,p);
p=strchr(tmpsub.sname,SP);
if(p) *p=0;
strcpy(tmpsub.sname,utos(tmpsub.sname));
sprintf(tmpsub.lname,"%.*s",LEN_SLNAME
,tmpsub.sname);
sprintf(tmpsub.qwkname,"%.*s",10
,tmpsub.sname);
} }
else if(k==3) { /* AREAS.BBS SBBSECHO */ else if(k==2) { /* AREAS.BBS SBBSecho */
p=str; p=str;
while(*p && *p>SP) p++; SKIP_WHITESPACE(p); /* Find internal code */
*p=0; tp=p;
SAFECOPY(tmp_code,str); FIND_WHITESPACE(tp);
p++; *tp=0; /* Truncate internal code */
while(*p && *p<=SP) p++; SAFECOPY(tmp_code,p); /* Copy internal code suffix */
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,p); p=tp+1;
p=strchr(tmpsub.sname,SP); SKIP_WHITESPACE(p); /* Find echo tag */
if(p) *p=0; SAFECOPY(tmpsub.lname,truncstr(utos(p)," \t"));
strcpy(tmpsub.sname,utos(tmpsub.sname)); SAFECOPY(tmpsub.sname,tmpsub.lname);
sprintf(tmpsub.lname,"%.*s",LEN_SLNAME SAFECOPY(tmpsub.qwkname,tmpsub.sname);
,tmpsub.sname);
sprintf(tmpsub.qwkname,"%.*s",10
,tmpsub.sname);
} }
else if(k==4) { /* FIDONET.NA */ else if(k==3) { /* FIDONET.NA */
p=str; p=str;
while(*p && *p>SP) p++; SKIP_WHITESPACE(p); /* Find echo tag */
*p=0; tp=p;
SAFECOPY(tmp_code,str); FIND_WHITESPACE(tp); /* Find end of tag */
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,utos(str)); *tp=0; /* Truncate echo tag */
sprintf(tmpsub.qwkname,"%.10s",tmpsub.sname); SAFECOPY(tmp_code,p); /* Copy tag to internal code suffix */
p++; SAFECOPY(tmpsub.sname,utos(p)); /* ... to short name, converting underscores to spaces */
while(*p && *p<=SP) p++; SAFECOPY(tmpsub.qwkname,tmpsub.sname); /* ... to QWK name .... */
sprintf(tmpsub.lname,"%.*s",LEN_SLNAME,p); p=tp+1;
SKIP_WHITESPACE(p); /* Find description */
SAFECOPY(tmpsub.lname,p); /* Copy description to long name */
}
ported++;
} }
ported++; }
else { else {
memset(&tmpsub,0,sizeof(sub_t)); memset(&tmpsub,0,sizeof(sub_t));
tmpsub.grp=i; tmpsub.grp=i;
...@@ -688,10 +654,16 @@ import into the current message group. ...@@ -688,10 +654,16 @@ import into the current message group.
while(!feof(stream) while(!feof(stream)
&& strcmp(str,"***END-OF-SUB***")) { && strcmp(str,"***END-OF-SUB***")) {
if(!fgets(str,128,stream)) break; if(!fgets(str,128,stream)) break;
truncsp(str); } } truncsp(str);
}
}
prep_code(tmp_code); /* Strip invalid chars */ p=tmp_code;
SAFECOPY(tmpsub.code_suffix,tmp_code); /* THEN truncate to valid length */ l=strlen(cfg.grp[i]->code_prefix);
if(l && strnicmp(p,cfg.grp[i]->code_prefix,l)==0 && strlen(p)!=l)
p+=l; /* Skip code prefix, if supplied */
prep_code(p); /* Strip invalid chars */
SAFECOPY(tmpsub.code_suffix,p); /* THEN truncate to valid length */
truncsp(tmpsub.sname); truncsp(tmpsub.sname);
truncsp(tmpsub.lname); truncsp(tmpsub.lname);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment