Commit cadada4d authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix issue with QWKnet hub sub-board mappings when inserting new sub-boards

The sub_t.subnum's that were being updated as message areas were being saved to
msgs.ini could not be used as an index into the scfg_t.sub array at this point
(the subnum would be the new index position when the msgs.ini was re-read/loaded)
.

This was not an issue in v3.19 because we just saved the subnum (to msgs.cnf) and
in v3.20, we save the sub's internal code (to msgs.ini) and were using the newly
updated sub_t.subnum to find the corresponding sub_t for that internal code. Since
the subnum is not used now during the save process, no need to update it here
(this reverses part of the commit 11e529d4 from 5 years ago).

This fixes issue #502 - thanks to the irc.synchro.netizens that reported it!
parent 81d86b89
Pipeline #3654 passed with stage
in 6 minutes and 7 seconds
......@@ -365,7 +365,6 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
/* Message Sub-boards */
unsigned int subnum = 0; /* New sub-board numbering (as saved) */
for(unsigned grp = 0; grp < cfg->total_grps; grp++) {
for(uint i=0; i<cfg->total_subs; i++) {
if(cfg->sub[i]->lname[0] == 0
......@@ -377,7 +376,6 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
SAFEPRINTF2(name, "sub:%s:%s"
,cfg->grp[grp]->sname, cfg->sub[i]->code_suffix);
str_list_t section = strListInit();
cfg->sub[i]->subnum = subnum++;
iniSetString(&section, name, "description", cfg->sub[i]->lname, NULL);
iniSetString(&section, name, "name", cfg->sub[i]->sname, NULL);
iniSetString(&section, name, "qwk_name", cfg->sub[i]->qwkname, NULL);
......@@ -506,17 +504,15 @@ BOOL write_msgs_cfg(scfg_t* cfg, int backup_level)
strListMerge(&ini, section);
free(section);
for(uint j=0; j<cfg->qhub[i]->subs; j++) {
if(cfg->qhub[i]->sub[j] == NULL)
continue;
int subnum = cfg->qhub[i]->sub[j]->subnum;
if(!is_valid_subnum(cfg, subnum))
sub_t* sub = cfg->qhub[i]->sub[j];
if(sub == NULL)
continue;
SAFEPRINTF2(name, "qhubsub:%s:%u", cfg->qhub[i]->id, cfg->qhub[i]->conf[j]);
str_list_t section = strListInit();
char code[LEN_EXTCODE + 1];
SAFEPRINTF2(code,"%s%s"
,cfg->grp[cfg->sub[subnum]->grp]->code_prefix
,cfg->sub[subnum]->code_suffix);
,cfg->grp[sub->grp]->code_prefix
,sub->code_suffix);
iniSetString(&section, name, "sub", code, NULL);
iniSetHexInt(&section, name, "settings", cfg->qhub[i]->mode[j], NULL);
strListMerge(&ini, section);
......
Supports Markdown
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