Support up to 16-character internal codes for Synchronet, patch by Rob Swindell, 1:103/705
This commit is contained in:
parent
c24758eb5b
commit
b56cd0ed8c
@ -43,6 +43,8 @@
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
const int LEN_CODE = 8; // Maximum length of internal codes
|
||||
const int LEN_EXTCODE = (LEN_CODE*2); // Code prefix + suffix
|
||||
const int LEN_DIR = 63; // Maximum length of directory paths
|
||||
const int LEN_ARSTR = 40; // Max length of Access Requirement string
|
||||
const int LEN_GSNAME = 15; // Group/Lib short name
|
||||
@ -91,7 +93,8 @@ typedef struct { // Message group info
|
||||
char lname[LEN_GLNAME+1], // Short name
|
||||
sname[LEN_GSNAME+1]; // Long name
|
||||
uint8_t ar[LEN_ARSTR+1], // Access requirements
|
||||
unused[96]; // unused
|
||||
code_prefix[LEN_CODE+1], // Prefix for internal code of every sub in this group
|
||||
unused[87]; // unused
|
||||
} grp_t;
|
||||
|
||||
typedef struct { // Message sub board info
|
||||
@ -99,7 +102,7 @@ typedef struct { // Message sub board info
|
||||
char lname[LEN_SLNAME+1], // Long name - used for listing
|
||||
sname[LEN_SSNAME+1], // Short name - used for prompts
|
||||
qwkname[LEN_SQWKNAME+1], // QWK name
|
||||
code[9], // Eight character code
|
||||
code_suffix[LEN_CODE+1], // Internal code (or just suffix)
|
||||
data_dir[LEN_DIR+1]; // Data file directory
|
||||
uint8_t ar[LEN_ARSTR+1], // Access requirements
|
||||
read_ar[LEN_ARSTR+1], // Read requirements
|
||||
@ -116,8 +119,9 @@ typedef struct { // Message sub board info
|
||||
uint16_t maxage, // Max age of messages (in days)
|
||||
ptridx; // Index into pointer file
|
||||
uint8_t mod_ar[LEN_ARSTR+1]; // Moderated user requirements
|
||||
uint16_t qwkconf; // QWK configuration
|
||||
uint8_t unused[53]; // unused
|
||||
uint16_t qwkconf; // QWK conference number
|
||||
char code[LEN_EXTCODE+1]; // Not actually read from the .cnf file
|
||||
uint8_t unused[36]; // unused
|
||||
} sub_t;
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -44,7 +44,6 @@ void gareafile::ReadSynchronet(char* tag) {
|
||||
Path file, path;
|
||||
char options[80];
|
||||
uint16_t shrt, i;
|
||||
grp_t grp;
|
||||
sub_t sub;
|
||||
|
||||
strcpy(options, tag);
|
||||
@ -102,9 +101,14 @@ void gareafile::ReadSynchronet(char* tag) {
|
||||
// unused (0xff) 512
|
||||
fseek(in, 1034, SEEK_CUR);
|
||||
|
||||
if(fread(&shrt, sizeof(uint16_t), 1, in) == 1) {
|
||||
for(i = 0; i < shrt; i++) {
|
||||
if(fread(&grp, sizeof(grp_t), 1, in) != 1)
|
||||
uint16_t total_groups = 0;
|
||||
grp_t* grp = NULL;
|
||||
|
||||
if(fread(&total_groups, sizeof(total_groups), 1, in) == 1
|
||||
&& total_groups >= 1
|
||||
&& (grp = (grp_t*)malloc(total_groups * sizeof(grp_t))) != NULL) {
|
||||
for(i = 0; i < total_groups; i++) {
|
||||
if(fread(&grp[i], sizeof(grp_t), 1, in) != 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -112,9 +116,14 @@ void gareafile::ReadSynchronet(char* tag) {
|
||||
for(i = 0; i < shrt; i++) {
|
||||
if(fread(&sub, sizeof(sub_t), 1, in) != 1)
|
||||
break;
|
||||
if(sub.grp >= total_groups) // Illegal group number
|
||||
continue;
|
||||
/* A sub-board's internal code is the combination of the grp's code_prefix & the sub's code_suffix */
|
||||
memset(sub.code, 0, sizeof(sub.code));
|
||||
snprintf(sub.code, sizeof(sub.code)-1, "%s%s", grp[sub.grp].code_prefix, sub.code_suffix);
|
||||
AreaCfg aa;
|
||||
aa.reset();
|
||||
aa.type = (sub.misc & SUB_QNET) ? GMB_LOCAL : GMB_ECHO;
|
||||
aa.type = (sub.misc & SUB_FIDO) ? GMB_ECHO : GMB_LOCAL;
|
||||
aa.attr = attribsecho;
|
||||
aa.basetype = "SMB";
|
||||
aa.setechoid((sub.misc & SUB_FIDO) ? sub.sname : sub.code);
|
||||
@ -132,6 +141,8 @@ void gareafile::ReadSynchronet(char* tag) {
|
||||
AddNewArea(aa);
|
||||
}
|
||||
}
|
||||
if(grp != NULL)
|
||||
free(grp);
|
||||
}
|
||||
fclose(in);
|
||||
}
|
||||
|
Reference in New Issue
Block a user