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 d8dbdf23 authored by rswindell's avatar rswindell

Added support for 16-char sub/dir internal codes by using new (optional)

grp/lib code prefix (helps generate unique internal codes).
parent 326b6561
......@@ -166,9 +166,7 @@ void prep_cfg(scfg_t* cfg)
#endif
for(i=0;i<cfg->total_subs;i++) {
#ifdef __unix__
strlwr(cfg->sub[i]->code); /* temporary Unix-compatibility hack */
#endif
if(!cfg->sub[i]->data_dir[0]) /* no data storage path specified */
sprintf(cfg->sub[i]->data_dir,"%ssubs",cfg->data_dir);
prep_dir(cfg->ctrl_dir, cfg->sub[i]->data_dir, sizeof(cfg->sub[i]->data_dir));
......@@ -184,6 +182,13 @@ void prep_cfg(scfg_t* cfg)
/* default origin line */
if(!cfg->sub[i]->origline[0])
strcpy(cfg->sub[i]->origline,cfg->origline);
/* A sub-board's internal code is the combination of the grp's code_prefix & the sub's code_suffix */
sprintf(cfg->sub[i]->code,"%s%s"
,cfg->grp[cfg->sub[i]->grp]->code_prefix
,cfg->sub[i]->code_suffix);
strlwr(cfg->sub[i]->code); /* data filenames are all lowercase */
}
for(i=0;i<cfg->total_libs;i++) {
......@@ -192,9 +197,6 @@ void prep_cfg(scfg_t* cfg)
}
for(i=0;i<cfg->total_dirs;i++) {
#ifdef __unix__
strlwr(cfg->dir[i]->code); /* temporary Unix-compatibility hack */
#endif
if(!cfg->dir[i]->data_dir[0]) /* no data storage path specified */
sprintf(cfg->dir[i]->data_dir,"%sdirs",cfg->data_dir);
......@@ -207,29 +209,35 @@ void prep_cfg(scfg_t* cfg)
else
prep_dir(cfg->ctrl_dir, cfg->dir[i]->path, sizeof(cfg->dir[i]->path));
/* A directory's internal code is the combination of the lib's code_prefix & the dir's code_suffix */
sprintf(cfg->dir[i]->code,"%s%s"
,cfg->lib[cfg->dir[i]->lib]->code_prefix
,cfg->dir[i]->code_suffix);
strlwr(cfg->dir[i]->code); /* data filenames are all lowercase */
prep_path(cfg->dir[i]->upload_sem);
}
#ifdef __unix__
/* make data filenames are all lowercase */
for(i=0;i<cfg->total_shells;i++)
strlwr(cfg->shell[i]->code); /* temporary Unix-compatibility hack */
strlwr(cfg->shell[i]->code);
for(i=0;i<cfg->total_gurus;i++)
strlwr(cfg->guru[i]->code); /* temporary Unix-compatibility hack */
strlwr(cfg->guru[i]->code);
for(i=0;i<cfg->total_txtsecs;i++)
strlwr(cfg->txtsec[i]->code); /* temporary Unix-compatibility hack */
strlwr(cfg->txtsec[i]->code);
for(i=0;i<cfg->total_xtrnsecs;i++)
strlwr(cfg->xtrnsec[i]->code); /* temporary Unix-compatibility hack */
#endif
strlwr(cfg->xtrnsec[i]->code);
for(i=0;i<cfg->total_xtrns;i++) {
prep_dir(cfg->ctrl_dir, cfg->xtrn[i]->path, sizeof(cfg->xtrn[i]->path));
}
for(i=0;i<cfg->total_events;i++) {
#ifdef __unix__
strlwr(cfg->event[i]->code); /* temporary Unix-compatibility hack */
#endif
strlwr(cfg->event[i]->code); /* data filenames are all lowercase */
prep_dir(cfg->ctrl_dir, cfg->event[i]->dir, sizeof(cfg->event[i]->dir));
}
......
......@@ -549,9 +549,8 @@ typedef enum { /* Values for xtrn_t.event */
#define U_MISC U_SEX+1 /* Miscellaneous flags in 8byte hex */
#define U_OLDXEDIT U_MISC+8 /* External editor (Version 1 method */
#define U_LEECH U_OLDXEDIT+2 /* two hex digits - leech attempt count */
#define U_CURSUB U_LEECH+2 /* Current sub (internal code */
#define U_CURDIR U_CURSUB+8 /* Current dir (internal code */
#define U_CURXTRN U_CURDIR+8 /* unused */
#define U_CURSUB U_LEECH+2 /* Current sub (internal code) */
#define U_CURXTRN U_CURSUB+16 /* Current xtrn (internal code) */
#define U_MAIN_CMD U_CURXTRN+8+2 /* unused */
#define U_XFER_CMD U_MAIN_CMD+LEN_MAIN_CMD /* unused */
#define U_SCAN_CMD U_XFER_CMD+LEN_XFER_CMD+2 /* unused */
......@@ -567,8 +566,9 @@ typedef enum { /* Values for xtrn_t.event */
#define U_NS_TIME U_CHAT+8 /* New-file scan date/time */
#define U_PROT U_NS_TIME+8 /* Default transfer protocol */
#define U_LOGONTIME U_PROT+1
#define U_UNUSED U_LOGONTIME+8
#define U_LEN (U_UNUSED+20+2)
#define U_CURDIR U_LOGONTIME+8 /* Current dir (internal code */
#define U_UNUSED U_CURDIR+16
#define U_LEN (U_UNUSED+4+2)
/****************************************************************************/
/* Offsets into DIR .DAT file for different fields for each file */
......@@ -909,8 +909,8 @@ typedef struct { /* Users information */
netmail[LEN_NETMAIL+1], /* NetMail forwarding address */
tmpext[4], /* QWK Packet extension */
comment[LEN_COMMENT+1], /* Private comment about user */
cursub[9], /* Current sub-board internal code */
curdir[9], /* Current directory internal code */
cursub[(LEN_CODE*2)+1], /* Current sub-board internal code */
curdir[(LEN_CODE*2)+1], /* Current directory internal code */
curxtrn[9]; /* Current external program internal code */
uchar level, /* Security level */
......
This diff is collapsed.
......@@ -243,7 +243,9 @@ select Yes.
if(j==0)
for(j=0;j<cfg.total_subs;j++)
if(cfg.sub[j]->grp==i) {
sprintf(str,"%s.s*",cfg.sub[j]->code);
sprintf(str,"%s%s.s*"
,cfg.grp[cfg.sub[j]->grp]->code_prefix
,cfg.sub[j]->code_suffix);
strlwr(str);
if(!cfg.sub[j]->data_dir[0])
sprintf(tmp,"%ssubs/",cfg.data_dir);
......@@ -288,6 +290,7 @@ select Yes.
j=0;
sprintf(opt[j++],"%-27.27s%s","Long Name",cfg.grp[i]->lname);
sprintf(opt[j++],"%-27.27s%s","Short Name",cfg.grp[i]->sname);
sprintf(opt[j++],"%-27.27s%s","Internal Code Prefix",cfg.grp[i]->code_prefix);
sprintf(opt[j++],"%-27.27s%.40s","Access Requirements"
,cfg.grp[i]->arstr);
strcpy(opt[j++],"Clone Options");
......@@ -334,10 +337,23 @@ main menu and reading messages prompts.
,cfg.grp[i]->sname,LEN_GSNAME,K_EDIT);
break;
case 2:
SETHELP(WHERE);
/*
`Internal Code Prefix:`
This is an `optional` code prefix used to help generate unique internal
codes for the sub-boards in this message group. If this option
is used, sub-board internal codes will be made up of this prefix and the
specified code suffix for each sub-board.
*/
uifc.input(WIN_MID|WIN_SAV,0,17,"Internal Code Prefix"
,cfg.grp[i]->code_prefix,LEN_CODE,K_EDIT|K_UPPER);
break;
case 3:
sprintf(str,"%s Group",cfg.grp[i]->sname);
getar(str,cfg.grp[i]->arstr);
break;
case 3: /* Clone Options */
case 4: /* Clone Options */
j=0;
strcpy(opt[0],"Yes");
strcpy(opt[1],"No");
......@@ -381,7 +397,7 @@ of CRCs, maximum age of messages, storage method, and data directory.
cfg.sub[j]->faddr=cfg.sub[k]->faddr; } } }
break;
case 4:
case 5:
k=0;
ported=0;
q=uifc.changes;
......@@ -447,32 +463,44 @@ export the current message group into.
continue;
ported++;
if(k==1) { /* AREAS.BBS *.MSG */
sprintf(str,"%s%s/",cfg.echomail_dir,cfg.sub[j]->code);
sprintf(str,"%s%s%s/"
,cfg.echomail_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==2) { /* AREAS.BBS SMB */
if(!cfg.sub[j]->data_dir[0])
sprintf(str,"%ssubs/%s",cfg.data_dir,cfg.sub[j]->code);
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",cfg.sub[j]->data_dir,cfg.sub[j]->code);
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,"%-30s %-20s %s\r\n"
,cfg.sub[j]->code,stou(cfg.sub[j]->sname),str2);
fprintf(stream,"%s%-30s %-20s %s\r\n"
,cfg.grp[cfg.sub[j]->grp]->code_prefix
,cfg.sub[j]->code_suffix
,stou(cfg.sub[j]->sname)
,str2);
continue; }
if(k==4) { /* FIDONET.NA */
fprintf(stream,"%-20s %s\r\n"
,stou(cfg.sub[j]->sname),cfg.sub[j]->lname);
continue; }
fprintf(stream,"%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n"
fprintf(stream,"%s\r\n%s\r\n%s\r\n%s%s\r\n%s\r\n%s\r\n"
"%s\r\n%s\r\n%s\r\n"
,cfg.sub[j]->lname
,cfg.sub[j]->sname
,cfg.sub[j]->qwkname
,cfg.sub[j]->code
,cfg.grp[cfg.sub[j]->grp]->code_prefix,cfg.sub[j]->code_suffix
,cfg.sub[j]->data_dir
,cfg.sub[j]->arstr
,cfg.sub[j]->read_arstr
......@@ -501,7 +529,7 @@ export the current message group into.
uifc.msg(str);
uifc.changes=q;
break;
case 5:
case 6:
ported=0;
k=0;
strcpy(opt[k++],"SUBS.TXT (Synchronet)");
......@@ -558,7 +586,7 @@ import into the current message group.
else p=str;
//sprintf(tmpsub.echopath,"%.*s",LEN_DIR,str);
p++;
sprintf(tmpsub.code,"%.8s",p);
sprintf(tmpsub.code_suffix,"%.8s",p);
while(*p && *p<=SP) p++;
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,p);
p=strchr(tmpsub.sname,SP);
......@@ -576,7 +604,7 @@ import into the current message group.
else p=str;
sprintf(tmpsub.data_dir,"%.*s",LEN_DIR,str);
p++;
sprintf(tmpsub.code,"%.8s",p);
sprintf(tmpsub.code_suffix,"%.8s",p);
while(*p && *p<=SP) p++;
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,p);
p=strchr(tmpsub.sname,SP);
......@@ -591,7 +619,7 @@ import into the current message group.
p=str;
while(*p && *p>SP) p++;
*p=0;
sprintf(tmpsub.code,"%.8s",str);
sprintf(tmpsub.code_suffix,"%.8s",str);
p++;
while(*p && *p<=SP) p++;
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,p);
......@@ -607,7 +635,7 @@ import into the current message group.
p=str;
while(*p && *p>SP) p++;
*p=0;
sprintf(tmpsub.code,"%.8s",str);
sprintf(tmpsub.code_suffix,"%.8s",str);
sprintf(tmpsub.sname,"%.*s",LEN_SSNAME,utos(str));
sprintf(tmpsub.qwkname,"%.10s",tmpsub.sname);
p++;
......@@ -627,7 +655,7 @@ import into the current message group.
sprintf(tmpsub.qwkname,"%.*s",10,str);
if(!fgets(str,128,stream)) break;
truncsp(str);
sprintf(tmpsub.code,"%.*s",8,str);
sprintf(tmpsub.code_suffix,"%.*s",8,str);
if(!fgets(str,128,stream)) break;
truncsp(str);
sprintf(tmpsub.data_dir,"%.*s",LEN_DIR,str);
......@@ -683,15 +711,15 @@ import into the current message group.
if(!fgets(str,128,stream)) break;
truncsp(str); } }
truncsp(tmpsub.code);
strip_slash(tmpsub.code);
truncsp(tmpsub.code_suffix);
strip_slash(tmpsub.code_suffix);
truncsp(tmpsub.sname);
truncsp(tmpsub.lname);
truncsp(tmpsub.qwkname);
for(j=0;j<cfg.total_subs;j++) {
if(cfg.sub[j]->grp!=i)
continue;
if(!stricmp(cfg.sub[j]->code,tmpsub.code))
if(!stricmp(cfg.sub[j]->code_suffix,tmpsub.code_suffix))
break; }
if(j==cfg.total_subs) {
......@@ -720,7 +748,7 @@ import into the current message group.
cfg.sub[j]->grp=i;
if(cfg.total_faddrs)
cfg.sub[j]->faddr=cfg.faddr[0];
strcpy(cfg.sub[j]->code,tmpsub.code);
strcpy(cfg.sub[j]->code_suffix,tmpsub.code_suffix);
strcpy(cfg.sub[j]->sname,tmpsub.sname);
strcpy(cfg.sub[j]->lname,tmpsub.lname);
strcpy(cfg.sub[j]->qwkname,tmpsub.qwkname);
......@@ -740,7 +768,7 @@ import into the current message group.
uifc.msg(str);
break;
case 6:
case 7:
sub_cfg(i);
break; } } }
......
This diff is collapsed.
......@@ -43,7 +43,8 @@
#include "startup.h"
typedef struct { /* Message sub board info */
char code[LEN_CODE+1]; /* Eight character code */
char code[(LEN_CODE*2)+1]; /* Internal code (with optional lib prefix) */
char code_suffix[LEN_CODE+1]; /* Eight character code suffix */
char lname[LEN_SLNAME+1], /* Short name - used for prompts */
sname[LEN_SSNAME+1], /* Long name - used for listing */
arstr[LEN_ARSTR+1], /* Access requirements */
......@@ -76,13 +77,15 @@ typedef struct { /* Message sub board info */
typedef struct { /* Message group info */
char lname[LEN_GLNAME+1], /* Short name */
sname[LEN_GSNAME+1], /* Long name */
arstr[LEN_ARSTR+1]; /* Access requirements */
arstr[LEN_ARSTR+1], /* Access requirements */
code_prefix[LEN_CODE+1]; /* Prefix for internal code */
uchar *ar;
} grp_t;
typedef struct { /* Transfer Directory Info */
char code[LEN_CODE+1]; /* Eight character code */
char code[(LEN_CODE*2)+1]; /* Internal code (with optional lib prefix) */
char code_suffix[LEN_CODE+1]; /* Eight character code suffix */
char lname[LEN_SLNAME+1], /* Short name - used for prompts */
sname[LEN_SSNAME+1], /* Long name - used for listing */
arstr[LEN_ARSTR+1], /* Access Requirements */
......@@ -114,6 +117,7 @@ typedef struct { /* Transfer Library Information */
char lname[LEN_GLNAME+1], /* Short Name - used for prompts */
sname[LEN_GSNAME+1], /* Long Name - used for listings */
arstr[LEN_ARSTR+1], /* Access Requirements */
code_prefix[LEN_CODE+1], /* Prefix for internal code */
parent_path[48]; /* Parent for dir paths */
uchar *ar;
ushort offline_dir; /* Offline file directory */
......
......@@ -465,7 +465,10 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error)
get_str(cfg->grp[i]->arstr,instream);
cfg->grp[i]->ar=arstr(NULL,cfg->grp[i]->arstr,cfg);
for(j=0;j<48;j++)
get_str(cfg->grp[i]->code_prefix,instream);
get_int(c,instream);
for(j=0;j<43;j++)
get_int(n,instream);
}
cfg->total_grps=i;
......@@ -492,7 +495,7 @@ BOOL read_msgs_cfg(scfg_t* cfg, char* error)
get_str(cfg->sub[i]->lname,instream);
get_str(cfg->sub[i]->sname,instream);
get_str(cfg->sub[i]->qwkname,instream);
get_str(cfg->sub[i]->code,instream);
get_str(cfg->sub[i]->code_suffix,instream);
get_str(cfg->sub[i]->data_dir,instream);
get_str(cfg->sub[i]->arstr,instream);
......
......@@ -304,7 +304,11 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
get_str(cfg->lib[i]->parent_path,instream);
for(j=0;j<8;j++)
get_str(cfg->lib[i]->code_prefix,instream);
get_int(c,instream);
for(j=0;j<3;j++)
get_int(n,instream); /* 0x0000 */
for(j=0;j<16;j++)
......@@ -344,7 +348,7 @@ BOOL read_file_cfg(scfg_t* cfg, char* error)
else if(!stricmp(cfg->dir[i]->sname,"OFFLINE")) /* Offline files dir */
cfg->lib[cfg->dir[i]->lib]->offline_dir=i;
get_str(cfg->dir[i]->code,instream);
get_str(cfg->dir[i]->code_suffix,instream);
get_str(cfg->dir[i]->data_dir,instream);
......
......@@ -422,8 +422,11 @@ BOOL DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level)
put_str(cfg->grp[i]->lname,stream);
put_str(cfg->grp[i]->sname,stream);
put_str(cfg->grp[i]->arstr,stream);
put_str(cfg->grp[i]->code_prefix,stream);
c=0;
put_int(c,stream);
n=0;
for(j=0;j<32;j++)
for(j=0;j<27;j++)
put_int(n,stream);
n=(short)0xffff;
for(j=0;j<16;j++)
......@@ -445,7 +448,7 @@ BOOL DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level)
put_str(cfg->sub[i]->lname,stream);
put_str(cfg->sub[i]->sname,stream);
put_str(cfg->sub[i]->qwkname,stream);
put_str(cfg->sub[i]->code,stream);
put_str(cfg->sub[i]->code_suffix,stream);
#if 1
if(cfg->sub[i]->data_dir[0]) {
backslash(cfg->sub[i]->data_dir);
......@@ -482,7 +485,8 @@ BOOL DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level)
else
sprintf(smb.file,"%s",cfg->sub[i]->data_dir);
prep_dir(cfg->ctrl_dir,smb.file,sizeof(smb.file));
strcat(smb.file,cfg->sub[i]->code);
strcat(smb.file,cfg->grp[cfg->sub[i]->grp]->code_prefix);
strcat(smb.file,cfg->sub[i]->code_suffix);
if(smb_open(&smb)!=0) {
/* errormsg(WHERE,ERR_OPEN,smb.file,x); */
continue;
......@@ -784,9 +788,12 @@ BOOL DLLCALL write_file_cfg(scfg_t* cfg, int backup_level)
put_str(cfg->lib[i]->sname,stream);
put_str(cfg->lib[i]->arstr,stream);
put_str(cfg->lib[i]->parent_path,stream);
put_str(cfg->lib[i]->code_prefix,stream);
c=0;
put_int(c,stream);
n=(short)0x0000;
for(j=0;j<8;j++)
for(j=0;j<3;j++)
put_int(n,stream);
n=(short)0xffff;
......@@ -803,7 +810,7 @@ BOOL DLLCALL write_file_cfg(scfg_t* cfg, int backup_level)
put_int(cfg->dir[i]->lib,stream);
put_str(cfg->dir[i]->lname,stream);
put_str(cfg->dir[i]->sname,stream);
put_str(cfg->dir[i]->code,stream);
put_str(cfg->dir[i]->code_suffix,stream);
#if 1
if(cfg->dir[i]->data_dir[0]) {
backslash(cfg->dir[i]->data_dir);
......@@ -821,7 +828,10 @@ BOOL DLLCALL write_file_cfg(scfg_t* cfg, int backup_level)
if(cfg->dir[i]->misc&DIR_FCHK) {
SAFECOPY(path,cfg->dir[i]->path);
if(!path[0]) /* no file storage path specified */
sprintf(path,"%sdirs/%s/",cfg->data_dir,cfg->dir[i]->code);
sprintf(path,"%sdirs/%s%s/"
,cfg->data_dir
,cfg->lib[cfg->dir[i]->lib]->code_prefix
,cfg->dir[i]->code_suffix);
else if(cfg->lib[cfg->dir[i]->lib]->parent_path[0]) {
SAFECOPY(path,cfg->lib[cfg->dir[i]->lib]->parent_path);
prep_dir(cfg->ctrl_dir,path,sizeof(path));
......
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